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 => '',
- );
+ ];
}
/**
$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,
- );
+ ];
}
/**
$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(
* @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();
*/
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
// Render the XML content
$templateInstance->renderXmlContent();
+
+ // Trace message
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-BOOTSTRAP-HELPER: EXIT!');
}
/**
* @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!');
}
}
// 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
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class XmlAnnouncementTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable {
+class XmlAnnouncementTemplateEngine extends BaseXmlTemplateEngine implements CompileableXmlTemplate, Registerable {
/**
* Some XML nodes must be available for later data extraction
*/
* @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);
// Pop the last entry
$this->getStackInstance()->popNamed('node_announcement');
}
-}
-// [EOF]
-?>
+}
// 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
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class XmlAnnouncementAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine implements CompileableTemplate, Registerable {
+class XmlAnnouncementAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine implements CompileableXmlTemplate, Registerable {
/**
* Some XML nodes must be available for later data extraction
*/
* @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);
// Pop the last entry
$this->getStackInstance()->popNamed('node_announcement_answer');
}
-}
-// [EOF]
-?>
+}
// 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
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class Xml???AnswerTemplateEngine extends BaseXmlAnswerTemplateEngine implements CompileableTemplate, Registerable {
+class Xml???AnswerTemplateEngine extends BaseXmlAnswerTemplateEngine implements CompileableXmlTemplate, Registerable {
/**
* Protected constructor
*
// Pop the last entry
$this->getStackInstance()->popNamed('!!!');
}
-}
-// [EOF]
-?>
+}
// 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
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-abstract class BaseXmlAnswerTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable {
+abstract class BaseXmlAnswerTemplateEngine extends BaseXmlTemplateEngine implements CompileableXmlTemplate, Registerable {
/**
* Generic 'answer-status' field
*/
// 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
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class XmlDhtBootstrapAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine implements CompileableTemplate, Registerable {
+class XmlDhtBootstrapAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine implements CompileableXmlTemplate, Registerable {
/**
* Some XML nodes must be available for later data extraction
*/
parent::__construct(__CLASS__);
// Init sub-nodes array
- $this->setSubNodes(array(
+ $this->setSubNodes([
// These nodes don't contain any data
'my-data',
'your-data',
self::ANSWER_STATUS,
// DHT node list
self::DHT_BOOTSTRAP_DATA_NODE_LIST,
- ));
+ ]);
}
/**
* @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);
// Pop the last entry
$this->getStackInstance()->popNamed('node_dht_bootstrap_answer');
}
-}
-// [EOF]
-?>
+}
// 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
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-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';
* @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);
// Pop the last entry
$this->getStackInstance()->popNamed('node_request_node_list_answer');
}
-}
-// [EOF]
-?>
+}
// 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
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class Xml???TemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable {
+class Xml???TemplateEngine extends BaseXmlTemplateEngine implements CompileableXmlTemplate, Registerable {
/**
* Protected constructor
*
// Pop the last entry
$this->getStackInstance()->popNamed('!!!');
}
-}
-// [EOF]
-?>
+}
// 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;
/**
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class XmlSelfConnectTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable {
+class XmlSelfConnectTemplateEngine extends BaseXmlTemplateEngine implements CompileableXmlTemplate, Registerable {
/**
* Data nodes
*/
* @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);
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Shipsimu\Hub\Template\Engine\Xml\Dht\Bootstrap;
+
+// Import application-specific stuff
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Registry\Registerable;
+use Org\Mxchange\CoreFramework\Template\Xml\CompileableXmlTemplate;
+use Org\Mxchange\CoreFramework\Template\Engine\Xml\BaseXmlTemplateEngine;
+
+/**
+ * An Bootstrap template engine class for XML templates
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2018 Hub Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.shipsimu.org
+ * @todo This template engine does not make use of setTemplateType()
+ *
+ * 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
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class XmlDhtBootstrapTemplateEngine extends BaseXmlTemplateEngine implements CompileableXmlTemplate, Registerable {
+ /**
+ * Some XML nodes must be available for later data extraction
+ */
+ const DHT_BOOTSTRAP_DATA_BOOTSTRAP_DATA = 'dht-bootstrap-data';
+ const DHT_BOOTSTRAP_DATA_SESSION_ID = 'session-id';
+ const DHT_BOOTSTRAP_DATA_NODE_STATUS = 'node-status';
+ const DHT_BOOTSTRAP_DATA_NODE_MODE = 'node-mode';
+ const DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS = 'external-address';
+ const DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS = 'internal-address';
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Init array
+ $this->setSubNodes([
+ self::DHT_BOOTSTRAP_DATA_BOOTSTRAP_DATA,
+ 'listener',
+ self::DHT_BOOTSTRAP_DATA_NODE_STATUS,
+ self::DHT_BOOTSTRAP_DATA_NODE_MODE,
+ self::DHT_BOOTSTRAP_DATA_SESSION_ID,
+ self::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS,
+ self::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS
+ ]);
+ }
+
+ /**
+ * Creates an instance of the class TemplateEngine and prepares it for usage
+ *
+ * @return $templateInstance An instance of TemplateEngine
+ * @throws BasePathIsEmptyException If the provided $templateBasePath is empty
+ * @throws InvalidBasePathStringException If $templateBasePath is no string
+ * @throws BasePathIsNoDirectoryException If $templateBasePath is no
+ * directory or not found
+ * @throws BasePathReadProtectedException If $templateBasePath is
+ * read-protected
+ */
+ public static final function createXmlDhtBootstrapTemplateEngine () {
+ // Get a new instance
+ $templateInstance = new XmlDhtBootstrapTemplateEngine();
+
+ // Init template instance
+ $templateInstance->initXmlTemplateEngine('node', 'dht_bootstrap');
+
+ // Return the prepared instance
+ return $templateInstance;
+ }
+
+ /**
+ * Currently not used
+ *
+ * @param $resource XML parser resource (currently ignored)
+ * @param $characters Characters to handle
+ * @return void
+ */
+ 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;
+ }
+
+ /*
+ * 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!');
+ }
+
+ /**
+ * Getter for cache file (FQFN)
+ *
+ * @return $fqfn Full-qualified file name of the menu cache
+ */
+ public function getMenuCacheFqfn () {
+ $this->partialStub('Please implement this method.');
+ }
+
+ /**
+ * Starts the dht bootstrap
+ *
+ * @return void
+ */
+ protected function startDhtBootstrap () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('dht_bootstrap', 'dht-bootstrap');
+ }
+
+ /**
+ * Starts the dht bootstrap data
+ *
+ * @return void
+ */
+ protected function startDhtBootstrapData () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('dht_bootstrap', self::DHT_BOOTSTRAP_DATA_BOOTSTRAP_DATA);
+ }
+
+ /**
+ * Starts the node status
+ *
+ * @return void
+ */
+ protected function startNodeStatus () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('dht_bootstrap', self::DHT_BOOTSTRAP_DATA_NODE_STATUS);
+ }
+
+ /**
+ * Starts the node-mode
+ *
+ * @return void
+ */
+ protected function startNodeMode () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('dht_bootstrap', self::DHT_BOOTSTRAP_DATA_NODE_MODE);
+ }
+
+ /**
+ * Starts the listener
+ *
+ * @return void
+ */
+ protected function startListener () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('dht_bootstrap', 'listener');
+ }
+
+ /**
+ * Starts the public ip
+ *
+ * @return void
+ */
+ protected function startExternalAddress () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('dht_bootstrap', self::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS);
+ }
+
+ /**
+ * Starts the private ip
+ *
+ * @return void
+ */
+ protected function startInternalAddress () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('dht_bootstrap', self::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS);
+ }
+
+ /**
+ * Starts the session id
+ *
+ * @return void
+ */
+ protected function startSessionId () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('dht_bootstrap', self::DHT_BOOTSTRAP_DATA_SESSION_ID);
+ }
+
+ /**
+ * Finishes the session id
+ *
+ * @return void
+ */
+ protected function finishSessionId () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('dht_bootstrap');
+ }
+
+ /**
+ * Finishes the private ip
+ *
+ * @return void
+ */
+ protected function finishInternalAddress () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('dht_bootstrap');
+ }
+
+ /**
+ * Finishes the public ip
+ *
+ * @return void
+ */
+ protected function finishExternalAddress () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('dht_bootstrap');
+ }
+
+ /**
+ * Finishes the listener
+ *
+ * @return void
+ */
+ protected function finishListener () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('dht_bootstrap');
+ }
+
+ /**
+ * Finishes the node mode
+ *
+ * @return void
+ */
+ protected function finishNodeMode () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('dht_bootstrap');
+ }
+
+ /**
+ * Finishes the node status
+ *
+ * @return void
+ */
+ protected function finishNodeStatus () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('dht_bootstrap');
+ }
+
+ /**
+ * Finishes the dht bootstrap data
+ *
+ * @return void
+ */
+ protected function finishDhtBootstrapData () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('dht_bootstrap');
+ }
+
+ /**
+ * Finishes the dht bootstrap
+ *
+ * @return void
+ */
+ protected function finishDhtBootstrap () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('dht_bootstrap');
+ }
+
+}
+++ /dev/null
-<?php
-// Own namespace
-namespace Org\Shipsimu\Hub\Template\Engine\Xml\Dht\Bootstrap;
-
-// Import application-specific stuff
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Registry\Registerable;
-use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
-use Org\Mxchange\CoreFramework\Template\Engine\Xml\BaseXmlTemplateEngine;
-
-/**
- * An Bootstrap template engine class for XML templates
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2018 Hub Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.shipsimu.org
- * @todo This template engine does not make use of setTemplateType()
- *
- * 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
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class XmlDhtBootstrapTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable {
- /**
- * Some XML nodes must be available for later data extraction
- */
- const DHT_BOOTSTRAP_DATA_BOOTSTRAP_DATA = 'dht-bootstrap-data';
- const DHT_BOOTSTRAP_DATA_SESSION_ID = 'session-id';
- const DHT_BOOTSTRAP_DATA_NODE_STATUS = 'node-status';
- const DHT_BOOTSTRAP_DATA_NODE_MODE = 'node-mode';
- const DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS = 'external-address';
- const DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS = 'internal-address';
-
- /**
- * Protected constructor
- *
- * @return void
- */
- protected function __construct () {
- // Call parent constructor
- parent::__construct(__CLASS__);
-
- // Init array
- $this->setSubNodes(array(
- self::DHT_BOOTSTRAP_DATA_BOOTSTRAP_DATA,
- 'listener',
- self::DHT_BOOTSTRAP_DATA_NODE_STATUS,
- self::DHT_BOOTSTRAP_DATA_NODE_MODE,
- self::DHT_BOOTSTRAP_DATA_SESSION_ID,
- self::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS,
- self::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS
- ));
- }
-
- /**
- * Creates an instance of the class TemplateEngine and prepares it for usage
- *
- * @return $templateInstance An instance of TemplateEngine
- * @throws BasePathIsEmptyException If the provided $templateBasePath is empty
- * @throws InvalidBasePathStringException If $templateBasePath is no string
- * @throws BasePathIsNoDirectoryException If $templateBasePath is no
- * directory or not found
- * @throws BasePathReadProtectedException If $templateBasePath is
- * read-protected
- */
- public static final function createXmlDhtBootstrapTemplateEngine () {
- // Get a new instance
- $templateInstance = new XmlDhtBootstrapTemplateEngine();
-
- // Init template instance
- $templateInstance->initXmlTemplateEngine('node', 'dht_bootstrap');
-
- // Return the prepared instance
- return $templateInstance;
- }
-
- /**
- * Currently not used
- *
- * @param $resource XML parser resource (currently ignored)
- * @param $characters Characters to handle
- * @return void
- */
- public function characterHandler ($resource, $characters) {
- // Trim all spaces away
- $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.
- */
- parent::assignVariable($this->getStackInstance()->getNamed('dht_bootstrap'), $characters);
- }
-
- /**
- * Getter for cache file (FQFN)
- *
- * @return $fqfn Full-qualified file name of the menu cache
- */
- public function getMenuCacheFqfn () {
- $this->partialStub('Please implement this method.');
- }
-
- /**
- * Starts the dht bootstrap
- *
- * @return void
- */
- protected function startDhtBootstrap () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('dht_bootstrap', 'dht-bootstrap');
- }
-
- /**
- * Starts the dht bootstrap data
- *
- * @return void
- */
- protected function startDhtBootstrapData () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('dht_bootstrap', self::DHT_BOOTSTRAP_DATA_BOOTSTRAP_DATA);
- }
-
- /**
- * Starts the node status
- *
- * @return void
- */
- protected function startNodeStatus () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('dht_bootstrap', self::DHT_BOOTSTRAP_DATA_NODE_STATUS);
- }
-
- /**
- * Starts the node-mode
- *
- * @return void
- */
- protected function startNodeMode () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('dht_bootstrap', self::DHT_BOOTSTRAP_DATA_NODE_MODE);
- }
-
- /**
- * Starts the listener
- *
- * @return void
- */
- protected function startListener () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('dht_bootstrap', 'listener');
- }
-
- /**
- * Starts the public ip
- *
- * @return void
- */
- protected function startExternalAddress () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('dht_bootstrap', self::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS);
- }
-
- /**
- * Starts the private ip
- *
- * @return void
- */
- protected function startInternalAddress () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('dht_bootstrap', self::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS);
- }
-
- /**
- * Starts the session id
- *
- * @return void
- */
- protected function startSessionId () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('dht_bootstrap', self::DHT_BOOTSTRAP_DATA_SESSION_ID);
- }
-
- /**
- * Finishes the session id
- *
- * @return void
- */
- protected function finishSessionId () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('dht_bootstrap');
- }
-
- /**
- * Finishes the private ip
- *
- * @return void
- */
- protected function finishInternalAddress () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('dht_bootstrap');
- }
-
- /**
- * Finishes the public ip
- *
- * @return void
- */
- protected function finishExternalAddress () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('dht_bootstrap');
- }
-
- /**
- * Finishes the listener
- *
- * @return void
- */
- protected function finishListener () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('dht_bootstrap');
- }
-
- /**
- * Finishes the node mode
- *
- * @return void
- */
- protected function finishNodeMode () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('dht_bootstrap');
- }
-
- /**
- * Finishes the node status
- *
- * @return void
- */
- protected function finishNodeStatus () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('dht_bootstrap');
- }
-
- /**
- * Finishes the dht bootstrap data
- *
- * @return void
- */
- protected function finishDhtBootstrapData () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('dht_bootstrap');
- }
-
- /**
- * Finishes the dht bootstrap
- *
- * @return void
- */
- protected function finishDhtBootstrap () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('dht_bootstrap');
- }
-}
-
-// [EOF]
-?>
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Shipsimu\Hub\Template\Engine\Xml\Dht\Publish;
+
+// Import application-specific stuff
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Registry\Registerable;
+use Org\Mxchange\CoreFramework\Template\Engine\Xml\BaseXmlTemplateEngine;
+use Org\Mxchange\CoreFramework\Template\Xml\CompileableXmlTemplate;
+
+/**
+ * An PublishEntry template engine class for XML templates
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2018 Hub Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.shipsimu.org
+ * @todo This template engine does not make use of setTemplateType()
+ *
+ * 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
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class XmlDhtPublishEntryTemplateEngine extends BaseXmlTemplateEngine implements CompileableXmlTemplate, Registerable {
+ /**
+ * Some XML nodes must be available for later data extraction
+ */
+ const PUBLISH_DATA_NODE_ID = 'node-id';
+ const PUBLISH_DATA_SESSION_ID = 'session-id';
+ const PUBLISH_DATA_NODE_STATUS = 'node-status';
+ const PUBLISH_DATA_NODE_MODE = 'node-mode';
+ const PUBLISH_DATA_EXTERNAL_ADDRESS = 'external-address';
+ const PUBLISH_DATA_PRIVATE_KEY_HASH = 'private-key-hash';
+ const PUBLISH_DATA_ACCEPTED_OBJECT_TYPES = 'accepted-object-types';
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Init array
+ $this->setSubNodes(array(
+ 'publish-data',
+ 'listener',
+ self::PUBLISH_DATA_NODE_STATUS,
+ self::PUBLISH_DATA_NODE_MODE,
+ self::PUBLISH_DATA_PRIVATE_KEY_HASH,
+ self::PUBLISH_DATA_ACCEPTED_OBJECT_TYPES,
+ self::PUBLISH_DATA_NODE_ID,
+ self::PUBLISH_DATA_SESSION_ID,
+ self::PUBLISH_DATA_EXTERNAL_ADDRESS,
+ 'object-type-list',
+ ));
+ }
+
+ /**
+ * Creates an instance of the class TemplateEngine and prepares it for usage
+ *
+ * @return $templateInstance An instance of TemplateEngine
+ * @throws BasePathIsEmptyException If the provided $templateBasePath is empty
+ * @throws InvalidBasePathStringException If $templateBasePath is no string
+ * @throws BasePathIsNoDirectoryException If $templateBasePath is no
+ * directory or not found
+ * @throws BasePathReadProtectedException If $templateBasePath is
+ * read-protected
+ */
+ public static final function createXmlDhtPublishEntryTemplateEngine () {
+ // Get a new instance
+ $templateInstance = new XmlDhtPublishEntryTemplateEngine();
+
+ // Init template instance
+ $templateInstance->initXmlTemplateEngine('node', 'dht_publish');
+
+ // Return the prepared instance
+ return $templateInstance;
+ }
+
+ /**
+ * Currently not used
+ *
+ * @param $resource XML parser resource (currently ignored)
+ * @param $characters Characters to handle
+ * @return void
+ */
+ public function characterHandler ($resource, string $characters) {
+ // Trim all spaces away
+ $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.
+ */
+ parent::assignVariable($this->getStackInstance()->getNamed('dht_publish'), $characters);
+ }
+
+ /**
+ * Getter for cache file (FQFN)
+ *
+ * @return $fqfn Full-qualified file name of the menu cache
+ */
+ public function getMenuCacheFqfn () {
+ $this->partialStub('Please implement this method.');
+ }
+
+ /**
+ * Starts the publish
+ *
+ * @return void
+ */
+ protected function startPublish () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('dht_publish', 'publish');
+ }
+
+ /**
+ * Starts the publish data
+ *
+ * @return void
+ */
+ protected function startPublishData () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('dht_publish', 'publish-data');
+ }
+
+ /**
+ * Starts the node status
+ *
+ * @return void
+ */
+ protected function startNodeStatus () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('dht_publish', self::PUBLISH_DATA_NODE_STATUS);
+ }
+
+ /**
+ * Starts the node-mode
+ *
+ * @return void
+ */
+ protected function startNodeMode () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('dht_publish', self::PUBLISH_DATA_NODE_MODE);
+ }
+
+ /**
+ * Starts the listener
+ *
+ * @return void
+ */
+ protected function startListener () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('dht_publish', 'listener');
+ }
+
+ /**
+ * Starts accepted object types
+ *
+ * @return void
+ */
+ protected function startAcceptedObjectTypes () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('dht_publish', self::PUBLISH_DATA_ACCEPTED_OBJECT_TYPES);
+ }
+
+ /**
+ * Starts hash from private key
+ *
+ * @return void
+ */
+ protected function startPrivateKeyHash () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('dht_publish', self::PUBLISH_DATA_PRIVATE_KEY_HASH);
+ }
+
+ /**
+ * Starts the node id
+ *
+ * @return void
+ */
+ protected function startNodeId () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('dht_publish', self::PUBLISH_DATA_NODE_ID);
+ }
+
+ /**
+ * Starts the session id
+ *
+ * @return void
+ */
+ protected function startSessionId () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('dht_publish', self::PUBLISH_DATA_SESSION_ID);
+ }
+
+ /**
+ * Starts the public ip
+ *
+ * @return void
+ */
+ protected function startExternalAddress () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('dht_publish', self::PUBLISH_DATA_EXTERNAL_ADDRESS);
+ }
+
+ /**
+ * Starts the object type list
+ *
+ * @return void
+ */
+ protected function startObjectTypeList () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('dht_publish', 'object-type-list');
+ }
+
+ /**
+ * Starts the object type
+ *
+ * @return void
+ */
+ protected function startObjectType () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('dht_publish', 'object-type');
+ }
+
+ /**
+ * Finishes the object type
+ *
+ * @return void
+ */
+ protected function finishObjectType () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('dht_publish');
+ }
+
+ /**
+ * Finishes the object type list
+ *
+ * @return void
+ */
+ protected function finishObjectTypeList () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('dht_publish');
+ }
+
+ /**
+ * Finishes the session id
+ *
+ * @return void
+ */
+ protected function finishSessionId () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('dht_publish');
+ }
+
+ /**
+ * Finishes the node id
+ *
+ * @return void
+ */
+ protected function finishNodeId () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('dht_publish');
+ }
+
+ /**
+ * Finishes the public ip
+ *
+ * @return void
+ */
+ protected function finishExternalAddress () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('dht_publish');
+ }
+
+ /**
+ * Finishes hash from private key
+ *
+ * @return void
+ */
+ protected function finishPrivateKeyHash () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('dht_publish');
+ }
+
+ /**
+ * Finishes accepted object types
+ *
+ * @return void
+ */
+ protected function finishAcceptedObjectTypes () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('dht_publish');
+ }
+
+ /**
+ * Finishes the listener
+ *
+ * @return void
+ */
+ protected function finishListener () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('dht_publish');
+ }
+
+ /**
+ * Finishes the node mode
+ *
+ * @return void
+ */
+ protected function finishNodeMode () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('dht_publish');
+ }
+
+ /**
+ * Finishes the node status
+ *
+ * @return void
+ */
+ protected function finishNodeStatus () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('dht_publish');
+ }
+
+ /**
+ * Finishes the publish data
+ *
+ * @return void
+ */
+ protected function finishPublishData () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('dht_publish');
+ }
+
+ /**
+ * Finishes the publish
+ *
+ * @return void
+ */
+ protected function finishPublish () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('dht_publish');
+ }
+
+}
// 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;
/**
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class XmlRequestNodeListEntryTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable {
+class XmlRequestNodeListEntryTemplateEngine extends BaseXmlTemplateEngine implements CompileableXmlTemplate, Registerable {
/**
* Protected constructor
*
* @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);
// Pop the last entry
$this->getStackInstance()->popNamed('node_request_node_list_entry');
}
-}
-// [EOF]
-?>
+}
// 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
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-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';
* @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);
// 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
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class XmlCruncherTestUnitTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable {
+class XmlCruncherTestUnitTemplateEngine extends BaseXmlTemplateEngine implements CompileableXmlTemplate, Registerable {
/**
* Protected constructor
*
* @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);
// Pop the last entry
$this->getStackInstance()->popNamed('cruncher_test_unit');
}
-}
-// [EOF]
-?>
+}
+++ /dev/null
-<?php
-// Own namespace
-namespace Org\Shipsimu\Hub\Template\Engine\Xml\Dht\Publish;
-
-// Import application-specific stuff
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Registry\Registerable;
-use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
-use Org\Mxchange\CoreFramework\Template\Engine\Xml\BaseXmlTemplateEngine;
-
-/**
- * An PublishEntry template engine class for XML templates
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2018 Hub Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.shipsimu.org
- * @todo This template engine does not make use of setTemplateType()
- *
- * 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
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class XmlDhtPublishEntryTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable {
- /**
- * Some XML nodes must be available for later data extraction
- */
- const PUBLISH_DATA_NODE_ID = 'node-id';
- const PUBLISH_DATA_SESSION_ID = 'session-id';
- const PUBLISH_DATA_NODE_STATUS = 'node-status';
- const PUBLISH_DATA_NODE_MODE = 'node-mode';
- const PUBLISH_DATA_EXTERNAL_ADDRESS = 'external-address';
- const PUBLISH_DATA_PRIVATE_KEY_HASH = 'private-key-hash';
- const PUBLISH_DATA_ACCEPTED_OBJECT_TYPES = 'accepted-object-types';
-
- /**
- * Protected constructor
- *
- * @return void
- */
- protected function __construct () {
- // Call parent constructor
- parent::__construct(__CLASS__);
-
- // Init array
- $this->setSubNodes(array(
- 'publish-data',
- 'listener',
- self::PUBLISH_DATA_NODE_STATUS,
- self::PUBLISH_DATA_NODE_MODE,
- self::PUBLISH_DATA_PRIVATE_KEY_HASH,
- self::PUBLISH_DATA_ACCEPTED_OBJECT_TYPES,
- self::PUBLISH_DATA_NODE_ID,
- self::PUBLISH_DATA_SESSION_ID,
- self::PUBLISH_DATA_EXTERNAL_ADDRESS,
- 'object-type-list',
- ));
- }
-
- /**
- * Creates an instance of the class TemplateEngine and prepares it for usage
- *
- * @return $templateInstance An instance of TemplateEngine
- * @throws BasePathIsEmptyException If the provided $templateBasePath is empty
- * @throws InvalidBasePathStringException If $templateBasePath is no string
- * @throws BasePathIsNoDirectoryException If $templateBasePath is no
- * directory or not found
- * @throws BasePathReadProtectedException If $templateBasePath is
- * read-protected
- */
- public static final function createXmlDhtPublishEntryTemplateEngine () {
- // Get a new instance
- $templateInstance = new XmlDhtPublishEntryTemplateEngine();
-
- // Init template instance
- $templateInstance->initXmlTemplateEngine('node', 'dht_publish');
-
- // Return the prepared instance
- return $templateInstance;
- }
-
- /**
- * Currently not used
- *
- * @param $resource XML parser resource (currently ignored)
- * @param $characters Characters to handle
- * @return void
- */
- public function characterHandler ($resource, $characters) {
- // Trim all spaces away
- $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.
- */
- parent::assignVariable($this->getStackInstance()->getNamed('dht_publish'), $characters);
- }
-
- /**
- * Getter for cache file (FQFN)
- *
- * @return $fqfn Full-qualified file name of the menu cache
- */
- public function getMenuCacheFqfn () {
- $this->partialStub('Please implement this method.');
- }
-
- /**
- * Starts the publish
- *
- * @return void
- */
- protected function startPublish () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('dht_publish', 'publish');
- }
-
- /**
- * Starts the publish data
- *
- * @return void
- */
- protected function startPublishData () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('dht_publish', 'publish-data');
- }
-
- /**
- * Starts the node status
- *
- * @return void
- */
- protected function startNodeStatus () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('dht_publish', self::PUBLISH_DATA_NODE_STATUS);
- }
-
- /**
- * Starts the node-mode
- *
- * @return void
- */
- protected function startNodeMode () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('dht_publish', self::PUBLISH_DATA_NODE_MODE);
- }
-
- /**
- * Starts the listener
- *
- * @return void
- */
- protected function startListener () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('dht_publish', 'listener');
- }
-
- /**
- * Starts accepted object types
- *
- * @return void
- */
- protected function startAcceptedObjectTypes () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('dht_publish', self::PUBLISH_DATA_ACCEPTED_OBJECT_TYPES);
- }
-
- /**
- * Starts hash from private key
- *
- * @return void
- */
- protected function startPrivateKeyHash () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('dht_publish', self::PUBLISH_DATA_PRIVATE_KEY_HASH);
- }
-
- /**
- * Starts the node id
- *
- * @return void
- */
- protected function startNodeId () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('dht_publish', self::PUBLISH_DATA_NODE_ID);
- }
-
- /**
- * Starts the session id
- *
- * @return void
- */
- protected function startSessionId () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('dht_publish', self::PUBLISH_DATA_SESSION_ID);
- }
-
- /**
- * Starts the public ip
- *
- * @return void
- */
- protected function startExternalAddress () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('dht_publish', self::PUBLISH_DATA_EXTERNAL_ADDRESS);
- }
-
- /**
- * Starts the object type list
- *
- * @return void
- */
- protected function startObjectTypeList () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('dht_publish', 'object-type-list');
- }
-
- /**
- * Starts the object type
- *
- * @return void
- */
- protected function startObjectType () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('dht_publish', 'object-type');
- }
-
- /**
- * Finishes the object type
- *
- * @return void
- */
- protected function finishObjectType () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('dht_publish');
- }
-
- /**
- * Finishes the object type list
- *
- * @return void
- */
- protected function finishObjectTypeList () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('dht_publish');
- }
-
- /**
- * Finishes the session id
- *
- * @return void
- */
- protected function finishSessionId () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('dht_publish');
- }
-
- /**
- * Finishes the node id
- *
- * @return void
- */
- protected function finishNodeId () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('dht_publish');
- }
-
- /**
- * Finishes the public ip
- *
- * @return void
- */
- protected function finishExternalAddress () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('dht_publish');
- }
-
- /**
- * Finishes hash from private key
- *
- * @return void
- */
- protected function finishPrivateKeyHash () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('dht_publish');
- }
-
- /**
- * Finishes accepted object types
- *
- * @return void
- */
- protected function finishAcceptedObjectTypes () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('dht_publish');
- }
-
- /**
- * Finishes the listener
- *
- * @return void
- */
- protected function finishListener () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('dht_publish');
- }
-
- /**
- * Finishes the node mode
- *
- * @return void
- */
- protected function finishNodeMode () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('dht_publish');
- }
-
- /**
- * Finishes the node status
- *
- * @return void
- */
- protected function finishNodeStatus () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('dht_publish');
- }
-
- /**
- * Finishes the publish data
- *
- * @return void
- */
- protected function finishPublishData () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('dht_publish');
- }
-
- /**
- * Finishes the publish
- *
- * @return void
- */
- protected function finishPublish () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('dht_publish');
- }
-}
-
-// [EOF]
-?>
// 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
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-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';
* @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);
// Pop the last entry
$this->getStackInstance()->popNamed('node_request_node_list');
}
-}
-// [EOF]
-?>
+}
// 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', '');
* @param $unl UNL to test
* @return $ifMatches Whether the found UNL matches own addresss
*/
- function isOwnAddress ($unl);
+ function isOwnAddress (string $unl);
}
-Subproject commit 90f442d88f7876a27ff75452e0ed1708b7dbc198
+Subproject commit 74b4f2c1770c622cbdbb1f84ac27771da18a0427