From 92f512c6b183ef3cc23242fb576bd4fa97e3796e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 26 Feb 2023 10:19:27 +0100 Subject: [PATCH] Continued: - invoke CryptoHelper::getSelfInstance() rather than creating new instances over ObjectFactory - this also removed the overhead of initialization - updated 'core' framework --- application/hub/classes/handler/chunks/class_ChunkHandler.php | 3 ++- .../classes/handler/package/class_NetworkPackageHandler.php | 3 ++- application/hub/classes/nodes/class_BaseHubNode.php | 3 ++- .../hub/classes/package/fragmenter/class_PackageFragmenter.php | 3 ++- application/hub/classes/source/units/class_TestUnitSource.php | 3 ++- core | 2 +- 6 files changed, 11 insertions(+), 6 deletions(-) diff --git a/application/hub/classes/handler/chunks/class_ChunkHandler.php b/application/hub/classes/handler/chunks/class_ChunkHandler.php index bd50a1e8e..e14a6b18e 100644 --- a/application/hub/classes/handler/chunks/class_ChunkHandler.php +++ b/application/hub/classes/handler/chunks/class_ChunkHandler.php @@ -12,6 +12,7 @@ use Org\Shipsimu\Hub\Traits\Fragmenter\FragmentableTrait; use Org\Mxchange\CoreFramework\Assertion\AssertionException; use Org\Mxchange\CoreFramework\EntryPoint\ApplicationEntryPoint; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; +use Org\Mxchange\CoreFramework\Helper\Crypto\CryptoHelper; use Org\Mxchange\CoreFramework\Registry\Registerable; use Org\Mxchange\CoreFramework\Utils\Strings\StringUtils; use Org\Mxchange\CoreFramework\Traits\Crypto\CryptoTrait; @@ -136,7 +137,7 @@ class ChunkHandler extends BaseHubHandler implements HandleableChunks, Registera $handlerInstance->setStackInstance($stackInstance); // Get a crypto instance ... - $cryptoInstance = ObjectFactory::createObjectByConfiguredName('crypto_class'); + $cryptoInstance = CryptoHelper::getSelfInstance(); // ... and set it in this handler /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CHUNK-HANDLER: Setting cryptoInstance=%s ...', $cryptoInstance->__toString())); diff --git a/application/hub/classes/handler/package/class_NetworkPackageHandler.php b/application/hub/classes/handler/package/class_NetworkPackageHandler.php index fa18fa497..1d3998479 100644 --- a/application/hub/classes/handler/package/class_NetworkPackageHandler.php +++ b/application/hub/classes/handler/package/class_NetworkPackageHandler.php @@ -40,6 +40,7 @@ use Org\Mxchange\CoreFramework\Factory\Registry\Socket\SocketRegistryFactory; use Org\Mxchange\CoreFramework\Feature\FrameworkFeature; use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Generic\NullPointerException; +use Org\Mxchange\CoreFramework\Helper\Crypto\CryptoHelper; use Org\Mxchange\CoreFramework\Middleware\Debug\DebugMiddleware; use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry; use Org\Mxchange\CoreFramework\Registry\Registerable; @@ -381,7 +382,7 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei $handlerInstance->setVisitorInstance($visitorInstance); // Get crypto instance and set it, too - $cryptoInstance = ObjectFactory::createObjectByConfiguredName('crypto_class'); + $cryptoInstance = CryptoHelper::getSelfInstance(); $handlerInstance->setCryptoInstance($cryptoInstance); // Get a singleton package assembler instance from factory and set it here, too diff --git a/application/hub/classes/nodes/class_BaseHubNode.php b/application/hub/classes/nodes/class_BaseHubNode.php index 2f12486c3..bf84d0061 100644 --- a/application/hub/classes/nodes/class_BaseHubNode.php +++ b/application/hub/classes/nodes/class_BaseHubNode.php @@ -29,6 +29,7 @@ use Org\Mxchange\CoreFramework\Factory\Database\Frontend\DatabaseFrontendFactory use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; use Org\Mxchange\CoreFramework\Generic\NullPointerException; use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper; +use Org\Mxchange\CoreFramework\Helper\Crypto\CryptoHelper; use Org\Mxchange\CoreFramework\Middleware\Debug\DebugMiddleware; use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry; use Org\Mxchange\CoreFramework\Request\Requestable; @@ -151,7 +152,7 @@ abstract class BaseHubNode extends BaseHubSystem implements Updateable, AddableC $this->setFrontendInstance($frontendInstance); // Get a crypto instance - $cryptoInstance = ObjectFactory::createObjectByConfiguredName('crypto_class'); + $cryptoInstance = CryptoHelper::getSelfInstance(); // Set it here $this->setCryptoInstance($cryptoInstance); diff --git a/application/hub/classes/package/fragmenter/class_PackageFragmenter.php b/application/hub/classes/package/fragmenter/class_PackageFragmenter.php index 7c0a63e0a..dc59b6d5a 100644 --- a/application/hub/classes/package/fragmenter/class_PackageFragmenter.php +++ b/application/hub/classes/package/fragmenter/class_PackageFragmenter.php @@ -13,6 +13,7 @@ use Org\Mxchange\CoreFramework\Assertion\AssertionException; use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\EntryPoint\ApplicationEntryPoint; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; +use Org\Mxchange\CoreFramework\Helper\Crypto\CryptoHelper; use Org\Mxchange\CoreFramework\Registry\Registerable; use Org\Mxchange\CoreFramework\Traits\Crypto\CryptoTrait; use Org\Mxchange\CoreFramework\Utils\Strings\StringUtils; @@ -155,7 +156,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera $fragmenterInstance = new PackageFragmenter(); // Get a crypto instance - $cryptoInstance = ObjectFactory::createObjectByConfiguredName('crypto_class'); + $cryptoInstance = CryptoHelper::getSelfInstance(); // Set it here $fragmenterInstance->setCryptoInstance($cryptoInstance); diff --git a/application/hub/classes/source/units/class_TestUnitSource.php b/application/hub/classes/source/units/class_TestUnitSource.php index 7052977df..e1f2f20ad 100644 --- a/application/hub/classes/source/units/class_TestUnitSource.php +++ b/application/hub/classes/source/units/class_TestUnitSource.php @@ -9,6 +9,7 @@ use Org\Shipsimu\Hub\Crawler\Source\BaseSource; use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Crypto\RandomNumber\RandomNumberGenerator; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; +use Org\Mxchange\CoreFramework\Helper\Crypto\CryptoHelper; use Org\Mxchange\CoreFramework\Registry\Registerable; /** @@ -63,7 +64,7 @@ class TestUnitSource extends BaseSource implements UnitSource, Registerable { $sourceInstance->setRngInstance($rngInstance); // And also a crypto instance (for our encrypted messages) - $cryptoInstance = ObjectFactory::createObjectByConfiguredName('crypto_class'); + $cryptoInstance = CryptoHelper::getSelfInstance(); $sourceInstance->setCryptoInstance($cryptoInstance); // Return the prepared instance diff --git a/core b/core index 53f5e597b..12e4c5a35 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 53f5e597b72bedb2995dca43e04d88f37eaa5e88 +Subproject commit 12e4c5a35325464e30bcfd223f121a105ebca91e -- 2.39.5