From 0c4491b1db2920db82653ac07e693fa212de9498 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 22 May 2017 22:47:55 +0200 Subject: [PATCH] Continued: - imported PackageDiscoveryFactory, BaseRecipientDiscovery, DiscoverableRecipient - imported DiscoverableNodeRecipient, RecipientListFactory, (Base)Recipient - imported ObjectFactory (opps?) - imported InvalidSessionIdException (also where it is being caught!) - imported FrameworkException - imported BaseIterator - recipients and not receipt! ;-) - also they are network-relevant and not generic - added namespaces to configuration entries MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../decoder/package/class_PackageDecoder.php | 1 + .../hub/classes/discovery/recipient/class_ | 10 +++++++--- .../recipient/class_BaseRecipientDiscovery.php | 2 ++ .../dht/class_DhtRecipientDiscovery.php | 3 ++- .../package/class_PackageRecipientDiscovery.php | 7 ++++++- .../socket/class_PackageSocketDiscovery.php | 1 + .../pool/tasks/class_TaskPoolIterator.php | 1 + .../hub/classes/package/class_NetworkPackage.php | 1 + .../pools/listener/class_DefaultListenerPool.php | 1 - application/hub/classes/recipient/class_ | 9 +++++---- .../classes/recipient/class_BaseRecipient.php | 6 ++---- .../classes/recipient/dht/class_DhtRecipient.php | 4 +++- .../recipient/direct/class_DirectRecipient.php | 2 ++ .../recipient/self/class_SelfRecipient.php | 4 +++- .../recipient/upper/class_UpperRecipient.php | 4 +++- application/hub/classes/tools/class_HubTools.php | 1 + application/hub/config.php | 16 ++++++++-------- .../class_FactoryRequiredParameterException.php | 2 ++ .../lists/class_InvalidListHashException.php | 1 + .../class_ListGroupAlreadyAddedException.php | 1 + .../lists/class_NoListGroupException.php | 1 + .../resolver/class_NoValidHostnameException.php | 1 + .../tasks/class_InvalidTaskException.php | 7 +++++++ .../dht/class_DiscoverableDhtRecipient.php | 10 +++++++--- .../node/class_DiscoverableNodeRecipient.php | 10 +++++++--- .../socket/class_DiscoverableSocket.php | 1 + .../hub/interfaces/recipient/class_Recipient.php | 2 +- 27 files changed, 77 insertions(+), 32 deletions(-) diff --git a/application/hub/classes/decoder/package/class_PackageDecoder.php b/application/hub/classes/decoder/package/class_PackageDecoder.php index a5b689e66..5cce8c2a8 100644 --- a/application/hub/classes/decoder/package/class_PackageDecoder.php +++ b/application/hub/classes/decoder/package/class_PackageDecoder.php @@ -5,6 +5,7 @@ namespace Hub\Network\Decoder\Package; // Import application-specific stuff use Hub\Decoder\BaseDecoder; use Hub\Decoder\Decodeable; +use Hub\Factory\Discovery\Package\PackageDiscoveryFactory; use Hub\Factory\Network\NetworkPackageFactory; use Hub\Handler\Network\RawData\Chunks\ChunkHandler; use Hub\Handler\Network\RawData\Chunks\HandleableChunks; diff --git a/application/hub/classes/discovery/recipient/class_ b/application/hub/classes/discovery/recipient/class_ index 6a792f53f..c4d935900 100644 --- a/application/hub/classes/discovery/recipient/class_ +++ b/application/hub/classes/discovery/recipient/class_ @@ -1,4 +1,10 @@ +} diff --git a/application/hub/classes/discovery/recipient/class_BaseRecipientDiscovery.php b/application/hub/classes/discovery/recipient/class_BaseRecipientDiscovery.php index cc9ff9c0c..462ffc902 100644 --- a/application/hub/classes/discovery/recipient/class_BaseRecipientDiscovery.php +++ b/application/hub/classes/discovery/recipient/class_BaseRecipientDiscovery.php @@ -4,6 +4,8 @@ namespace Hub\Discovery\Recipient; // Import framework-specific stuff use Hub\Discovery\Node\BaseNodeDiscovery; +use Hub\Discovery\Recipient\DiscoverableRecipient; +use Hub\Factory\Lists\Recipient\RecipientListFactory; /** * A PackageRecipient discovery class diff --git a/application/hub/classes/discovery/recipient/dht/class_DhtRecipientDiscovery.php b/application/hub/classes/discovery/recipient/dht/class_DhtRecipientDiscovery.php index ac3d5f7b8..ac24c3830 100644 --- a/application/hub/classes/discovery/recipient/dht/class_DhtRecipientDiscovery.php +++ b/application/hub/classes/discovery/recipient/dht/class_DhtRecipientDiscovery.php @@ -1,8 +1,9 @@ resolveRecipient($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT], $this->getListInstance(), $packageData); - } catch (FrameworkException $e) { + } catch (InvalidSessionIdException $e) { // Didn't work, so try the non-generic, depending recipient field itself (this may fail) try { // Try to find the right class diff --git a/application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php b/application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php index 371a3862a..177c8d821 100644 --- a/application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php +++ b/application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php @@ -4,6 +4,7 @@ namespace Hub\Network\Discovery\Socket; // Import hub-specific stuff use Hub\Container\Socket\StorableSocket; +use Hub\Discovery\Recipient\BaseRecipientDiscovery; use Hub\Factory\Node\NodeObjectFactory; use Hub\Factory\Socket\SocketFactory; use Hub\Generic\BaseHubSystem; diff --git a/application/hub/classes/iterator/pool/tasks/class_TaskPoolIterator.php b/application/hub/classes/iterator/pool/tasks/class_TaskPoolIterator.php index 5084d71db..fbcdc84f9 100644 --- a/application/hub/classes/iterator/pool/tasks/class_TaskPoolIterator.php +++ b/application/hub/classes/iterator/pool/tasks/class_TaskPoolIterator.php @@ -3,6 +3,7 @@ namespace Hub\Iterator\Pool\Task; // Import framework stuff +use CoreFramework\Iterator\BaseIterator; use CoreFramework\Lists\Listable; use CoreFramework\Registry\Registerable; diff --git a/application/hub/classes/package/class_NetworkPackage.php b/application/hub/classes/package/class_NetworkPackage.php index 83820a279..8c33927cb 100644 --- a/application/hub/classes/package/class_NetworkPackage.php +++ b/application/hub/classes/package/class_NetworkPackage.php @@ -7,6 +7,7 @@ use Hub\Container\Socket\StorableSocket; use Hub\Database\Frontend\Node\Dht\NodeDistributedHashTableDatabaseWrapper; use Hub\Factory\Assembler\Package\PackageAssemblerFactory; use Hub\Factory\Dht\DhtObjectFactory; +use Hub\Factory\Discovery\Package\PackageDiscoveryFactory; use Hub\Factory\Information\Connection\ConnectionInfoFactory; use Hub\Factory\Node\NodeObjectFactory; use Hub\Generic\BaseHubSystem; diff --git a/application/hub/classes/pools/listener/class_DefaultListenerPool.php b/application/hub/classes/pools/listener/class_DefaultListenerPool.php index a44658925..268acd06f 100644 --- a/application/hub/classes/pools/listener/class_DefaultListenerPool.php +++ b/application/hub/classes/pools/listener/class_DefaultListenerPool.php @@ -9,7 +9,6 @@ use Hub\Pool\BasePool; use Hub\Pool\Listener\PoolableListener; // Import framework stuff -use CoreFramework\Factory\ObjectFactory; /** * A default listener pool diff --git a/application/hub/classes/recipient/class_ b/application/hub/classes/recipient/class_ index 605e663dc..82893fec5 100644 --- a/application/hub/classes/recipient/class_ +++ b/application/hub/classes/recipient/class_ @@ -1,6 +1,9 @@ partialStub('Please implement this method. recipient=' . $recipient); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/recipient/class_BaseRecipient.php b/application/hub/classes/recipient/class_BaseRecipient.php index e0d9f87e8..5340d0e6a 100644 --- a/application/hub/classes/recipient/class_BaseRecipient.php +++ b/application/hub/classes/recipient/class_BaseRecipient.php @@ -1,6 +1,6 @@ +} diff --git a/application/hub/classes/recipient/dht/class_DhtRecipient.php b/application/hub/classes/recipient/dht/class_DhtRecipient.php index 2e3e2a78d..8d7742ee1 100644 --- a/application/hub/classes/recipient/dht/class_DhtRecipient.php +++ b/application/hub/classes/recipient/dht/class_DhtRecipient.php @@ -1,10 +1,12 @@ setConfigEntry('task_dht_publication_interval_delay', 5000); $cfg->setConfigEntry('task_dht_publication_max_runs', 0); // CFG: TASK-POOL-ITERATOR-CLASS -$cfg->setConfigEntry('task_pool_iterator_class', 'TaskPoolIterator'); +$cfg->setConfigEntry('task_pool_iterator_class', 'Hub\Iterator\Pool\Task\TaskPoolIterator'); // CFG: MONITOR-POOL-ITERATOR-CLASS $cfg->setConfigEntry('monitor_pool_iterator_class', 'Hub\Iterator\Pool\Monitor\MonitorPoolIterator'); @@ -718,13 +718,13 @@ $cfg->setConfigEntry('socket_container_class', 'Hub\Container\Socket\SocketConta $cfg->setConfigEntry('ipc_socket_file_name', 'php_hub_ipc_socket'); // CFG: PACKAGE-RECIPIENT-DISCOVERY-CLASS -$cfg->setConfigEntry('package_recipient_discovery_class', 'PackageRecipientDiscovery'); +$cfg->setConfigEntry('package_recipient_discovery_class', 'Hub\Discovery\Network\Recipient\PackageRecipientDiscovery'); // CFG: SOCKET-DISCOVERY-CLASS $cfg->setConfigEntry('socket_discovery_class', 'PackageSocketDiscovery'); // CFG: DHT-RECIPIENT-DISCOVERY-CLASS -$cfg->setConfigEntry('dht_recipient_discovery_class', 'DhtRecipientDiscovery'); +$cfg->setConfigEntry('dht_recipient_discovery_class', 'Hub\Discovery\Recipient\Dht\DhtRecipientDiscovery'); // CFG: UNL-DISCOVERY-CLASS $cfg->setConfigEntry('unl_discovery_class', 'Hub\Discovery\Locator\UniversalNodeLocatorDiscovery'); @@ -736,7 +736,7 @@ $cfg->setConfigEntry('tcp_protocol_handler_class', 'TcpProtocolHandler'); $cfg->setConfigEntry('universal_node_locator_class', 'Hub\Locator\Node\UniversalNodeLocator'); // CFG: RECIPIENT-LIST-CLASS -$cfg->setConfigEntry('recipient_list_class', 'RecipientList'); +$cfg->setConfigEntry('recipient_list_class', 'Hub\Lists\Recipient\RecipientList'); // CFG: PACKAGE-TAGS-CLASS $cfg->setConfigEntry('package_tags_class', 'Hub\Tag\Package\PackageTags'); @@ -923,16 +923,16 @@ $cfg->setConfigEntry('request_node_list_answer_status_okay_handler_class', 'Requ /////////////////////////////////////////////////////////////////////////////// // CFG: DIRECT-RECIPIENT-CLASS -$cfg->setConfigEntry('direct_recipient_class', 'DirectRecipient'); +$cfg->setConfigEntry('direct_recipient_class', 'Hub\Network\Recipient\Direct\DirectRecipient'); // CFG: DHT-RECIPIENT-CLASS -$cfg->setConfigEntry('dht_recipient_class', 'DhtRecipient'); +$cfg->setConfigEntry('dht_recipient_class', 'Hub\Network\Recipient\Dht\DhtRecipient'); // CFG: SELF-RECIPIENT-CLASS -$cfg->setConfigEntry('self_recipient_class', 'SelfRecipient'); +$cfg->setConfigEntry('self_recipient_class', 'Hub\Network\Recipient\Loopback\SelfRecipient'); // CFG: UPPER-RECIPIENT-CLASS -$cfg->setConfigEntry('upper_recipient_class', 'UpperRecipient'); +$cfg->setConfigEntry('upper_recipient_class', 'Hub\Network\Recipient\Upper\UpperRecipient'); /////////////////////////////////////////////////////////////////////////////// // Miner configuration diff --git a/application/hub/exceptions/factory/class_FactoryRequiredParameterException.php b/application/hub/exceptions/factory/class_FactoryRequiredParameterException.php index 7f0c63481..4a119796e 100644 --- a/application/hub/exceptions/factory/class_FactoryRequiredParameterException.php +++ b/application/hub/exceptions/factory/class_FactoryRequiredParameterException.php @@ -4,6 +4,7 @@ namespace Hub\Factory\Parameter; // Import framework stuff use CoreFramework\Factory\ObjectFactory; +use CoreFramework\Generic\FrameworkException; /** * This exception is thrown if not all required parameter are given. @@ -13,6 +14,7 @@ use CoreFramework\Factory\ObjectFactory; * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.shipsimu.org + * @todo this is generic * * 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 diff --git a/application/hub/exceptions/lists/class_InvalidListHashException.php b/application/hub/exceptions/lists/class_InvalidListHashException.php index baa53ff34..6f965ac79 100644 --- a/application/hub/exceptions/lists/class_InvalidListHashException.php +++ b/application/hub/exceptions/lists/class_InvalidListHashException.php @@ -7,6 +7,7 @@ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.shipsimu.org + * @todo this is generic * * 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 diff --git a/application/hub/exceptions/lists/class_ListGroupAlreadyAddedException.php b/application/hub/exceptions/lists/class_ListGroupAlreadyAddedException.php index c8bddc404..f5b16ffc7 100644 --- a/application/hub/exceptions/lists/class_ListGroupAlreadyAddedException.php +++ b/application/hub/exceptions/lists/class_ListGroupAlreadyAddedException.php @@ -7,6 +7,7 @@ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.shipsimu.org + * @todo this is generic * * 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 diff --git a/application/hub/exceptions/lists/class_NoListGroupException.php b/application/hub/exceptions/lists/class_NoListGroupException.php index 10ba8e102..7fe024b57 100644 --- a/application/hub/exceptions/lists/class_NoListGroupException.php +++ b/application/hub/exceptions/lists/class_NoListGroupException.php @@ -7,6 +7,7 @@ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.shipsimu.org + * @todo this is generic * * 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 diff --git a/application/hub/exceptions/resolver/class_NoValidHostnameException.php b/application/hub/exceptions/resolver/class_NoValidHostnameException.php index 24a5ea7d8..485b25c72 100644 --- a/application/hub/exceptions/resolver/class_NoValidHostnameException.php +++ b/application/hub/exceptions/resolver/class_NoValidHostnameException.php @@ -7,6 +7,7 @@ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.shipsimu.org + * @todo this is generic * * 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 diff --git a/application/hub/exceptions/tasks/class_InvalidTaskException.php b/application/hub/exceptions/tasks/class_InvalidTaskException.php index f2b57e650..998fddf00 100644 --- a/application/hub/exceptions/tasks/class_InvalidTaskException.php +++ b/application/hub/exceptions/tasks/class_InvalidTaskException.php @@ -1,4 +1,10 @@ +} diff --git a/application/hub/interfaces/discovery/recipient/node/class_DiscoverableNodeRecipient.php b/application/hub/interfaces/discovery/recipient/node/class_DiscoverableNodeRecipient.php index 6633089c8..f3f800909 100644 --- a/application/hub/interfaces/discovery/recipient/node/class_DiscoverableNodeRecipient.php +++ b/application/hub/interfaces/discovery/recipient/node/class_DiscoverableNodeRecipient.php @@ -1,4 +1,10 @@ +} diff --git a/application/hub/interfaces/discovery/recipient/socket/class_DiscoverableSocket.php b/application/hub/interfaces/discovery/recipient/socket/class_DiscoverableSocket.php index 95dd2de72..fda8684b8 100644 --- a/application/hub/interfaces/discovery/recipient/socket/class_DiscoverableSocket.php +++ b/application/hub/interfaces/discovery/recipient/socket/class_DiscoverableSocket.php @@ -3,6 +3,7 @@ namespace Hub\Discovery\Socket; // Import application-specific stuff +use Hub\Discovery\Recipient\DiscoverableRecipient; use Hub\Handler\Protocol\HandleableProtocol; /** diff --git a/application/hub/interfaces/recipient/class_Recipient.php b/application/hub/interfaces/recipient/class_Recipient.php index 9c36529fb..1e170d22b 100644 --- a/application/hub/interfaces/recipient/class_Recipient.php +++ b/application/hub/interfaces/recipient/class_Recipient.php @@ -1,6 +1,6 @@