From e6632ba800ce900e338884ca18873681338ed647 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 2 Dec 2020 08:33:47 +0100 Subject: [PATCH] Continued: - moved DHT-related template classes to proper sub directories - replaced CompileableTemplate with newly added CompileableXmlTemplate interface as this is closer to what the class is about - updated core framework MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../class_PackageDhtBootstrapTagFilter.php | 4 ++-- ...s_NodeMessageDhtBootstrapAnswerHandler.php | 16 +++++++------- .../class_NodeMessageDhtBootstrapHandler.php | 12 +++++------ .../protocol/class_BaseProtocolHandler.php | 2 +- .../helper/dht/class_DhtBootstrapHelper.php | 16 +++++++------- .../class_XmlAnnouncementTemplateEngine.php | 10 ++++----- ...ss_XmlAnnouncementAnswerTemplateEngine.php | 10 ++++----- .../hub/classes/template/xml/answer/class_ | 8 +++---- .../class_BaseXmlAnswerTemplateEngine.php | 4 ++-- ...ss_XmlDhtBootstrapAnswerTemplateEngine.php | 14 ++++++------- ...XmlRequestNodeListAnswerTemplateEngine.php | 10 ++++----- application/hub/classes/template/xml/class_ | 8 +++---- .../class_XmlSelfConnectTemplateEngine.php | 6 +++--- .../class_XmlDhtBootstrapTemplateEngine.php | 21 +++++++++++-------- ...class_XmlDhtPublishEntryTemplateEngine.php | 10 ++++----- ..._XmlRequestNodeListEntryTemplateEngine.php | 10 ++++----- .../class_XmlObjectRegistryTemplateEngine.php | 6 +++--- ...lass_XmlCruncherTestUnitTemplateEngine.php | 10 ++++----- ...class_XmlRequestNodeListTemplateEngine.php | 10 ++++----- application/hub/config.php | 12 ----------- .../protocol/class_HandleableProtocol.php | 2 +- core | 2 +- 22 files changed, 88 insertions(+), 115 deletions(-) rename application/hub/classes/template/xml/dht/{ => bootstrap}/class_XmlDhtBootstrapTemplateEngine.php (89%) rename application/hub/classes/template/xml/{ => dht}/publish/class_XmlDhtPublishEntryTemplateEngine.php (97%) diff --git a/application/hub/classes/filter/tags/class_PackageDhtBootstrapTagFilter.php b/application/hub/classes/filter/tags/class_PackageDhtBootstrapTagFilter.php index 966ef7a0c..06b98f676 100644 --- a/application/hub/classes/filter/tags/class_PackageDhtBootstrapTagFilter.php +++ b/application/hub/classes/filter/tags/class_PackageDhtBootstrapTagFilter.php @@ -48,13 +48,13 @@ class PackageDhtBootstrapTagFilter extends BaseNodeFilter implements FilterableP parent::__construct(__CLASS__); // Init array - $this->dataXmlNodes = array( + $this->dataXmlNodes = [ XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS => '', XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS => '', XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_NODE_STATUS => '', XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_NODE_MODE => '', XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_SESSION_ID => '', - ); + ]; } /** diff --git a/application/hub/classes/handler/data/message-types/answer/class_NodeMessageDhtBootstrapAnswerHandler.php b/application/hub/classes/handler/data/message-types/answer/class_NodeMessageDhtBootstrapAnswerHandler.php index 078a3cc5d..1f89332a9 100644 --- a/application/hub/classes/handler/data/message-types/answer/class_NodeMessageDhtBootstrapAnswerHandler.php +++ b/application/hub/classes/handler/data/message-types/answer/class_NodeMessageDhtBootstrapAnswerHandler.php @@ -53,37 +53,37 @@ class NodeMessageDhtBootstrapAnswerHandler extends BaseMessageHandler implements $this->setHandlerName('message_announcement_answer'); // Init message data array - $this->messageDataElements = array( + $this->messageDataElements = [ XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS, XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS, XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_NODE_STATUS, XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_SESSION_ID, BaseXmlAnswerTemplateEngine::ANSWER_STATUS, - ); + ]; // Init message-data->configuration translation array - $this->messageToConfig = array( + $this->messageToConfig = [ /* @TODO Why commented out? XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS => 'your_external_address', XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS => 'your_internal_address', XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_SESSION_ID => 'your_session_id' */ - ); + ]; // Init config-copy array - $this->configCopy = array( + $this->configCopy = [ XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS => 'external_address', XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS => 'internal_address', XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_NODE_STATUS => 'node_status', XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_SESSION_ID => 'session_id', - ); + ]; // Init array - $this->searchData = array( + $this->searchData = [ XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_SESSION_ID, XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS, - ); + ]; } /** diff --git a/application/hub/classes/handler/data/message-types/dht/class_NodeMessageDhtBootstrapHandler.php b/application/hub/classes/handler/data/message-types/dht/class_NodeMessageDhtBootstrapHandler.php index f4b55509e..97373cff7 100644 --- a/application/hub/classes/handler/data/message-types/dht/class_NodeMessageDhtBootstrapHandler.php +++ b/application/hub/classes/handler/data/message-types/dht/class_NodeMessageDhtBootstrapHandler.php @@ -54,28 +54,28 @@ class NodeMessageDhtBootstrapHandler extends BaseMessageHandler implements Handl $this->setHandlerName('message_dht_bootstrap'); // Init message data array - $this->messageDataElements = array( + $this->messageDataElements = [ XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS, XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS, XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_NODE_STATUS, XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_NODE_MODE, XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_SESSION_ID, - ); + ]; // Init message-data->configuration translation array - $this->messageToConfig = array( + $this->messageToConfig = [ XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS => 'your_external_address', XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS => 'your_internal_address', XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_SESSION_ID => 'your_session_id' - ); + ]; // Init config-copy array - $this->configCopy = array( + $this->configCopy = [ XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS => 'external_address', XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS => 'internal_address', XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_NODE_STATUS => 'node_status', XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_SESSION_ID => 'session_id', - ); + ]; // Init array $this->searchData = array( diff --git a/application/hub/classes/handler/protocol/class_BaseProtocolHandler.php b/application/hub/classes/handler/protocol/class_BaseProtocolHandler.php index a6fc984f6..d23761a92 100644 --- a/application/hub/classes/handler/protocol/class_BaseProtocolHandler.php +++ b/application/hub/classes/handler/protocol/class_BaseProtocolHandler.php @@ -83,7 +83,7 @@ abstract class BaseProtocolHandler extends BaseHubHandler implements HandleableP * @param $unl UNL to test * @return $ifMatches Whether the found UNL matches own addresss */ - public function isOwnAddress ($unl) { + public function isOwnAddress (string $unl) { // Get own external UNL $externalUnl = HubTools::determineOwnExternalAddress(); diff --git a/application/hub/classes/helper/dht/class_DhtBootstrapHelper.php b/application/hub/classes/helper/dht/class_DhtBootstrapHelper.php index ac9d605af..76c78d1b9 100644 --- a/application/hub/classes/helper/dht/class_DhtBootstrapHelper.php +++ b/application/hub/classes/helper/dht/class_DhtBootstrapHelper.php @@ -75,6 +75,7 @@ class DhtBootstrapHelper extends BaseHubSystemHelper implements HelpableDht { */ public function loadDescriptorXml (Distributable $dhtInstance) { // Debug message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('DHT-BOOTSTRAP-HELPER: dhtInstance=%s - CALLED!', $dhtInstance->__toString())); self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-BOOTSTRAP-HELPER: Starting with DHT boostrap ...'); // Get a XML template instance @@ -88,6 +89,9 @@ class DhtBootstrapHelper extends BaseHubSystemHelper implements HelpableDht { // Render the XML content $templateInstance->renderXmlContent(); + + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-BOOTSTRAP-HELPER: EXIT!'); } /** @@ -97,27 +101,25 @@ class DhtBootstrapHelper extends BaseHubSystemHelper implements HelpableDht { * @return void */ public function sendPackage (Distributable $dhtInstance) { - // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-BOOTSTRAP-HELPER: CALLED!'); - /* * Sanity check: Is the DHT in the approx. state? 'init' for bootstrap * nodes and 'virgin' for all others. */ + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('DHT-BOOTSTRAP-HELPER: dhtInstance=%s - CALLED!', $dhtInstance->__toString())); $dhtInstance->getStateInstance()->validateDhtStateIsVirginOrInit(); // Compile the template, this inserts the loaded dht data into the gaps. $this->getTemplateInstance()->compileTemplate(); // Get a singleton network package instance - $packageInstance = NetworkPackageHandlerFactory::createNetworkPackageHandlerInstance(); + $handlerInstance = NetworkPackageHandlerFactory::createNetworkPackageHandlerInstance(); // Next, feed the content in. The network package class is a pipe-through class. //* DEBUG: */ die(__METHOD__ . ':dhtInstance=' . print_r($dhtInstance, TRUE)); - $packageInstance->enqueueRawDataFromTemplate($this); + $handlerInstance->enqueueRawDataFromTemplate($this); - // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-BOOTSTRAP-HELPER: EXIT!'); + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-BOOTSTRAP-HELPER: EXIT!'); } } diff --git a/application/hub/classes/template/xml/announcement/class_XmlAnnouncementTemplateEngine.php b/application/hub/classes/template/xml/announcement/class_XmlAnnouncementTemplateEngine.php index 272dac68a..5195d786f 100644 --- a/application/hub/classes/template/xml/announcement/class_XmlAnnouncementTemplateEngine.php +++ b/application/hub/classes/template/xml/announcement/class_XmlAnnouncementTemplateEngine.php @@ -6,8 +6,8 @@ namespace Org\Shipsimu\Hub\Template\Engine\Xml\Announcement; // Import framework stuff use Org\Mxchange\CoreFramework\Registry\Registerable; -use Org\Mxchange\CoreFramework\Template\CompileableTemplate; use Org\Mxchange\CoreFramework\Template\Engine\Xml\BaseXmlTemplateEngine; +use Org\Mxchange\CoreFramework\Template\Xml\CompileableXmlTemplate; /** * An Announcement template engine class for XML templates @@ -32,7 +32,7 @@ use Org\Mxchange\CoreFramework\Template\Engine\Xml\BaseXmlTemplateEngine; * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class XmlAnnouncementTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable { +class XmlAnnouncementTemplateEngine extends BaseXmlTemplateEngine implements CompileableXmlTemplate, Registerable { /** * Some XML nodes must be available for later data extraction */ @@ -97,7 +97,7 @@ class XmlAnnouncementTemplateEngine extends BaseXmlTemplateEngine implements Com * @param $characters Characters to handle * @return void */ - public function characterHandler ($resource, $characters) { + public function characterHandler ($resource, string $characters) { // Trim all spaces away $characters = trim($characters); @@ -362,7 +362,5 @@ class XmlAnnouncementTemplateEngine extends BaseXmlTemplateEngine implements Com // Pop the last entry $this->getStackInstance()->popNamed('node_announcement'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/template/xml/answer/announcement/class_XmlAnnouncementAnswerTemplateEngine.php b/application/hub/classes/template/xml/answer/announcement/class_XmlAnnouncementAnswerTemplateEngine.php index 09eb6b1ad..0a1ef4315 100644 --- a/application/hub/classes/template/xml/answer/announcement/class_XmlAnnouncementAnswerTemplateEngine.php +++ b/application/hub/classes/template/xml/answer/announcement/class_XmlAnnouncementAnswerTemplateEngine.php @@ -7,7 +7,7 @@ use Org\Shipsimu\Hub\Template\Engine\Xml\Network\Answer\BaseXmlAnswerTemplateEng // Import framework stuff use Org\Mxchange\CoreFramework\Registry\Registerable; -use Org\Mxchange\CoreFramework\Template\CompileableTemplate; +use Org\Mxchange\CoreFramework\Template\Xml\CompileableXmlTemplate; /** * An AnnouncementAnswer template engine class for XML templates @@ -32,7 +32,7 @@ use Org\Mxchange\CoreFramework\Template\CompileableTemplate; * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class XmlAnnouncementAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine implements CompileableTemplate, Registerable { +class XmlAnnouncementAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine implements CompileableXmlTemplate, Registerable { /** * Some XML nodes must be available for later data extraction */ @@ -105,7 +105,7 @@ class XmlAnnouncementAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine im * @return void * @todo Find something useful with this! */ - public function characterHandler ($resource, $characters) { + public function characterHandler ($resource, string $characters) { // Trim all spaces away $characters = trim($characters); @@ -410,7 +410,5 @@ class XmlAnnouncementAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine im // Pop the last entry $this->getStackInstance()->popNamed('node_announcement_answer'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/template/xml/answer/class_ b/application/hub/classes/template/xml/answer/class_ index 19ad3bb97..6bac5be31 100644 --- a/application/hub/classes/template/xml/answer/class_ +++ b/application/hub/classes/template/xml/answer/class_ @@ -7,7 +7,7 @@ use Org\Mxchange\Hub\Template\Engine\Xml\Network\Answer\BaseXmlAnswerTemplateEng // Import framework stuff use Org\Mxchange\CoreFramework\Registry\Registerable; -use Org\Mxchange\CoreFramework\Template\CompileableTemplate; +use Org\Mxchange\CoreFramework\Template\Xml\CompileableXmlTemplate; /** * An ??? answer template engine class for XML templates @@ -32,7 +32,7 @@ use Org\Mxchange\CoreFramework\Template\CompileableTemplate; * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class Xml???AnswerTemplateEngine extends BaseXmlAnswerTemplateEngine implements CompileableTemplate, Registerable { +class Xml???AnswerTemplateEngine extends BaseXmlAnswerTemplateEngine implements CompileableXmlTemplate, Registerable { /** * Protected constructor * @@ -114,7 +114,5 @@ class Xml???AnswerTemplateEngine extends BaseXmlAnswerTemplateEngine implements // Pop the last entry $this->getStackInstance()->popNamed('!!!'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/template/xml/answer/class_BaseXmlAnswerTemplateEngine.php b/application/hub/classes/template/xml/answer/class_BaseXmlAnswerTemplateEngine.php index 4d5eea307..a5e6a25ad 100644 --- a/application/hub/classes/template/xml/answer/class_BaseXmlAnswerTemplateEngine.php +++ b/application/hub/classes/template/xml/answer/class_BaseXmlAnswerTemplateEngine.php @@ -6,8 +6,8 @@ namespace Org\Shipsimu\Hub\Template\Engine\Xml\Network\Answer; // Import framework stuff use Org\Mxchange\CoreFramework\Registry\Registerable; -use Org\Mxchange\CoreFramework\Template\CompileableTemplate; use Org\Mxchange\CoreFramework\Template\Engine\Xml\BaseXmlTemplateEngine; +use Org\Mxchange\CoreFramework\Template\Xml\CompileableXmlTemplate; /** * An generic answer template engine class for XML templates @@ -32,7 +32,7 @@ use Org\Mxchange\CoreFramework\Template\Engine\Xml\BaseXmlTemplateEngine; * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -abstract class BaseXmlAnswerTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable { +abstract class BaseXmlAnswerTemplateEngine extends BaseXmlTemplateEngine implements CompileableXmlTemplate, Registerable { /** * Generic 'answer-status' field */ diff --git a/application/hub/classes/template/xml/answer/dht/class_XmlDhtBootstrapAnswerTemplateEngine.php b/application/hub/classes/template/xml/answer/dht/class_XmlDhtBootstrapAnswerTemplateEngine.php index 3d15afdc1..c155bc8da 100644 --- a/application/hub/classes/template/xml/answer/dht/class_XmlDhtBootstrapAnswerTemplateEngine.php +++ b/application/hub/classes/template/xml/answer/dht/class_XmlDhtBootstrapAnswerTemplateEngine.php @@ -8,7 +8,7 @@ use Org\Shipsimu\Hub\Template\Engine\Xml\Network\Answer\BaseXmlAnswerTemplateEng // Import framework stuff use Org\Mxchange\CoreFramework\Registry\Registerable; -use Org\Mxchange\CoreFramework\Template\CompileableTemplate; +use Org\Mxchange\CoreFramework\Template\Xml\CompileableXmlTemplate; /** * An DhtBootstrapAnswer template engine class for XML templates @@ -33,7 +33,7 @@ use Org\Mxchange\CoreFramework\Template\CompileableTemplate; * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class XmlDhtBootstrapAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine implements CompileableTemplate, Registerable { +class XmlDhtBootstrapAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine implements CompileableXmlTemplate, Registerable { /** * Some XML nodes must be available for later data extraction */ @@ -54,7 +54,7 @@ class XmlDhtBootstrapAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine im parent::__construct(__CLASS__); // Init sub-nodes array - $this->setSubNodes(array( + $this->setSubNodes([ // These nodes don't contain any data 'my-data', 'your-data', @@ -71,7 +71,7 @@ class XmlDhtBootstrapAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine im self::ANSWER_STATUS, // DHT node list self::DHT_BOOTSTRAP_DATA_NODE_LIST, - )); + ]); } /** @@ -104,7 +104,7 @@ class XmlDhtBootstrapAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine im * @return void * @todo Find something useful with this! */ - public function characterHandler ($resource, $characters) { + public function characterHandler ($resource, string $characters) { // Trim all spaces away $characters = trim($characters); @@ -389,7 +389,5 @@ class XmlDhtBootstrapAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine im // Pop the last entry $this->getStackInstance()->popNamed('node_dht_bootstrap_answer'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/template/xml/answer/requests/class_XmlRequestNodeListAnswerTemplateEngine.php b/application/hub/classes/template/xml/answer/requests/class_XmlRequestNodeListAnswerTemplateEngine.php index f954b517d..b8168c28c 100644 --- a/application/hub/classes/template/xml/answer/requests/class_XmlRequestNodeListAnswerTemplateEngine.php +++ b/application/hub/classes/template/xml/answer/requests/class_XmlRequestNodeListAnswerTemplateEngine.php @@ -8,7 +8,7 @@ use Org\Shipsimu\Hub\Template\Engine\Xml\Network\Answer\BaseXmlAnswerTemplateEng // Import framework stuff use Org\Mxchange\CoreFramework\Factory\Template\XmlTemplateEngineFactory; use Org\Mxchange\CoreFramework\Registry\Registerable; -use Org\Mxchange\CoreFramework\Template\CompileableTemplate; +use Org\Mxchange\CoreFramework\Template\Xml\CompileableXmlTemplate; /** * A RequestNodeListAnswer template engine class for XML templates @@ -33,7 +33,7 @@ use Org\Mxchange\CoreFramework\Template\CompileableTemplate; * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class XmlRequestNodeListAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine implements CompileableTemplate, Registerable { +class XmlRequestNodeListAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine implements CompileableXmlTemplate, Registerable { // Constants for array elements const REQUEST_DATA_SESSION_ID = 'session-id'; const REQUEST_DATA_NODE_LIST = 'node-list'; @@ -92,7 +92,7 @@ class XmlRequestNodeListAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine * @return void * @todo Find something useful with this! */ - public function characterHandler ($resource, $characters) { + public function characterHandler ($resource, string $characters) { // Trim all spaces away $characters = trim($characters); @@ -177,7 +177,5 @@ class XmlRequestNodeListAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine // Pop the last entry $this->getStackInstance()->popNamed('node_request_node_list_answer'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/template/xml/class_ b/application/hub/classes/template/xml/class_ index 707cea3ae..adef7c467 100644 --- a/application/hub/classes/template/xml/class_ +++ b/application/hub/classes/template/xml/class_ @@ -7,7 +7,7 @@ use Org\Mxchange\Hub\Template\Engine\Xml\BaseXmlTemplateEngine; // Import framework stuff use Org\Mxchange\CoreFramework\Registry\Registerable; -use Org\Mxchange\CoreFramework\Template\CompileableTemplate; +use Org\Mxchange\CoreFramework\Template\Xml\CompileableXmlTemplate; /** * An ??? template engine class for XML templates @@ -32,7 +32,7 @@ use Org\Mxchange\CoreFramework\Template\CompileableTemplate; * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class Xml???TemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable { +class Xml???TemplateEngine extends BaseXmlTemplateEngine implements CompileableXmlTemplate, Registerable { /** * Protected constructor * @@ -114,7 +114,5 @@ class Xml???TemplateEngine extends BaseXmlTemplateEngine implements CompileableT // Pop the last entry $this->getStackInstance()->popNamed('!!!'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/template/xml/connect/class_XmlSelfConnectTemplateEngine.php b/application/hub/classes/template/xml/connect/class_XmlSelfConnectTemplateEngine.php index eaf2ec1b8..e6146ec86 100644 --- a/application/hub/classes/template/xml/connect/class_XmlSelfConnectTemplateEngine.php +++ b/application/hub/classes/template/xml/connect/class_XmlSelfConnectTemplateEngine.php @@ -7,7 +7,7 @@ use Org\Shipsimu\Hub\Tag\Tagable; // Import framework stuff use Org\Mxchange\CoreFramework\Registry\Registerable; -use Org\Mxchange\CoreFramework\Template\CompileableTemplate; +use Org\Mxchange\CoreFramework\Template\Xml\CompileableXmlTemplate; use Org\Mxchange\CoreFramework\Template\Engine\Xml\BaseXmlTemplateEngine; /** @@ -33,7 +33,7 @@ use Org\Mxchange\CoreFramework\Template\Engine\Xml\BaseXmlTemplateEngine; * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class XmlSelfConnectTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable { +class XmlSelfConnectTemplateEngine extends BaseXmlTemplateEngine implements CompileableXmlTemplate, Registerable { /** * Data nodes */ @@ -87,7 +87,7 @@ class XmlSelfConnectTemplateEngine extends BaseXmlTemplateEngine implements Comp * @return void * @todo Find something useful with this! */ - public function characterHandler ($resource, $characters) { + public function characterHandler ($resource, string $characters) { // Trim all spaces away $characters = trim($characters); diff --git a/application/hub/classes/template/xml/dht/class_XmlDhtBootstrapTemplateEngine.php b/application/hub/classes/template/xml/dht/bootstrap/class_XmlDhtBootstrapTemplateEngine.php similarity index 89% rename from application/hub/classes/template/xml/dht/class_XmlDhtBootstrapTemplateEngine.php rename to application/hub/classes/template/xml/dht/bootstrap/class_XmlDhtBootstrapTemplateEngine.php index ea51a1f55..d769acd07 100644 --- a/application/hub/classes/template/xml/dht/class_XmlDhtBootstrapTemplateEngine.php +++ b/application/hub/classes/template/xml/dht/bootstrap/class_XmlDhtBootstrapTemplateEngine.php @@ -6,7 +6,7 @@ namespace Org\Shipsimu\Hub\Template\Engine\Xml\Dht\Bootstrap; // Import framework stuff use Org\Mxchange\CoreFramework\Registry\Registerable; -use Org\Mxchange\CoreFramework\Template\CompileableTemplate; +use Org\Mxchange\CoreFramework\Template\Xml\CompileableXmlTemplate; use Org\Mxchange\CoreFramework\Template\Engine\Xml\BaseXmlTemplateEngine; /** @@ -32,7 +32,7 @@ use Org\Mxchange\CoreFramework\Template\Engine\Xml\BaseXmlTemplateEngine; * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class XmlDhtBootstrapTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable { +class XmlDhtBootstrapTemplateEngine extends BaseXmlTemplateEngine implements CompileableXmlTemplate, Registerable { /** * Some XML nodes must be available for later data extraction */ @@ -53,7 +53,7 @@ class XmlDhtBootstrapTemplateEngine extends BaseXmlTemplateEngine implements Com parent::__construct(__CLASS__); // Init array - $this->setSubNodes(array( + $this->setSubNodes([ self::DHT_BOOTSTRAP_DATA_BOOTSTRAP_DATA, 'listener', self::DHT_BOOTSTRAP_DATA_NODE_STATUS, @@ -61,7 +61,7 @@ class XmlDhtBootstrapTemplateEngine extends BaseXmlTemplateEngine implements Com self::DHT_BOOTSTRAP_DATA_SESSION_ID, self::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS, self::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS - )); + ]); } /** @@ -93,21 +93,26 @@ class XmlDhtBootstrapTemplateEngine extends BaseXmlTemplateEngine implements Com * @param $characters Characters to handle * @return void */ - public function characterHandler ($resource, $characters) { + public function characterHandler ($resource, string $characters) { // Trim all spaces away + //* NOISY-DEBIG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('XML-DHT-BOOTSTRAP-TEMPLATE-ENGINE: resource[%s]=%s,characters(%d)=%s - CALLED!', gettype($resource), $resource, strlen($characters), $characters)); $characters = trim($characters); // Is this string empty? if (empty($characters)) { // Then skip it silently return; - } // END - if + } /* * Assign the found characters to variable and use the last entry from * stack as the name. */ + //* NOISY-DEBIG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('XML-DHT-BOOTSTRAP-TEMPLATE-ENGINE: Current node: %s', $this->getStackInstance()->getNamed('dht_bootstrap'))); parent::assignVariable($this->getStackInstance()->getNamed('dht_bootstrap'), $characters); + + // Trace message + //* NOISY-DEBIG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('XML-DHT-BOOTSTRAP-TEMPLATE-ENGINE: EXIT!'); } /** @@ -278,7 +283,5 @@ class XmlDhtBootstrapTemplateEngine extends BaseXmlTemplateEngine implements Com // Pop the last entry $this->getStackInstance()->popNamed('dht_bootstrap'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/template/xml/publish/class_XmlDhtPublishEntryTemplateEngine.php b/application/hub/classes/template/xml/dht/publish/class_XmlDhtPublishEntryTemplateEngine.php similarity index 97% rename from application/hub/classes/template/xml/publish/class_XmlDhtPublishEntryTemplateEngine.php rename to application/hub/classes/template/xml/dht/publish/class_XmlDhtPublishEntryTemplateEngine.php index 4f818bf75..c00113a78 100644 --- a/application/hub/classes/template/xml/publish/class_XmlDhtPublishEntryTemplateEngine.php +++ b/application/hub/classes/template/xml/dht/publish/class_XmlDhtPublishEntryTemplateEngine.php @@ -6,8 +6,8 @@ namespace Org\Shipsimu\Hub\Template\Engine\Xml\Dht\Publish; // Import framework stuff use Org\Mxchange\CoreFramework\Registry\Registerable; -use Org\Mxchange\CoreFramework\Template\CompileableTemplate; use Org\Mxchange\CoreFramework\Template\Engine\Xml\BaseXmlTemplateEngine; +use Org\Mxchange\CoreFramework\Template\Xml\CompileableXmlTemplate; /** * An PublishEntry template engine class for XML templates @@ -32,7 +32,7 @@ use Org\Mxchange\CoreFramework\Template\Engine\Xml\BaseXmlTemplateEngine; * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class XmlDhtPublishEntryTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable { +class XmlDhtPublishEntryTemplateEngine extends BaseXmlTemplateEngine implements CompileableXmlTemplate, Registerable { /** * Some XML nodes must be available for later data extraction */ @@ -97,7 +97,7 @@ class XmlDhtPublishEntryTemplateEngine extends BaseXmlTemplateEngine implements * @param $characters Characters to handle * @return void */ - public function characterHandler ($resource, $characters) { + public function characterHandler ($resource, string $characters) { // Trim all spaces away $characters = trim($characters); @@ -362,7 +362,5 @@ class XmlDhtPublishEntryTemplateEngine extends BaseXmlTemplateEngine implements // Pop the last entry $this->getStackInstance()->popNamed('dht_publish'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/template/xml/entries/class_XmlRequestNodeListEntryTemplateEngine.php b/application/hub/classes/template/xml/entries/class_XmlRequestNodeListEntryTemplateEngine.php index aff38500b..a79701fac 100644 --- a/application/hub/classes/template/xml/entries/class_XmlRequestNodeListEntryTemplateEngine.php +++ b/application/hub/classes/template/xml/entries/class_XmlRequestNodeListEntryTemplateEngine.php @@ -6,7 +6,7 @@ namespace Org\Shipsimu\Hub\Template\Engine\Xml\Request\NodeList; // Import framework stuff use Org\Mxchange\CoreFramework\Registry\Registerable; -use Org\Mxchange\CoreFramework\Template\CompileableTemplate; +use Org\Mxchange\CoreFramework\Template\Xml\CompileableXmlTemplate; use Org\Mxchange\CoreFramework\Template\Engine\Xml\BaseXmlTemplateEngine; /** @@ -32,7 +32,7 @@ use Org\Mxchange\CoreFramework\Template\Engine\Xml\BaseXmlTemplateEngine; * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class XmlRequestNodeListEntryTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable { +class XmlRequestNodeListEntryTemplateEngine extends BaseXmlTemplateEngine implements CompileableXmlTemplate, Registerable { /** * Protected constructor * @@ -73,7 +73,7 @@ class XmlRequestNodeListEntryTemplateEngine extends BaseXmlTemplateEngine implem * @return void * @todo Find something useful with this! */ - public function characterHandler ($resource, $characters) { + public function characterHandler ($resource, string $characters) { // Trim all spaces away $characters = trim($characters); @@ -115,7 +115,5 @@ class XmlRequestNodeListEntryTemplateEngine extends BaseXmlTemplateEngine implem // Pop the last entry $this->getStackInstance()->popNamed('node_request_node_list_entry'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/template/xml/objects/class_XmlObjectRegistryTemplateEngine.php b/application/hub/classes/template/xml/objects/class_XmlObjectRegistryTemplateEngine.php index 5edc06dbd..8ae96ea15 100644 --- a/application/hub/classes/template/xml/objects/class_XmlObjectRegistryTemplateEngine.php +++ b/application/hub/classes/template/xml/objects/class_XmlObjectRegistryTemplateEngine.php @@ -8,8 +8,8 @@ use Org\Shipsimu\Hub\Factory\Registry\Object\ObjectTypeRegistryFactory; // Import framework stuff use Org\Mxchange\CoreFramework\Registry\GenericRegistry; use Org\Mxchange\CoreFramework\Registry\Registerable; -use Org\Mxchange\CoreFramework\Template\CompileableTemplate; use Org\Mxchange\CoreFramework\Template\Engine\Xml\BaseXmlTemplateEngine; +use Org\Mxchange\CoreFramework\Template\Xml\CompileableXmlTemplate; /** * An ObjectRegistry template engine class for XML templates @@ -34,7 +34,7 @@ use Org\Mxchange\CoreFramework\Template\Engine\Xml\BaseXmlTemplateEngine; * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class XmlObjectRegistryTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable { +class XmlObjectRegistryTemplateEngine extends BaseXmlTemplateEngine implements CompileableXmlTemplate, Registerable { // Constants const OBJECT_TYPE_DATA_NAME = 'object-name'; const OBJECT_TYPE_DATA_RECIPIENT_LIMITATION = 'object-recipient-limitation'; @@ -100,7 +100,7 @@ class XmlObjectRegistryTemplateEngine extends BaseXmlTemplateEngine implements C * @param $characters Characters to handle * @return void */ - public function characterHandler ($resource, $characters) { + public function characterHandler ($resource, string $characters) { // Trim all spaces away //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('XML-OBJECT-REGISTRY-TEMPLATE-ENGINE: resource[%s]=%s,characters[%s]=%s - CALLED!', gettype($resource), $resource, gettype($characters), $characters)); $characters = trim($characters); diff --git a/application/hub/classes/template/xml/producer/test_units/class_XmlCruncherTestUnitTemplateEngine.php b/application/hub/classes/template/xml/producer/test_units/class_XmlCruncherTestUnitTemplateEngine.php index 36b805bb2..634a825b7 100644 --- a/application/hub/classes/template/xml/producer/test_units/class_XmlCruncherTestUnitTemplateEngine.php +++ b/application/hub/classes/template/xml/producer/test_units/class_XmlCruncherTestUnitTemplateEngine.php @@ -6,8 +6,8 @@ namespace Org\Shipsimu\Hub\Cruncher\Template\Engine\Xml\TestUnit; // Import framework stuff use Org\Mxchange\CoreFramework\Registry\Registerable; -use Org\Mxchange\CoreFramework\Template\CompileableTemplate; use Org\Mxchange\CoreFramework\Template\Engine\Xml\BaseXmlTemplateEngine; +use Org\Mxchange\CoreFramework\Template\Xml\CompileableXmlTemplate; /** * An TestUnit template engine class for XML templates @@ -32,7 +32,7 @@ use Org\Mxchange\CoreFramework\Template\Engine\Xml\BaseXmlTemplateEngine; * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class XmlCruncherTestUnitTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable { +class XmlCruncherTestUnitTemplateEngine extends BaseXmlTemplateEngine implements CompileableXmlTemplate, Registerable { /** * Protected constructor * @@ -88,7 +88,7 @@ class XmlCruncherTestUnitTemplateEngine extends BaseXmlTemplateEngine implements * @param $characters Characters to handle * @return void */ - public function characterHandler ($resource, $characters) { + public function characterHandler ($resource, string $characters) { // Trim all spaces away $characters = trim($characters); @@ -373,7 +373,5 @@ class XmlCruncherTestUnitTemplateEngine extends BaseXmlTemplateEngine implements // Pop the last entry $this->getStackInstance()->popNamed('cruncher_test_unit'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/template/xml/requests/class_XmlRequestNodeListTemplateEngine.php b/application/hub/classes/template/xml/requests/class_XmlRequestNodeListTemplateEngine.php index 84f1f95aa..19ef10e98 100644 --- a/application/hub/classes/template/xml/requests/class_XmlRequestNodeListTemplateEngine.php +++ b/application/hub/classes/template/xml/requests/class_XmlRequestNodeListTemplateEngine.php @@ -7,8 +7,8 @@ use Org\Shipsimu\Hub\Template\Engine\Xml\Request\NodeList\XmlRequestNodeListTemp // Import framework stuff use Org\Mxchange\CoreFramework\Registry\Registerable; -use Org\Mxchange\CoreFramework\Template\CompileableTemplate; use Org\Mxchange\CoreFramework\Template\Engine\Xml\BaseXmlTemplateEngine; +use Org\Mxchange\CoreFramework\Template\Xml\CompileableXmlTemplate; /** * An RequestNodeList template engine class for XML templates @@ -33,7 +33,7 @@ use Org\Mxchange\CoreFramework\Template\Engine\Xml\BaseXmlTemplateEngine; * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class XmlRequestNodeListTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable { +class XmlRequestNodeListTemplateEngine extends BaseXmlTemplateEngine implements CompileableXmlTemplate, Registerable { // Constants for array elements const REQUEST_DATA_ACCEPTED_OBJECT_TYPES = 'accepted-object-types'; const REQUEST_DATA_SESSION_ID = 'session-id'; @@ -84,7 +84,7 @@ class XmlRequestNodeListTemplateEngine extends BaseXmlTemplateEngine implements * @return void * @todo Find something useful with this! */ - public function characterHandler ($resource, $characters) { + public function characterHandler ($resource, string $characters) { // Trim all spaces away $characters = trim($characters); @@ -166,7 +166,5 @@ class XmlRequestNodeListTemplateEngine extends BaseXmlTemplateEngine implements // Pop the last entry $this->getStackInstance()->popNamed('node_request_node_list'); } -} -// [EOF] -?> +} diff --git a/application/hub/config.php b/application/hub/config.php index e1e219258..bccfb4988 100644 --- a/application/hub/config.php +++ b/application/hub/config.php @@ -790,18 +790,6 @@ $cfg->setConfigEntry('tcp_socket_accept_wait_usec', 0); // CFG: NODE-STATE-CHECKED-PACKAGE-CLASS $cfg->setConfigEntry('node_state_checked_package_class', 'NewConnectionNodeState'); -// CFG: NODE-ID -$cfg->setConfigEntry('node_id', ''); - -// CFG: SESSION-ID -$cfg->setConfigEntry('session_id', ''); - -// CFG: PRIVATE-KEY -$cfg->setConfigEntry('private_key', ''); - -// CFG: PRIVATE-KEY-HASH -$cfg->setConfigEntry('private_key_hash', ''); - // CFG: EXTERNAL-ADDRESS $cfg->setConfigEntry('external_address', ''); diff --git a/application/hub/interfaces/handler/protocol/class_HandleableProtocol.php b/application/hub/interfaces/handler/protocol/class_HandleableProtocol.php index d531a43a3..ceb19add6 100644 --- a/application/hub/interfaces/handler/protocol/class_HandleableProtocol.php +++ b/application/hub/interfaces/handler/protocol/class_HandleableProtocol.php @@ -69,6 +69,6 @@ interface HandleableProtocol extends Handleable, HubInterface { * @param $unl UNL to test * @return $ifMatches Whether the found UNL matches own addresss */ - function isOwnAddress ($unl); + function isOwnAddress (string $unl); } diff --git a/core b/core index 90f442d88..74b4f2c17 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 90f442d88f7876a27ff75452e0ed1708b7dbc198 +Subproject commit 74b4f2c1770c622cbdbb1f84ac27771da18a0427 -- 2.39.5