From 54877972578bb7190c1f288edd658f47a079677f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 19 May 2017 17:13:03 +0200 Subject: [PATCH] Next wave: - imported Visitable, Visitor - imported Taskable - imported BasePool, Poolable - imported Listenable - created new namespaces - added namespaces MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- application/hub/classes/class_BaseHubSystem.php | 3 ++- .../recipient/socket/class_PackageSocketDiscovery.php | 1 + .../source/url/class_UrlSourceObjectFactory.php | 1 - application/hub/classes/handler/network/tcp/class_ | 7 ++++++- .../handler/network/tcp/class_TcpRawDataHandler.php | 6 ++++++ .../handler/network/udp/class_UdpRawDataHandler.php | 6 ++++++ .../helper/connection/class_BaseConnectionHelper.php | 4 +++- .../classes/info/connection/class_ConnectionInfo.php | 1 + application/hub/classes/listener/tcp/class_ | 4 ++++ .../hub/classes/listener/tcp/class_TcpListener.php | 1 + .../decorators/class_ClientTcpListenerDecorator.php | 6 ++++++ .../tcp/decorators/class_HubTcpListenerDecorator.php | 6 ++++++ application/hub/classes/listener/udp/class_ | 3 +++ .../hub/classes/listener/udp/class_UdpListener.php | 1 + .../decorators/class_ClientUdpListenerDecorator.php | 6 ++++++ .../udp/decorators/class_HubUdpListenerDecorator.php | 6 ++++++ application/hub/classes/nodes/class_BaseHubNode.php | 1 - .../package/assembler/class_PackageAssembler.php | 2 ++ .../hub/classes/package/class_NetworkPackage.php | 2 ++ application/hub/classes/pools/class_ | 10 ++++++++++ application/hub/classes/pools/class_BasePool.php | 2 ++ .../pools/listener/class_DefaultListenerPool.php | 7 +++++-- .../hub/classes/pools/peer/class_DefaultPeerPool.php | 10 ++++++++++ .../classes/registry/socket/class_SocketRegistry.php | 1 + .../hub/classes/tags/package/class_PackageTags.php | 1 + application/hub/classes/tasks/apt-proxy/class_ | 7 +++++++ .../tasks/apt-proxy/class_AptProxyListenerTask.php | 1 + application/hub/classes/tasks/chat/class_ | 7 +++++++ .../tasks/chat/class_ChatTelnetListenerTask.php | 1 + application/hub/classes/tasks/crawler/class_Crawler | 7 +++++++ .../communicator/class_CrawlerNodeCommunicatorTask.php | 1 + .../class_CrawlerDocumentParserTask.php | 1 + .../mime_sniffer/class_CrawlerMimeSnifferTask.php | 1 + .../tasks/crawler/ping/class_CrawlerPingTask.php | 1 + .../publisher/class_CrawlerRemoteJobPublisherTask.php | 1 + .../hub/classes/tasks/crawler/scanner/class_Crawler | 8 ++++++++ .../class_CrawlerUploadedListScannerTask.php | 1 + .../class_CrawlerSnippetExtractorTask.php | 1 + .../class_CrawlerStructureAnalyzerTask.php | 1 + .../local/class_CrawlerLocalUrlCrawlerTask.php | 1 + .../remote/class_CrawlerRemoteUrlCrawlerTask.php | 1 + .../tasks/crawler/url_source/class_CrawlerUrlSource | 8 ++++++++ .../url_source/class_CrawlerUrlSourceFoundRssTask.php | 1 + .../class_CrawlerUrlSourceLocalStartTask.php | 1 + .../url_source/class_CrawlerUrlSourceRssStartTask.php | 1 + .../class_CrawlerUrlSourceUploadedListTask.php | 1 + application/hub/classes/tasks/cruncher/class_Cruncher | 7 +++++++ .../tasks/cruncher/class_CruncherKeyProducerTask.php | 1 + .../cruncher/class_CruncherTestUnitProducerTask.php | 1 + .../cruncher/class_CruncherWorkUnitFetcherTask.php | 1 + .../block_fetcher/class_MinerBlockFetcherTask.php | 1 + .../class_MinerRealGenesisBlockProducerTask.php | 1 + .../class_MinerTestGenesisBlockProducerTask.php | 1 + application/hub/classes/tasks/miner/class_Miner | 7 +++++++ .../communicator/class_MinerNodeCommunicatorTask.php | 1 + .../hub/classes/tasks/network/class_NetworkPackage | 7 +++++++ .../tasks/network/class_NetworkPackageReaderTask.php | 1 + .../tasks/network/class_NetworkPackageWriterTask.php | 1 + .../node/announcement/class_NodeAnnouncementTask.php | 1 + .../tasks/node/chunks/class_NodeChunkAssemblerTask.php | 1 + application/hub/classes/tasks/node/class_Node | 2 ++ .../node/decoder/class_NodePackageDecoderTask.php | 1 + application/hub/classes/tasks/node/dht/class_NodeDht | 7 +++++++ .../tasks/node/dht/class_NodeDhtBootstrapTask.php | 1 + .../tasks/node/dht/class_NodeDhtInitializationTask.php | 1 + .../tasks/node/dht/class_NodeDhtLateBootstrapTask.php | 1 + .../node/dht/class_NodeDhtPublicationCheckTask.php | 1 + .../tasks/node/dht/class_NodeDhtPublicationTask.php | 1 + .../classes/tasks/node/dht/class_NodeDhtQueryTask.php | 1 + .../node/listener/class_NodeSocketListenerTask.php | 1 + .../hub/classes/tasks/node/ping/class_NodePingTask.php | 1 + .../node/self_connect/class_NodeSelfConnectTask.php | 1 + .../tasks/node/tags/class_NodePackageTagsInitTask.php | 1 + .../tasks/node/update/class_NodeUpdateCheckTask.php | 1 + application/hub/classes/visitor/pool/class_ | 7 +++++++ .../hub/classes/visitor/pool/handler/class_Handler | 10 +++++++--- .../pool/monitor/class_RawDataPoolMonitorVisitor.php | 4 ++++ .../hub/classes/visitor/pool/shutdown/class_Shutdown | 6 ++++++ .../shutdown/class_ShutdownListenerPoolVisitor.php | 7 +++++++ .../visitor/socket/class_HalfShutdownSocketVisitor.php | 6 ++++++ .../visitor/socket/class_ShutdownSocketVisitor.php | 6 ++++++ application/hub/config.php | 2 +- .../recipient/socket/class_DiscoverableSocket.php | 4 +--- .../interfaces/shareable/info/class_ShareableInfo.php | 1 + application/hub/interfaces/tags/class_Tagable.php | 1 + .../pool/listener/class_ListenerPoolVisitor.php | 10 +++++++--- core | 2 +- 87 files changed, 252 insertions(+), 18 deletions(-) diff --git a/application/hub/classes/class_BaseHubSystem.php b/application/hub/classes/class_BaseHubSystem.php index 2ddfc6aed..f56f81007 100644 --- a/application/hub/classes/class_BaseHubSystem.php +++ b/application/hub/classes/class_BaseHubSystem.php @@ -7,6 +7,7 @@ use Hub\Network\Receive\Receivable; // Import framework stuff use CoreFramework\Object\BaseFrameworkSystem; +use CoreFramework\Pool\Poolable; /** * A general hub system class @@ -143,7 +144,7 @@ class BaseHubSystem extends BaseFrameworkSystem { * @param $listenerPoolInstance The new listener pool instance * @return void */ - protected final function setListenerPoolInstance (PoolableListener $listenerPoolInstance) { + protected final function setListenerPoolInstance (Poolable $listenerPoolInstance) { $this->listenerPoolInstance = $listenerPoolInstance; } diff --git a/application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php b/application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php index 6de0dab0e..2e7940794 100644 --- a/application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php +++ b/application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php @@ -7,6 +7,7 @@ use Hub\Factory\Node\NodeObjectFactory; use Hub\Generic\BaseHubSystem; // Import framework stuff +use CoreFramework\Listener\Listenable; use CoreFramework\Registry\Registerable; use CoreFramework\Registry\Registry; diff --git a/application/hub/classes/factories/source/url/class_UrlSourceObjectFactory.php b/application/hub/classes/factories/source/url/class_UrlSourceObjectFactory.php index 00d84c908..4dd8de645 100644 --- a/application/hub/classes/factories/source/url/class_UrlSourceObjectFactory.php +++ b/application/hub/classes/factories/source/url/class_UrlSourceObjectFactory.php @@ -6,7 +6,6 @@ namespace Hub\Source\Url; use CoreFramework\Factory\ObjectFactory; use CoreFramework\Registry\Registry; use CoreFramework\Task\Taskable; -use CoreFramework\Visitor\Visitable; /** * A factory class for URL sources diff --git a/application/hub/classes/handler/network/tcp/class_ b/application/hub/classes/handler/network/tcp/class_ index d0fb638b4..c4413218d 100644 --- a/application/hub/classes/handler/network/tcp/class_ +++ b/application/hub/classes/handler/network/tcp/class_ @@ -109,8 +109,9 @@ while (count($clients) > 0) { foreach ($clients as $send_sock) { // if its the listening sock or the client that we got the message from, go to the next one in the list - if ($send_sock == $mainSocket || $send_sock == $read_sock) + if ($send_sock == $mainSocket || $send_sock == $read_sock) { continue; + } // END - if // write the message to the client -- add a newline character to the end of the message socket_write($send_sock, "{$ip}:{$data}\n"); @@ -138,6 +139,10 @@ namespace Hub\Listener\; // Import application-specific stuff use Hub\Helper\Node\NodeHelper; +// Import framework stuff +use CoreFramework\Listener\Listenable; +use CoreFramework\Visitor\Visitable; + . */ -class BaseConnectionHelper extends BaseHubSystemHelper implements Registerable { +class BaseConnectionHelper extends BaseHubSystemHelper implements Visitable, Registerable { // Exception codes const EXCEPTION_UNSUPPORTED_ERROR_HANDLER = 0x9100; diff --git a/application/hub/classes/info/connection/class_ConnectionInfo.php b/application/hub/classes/info/connection/class_ConnectionInfo.php index 5bfbe324d..9ea663635 100644 --- a/application/hub/classes/info/connection/class_ConnectionInfo.php +++ b/application/hub/classes/info/connection/class_ConnectionInfo.php @@ -3,6 +3,7 @@ namespace Hub\Information\Connection; // Import framework stuff +use CoreFramework\Listener\Listenable; use CoreFramework\Registry\Registerable; /** diff --git a/application/hub/classes/listener/tcp/class_ b/application/hub/classes/listener/tcp/class_ index 2c52bff33..c2a49dcce 100644 --- a/application/hub/classes/listener/tcp/class_ +++ b/application/hub/classes/listener/tcp/class_ @@ -138,6 +138,10 @@ namespace Hub\Listener\Tcp\; // Import application-specific stuff use Hub\Helper\Node\NodeHelper; +// Import framework stuff +use CoreFramework\Listener\Listenable; +use CoreFramework\Visitor\Visitable; + . */ -class DefaultListenerPool extends BasePool implements PoolableListener { +class DefaultListenerPool extends BasePool implements Poolable { /** * Protected constructor * @@ -74,7 +77,7 @@ class DefaultListenerPool extends BasePool implements PoolableListener { } /** - * Run the shutdown seqeuence by a Visitor Pattern + * Run the shutdown seqeuence by a visitor pattern * * @return void */ diff --git a/application/hub/classes/pools/peer/class_DefaultPeerPool.php b/application/hub/classes/pools/peer/class_DefaultPeerPool.php index 756c3fb16..46a187a5f 100644 --- a/application/hub/classes/pools/peer/class_DefaultPeerPool.php +++ b/application/hub/classes/pools/peer/class_DefaultPeerPool.php @@ -1,4 +1,14 @@ partialStub('Please implement this method.'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/visitor/pool/monitor/class_RawDataPoolMonitorVisitor.php b/application/hub/classes/visitor/pool/monitor/class_RawDataPoolMonitorVisitor.php index a2da41e71..8b2e803e7 100644 --- a/application/hub/classes/visitor/pool/monitor/class_RawDataPoolMonitorVisitor.php +++ b/application/hub/classes/visitor/pool/monitor/class_RawDataPoolMonitorVisitor.php @@ -5,6 +5,10 @@ namespace Hub\Visitor\Monitor\Pool; // Import application-specific stuff use Hub\Network\Receive\Receivable; +// Import framework stuff +use CoreFramework\Listener\Listenable; +use CoreFramework\Pool\Poolable; + /** * A RawDataMonitor visitor * diff --git a/application/hub/classes/visitor/pool/shutdown/class_Shutdown b/application/hub/classes/visitor/pool/shutdown/class_Shutdown index d85f52e97..282d6896b 100644 --- a/application/hub/classes/visitor/pool/shutdown/class_Shutdown +++ b/application/hub/classes/visitor/pool/shutdown/class_Shutdown @@ -1,4 +1,10 @@ setConfigEntry('peer_state_lookup_db_wrapper_class', 'PeerStateLookupDatab $cfg->setConfigEntry('web_content_type', ''); // CFG: LISTENER-POOL-CLAS -$cfg->setConfigEntry('listener_pool_class', 'DefaultListenerPool'); +$cfg->setConfigEntry('listener_pool_class', 'Hub\Pool\Listener\DefaultListenerPool'); // CFG: TCP-LISTENER-CLASS $cfg->setConfigEntry('tcp_listener_class', 'TcpListener'); diff --git a/application/hub/interfaces/discovery/recipient/socket/class_DiscoverableSocket.php b/application/hub/interfaces/discovery/recipient/socket/class_DiscoverableSocket.php index b28b8f6ae..8502aa726 100644 --- a/application/hub/interfaces/discovery/recipient/socket/class_DiscoverableSocket.php +++ b/application/hub/interfaces/discovery/recipient/socket/class_DiscoverableSocket.php @@ -42,7 +42,5 @@ interface DiscoverableSocket extends DiscoverableRecipient { * @return $listenerInstance An instance of a Listenable instance or null */ function discoverListenerInstance (HandleableProtocol $protocolInstance, array $packageData); -} -// [EOF] -?> +} diff --git a/application/hub/interfaces/shareable/info/class_ShareableInfo.php b/application/hub/interfaces/shareable/info/class_ShareableInfo.php index dbd1f49c1..a3765228f 100644 --- a/application/hub/interfaces/shareable/info/class_ShareableInfo.php +++ b/application/hub/interfaces/shareable/info/class_ShareableInfo.php @@ -4,6 +4,7 @@ namespace Hub\Information; // Import framework stuff use CoreFramework\Generic\FrameworkInterface; +use CoreFramework\Listener\Listenable; /** * An interface for shareable informations diff --git a/application/hub/interfaces/tags/class_Tagable.php b/application/hub/interfaces/tags/class_Tagable.php index d0ba6c756..cac89f9a4 100644 --- a/application/hub/interfaces/tags/class_Tagable.php +++ b/application/hub/interfaces/tags/class_Tagable.php @@ -4,6 +4,7 @@ namespace Hub\Tag; // Import framework stuff use CoreFramework\Generic\FrameworkInterface; +use CoreFramework\Listener\Listenable; /** * An interface for tags diff --git a/application/hub/interfaces/visitor/pool/listener/class_ListenerPoolVisitor.php b/application/hub/interfaces/visitor/pool/listener/class_ListenerPoolVisitor.php index 7c05cdd29..e89db8866 100644 --- a/application/hub/interfaces/visitor/pool/listener/class_ListenerPoolVisitor.php +++ b/application/hub/interfaces/visitor/pool/listener/class_ListenerPoolVisitor.php @@ -1,4 +1,10 @@ +} diff --git a/core b/core index aa425d10f..1e0fc6320 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit aa425d10f8eef36160fcfd87bcd9a7d44af9ff16 +Subproject commit 1e0fc6320d565605e15aa4f023915ca1574272e4 -- 2.39.5