From: Roland Häder Date: Wed, 2 Dec 2020 18:38:57 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5cfc74ea5dc98559a4a3f5a11c2ee470572a4e65;p=hub.git Continued: - replaced $handlerInstance with HandleableTrait - added deeper namespace - updated core framework Signed-off-by: Roland Häder --- diff --git a/application/hub/classes/decoder/class_BaseDecoder.php b/application/hub/classes/decoder/class_BaseDecoder.php index 9849337d6..8dc5285d9 100644 --- a/application/hub/classes/decoder/class_BaseDecoder.php +++ b/application/hub/classes/decoder/class_BaseDecoder.php @@ -7,7 +7,7 @@ use Org\Shipsimu\Hub\Generic\BaseHubSystem; use Org\Shipsimu\Hub\Network\Delivery\Deliverable; // Import framework stuff -use Org\Mxchange\CoreFramework\Handler\Handleable; +use Org\Mxchange\CoreFramework\Traits\Handler\HandleableTrait; use Org\Mxchange\CoreFramework\Traits\Stacker\StackableTrait; /** @@ -34,6 +34,7 @@ use Org\Mxchange\CoreFramework\Traits\Stacker\StackableTrait; */ abstract class BaseDecoder extends BaseHubSystem { // Load traits + use HandleableTrait; use StackableTrait; /** @@ -41,11 +42,6 @@ abstract class BaseDecoder extends BaseHubSystem { */ private $packageHandlerInstance = NULL; - /** - * Handler instance - */ - private $handlerInstance = NULL; - /** * Protected constructor * @@ -76,23 +72,4 @@ abstract class BaseDecoder extends BaseHubSystem { return $this->packageHandlerInstance; } - /** - * Setter for handler instance - * - * @param $handlerInstance An instance of a Handleable class - * @return void - */ - protected final function setHandlerInstance (Handleable $handlerInstance) { - $this->handlerInstance = $handlerInstance; - } - - /** - * Getter for handler instance - * - * @return $handlerInstance A Handleable instance - */ - protected final function getHandlerInstance () { - return $this->handlerInstance; - } - } diff --git a/application/hub/classes/helper/connection/ipv4/class_BaseIpV4ConnectionHelper.php b/application/hub/classes/helper/connection/ipv4/class_BaseIpV4ConnectionHelper.php index 407b84537..c0b72c7e9 100644 --- a/application/hub/classes/helper/connection/ipv4/class_BaseIpV4ConnectionHelper.php +++ b/application/hub/classes/helper/connection/ipv4/class_BaseIpV4ConnectionHelper.php @@ -10,7 +10,7 @@ use Org\Shipsimu\Hub\Traits\Container\Socket\StorableSocketTrait; // Import framework stuff use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; -use Org\Mxchange\CoreFramework\Handler\Handleable; +use Org\Mxchange\CoreFramework\Traits\Handler\HandleableTrait; /** * A ??? connection helper class @@ -37,6 +37,7 @@ use Org\Mxchange\CoreFramework\Handler\Handleable; */ abstract class BaseIpV4ConnectionHelper extends BaseConnectionHelper { // Load traits + use HandleableTrait; use StorableSocketTrait; /** @@ -44,11 +45,6 @@ abstract class BaseIpV4ConnectionHelper extends BaseConnectionHelper { */ private $protocolName = 'invalid'; - /** - * Handler instance - */ - private $handlerInstance = NULL; - /** * Protected constructor * @@ -79,25 +75,6 @@ abstract class BaseIpV4ConnectionHelper extends BaseConnectionHelper { return $this->protocolName; } - /** - * Setter for handler instance - * - * @param $handlerInstance An instance of a Handleable class - * @return void - */ - protected final function setHandlerInstance (Handleable $handlerInstance) { - $this->handlerInstance = $handlerInstance; - } - - /** - * Getter for handler instance - * - * @return $handlerInstance A Handleable instance - */ - protected final function getHandlerInstance () { - return $this->handlerInstance; - } - /** * Attempts to connect to a peer by given IP number and port from an UNL * instance with currently configured timeout. diff --git a/application/hub/classes/listener/class_BaseListener.php b/application/hub/classes/listener/class_BaseListener.php index 3d27b7a29..395ed284d 100644 --- a/application/hub/classes/listener/class_BaseListener.php +++ b/application/hub/classes/listener/class_BaseListener.php @@ -21,10 +21,10 @@ use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Factory\ObjectFactory; use Org\Mxchange\CoreFramework\Factory\Registry\Socket\SocketRegistryFactory; use Org\Mxchange\CoreFramework\Generic\NullPointerException; -use Org\Mxchange\CoreFramework\Handler\Handleable; use Org\Mxchange\CoreFramework\Registry\Register; use Org\Mxchange\CoreFramework\Socket\InvalidServerSocketException; use Org\Mxchange\CoreFramework\Socket\SocketAlreadyRegisteredException; +use Org\Mxchange\CoreFramework\Traits\Handler\HandleableTrait; use Org\Mxchange\CoreFramework\Traits\Iterator\IteratorTrait; use Org\Mxchange\CoreFramework\Visitor\Visitable; use Org\Mxchange\CoreFramework\Visitor\Visitor; @@ -58,6 +58,7 @@ use \LogicException; abstract class BaseListener extends BaseHubSystem implements Visitable { // Load traits use IteratorTrait; + use HandleableTrait; use StorableSocketTrait; // Exception code constants @@ -95,11 +96,6 @@ abstract class BaseListener extends BaseHubSystem implements Visitable { */ private $registryInstance = NULL; - /** - * Handler instance - */ - private $handlerInstance = NULL; - /** * Protected constructor * @@ -247,25 +243,6 @@ abstract class BaseListener extends BaseHubSystem implements Visitable { return $this->registryInstance; } - /** - * Setter for handler instance - * - * @param $handlerInstance An instance of a Handleable class - * @return void - */ - protected final function setHandlerInstance (Handleable $handlerInstance) { - $this->handlerInstance = $handlerInstance; - } - - /** - * Getter for handler instance - * - * @return $handlerInstance A Handleable instance - */ - public final function getHandlerInstance () { - return $this->handlerInstance; - } - /** * Registeres the given socket resource for "this" listener instance. This * will be done in a seperate class to allow package writers to use it diff --git a/application/hub/classes/package/assembler/class_PackageAssembler.php b/application/hub/classes/package/assembler/class_PackageAssembler.php index a6e776c6f..c27fcb807 100644 --- a/application/hub/classes/package/assembler/class_PackageAssembler.php +++ b/application/hub/classes/package/assembler/class_PackageAssembler.php @@ -16,8 +16,8 @@ use Org\Shipsimu\Hub\Network\Receive\Receivable; // Import framework stuff use Org\Mxchange\CoreFramework\Factory\ObjectFactory; -use Org\Mxchange\CoreFramework\Handler\Handleable; use Org\Mxchange\CoreFramework\Registry\Registerable; +use Org\Mxchange\CoreFramework\Traits\Handler\HandleableTrait; use Org\Mxchange\CoreFramework\Traits\Stacker\StackableTrait; use Org\Mxchange\CoreFramework\Traits\Stream\Input\InputStreamTrait; use Org\Mxchange\CoreFramework\Utils\String\StringUtils; @@ -52,6 +52,7 @@ use \BadMethodCallException; */ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable, Visitable { // Load traits + use HandleableTrait; use InputStreamTrait; use StackableTrait; @@ -80,11 +81,6 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable, */ private $packageHandlerInstance = NULL; - /** - * Handler instance - */ - private $handlerInstance = NULL; - /** * Protected constructor * @@ -114,11 +110,8 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable, // And set it $assemblerInstance->setInputStreamInstance($streamInstance); - // Now get a chunk handler instance - $handlerInstance = ChunkHandlerFactory::createChunkHandlerInstance(); - - // Set handler instance - $assemblerInstance->setHandlerInstance($handlerInstance); + // Set chunk handler instance + $assemblerInstance->setHandlerInstance(ChunkHandlerFactory::createChunkHandlerInstance()); // Get stacker instance $stackInstance = ObjectFactory::createObjectByConfiguredName('multiple_message_stacker_class'); @@ -163,25 +156,6 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable, return $this->packageHandlerInstance; } - /** - * Setter for handler instance - * - * @param $handlerInstance An instance of a Handleable class - * @return void - */ - protected final function setHandlerInstance (Handleable $handlerInstance) { - $this->handlerInstance = $handlerInstance; - } - - /** - * Getter for handler instance - * - * @return $handlerInstance A Handleable instance - */ - protected final function getHandlerInstance () { - return $this->handlerInstance; - } - /** * Checks whether the input buffer (stacker to be more preceise) is empty. * diff --git a/application/hub/classes/tasks/network/class_NetworkPackageReaderTask.php b/application/hub/classes/tasks/network/class_NetworkPackageReaderTask.php index e315aa3bd..743339e29 100644 --- a/application/hub/classes/tasks/network/class_NetworkPackageReaderTask.php +++ b/application/hub/classes/tasks/network/class_NetworkPackageReaderTask.php @@ -1,6 +1,6 @@ . */ class NodeChunkAssemblerTask extends BaseHubTask implements Taskable, Visitable { - /** - * Handler instance - */ - private $handlerInstance = NULL; + // Load traits + use HandleableTrait; /** * Protected constructor @@ -51,25 +50,6 @@ class NodeChunkAssemblerTask extends BaseHubTask implements Taskable, Visitable parent::__construct(__CLASS__); } - /** - * Setter for handler instance - * - * @param $handlerInstance An instance of a Handleable class - * @return void - */ - protected final function setHandlerInstance (Handleable $handlerInstance) { - $this->handlerInstance = $handlerInstance; - } - - /** - * Getter for handler instance - * - * @return $handlerInstance A Handleable instance - */ - protected final function getHandlerInstance () { - return $this->handlerInstance; - } - /** * Creates an instance of this class * diff --git a/application/hub/config.php b/application/hub/config.php index a6de31980..da82e3287 100644 --- a/application/hub/config.php +++ b/application/hub/config.php @@ -565,10 +565,10 @@ $cfg->setConfigEntry('node_ping_task_class', 'Org\Shipsimu\Hub\Node\Ping\NodePin $cfg->setConfigEntry('node_announcement_task_class', 'Org\Shipsimu\Hub\Filter\Activation\Node\Announcement\NodeAnnouncementTask'); // CFG: NODE-PACKAGE-WRITER-TASK-CLASS -$cfg->setConfigEntry('node_package_writer_task_class', 'Org\Shipsimu\Hub\Task\Network\Writer\NetworkPackageWriterTask'); +$cfg->setConfigEntry('node_package_writer_task_class', 'Org\Shipsimu\Hub\Node\Task\Network\Writer\NetworkPackageWriterTask'); // CFG: NODE-PACKAGE-READER-TASK-CLASS -$cfg->setConfigEntry('node_package_reader_task_class', 'Org\Shipsimu\Hub\Task\Network\Reader\NetworkPackageReaderTask'); +$cfg->setConfigEntry('node_package_reader_task_class', 'Org\Shipsimu\Hub\Node\Task\Network\Reader\NetworkPackageReaderTask'); // CFG: NODE-SOCKET-LISTENER-TASK-CLASS $cfg->setConfigEntry('node_socket_listener_task_class', 'Org\Shipsimu\Hub\Node\Task\Listener\Socket\NodeSocketListenerTask'); diff --git a/core b/core index ef7a7e55c..bed2c6a3c 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit ef7a7e55c59c9e887e6bb09c8c02b8126309f716 +Subproject commit bed2c6a3cf04dd79cbe36186852dd3628d5200a4