$this->bufferInstance = ObjectFactory::createObjectByConfiguredName('cruncher_buffer_stacker_class');
// Initialize common stackers, like in/out
- $this->bufferInstance->initStacks(array(
+ $this->bufferInstance->initStacks([
self::STACKER_NAME_IN_QUEUE,
self::STACKER_NAME_OUT_QUEUE
- ));
+ ]);
// Output debug message
self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRUNCHER: All buffers are now initialized.');
// Import framework stuff
use Org\Mxchange\CoreFramework\Handler\Handleable;
-use Org\Mxchange\CoreFramework\Stacker\Stackable;
+use Org\Mxchange\CoreFramework\Traits\Stacker\StackableTrait;
/**
* A general Decoder class
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
abstract class BaseDecoder extends BaseHubSystem {
+ // Load traits
+ use StackableTrait;
+
/**
* A network package handler instance
*/
private $packageHandlerInstance = NULL;
- /**
- * Instance of the stacker
- */
- private $stackInstance = NULL;
-
/**
* Handler instance
*/
return $this->packageHandlerInstance;
}
- /**
- * Setter for stacker instance
- *
- * @param $stackInstance An instance of an stacker
- * @return void
- */
- protected final function setStackInstance (Stackable $stackInstance) {
- $this->stackInstance = $stackInstance;
- }
-
- /**
- * Getter for stacker instance
- *
- * @return $stackInstance An instance of an stacker
- */
- public final function getStackInstance () {
- return $this->stackInstance;
- }
-
/**
* Setter for handler instance
*
use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
use Org\Mxchange\CoreFramework\Result\Search\SearchableResult;
-use Org\Mxchange\CoreFramework\Stacker\Stackable;
+use Org\Mxchange\CoreFramework\Traits\Stacker\StackableTrait;
use Org\Mxchange\CoreFramework\Traits\State\StateableTrait;
/**
abstract class BaseDht extends BaseHubSystem implements Distributable {
// Load traits
use StateableTrait;
+ use StackableTrait;
/**
* Stacker name for "INSERT" node data
*/
private $publishHelperInstance = NULL;
- /**
- * Instance of the stacker
- */
- private $stackInstance = NULL;
-
/**
* Protected constructor
*
DhtStateFactory::createDhtStateInstanceByName('init', $this);
}
- /**
- * Setter for stacker instance
- *
- * @param $stackInstance An instance of an stacker
- * @return void
- */
- protected final function setStackInstance (Stackable $stackInstance) {
- $this->stackInstance = $stackInstance;
- }
-
- /**
- * Getter for stacker instance
- *
- * @return $stackInstance An instance of an stacker
- */
- public final function getStackInstance () {
- return $this->stackInstance;
- }
-
/**
* Initializes all stackers
*
*/
private function initStacks () {
// Initialize all stacker
- $this->getStackInstance()->initStacks(array(
+ $this->getStackInstance()->initStacks([
self::STACKER_NAME_INSERT_NODE,
self::STACKER_NAME_PENDING_PUBLISHING,
- ));
+ ]);
}
/**
// Init all stacker
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CHUNK-HANDLER: Initializing stackInstance=%s ...', $stackInstance->__toString()));
- $stackInstance->initStacks(array(
+ $stackInstance->initStacks([
self::STACKER_NAME_CHUNKS_WITH_FINAL_EOP,
self::STACKER_NAME_CHUNKS_WITHOUT_FINAL,
self::STACKER_NAME_ASSEMBLED_RAW_DATA
- ));
+ ]);
// Set the stacker in this handler
$handlerInstance->setStackInstance($stackInstance);
use Org\Mxchange\CoreFramework\Handler\BaseHandler;
use Org\Mxchange\CoreFramework\Handler\Handleable;
use Org\Mxchange\CoreFramework\Registry\Register;
-use Org\Mxchange\CoreFramework\Stacker\Stackable;
+use Org\Mxchange\CoreFramework\Traits\Stacker\StackableTrait;
/**
* A general hub handler
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
abstract class BaseHubHandler extends BaseHandler implements Handleable, HubInterface {
+ // Load traits
+ use StackableTrait;
+
/**
* Listener instance
*/
*/
private $registryInstance = NULL;
- /**
- * Instance of the stacker
- */
- private $stackInstance = NULL;
-
/**
* Protected constructor
*
return $this->registryInstance;
}
- /**
- * Setter for stacker instance
- *
- * @param $stackInstance An instance of an stacker
- * @return void
- */
- protected final function setStackInstance (Stackable $stackInstance) {
- $this->stackInstance = $stackInstance;
- }
-
- /**
- * Getter for stacker instance
- *
- * @return $stackInstance An instance of an stacker
- */
- public final function getStackInstance () {
- return $this->stackInstance;
- }
-
}
use Org\Mxchange\CoreFramework\Traits\Crypto\CryptoTrait;
use Org\Mxchange\CoreFramework\Traits\Visitor\VisitorTrait;
use Org\Mxchange\CoreFramework\Visitor\Visitable;
+use Org\Mxchange\CoreFramework\Visitor\Visitor;
// Import SPL stuff
use \BadMethodCallException;
*/
protected function initStacks ($forceReInit = FALSE) {
// Initialize all
- $this->getStackInstance()->initStacks(array(
+ $this->getStackInstance()->initStacks([
self::STACKER_NAME_UNDECLARED,
self::STACKER_NAME_DECLARED,
self::STACKER_NAME_OUTGOING,
self::STACKER_NAME_NEW_MESSAGE,
self::STACKER_NAME_PROCESSED_MESSAGE,
self::STACKER_NAME_OUTGOING_STREAM
- ), $forceReInit);
+ ], $forceReInit);
}
/**
$this->bufferInstance = ObjectFactory::createObjectByConfiguredName('miner_buffer_stacker_class');
// Initialize common stackers, like in/out
- $this->bufferInstance->initStacks(array(
+ $this->bufferInstance->initStacks([
self::STACKER_NAME_IN_QUEUE,
self::STACKER_NAME_OUT_QUEUE
- ));
+ ]);
// Output debug message
self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MINER: All buffers are now initialized.');
use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
use Org\Mxchange\CoreFramework\Handler\Handleable;
use Org\Mxchange\CoreFramework\Registry\Registerable;
-use Org\Mxchange\CoreFramework\Stacker\Stackable;
+use Org\Mxchange\CoreFramework\Traits\Stacker\StackableTrait;
use Org\Mxchange\CoreFramework\Traits\Stream\Input\InputStreamTrait;
use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
use Org\Mxchange\CoreFramework\Visitor\Visitable;
class PackageAssembler extends BaseHubSystem implements Assembler, Registerable, Visitable {
// Load traits
use InputStreamTrait;
+ use StackableTrait;
/**
* Name for stacker holding raw data of multiple messages
*/
private $packageHandlerInstance = NULL;
- /**
- * Instance of the stacker
- */
- private $stackInstance = NULL;
-
/**
* Handler instance
*/
return $this->packageHandlerInstance;
}
- /**
- * Setter for stacker instance
- *
- * @param $stackInstance An instance of an stacker
- * @return void
- */
- protected final function setStackInstance (Stackable $stackInstance) {
- $this->stackInstance = $stackInstance;
- }
-
- /**
- * Getter for stacker instance
- *
- * @return $stackInstance An instance of an stacker
- */
- public final function getStackInstance () {
- return $this->stackInstance;
- }
-
/**
* Setter for handler instance
*
// Import framework stuff
use Org\Mxchange\CoreFramework\Factory\Stack\FileStackFactory;
-use Org\Mxchange\CoreFramework\Stacker\Stackable;
+use Org\Mxchange\CoreFramework\Traits\Stacker\StackableTrait;
/**
* A general URL source class
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
abstract class BaseUrlSource extends BaseSource {
+ // Load traits
+ use StackableTrait;
+
// Stack name for all URLs
const STACKER_NAME_URLS = 'urls';
const CRAWL_JOB_ARRAY_DEPTH = 'start_depth';
const CRAWL_JOB_ARRAY_EXTERNAL_DEPTH = 'external_depth';
- /**
- * Instance of the stacker
- */
- private $stackInstance = NULL;
-
/**
* Protected constructor
*
parent::__construct($className);
}
- /**
- * Setter for stacker instance
- *
- * @param $stackInstance An instance of an stacker
- * @return void
- */
- protected final function setStackInstance (Stackable $stackInstance) {
- $this->stackInstance = $stackInstance;
- }
-
- /**
- * Getter for stacker instance
- *
- * @return $stackInstance An instance of an stacker
- */
- public final function getStackInstance () {
- return $this->stackInstance;
- }
-
/**
* Initalizes this source
*
+++ /dev/null
-<?php
-// Own namespace
-namespace Org\Shipsimu\Hub\Template\Engine\Xml\Announcement;
-
-// Import application-specific stuff
-use Org\Shipsimu\Hub\Template\Engine\Xml\BaseXmlTemplateEngine;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Registry\Registerable;
-use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
-
-/**
- * An Announcement 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 XmlAnnouncementTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable {
- /**
- * Some XML nodes must be available for later data extraction
- */
- const ANNOUNCEMENT_DATA_SESSION_ID = 'session-id';
- const ANNOUNCEMENT_DATA_NODE_ID = 'node-id';
- const ANNOUNCEMENT_DATA_PRIVATE_KEY_HASH = 'private-key-hash';
- const ANNOUNCEMENT_DATA_NODE_STATUS = 'node-status';
- const ANNOUNCEMENT_DATA_NODE_MODE = 'node-mode';
- const ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS = 'external-address';
- const ANNOUNCEMENT_DATA_INTERNAL_ADDRESS = 'internal-address';
-
- /**
- * Protected constructor
- *
- * @return void
- */
- protected function __construct () {
- // Call parent constructor
- parent::__construct(__CLASS__);
-
- // Init array
- $this->setSubNodes(array(
- 'announcement-data',
- 'listener',
- self::ANNOUNCEMENT_DATA_NODE_STATUS,
- self::ANNOUNCEMENT_DATA_NODE_MODE,
- self::ANNOUNCEMENT_DATA_NODE_ID,
- self::ANNOUNCEMENT_DATA_SESSION_ID,
- self::ANNOUNCEMENT_DATA_PRIVATE_KEY_HASH,
- self::ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS,
- self::ANNOUNCEMENT_DATA_INTERNAL_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 createXmlAnnouncementTemplateEngine () {
- // Get a new instance
- $templateInstance = new XmlAnnouncementTemplateEngine();
-
- // Init template instance
- $templateInstance->initXmlTemplateEngine('node', 'announcement');
-
- // 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('node_announcement'), $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 announcement
- *
- * @return void
- */
- protected function startAnnouncement () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_announcement', 'announcement');
- }
-
- /**
- * Starts the announcement data
- *
- * @return void
- */
- protected function startAnnouncementData () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_announcement', 'announcement-data');
- }
-
- /**
- * Starts the node status
- *
- * @return void
- */
- protected function startNodeStatus () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_announcement', self::ANNOUNCEMENT_DATA_NODE_STATUS);
- }
-
- /**
- * Starts the node-mode
- *
- * @return void
- */
- protected function startNodeMode () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_announcement', self::ANNOUNCEMENT_DATA_NODE_MODE);
- }
-
- /**
- * Starts the listener
- *
- * @return void
- */
- protected function startListener () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_announcement', 'listener');
- }
-
- /**
- * Starts the session id
- *
- * @return void
- */
- protected function startSessionId () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_announcement', self::ANNOUNCEMENT_DATA_SESSION_ID);
- }
-
- /**
- * Starts the node id
- *
- * @return void
- */
- protected function startNodeId () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_announcement', self::ANNOUNCEMENT_DATA_NODE_ID);
- }
-
- /**
- * Starts the private key hash
- *
- * @return void
- */
- protected function startPrivateKeyHash () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_announcement', self::ANNOUNCEMENT_DATA_PRIVATE_KEY_HASH);
- }
-
- /**
- * Starts the public ip
- *
- * @return void
- */
- protected function startExternalAddress () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_announcement', self::ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS);
- }
-
- /**
- * Starts the private ip
- *
- * @return void
- */
- protected function startInternalAddress () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_announcement', self::ANNOUNCEMENT_DATA_INTERNAL_ADDRESS);
- }
-
- /**
- * Starts the object type list
- *
- * @return void
- */
- protected function startObjectTypeList () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_announcement', 'object-type-list');
- }
-
- /**
- * Starts the object type
- *
- * @return void
- */
- protected function startObjectType () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_announcement', 'object-type');
- }
-
- /**
- * Finishes the object type
- *
- * @return void
- */
- protected function finishObjectType () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_announcement');
- }
-
- /**
- * Finishes the object type list
- *
- * @return void
- */
- protected function finishObjectTypeList () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_announcement');
- }
-
- /**
- * Finishes the private key hash
- *
- * @return void
- */
- protected function finishPrivateKeyHash () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_announcement');
- }
-
- /**
- * Finishes the node id
- *
- * @return void
- */
- protected function finishNodeId () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_announcement');
- }
-
- /**
- * Finishes the session id
- *
- * @return void
- */
- protected function finishSessionId () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_announcement');
- }
-
- /**
- * Finishes the private ip
- *
- * @return void
- */
- protected function finishInternalAddress () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_announcement');
- }
-
- /**
- * Finishes the public ip
- *
- * @return void
- */
- protected function finishExternalAddress () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_announcement');
- }
-
- /**
- * Finishes the listener
- *
- * @return void
- */
- protected function finishListener () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_announcement');
- }
-
- /**
- * Finishes the node mode
- *
- * @return void
- */
- protected function finishNodeMode () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_announcement');
- }
-
- /**
- * Finishes the node status
- *
- * @return void
- */
- protected function finishNodeStatus () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_announcement');
- }
-
- /**
- * Finishes the announcement data
- *
- * @return void
- */
- protected function finishAnnouncementData () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_announcement');
- }
-
- /**
- * Finishes the announcement
- *
- * @return void
- */
- protected function finishAnnouncement () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_announcement');
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-// Own namespace
-namespace Org\Shipsimu\Hub\Template\Engine\Xml\Answer\Announcement;
-
-// Import application-specific stuff
-use Org\Shipsimu\Hub\Template\Engine\Xml\Network\Answer\BaseXmlAnswerTemplateEngine;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Registry\Registerable;
-use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
-
-/**
- * An AnnouncementAnswer 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 XmlAnnouncementAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine implements CompileableTemplate, Registerable {
- /**
- * Some XML nodes must be available for later data extraction
- */
- const ANNOUNCEMENT_DATA_NODE_ID = 'my-node-id';
- const ANNOUNCEMENT_DATA_SESSION_ID = 'my-session-id';
- const ANNOUNCEMENT_DATA_PRIVATE_KEY_HASH = 'my-private-key-hash';
- const ANNOUNCEMENT_DATA_NODE_STATUS = 'my-status';
- const ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS = 'my-external-address';
- const ANNOUNCEMENT_DATA_INTERNAL_ADDRESS = 'my-internal-address';
-
- /**
- * Protected constructor
- *
- * @return void
- */
- protected function __construct () {
- // Call parent constructor
- parent::__construct(__CLASS__);
-
- // Init sub-nodes array
- $this->setSubNodes(array(
- // These nodes don't contain any data
- 'my-data',
- 'your-data',
- // Data from *this* node
- self::ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS,
- self::ANNOUNCEMENT_DATA_INTERNAL_ADDRESS,
- self::ANNOUNCEMENT_DATA_NODE_STATUS,
- self::ANNOUNCEMENT_DATA_NODE_ID,
- self::ANNOUNCEMENT_DATA_SESSION_ID,
- self::ANNOUNCEMENT_DATA_PRIVATE_KEY_HASH,
- // Data from other node
- 'your-external-address',
- 'your-internal-address',
- 'your-node-id',
- 'your-session-id',
- 'your-private-key-hash',
- // Answer status (generic field)
- self::ANSWER_STATUS,
- ));
- }
-
- /**
- * 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 createXmlAnnouncementAnswerTemplateEngine () {
- // Get a new instance
- $templateInstance = new XmlAnnouncementAnswerTemplateEngine();
-
- // Init instance
- $templateInstance->initXmlTemplateEngine('node', 'announcement_answer');
-
- // Return the prepared instance
- return $templateInstance;
- }
-
- /**
- * Currently not used
- *
- * @param $resource XML parser resource (currently ignored)
- * @param $characters Characters to handle
- * @return void
- * @todo Find something useful with this!
- */
- 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('node_announcement_answer'), $characters);
- }
-
- /**
- * Getter for cache file (FQFN)
- *
- * @return $fqfn Full-qualified file name of the menu cache
- */
- public function getAnnouncementAnswerCacheFqfn () {
- $this->partialStub('Please implement this method.');
- }
-
- /**
- * Starts the announcement-answer
- *
- * @return void
- */
- protected function startAnnouncementAnswer () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_announcement_answer', 'announcement-answer');
- }
-
- /**
- * Starts the my-data
- *
- * @return void
- */
- protected function startMyData () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_announcement_answer', 'my-data');
- }
-
- /**
- * Starts the my-external-address
- *
- * @return void
- */
- protected function startMyExternalAddress () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_announcement_answer', self::ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS);
- }
-
- /**
- * Starts the my-internal-address
- *
- * @return void
- */
- protected function startMyInternalAddress () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_announcement_answer', self::ANNOUNCEMENT_DATA_INTERNAL_ADDRESS);
- }
-
- /**
- * Starts the my-node-id
- *
- * @return void
- */
- protected function startMyNodeId () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_announcement_answer', self::ANNOUNCEMENT_DATA_NODE_ID);
- }
-
- /**
- * Starts the my-session-id
- *
- * @return void
- */
- protected function startMySessionId () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_announcement_answer', self::ANNOUNCEMENT_DATA_SESSION_ID);
- }
-
- /**
- * Starts the my-private-key-hash
- *
- * @return void
- */
- protected function startMyPrivateKeyHash () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_announcement_answer', self::ANNOUNCEMENT_DATA_PRIVATE_KEY_HASH);
- }
-
- /**
- * Starts the my-status
- *
- * @return void
- */
- protected function startMyStatus () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_announcement_answer', self::ANNOUNCEMENT_DATA_NODE_STATUS);
- }
-
- /**
- * Finishes the my-status
- *
- * @return void
- */
- protected function finishMyStatus () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_announcement_answer');
- }
-
- /**
- * Finishes the my-private-key-hash
- *
- * @return void
- */
- protected function finishMyPrivateKeyhash () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_announcement_answer');
- }
-
- /**
- * Finishes the my-session-id
- *
- * @return void
- */
- protected function finishMySessionId () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_announcement_answer');
- }
-
- /**
- * Finishes the my-node-id
- *
- * @return void
- */
- protected function finishMyNodeId () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_announcement_answer');
- }
-
- /**
- * Finishes the my-internal-address
- *
- * @return void
- */
- protected function finishMyInternalAddress () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_announcement_answer');
- }
-
- /**
- * Finishes the my-external-address
- *
- * @return void
- */
- protected function finishMyExternalAddress () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_announcement_answer');
- }
-
- /**
- * Finishes the my-data
- *
- * @return void
- */
- protected function finishMyData () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_announcement_answer');
- }
-
- /**
- * Starts the your-data
- *
- * @return void
- */
- protected function startYourData () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_announcement_answer', 'your-data');
- }
-
- /**
- * Starts the your-external-address
- *
- * @return void
- */
- protected function startYourExternalAddress () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_announcement_answer', 'your-external-address');
- }
-
- /**
- * Starts the your-internal-address
- *
- * @return void
- */
- protected function startYourInternalAddress () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_announcement_answer', 'your-internal-address');
- }
-
- /**
- * Starts the your-session-id
- *
- * @return void
- */
- protected function startYourSessionId () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_announcement_answer', 'your-session-id');
- }
-
- /**
- * Starts the your-node-id
- *
- * @return void
- */
- protected function startYourNodeId () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_announcement_answer', 'your-node-id');
- }
-
- /**
- * Starts the your-private-key-hash
- *
- * @return void
- */
- protected function startYourPrivateKeyHash () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_announcement_answer', 'your-private-key-hash');
- }
-
- /**
- * Finishes the your-private-key-hash
- *
- * @return void
- */
- protected function finishYourPrivateKeyHash () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_announcement_answer');
- }
-
- /**
- * Finishes the your-node-id
- *
- * @return void
- */
- protected function finishYourNodeId () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_announcement_answer');
- }
-
- /**
- * Finishes the your-session-id
- *
- * @return void
- */
- protected function finishYourSessionId () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_announcement_answer');
- }
-
- /**
- * Finishes the your-internal-address
- *
- * @return void
- */
- protected function finishYourInternalAddress () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_announcement_answer');
- }
-
- /**
- * Finishes the your-external-address
- *
- * @return void
- */
- protected function finishYourExternalAddress () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_announcement_answer');
- }
-
- /**
- * Finishes the your-data
- *
- * @return void
- */
- protected function finishYourData () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_announcement_answer');
- }
-
- /**
- * Finishes the announcement-answer
- *
- * @return void
- */
- protected function finishAnnouncementAnswer () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_announcement_answer');
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-// Own namespace
-namespace Org\Mxchange\Hub\Template\Engine\Xml\Network\Answer\;
-
-// Import application-specific stuff
-use Org\Mxchange\Hub\Template\Engine\Xml\Network\Answer\BaseXmlAnswerTemplateEngine;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Registry\Registerable;
-use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
-
-/**
- * An ??? answer template engine class for XML templates
- *
- * @author Roland Haeder <webmaster@ship-simu.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.ship-simu.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 Xml???AnswerTemplateEngine extends BaseXmlAnswerTemplateEngine implements CompileableTemplate, Registerable {
- /**
- * Protected constructor
- *
- * @return void
- */
- protected function __construct () {
- // Call parent constructor
- parent::__construct(__CLASS__);
- }
-
- /**
- * 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 createXml???TemplateEngine () {
- // Get a new instance
- $templateInstance = new Xml???TemplateEngine();
-
- // Init template instannce
- $templateInstance->initXmlTemplateEngine('PREFIX', '!!!');
-
- // 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 false;
- } // END - if
-
- // Assign data with matching variable here
- parent::assignVariable($this->getStackInstance()->getNamed('!!!'), $characters);
- }
-
- /**
- * Getter for cache file (FQFN)
- *
- * @return $fqfn Full-qualified file name of the menu cache
- */
- public function get???CacheFqfn () {
- $this->partialStub('Please implement this method.');
- }
-
- /**
- * Starts the |||
- *
- * @return void
- */
- protected function start??? () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('!!!', '|||');
- }
-
- /**
- * Finishes the |||
- *
- * @return void
- */
- protected function finish??? () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('!!!');
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-// Own namespace
-namespace Org\Shipsimu\Hub\Template\Engine\Xml\Network\Answer;
-
-// Import application-specific stuff
-use Org\Shipsimu\Hub\Template\Engine\Xml\BaseXmlTemplateEngine;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Registry\Registerable;
-use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
-
-/**
- * An generic answer 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/>.
- */
-abstract class BaseXmlAnswerTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable {
- /**
- * Generic 'answer-status' field
- */
- const ANSWER_STATUS = 'answer-status';
-
- /**
- * Protected constructor
- *
- * @param $className Name of the class
- * @return void
- */
- protected function __construct (string $className) {
- // Call parent constructor
- parent::__construct($className);
- }
-
- /**
- * Starts the answer-status
- *
- * @return void
- */
- protected function startAnswerStatus () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed($this->getStackerName(), self::ANSWER_STATUS);
- }
-
- /**
- * Finishes the answer-status
- *
- * @return void
- */
- protected function finishAnswerStatus () {
- // Pop the last entry
- $this->getStackInstance()->popNamed($this->getStackerName());
- }
-
-}
+++ /dev/null
-<?php
-// Own namespace
-namespace Org\Shipsimu\Hub\Template\Engine\Xml\Answer\Dht\Bootstrap;
-
-// Import application-specific stuff
-use Org\Shipsimu\Hub\Template\Engine\Xml\Answer\Dht\Bootstrap\XmlDhtBootstrapAnswerTemplateEngine;
-use Org\Shipsimu\Hub\Template\Engine\Xml\Network\Answer\BaseXmlAnswerTemplateEngine;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Registry\Registerable;
-use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
-
-/**
- * An DhtBootstrapAnswer 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 XmlDhtBootstrapAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine implements CompileableTemplate, Registerable {
- /**
- * Some XML nodes must be available for later data extraction
- */
- const DHT_BOOTSTRAP_DATA_SESSION_ID = 'my-session-id';
- const DHT_BOOTSTRAP_DATA_PRIVATE_KEY_HASH = 'my-private-key-hash';
- const DHT_BOOTSTRAP_DATA_NODE_STATUS = 'my-status';
- const DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS = 'my-external-address';
- const DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS = 'my-internal-address';
- const DHT_BOOTSTRAP_DATA_NODE_LIST = 'dht-nodes-list';
-
- /**
- * Protected constructor
- *
- * @return void
- */
- protected function __construct () {
- // Call parent constructor
- parent::__construct(__CLASS__);
-
- // Init sub-nodes array
- $this->setSubNodes(array(
- // These nodes don't contain any data
- 'my-data',
- 'your-data',
- // Data from *this* node
- self::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS,
- self::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS,
- self::DHT_BOOTSTRAP_DATA_NODE_STATUS,
- self::DHT_BOOTSTRAP_DATA_SESSION_ID,
- // Data from other node
- 'your-external-address',
- 'your-internal-address',
- 'your-session-id',
- // Answer status (generic field)
- self::ANSWER_STATUS,
- // DHT node list
- self::DHT_BOOTSTRAP_DATA_NODE_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 createXmlDhtBootstrapAnswerTemplateEngine () {
- // Get a new instance
- $templateInstance = new XmlDhtBootstrapAnswerTemplateEngine();
-
- // Init instance
- $templateInstance->initXmlTemplateEngine('node', 'dht_bootstrap_answer');
-
- // Return the prepared instance
- return $templateInstance;
- }
-
- /**
- * Currently not used
- *
- * @param $resource XML parser resource (currently ignored)
- * @param $characters Characters to handle
- * @return void
- * @todo Find something useful with this!
- */
- 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('node_dht_bootstrap_answer'), $characters);
- }
-
- /**
- * Getter for cache file (FQFN)
- *
- * @return $fqfn Full-qualified file name of the menu cache
- */
- public function getDhtBootstrapAnswerCacheFqfn () {
- $this->partialStub('Please implement this method.');
- }
-
- /**
- * Starts the dht_bootstrap-answer
- *
- * @return void
- */
- protected function startDhtBootstrapAnswer () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_dht_bootstrap_answer', 'dht_bootstrap-answer');
- }
-
- /**
- * Starts the my-data
- *
- * @return void
- */
- protected function startMyData () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_dht_bootstrap_answer', 'my-data');
- }
-
- /**
- * Starts the my-external-address
- *
- * @return void
- */
- protected function startMyExternalAddress () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_dht_bootstrap_answer', self::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS);
- }
-
- /**
- * Starts the my-internal-address
- *
- * @return void
- */
- protected function startMyInternalAddress () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_dht_bootstrap_answer', self::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS);
- }
-
- /**
- * Starts the my-session-id
- *
- * @return void
- */
- protected function startMySessionId () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_dht_bootstrap_answer', self::DHT_BOOTSTRAP_DATA_SESSION_ID);
- }
-
- /**
- * Starts the my-private-key-hash
- *
- * @return void
- */
- protected function startMyPrivateKeyHash () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_dht_bootstrap_answer', self::DHT_BOOTSTRAP_DATA_PRIVATE_KEY_HASH);
- }
-
- /**
- * Starts the my-status
- *
- * @return void
- */
- protected function startMyStatus () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_dht_bootstrap_answer', self::DHT_BOOTSTRAP_DATA_NODE_STATUS);
- }
-
- /**
- * Starts the dht-nodes-list
- *
- * @return void
- */
- protected function startDhtNodesList () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_dht_bootstrap_answer', self::DHT_BOOTSTRAP_DATA_NODE_LIST);
- }
-
- /**
- * Finishes the dht-nodes-list
- *
- * @return void
- */
- protected function finishDhtNodesList () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_dht_bootstrap_answer');
- }
-
- /**
- * Finishes the my-status
- *
- * @return void
- */
- protected function finishMyStatus () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_dht_bootstrap_answer');
- }
-
- /**
- * Finishes the my-private-key-hash
- *
- * @return void
- */
- protected function finishMyPrivateKeyHash () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_dht_bootstrap_answer');
- }
-
- /**
- * Finishes the my-session-id
- *
- * @return void
- */
- protected function finishMySessionId () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_dht_bootstrap_answer');
- }
-
- /**
- * Finishes the my-internal-address
- *
- * @return void
- */
- protected function finishMyInternalAddress () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_dht_bootstrap_answer');
- }
-
- /**
- * Finishes the my-external-address
- *
- * @return void
- */
- protected function finishMyExternalAddress () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_dht_bootstrap_answer');
- }
-
- /**
- * Finishes the my-data
- *
- * @return void
- */
- protected function finishMyData () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_dht_bootstrap_answer');
- }
-
- /**
- * Starts the your-data
- *
- * @return void
- */
- protected function startYourData () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_dht_bootstrap_answer', 'your-data');
- }
-
- /**
- * Starts the your-external-address
- *
- * @return void
- */
- protected function startYourExternalAddress () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_dht_bootstrap_answer', 'your-external-address');
- }
-
- /**
- * Starts the your-internal-address
- *
- * @return void
- */
- protected function startYourInternalAddress () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_dht_bootstrap_answer', 'your-internal-address');
- }
-
- /**
- * Starts the your-session-id
- *
- * @return void
- */
- protected function startYourSessionId () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_dht_bootstrap_answer', 'your-session-id');
- }
-
- /**
- * Starts the your-private-key-hash
- *
- * @return void
- */
- protected function startYourPrivateKeyHash () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_dht_bootstrap_answer', 'your-private-key-hash');
- }
-
- /**
- * Finishes the your-private-key-hash
- *
- * @return void
- */
- protected function finishYourPrivateKeyHash () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_dht_bootstrap_answer');
- }
-
- /**
- * Finishes the your-session-id
- *
- * @return void
- */
- protected function finishYourSessionId () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_dht_bootstrap_answer');
- }
-
- /**
- * Finishes the your-internal-address
- *
- * @return void
- */
- protected function finishYourInternalAddress () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_dht_bootstrap_answer');
- }
-
- /**
- * Finishes the your-external-address
- *
- * @return void
- */
- protected function finishYourExternalAddress () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_dht_bootstrap_answer');
- }
-
- /**
- * Finishes the your-data
- *
- * @return void
- */
- protected function finishYourData () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_dht_bootstrap_answer');
- }
-
- /**
- * Finishes the dht_bootstrap-answer
- *
- * @return void
- */
- protected function finishDhtBootstrapAnswer () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_dht_bootstrap_answer');
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-// Own namespace
-namespace Org\Shipsimu\Hub\Template\Engine\Xml\Answer\Request\NodeList;
-
-// Import application-specific stuff
-use Org\Shipsimu\Hub\Template\Engine\Xml\Network\Answer\BaseXmlAnswerTemplateEngine;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Factory\Template\XmlTemplateEngineFactory;
-use Org\Mxchange\CoreFramework\Registry\Registerable;
-use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
-
-/**
- * A RequestNodeListAnswer 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 XmlRequestNodeListAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine implements CompileableTemplate, Registerable {
- // Constants for array elements
- const REQUEST_DATA_SESSION_ID = 'session-id';
- const REQUEST_DATA_NODE_LIST = 'node-list';
-
- /**
- * Protected constructor
- *
- * @return void
- */
- protected function __construct () {
- // Call parent constructor
- parent::__construct(__CLASS__);
-
- // Init sub-nodes array
- $this->setSubNodes(array(
- self::REQUEST_DATA_SESSION_ID,
- self::REQUEST_DATA_NODE_LIST,
- // Answer status (generic field)
- self::ANSWER_STATUS,
- ));
- }
-
- /**
- * 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 createXmlRequestNodeListAnswerTemplateEngine () {
- // Get a new instance
- $templateInstance = new XmlRequestNodeListAnswerTemplateEngine();
-
- // Init instance
- $templateInstance->initXmlTemplateEngine('node', 'request_node_list_answer');
-
- // Get a template instance for list entries (as they are dynamic)
- $entriesInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance('node_request_node_list_entries_template_class');
-
- // Set it here
- $templateInstance->setTemplateInstance($entriesInstance);
-
- // Return the prepared instance
- return $templateInstance;
- }
-
- /**
- * Currently not used
- *
- * @param $resource XML parser resource (currently ignored)
- * @param $characters Characters to handle
- * @return void
- * @todo Find something useful with this!
- */
- 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('node_request_node_list_answer'), $characters);
- }
-
- /**
- * Getter for cache file (FQFN)
- *
- * @return $fqfn Full-qualified file name of the menu cache
- */
- public function getRequestNodeListAnswerCacheFqfn () {
- $this->partialStub('Please implement this method.');
- }
-
- /**
- * Starts the 'request-node-list-answer'
- *
- * @return void
- */
- protected function startRequestNodeListAnswer () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_request_node_list_answer', 'request-node-list-answer');
- }
-
- /**
- * Starts the session-id
- *
- * @return void
- */
- protected function startSessionId () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_request_node_list_answer', self::REQUEST_DATA_SESSION_ID);
- }
-
- /**
- * Starts the node-list
- *
- * @return void
- */
- protected function startNodeList () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_request_node_list_answer', self::REQUEST_DATA_NODE_LIST);
- }
-
- /**
- * Finishes the node-list
- *
- * @return void
- */
- protected function finishNodeList () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_request_node_list_answer');
- }
-
- /**
- * Finishes the session-id
- *
- * @return void
- */
- protected function finishSessionId () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_request_node_list_answer');
- }
-
- /**
- * Finishes the 'request-node-list-answer'
- *
- * @return void
- */
- protected function finishRequestNodeListAnswer () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_request_node_list_answer');
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-// Own namespace
-namespace Org\Mxchange\Hub\Template\Engine\Xml\;
-
-// Import application-specific stuff
-use Org\Mxchange\Hub\Template\Engine\Xml\BaseXmlTemplateEngine;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Registry\Registerable;
-use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
-
-/**
- * An ??? template engine class for XML templates
- *
- * @author Roland Haeder <webmaster@ship-simu.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.ship-simu.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 Xml???TemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable {
- /**
- * Protected constructor
- *
- * @return void
- */
- protected function __construct () {
- // Call parent constructor
- parent::__construct(__CLASS__);
- }
-
- /**
- * 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 createXml???TemplateEngine () {
- // Get a new instance
- $templateInstance = new Xml???TemplateEngine();
-
- // Init template instannce
- $templateInstance->initXmlTemplateEngine('PREFIX', '!!!');
-
- // 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 false;
- } // END - if
-
- // Assign data with matching variable here
- parent::assignVariable($this->getStackInstance()->getNamed('!!!'), $characters);
- }
-
- /**
- * Getter for cache file (FQFN)
- *
- * @return $fqfn Full-qualified file name of the menu cache
- */
- public function get???CacheFqfn () {
- $this->partialStub('Please implement this method.');
- }
-
- /**
- * Starts the |||
- *
- * @return void
- */
- protected function start??? () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('!!!', '|||');
- }
-
- /**
- * Finishes the |||
- *
- * @return void
- */
- protected function finish??? () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('!!!');
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-// Own namespace
-namespace Org\Shipsimu\Hub\Template\Engine\Xml;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
-use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
-use Org\Mxchange\CoreFramework\Factory\Template\XmlTemplateEngineFactory;
-use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
-use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
-use Org\Mxchange\CoreFramework\Template\Engine\BaseTemplateEngine;
-use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
-
-// Import SPL stuff
-use \InvalidArgumentException;
-
-/**
- * A generic XML template engine class
- *
- * @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/>.
- */
-abstract class BaseXmlTemplateEngine extends BaseTemplateEngine {
- /**
- * Main nodes in the XML tree
- */
- private $mainNodes = [];
-
- /**
- * Sub nodes in the XML tree
- */
- private $subNodes = [];
-
- /**
- * Current main node
- */
- private $curr = [];
-
- /**
- * XML template type
- */
- private $xmlTemplateType = 'xml';
-
- /**
- * Type prefix
- */
- private $typePrefix = 'xml';
-
- /**
- * Name of stacker
- */
- private $stackerName = '';
-
- /**
- * Content from dependency
- */
- protected $dependencyContent = [];
-
- /**
- * Template engine instance
- */
- private $templateInstance = NULL;
-
- /**
- * Protected constructor
- *
- * @param $className Name of the class
- * @return void
- */
- protected function __construct (string $className) {
- // Call parent constructor
- parent::__construct($className);
- }
-
- /**
- * Does a generic initialization of the template engine
- *
- * @param $typePrefix Type prefix
- * @param $xmlTemplateType Type of XML template
- * @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
- */
- protected function initXmlTemplateEngine ($typePrefix, $xmlTemplateType) {
- // Set XML template type and prefix
- $this->xmlTemplateType = $xmlTemplateType;
- $this->typePrefix = $typePrefix;
-
- // Get template instance
- $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
-
- // Determine base path
- $templateBasePath = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('application_base_path') . FrameworkBootstrap::getRequestInstance()->getRequestElement('app') . '/';
-
- // Is the base path valid?
- if (empty($templateBasePath)) {
- // Base path is empty
- throw new BasePathIsEmptyException($this, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
- } elseif (!is_string($templateBasePath)) {
- // Is not a string
- throw new InvalidBasePathStringException(array($this, $templateBasePath), self::EXCEPTION_INVALID_STRING);
- } elseif (!is_dir($templateBasePath)) {
- // Is not a path
- throw new BasePathIsNoDirectoryException(array($this, $templateBasePath), self::EXCEPTION_INVALID_PATH_NAME);
- } elseif (!is_readable($templateBasePath)) {
- // Is not readable
- throw new BasePathReadProtectedException(array($this, $templateBasePath), self::EXCEPTION_READ_PROTECED_PATH);
- }
-
- // Set the base path
- $this->setTemplateBasePath($templateBasePath);
-
- // Set template extensions
- $this->setRawTemplateExtension(FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('raw_template_extension'));
- $this->setCodeTemplateExtension(FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($typePrefix . '_message_template_extension'));
-
- // Absolute output path for compiled templates
- $this->setCompileOutputPath(sprintf('%s%s',
- $templateBasePath,
- FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('compile_output_path')
- ));
-
- // Init a variable stacker
- $stackInstance = ObjectFactory::createObjectByConfiguredName($typePrefix . '_' . $xmlTemplateType . '_stacker_class');
-
- // Set name
- $this->stackerName = $typePrefix . '_' . $xmlTemplateType;
-
- // Init stacker
- $stackInstance->initStack($this->stackerName);
-
- // Set it
- $this->setStackInstance($stackInstance);
-
- // Set it in main nodes
- array_push($this->mainNodes, str_replace('_', '-', $xmlTemplateType));
- }
-
- /**
- * Load a specified XML template into the engine
- *
- * @param $templateName Optional name of template
- * @return void
- */
- public function loadXmlTemplate ($templateName = '') {
- // Is the template name empty?
- if (empty($templateName)) {
- // Set generic template name
- $templateName = $this->typePrefix . '_' . $this->xmlTemplateType . '_template_type';
- } // END - if
-
- // Set template type
- $this->setTemplateType(FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($templateName));
-
- // Load the special template
- $this->loadTemplate($this->xmlTemplateType);
- }
-
- /**
- * Getter for current main node
- *
- * @return $currMainNode Current main node
- */
- public final function getCurrMainNode () {
- return $this->curr['main_node'];
- }
-
- /**
- * Setter for current main node
- *
- * @param $element Element name to set as current main node
- * @return $currMainNode Current main node
- */
- private final function setCurrMainNode ($element) {
- $this->curr['main_node'] = (string) $element;
- }
-
- /**
- * Getter for main node array
- *
- * @return $mainNodes Array with valid main node names
- */
- public final function getMainNodes () {
- return $this->mainNodes;
- }
-
- /**
- * Getter for stacker name
- *
- * @return $stackerName Name of stacker of this class
- */
- protected final function getStackerName () {
- return $this->stackerName;
- }
-
- /**
- * Setter for sub node array
- *
- * @param $subNodes Array with valid sub node names
- * @return void
- */
- public final function setSubNodes (array $subNodes) {
- $this->subNodes = $subNodes;
- }
-
- /**
- * Getter for sub node array
- *
- * @return $subNodes Array with valid sub node names
- */
- public final function getSubNodes () {
- return $this->subNodes;
- }
-
- /**
- * Setter for template engine instances
- *
- * @param $templateInstance An instance of a template engine class
- * @return void
- */
- protected final function setTemplateInstance (CompileableTemplate $templateInstance) {
- $this->templateInstance = $templateInstance;
- }
-
- /**
- * Getter for template engine instances
- *
- * @return $templateInstance An instance of a template engine class
- */
- protected final function getTemplateInstance () {
- return $this->templateInstance;
- }
-
- /**
- * Read XML variables by calling readVariable() with 'general' as
- * variable stack.
- *
- * @param $key Key to read from
- * @return $value Value from variable
- */
- public function readXmlData (string $key) {
- // Is key parameter valid?
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-XML-TEMPLATE-ENGINE: key=%s - CALLED!', $key));
- if (empty($key)) {
- // Throw exception
- throw new InvalidArgumentException('Parameter key is empty');
- }
-
- // Read the variable
- $value = parent::readVariable($key, 'general');
-
- // Is this null?
- if (is_null($value)) {
- // Bah, needs fixing.
- $this->debugInstance(sprintf('[%s:%d]: key=%s returns NULL', __METHOD__, __LINE__, $key));
- } // END - if
-
- // Return value
- return $value;
- }
-
- /**
- * Handles the template dependency for given XML node
- *
- * @param $node The XML node we should load a dependency template
- * @param $templateDependency A template to load to satisfy dependencies
- * @return void
- */
- protected function handleTemplateDependency ($node, $templateDependency) {
- // Check that the XML node is not empty
- assert(!empty($node));
-
- // Is the template dependency set?
- if ((!empty($templateDependency)) && (!isset($this->dependencyContent[$node]))) {
- // Get a temporay template instance
- $templateInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance($this->typePrefix . '_' . self::convertDashesToUnderscores($node) . '_' . $this->xmlTemplateType . '_template_class');
-
- // Then load it
- $templateInstance->loadXmlTemplate($templateDependency);
-
- // Parse the XML content
- $templateInstance->renderXmlContent();
-
- // Save the parsed raw content in our dependency array
- $this->dependencyContent[$node] = $templateInstance->getRawTemplateData();
- } // END - if
- }
-
- /**
- * Handles the start element of an XML resource
- *
- * @param $resource XML parser resource (currently ignored)
- * @param $element The element we shall handle
- * @param $attributes All attributes
- * @return void
- * @throws InvalidXmlNodeException If an unknown/invalid XML node name was found
- */
- public final function startElement ($resource, $element, array $attributes) {
- // Initial method name which will never be called...
- $methodName = 'init' . StringUtils::convertToClassName($this->xmlTemplateType);
-
- // Make the element name lower-case
- $element = strtolower($element);
-
- // Is the element a main node?
- //* DEBUG: */ echo "START: >".$element."<<br />\n";
- if (in_array($element, $this->getMainNodes())) {
- // Okay, main node found!
- $methodName = 'start' . StringUtils::convertToClassName($element);
-
- // Set it
- $this->setCurrMainNode($element);
- } elseif (in_array($element, $this->getSubNodes())) {
- // Sub node found
- $methodName = 'start' . StringUtils::convertToClassName($element);
- } else {
- // Invalid node name found
- throw new InvalidXmlNodeException(array($this, $element, $attributes), XmlParser::EXCEPTION_XML_NODE_UNKNOWN);
- }
-
- // Call method
- call_user_func_array(array($this, $methodName), $attributes);
- }
-
- /**
- * Ends the main or sub node by sending out the gathered data
- *
- * @param $resource An XML resource pointer (currently ignored)
- * @param $nodeName Name of the node we want to finish
- * @return void
- * @throws XmlNodeMismatchException If current main node mismatches the closing one
- */
- public final function finishElement ($resource, $nodeName) {
- // Make all lower-case
- $nodeName = strtolower($nodeName);
-
- // Does this match with current main node?
- //* DEBUG: */ echo "END: >".$nodeName."<<br />\n";
- if (($nodeName != $this->getCurrMainNode()) && (in_array($nodeName, $this->getMainNodes()))) {
- // Did not match!
- throw new XmlNodeMismatchException (array($this, $nodeName, $this->getCurrMainNode()), XmlParser::EXCEPTION_XML_NODE_MISMATCH);
- } // END - if
-
- // Construct method name
- $methodName = 'finish' . StringUtils::convertToClassName($nodeName);
-
- // Call the corresponding method
- //* DEBUG: */ echo "call: ".$methodName."<br />\n";
- call_user_func_array(array($this, $methodName), array());
- }
-
-}
+++ /dev/null
-<?php
-// Own namespace
-namespace Org\Shipsimu\Hub\Template\Engine\Xml\SelfConnect;
-
-// Import application-specific stuff
-use Org\Shipsimu\Hub\Tag\Tagable;
-use Org\Shipsimu\Hub\Template\Engine\Xml\BaseXmlTemplateEngine;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Registry\Registerable;
-use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
-
-/**
- * An SelfConnect 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 XmlSelfConnectTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable {
- /**
- * Data nodes
- */
- const SELF_CONNECT_DATA_NODE_ID = 'node-id';
- const SELF_CONNECT_DATA_SESSION_ID = 'session-id';
-
- /**
- * Protected constructor
- *
- * @return void
- */
- protected function __construct () {
- // Call parent constructor
- parent::__construct(__CLASS__);
-
- // Init array
- $this->setSubNodes(array(
- 'self-connect-data',
- self::SELF_CONNECT_DATA_NODE_ID,
- self::SELF_CONNECT_DATA_SESSION_ID
- ));
- }
-
- /**
- * 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 createXmlSelfConnectTemplateEngine () {
- // Get a new instance
- $templateInstance = new XmlSelfConnectTemplateEngine();
-
- // Init template instance
- $templateInstance->initXmlTemplateEngine('node', Tagable::TAG_SELF_CONNECT);
-
- // Return the prepared instance
- return $templateInstance;
- }
-
- /**
- * Currently not used
- *
- * @param $resource XML parser resource (currently ignored)
- * @param $characters Characters to handle
- * @return void
- * @todo Find something useful with this!
- */
- 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('node_self_connect'), $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 self_connect
- *
- * @return void
- */
- protected function startSelfConnect () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_self_connect', 'self-connect');
- }
-
- /**
- * Starts the self_connect data
- *
- * @return void
- */
- protected function startSelfConnectData () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_self_connect', 'self-connect-data');
- }
-
- /**
- * Starts the node id
- *
- * @return void
- */
- protected function startNodeId () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_self_connect', self::SELF_CONNECT_DATA_NODE_ID);
- }
-
- /**
- * Starts the session id
- *
- * @return void
- */
- protected function startSessionId () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_self_connect', self::SELF_CONNECT_DATA_SESSION_ID);
- }
-
- /**
- * Finishes the session id
- *
- * @return void
- */
- protected function finishSessionId () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_self_connect');
- }
-
- /**
- * Finishes the node id
- *
- * @return void
- */
- protected function finishNodeId () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_self_connect');
- }
-
- /**
- * Finishes the self_connect data
- *
- * @return void
- */
- protected function finishSelfConnectData () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_self_connect');
- }
-
- /**
- * Finishes the self_connect
- *
- * @return void
- */
- protected function finishSelfConnect () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_self_connect');
- }
-
-}
+++ /dev/null
-<?php
-// Own namespace
-namespace Org\Shipsimu\Hub\Template\Engine\Xml\Dht\Bootstrap;
-
-// Import application-specific stuff
-use Org\Shipsimu\Hub\Template\Engine\Xml\BaseXmlTemplateEngine;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Registry\Registerable;
-use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
-
-/**
- * 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\Request\NodeList;
-
-// Import application-specific stuff
-use Org\Shipsimu\Hub\Template\Engine\Xml\BaseXmlTemplateEngine;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Registry\Registerable;
-use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
-
-/**
- * An RequestNodeListEntry 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 XmlRequestNodeListEntryTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable {
- /**
- * Protected constructor
- *
- * @return void
- */
- protected function __construct () {
- // Call parent constructor
- parent::__construct(__CLASS__);
- }
-
- /**
- * 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 createXmlRequestNodeListEntryTemplateEngine () {
- // Get a new instance
- $templateInstance = new XmlRequestNodeListEntryTemplateEngine();
-
- // Init template instannce
- $templateInstance->initXmlTemplateEngine('node', 'request_node_list_entry');
-
- // Return the prepared instance
- return $templateInstance;
- }
-
- /**
- * Currently not used
- *
- * @param $resource XML parser resource (currently ignored)
- * @param $characters Characters to handle
- * @return void
- * @todo Find something useful with this!
- */
- 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 data with matching variable here
- parent::assignVariable($this->getStackInstance()->getNamed('node_request_node_list_entry'), $characters);
- }
-
- /**
- * Getter for cache file (FQFN)
- *
- * @return $fqfn Full-qualified file name of the menu cache
- */
- public function getRequestNodeListEntryCacheFqfn () {
- $this->partialStub('Please implement this method.');
- }
-
- /**
- * Starts the request-node-list-entry
- *
- * @return void
- */
- protected function startRequestNodeListEntry () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_request_node_list_entry', 'request-node-list-entry');
- }
-
- /**
- * Finishes the request-node-list-entry
- *
- * @return void
- */
- protected function finishRequestNodeListEntry () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_request_node_list_entry');
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-// Own namespace
-namespace Org\Shipsimu\Hub\Template\Engine\Xml\ObjectRegistry;
-
-// Import application-specific stuff
-use Org\Shipsimu\Hub\Factory\Registry\Object\ObjectTypeRegistryFactory;
-use Org\Shipsimu\Hub\Template\Engine\Xml\BaseXmlTemplateEngine;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
-use Org\Mxchange\CoreFramework\Registry\Registerable;
-use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
-
-/**
- * An ObjectRegistry 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 XmlObjectRegistryTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable {
- // Constants
- const OBJECT_TYPE_DATA_NAME = 'object-name';
- const OBJECT_TYPE_DATA_RECIPIENT_LIMITATION = 'object-recipient-limitation';
- const OBJECT_TYPE_DATA_MAX_SPREAD = 'object-max-spread';
- const OBJECT_TYPE_DATA_PROTOCOL = 'object-protocol';
- const OBJECT_TYPE_DATA_RECIPIENT_TYPE = 'object-recipient-type';
-
- /**
- * Instance for the object registry
- */
- private $objectRegistryInstance = NULL;
-
- /**
- * Protected constructor
- *
- * @return void
- */
- protected function __construct () {
- // Call parent constructor
- parent::__construct(__CLASS__);
-
- // Init object type registry instance
- $this->objectRegistryInstance = ObjectTypeRegistryFactory::createObjectTypeRegistryInstance();
-
- // Init sub nodes
- $this->setSubNodes(array(
- 'object-list',
- 'object-list-entry',
- self::OBJECT_TYPE_DATA_NAME,
- self::OBJECT_TYPE_DATA_RECIPIENT_LIMITATION,
- self::OBJECT_TYPE_DATA_MAX_SPREAD,
- self::OBJECT_TYPE_DATA_PROTOCOL,
- self::OBJECT_TYPE_DATA_RECIPIENT_TYPE
- ));
- }
-
- /**
- * 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 createXmlObjectRegistryTemplateEngine () {
- // Get a new instance
- $templateInstance = new XmlObjectRegistryTemplateEngine();
-
- // Init template instance
- $templateInstance->initXmlTemplateEngine('node', 'object_registry');
-
- // 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
- //* 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);
-
- // Is this string empty?
- if (empty($characters)) {
- // Then skip it silently
- return;
- } // END - if
-
- // Get current XML node name as an array index
- $nodeName = $this->getStackInstance()->getNamed('node_object_registry');
-
- // Is the node name self::OBJECT_TYPE_DATA_NAME?
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('XML-OBJECT-REGISTRY-TEMPLATE-ENGINE: Checking nodeName=%s ...', $nodeName));
- if ($nodeName == self::OBJECT_TYPE_DATA_NAME) {
- // Output debug message
- /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('XML-OBJECT-REGISTRY-TEMPLATE-ENGINE: Adding object type ' . $characters . ' to registry.');
- } // END - if
-
- // Add it to the registry
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('XML-OBJECT-REGISTRY-TEMPLATE-ENGINE: EXIT!');
- $this->objectRegistryInstance->addEntry($nodeName, $characters);
- }
-
- /**
- * Getter for cache file (FQFN)
- *
- * @return $fqfn Full-qualified file name of the menu cache
- */
- public function getObjectRegistryCacheFqfn () {
- $this->partialStub('Please implement this method.');
- }
-
- /**
- * Starts the object-registry
- *
- * @return void
- */
- protected function startObjectRegistry () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_object_registry', 'object-registry');
- }
-
- /**
- * Starts the object-list
- *
- * @param $objectCount Count of all objects
- * @return void
- * @todo Handle $objectCount
- */
- protected function startObjectList ($objectCount) {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_object_registry', 'object-list');
- }
-
- /**
- * Starts the object-list-entry
- *
- * @return void
- */
- protected function startObjectListEntry () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_object_registry', 'object-list-entry');
- }
-
- /**
- * Starts the object-name
- *
- * @return void
- */
- protected function startObjectName () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_object_registry', self::OBJECT_TYPE_DATA_NAME);
- }
-
- /**
- * Starts the object-recipient-limitation
- *
- * @return void
- */
- protected function startObjectRecipientLimitation () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_object_registry', self::OBJECT_TYPE_DATA_RECIPIENT_LIMITATION);
- }
-
- /**
- * Starts the object-max-spread
- *
- * @return void
- */
- protected function startObjectMaxSpread () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_object_registry', self::OBJECT_TYPE_DATA_MAX_SPREAD);
- }
-
- /**
- * Starts the object-protocol
- *
- * @return void
- */
- protected function startObjectProtocol () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_object_registry', self::OBJECT_TYPE_DATA_PROTOCOL);
- }
-
- /**
- * Starts the object-recipient-type
- *
- * @return void
- */
- protected function startObjectRecipientType () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_object_registry', self::OBJECT_TYPE_DATA_RECIPIENT_TYPE);
- }
-
- /**
- * Finishes the object-recipient-type
- *
- * @return void
- */
- protected function finishObjectRecipientType () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_object_registry');
- }
-
- /**
- * Finishes the object-protocol
- *
- * @return void
- */
- protected function finishObjectProtocol () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_object_registry');
- }
-
- /**
- * Finishes the object-max-spread
- *
- * @return void
- */
- protected function finishObjectMaxSpread () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_object_registry');
- }
-
- /**
- * Finishes the object-recipient-limitation
- *
- * @return void
- */
- protected function finishObjectRecipientLimitation () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_object_registry');
- }
-
- /**
- * Finishes the object-name
- *
- * @return void
- */
- protected function finishObjectName () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_object_registry');
- }
-
- /**
- * Finishes the object-list-entry
- *
- * @return void
- */
- protected function finishObjectListEntry () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_object_registry');
- }
-
- /**
- * Finishes the object-list
- *
- * @return void
- */
- protected function finishObjectList () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_object_registry');
- }
-
- /**
- * Finishes the object-registry
- *
- * @return void
- */
- protected function finishObjectRegistry () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_object_registry');
- }
-
-}
+++ /dev/null
-<?php
-// Own namespace
-namespace Org\Shipsimu\Hub\Cruncher\Template\Engine\Xml\TestUnit;
-
-// Import application-specific stuff
-use Org\Shipsimu\Hub\Template\Engine\Xml\BaseXmlTemplateEngine;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Registry\Registerable;
-use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
-
-/**
- * An TestUnit template engine class for XML templates
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2011 - 2014 - 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 XmlCruncherTestUnitTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable {
- /**
- * Protected constructor
- *
- * @return void
- */
- protected function __construct () {
- // Call parent constructor
- parent::__construct(__CLASS__);
-
- // Init sub nodes
- $this->setSubNodes(array(
- 'meta-data',
- 'global-project-identifier',
- 'test-unit-created',
- 'cipher',
- 'cipher-function',
- 'cipher-name',
- 'unprocessed-data',
- 'encrypted-message',
- 'cruncher-key-list',
- 'cruncher-key',
- 'key-id',
- 'key-value'
- ));
- }
-
- /**
- * 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 createXmlCruncherTestUnitTemplateEngine () {
- // Get a new instance
- $templateInstance = new XmlCruncherTestUnitTemplateEngine();
-
- // Init template instance
- $templateInstance->initXmlTemplateEngine('cruncher', 'test_unit');
-
- // 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('cruncher_test_unit'), $characters);
- }
-
- /**
- * Getter for cache file (FQFN)
- *
- * @return $fqfn Full-qualified file name of the menu cache
- */
- public function getCruncherTestUnitCacheFqfn () {
- $this->partialStub('Please implement this method.');
- }
-
- /**
- * Starts the test-unit
- *
- * @return void
- */
- protected function startTestUnit () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('cruncher_test_unit', 'cruncher-test-unit');
- }
-
- /**
- * Starts the meta-data
- *
- * @return void
- */
- protected function startMetaData () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('cruncher_test_unit', 'meta-data');
- }
-
- /**
- * Starts the global-project-identifier
- *
- * @return void
- */
- protected function startGlobalProjectIdentifier () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('cruncher_test_unit', 'global-project-identifier');
- }
-
- /**
- * Finishes the global-project-identifier
- *
- * @return void
- */
- protected function finishGlobalProjectIdentifier () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('cruncher_test_unit');
- }
-
- /**
- * Starts the test-unit-created
- *
- * @return void
- */
- protected function startTestUnitCreated () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('cruncher_test_unit', 'test-unit-created');
- }
-
- /**
- * Finishes the test-unit-created
- *
- * @return void
- */
- protected function finishTestUnitCreated () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('cruncher_test_unit');
- }
-
- /**
- * Starts the cipher
- *
- * @return void
- */
- protected function startCipher () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('cruncher_test_unit', 'cipher');
- }
-
- /**
- * Starts the cipher-function
- *
- * @return void
- */
- protected function startCipherFunction () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('cruncher_test_unit', 'cipher-function');
- }
-
- /**
- * Finishes the cipher-function
- *
- * @return void
- */
- protected function finishCipherFunction () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('cruncher_test_unit');
- }
-
- /**
- * Starts the cipher-name
- *
- * @return void
- */
- protected function startCipherName () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('cruncher_test_unit', 'cipher-name');
- }
-
- /**
- * Finishes the cipher-name
- *
- * @return void
- */
- protected function finishCipherName () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('cruncher_test_unit');
- }
-
- /**
- * Finishes the cipher
- *
- * @return void
- */
- protected function finishCipher () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('cruncher_test_unit');
- }
-
- /**
- * Finishes the meta-data
- *
- * @return void
- */
- protected function finishMetaData () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('cruncher_test_unit');
- }
-
- /**
- * Starts the unprocessed-data
- *
- * @return void
- */
- protected function startUnprocessedData () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('cruncher_test_unit', 'unprocessed-data');
- }
-
- /**
- * Starts the encrypted-message
- *
- * @return void
- */
- protected function startEncryptedMessage () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('cruncher_test_unit', 'encrypted-message');
- }
-
- /**
- * Finishes the encrypted-message
- *
- * @return void
- */
- protected function finishEncryptedMessage () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('cruncher_test_unit');
- }
-
- /**
- * Starts the cruncher-key-list
- *
- * @param $keyCount Count of keys in this test unit
- * @return void
- * @todo Handle $keyCount
- */
- protected function startCruncherKeyList ($keyCount) {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('cruncher_test_unit', 'cruncher-key-list');
- }
-
- /**
- * Starts the cruncher-key
- *
- * @return void
- */
- protected function startCruncherKey () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('cruncher_test_unit', 'cruncher-key');
- }
-
- /**
- * Starts the key-id
- *
- * @return void
- */
- protected function startKeyId () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('cruncher_test_unit', 'key-id');
- }
-
- /**
- * Finishes the key-id
- *
- * @return void
- */
- protected function finishKeyId () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('cruncher_test_unit');
- }
-
- /**
- * Starts the key-value
- *
- * @return void
- */
- protected function startKeyValue () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('cruncher_test_unit', 'key-value');
- }
-
- /**
- * Finishes the key-value
- *
- * @return void
- */
- protected function finishKeyValue () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('cruncher_test_unit');
- }
-
- /**
- * Finishes the cruncher-key
- *
- * @return void
- */
- protected function finishCruncherKey () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('cruncher_test_unit');
- }
-
- /**
- * Finishes the cruncher-key-list
- *
- * @return void
- */
- protected function finishCruncherKeyList () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('cruncher_test_unit');
- }
-
- /**
- * Finishes the unprocessed-data
- *
- * @return void
- */
- protected function finishUnprocessedData () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('cruncher_test_unit');
- }
-
- /**
- * Finishes the test-unit
- *
- * @return void
- */
- protected function finishTestUnit () {
- // 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
-use Org\Shipsimu\Hub\Template\Engine\Xml\BaseXmlTemplateEngine;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Registry\Registerable;
-use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
-
-/**
- * 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]
-?>
+++ /dev/null
-<?php
-// Own namespace
-namespace Org\Shipsimu\Hub\Template\Engine\Xml\Request\NodeList;
-
-// Import application-specific stuff
-use Org\Shipsimu\Hub\Template\Engine\Xml\BaseXmlTemplateEngine;
-use Org\Shipsimu\Hub\Template\Engine\Xml\Request\NodeList\XmlRequestNodeListTemplateEngine;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Registry\Registerable;
-use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
-
-/**
- * An RequestNodeList 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 XmlRequestNodeListTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable {
- // Constants for array elements
- const REQUEST_DATA_ACCEPTED_OBJECT_TYPES = 'accepted-object-types';
- const REQUEST_DATA_SESSION_ID = 'session-id';
-
- /**
- * Protected constructor
- *
- * @return void
- */
- protected function __construct () {
- // Call parent constructor
- parent::__construct(__CLASS__);
-
- // Init sub nodes
- $this->setSubNodes(array(
- self::REQUEST_DATA_ACCEPTED_OBJECT_TYPES,
- self::REQUEST_DATA_SESSION_ID,
- ));
- }
-
- /**
- * 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 createXmlRequestNodeListTemplateEngine () {
- // Get a new instance
- $templateInstance = new XmlRequestNodeListTemplateEngine();
-
- // Init template instance
- $templateInstance->initXmlTemplateEngine('node', 'request_node_list');
-
- // Return the prepared instance
- return $templateInstance;
- }
-
- /**
- * Currently not used
- *
- * @param $resource XML parser resource (currently ignored)
- * @param $characters Characters to handle
- * @return void
- * @todo Find something useful with this!
- */
- 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 data with matching variable here
- parent::assignVariable($this->getStackInstance()->getNamed('node_request_node_list'), $characters);
- }
-
- /**
- * Getter for cache file (FQFN)
- *
- * @return $fqfn Full-qualified file name of the menu cache
- */
- public function getRequestNodeListCacheFqfn () {
- $this->partialStub('Please implement this method.');
- }
-
- /**
- * Starts the node-request-node-list
- *
- * @return void
- */
- protected function startRequestNodeList () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_request_node_list', 'node-request-node-list');
- }
-
- /**
- * Starts the accepted-object-types
- *
- * @return void
- */
- protected function startAcceptedObjectTypes () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_request_node_list', self::REQUEST_DATA_ACCEPTED_OBJECT_TYPES);
- }
-
- /**
- * Starts the session-id
- *
- * @return void
- */
- protected function startSessionId () {
- // Push the node name on the stacker
- $this->getStackInstance()->pushNamed('node_request_node_list', self::REQUEST_DATA_SESSION_ID);
- }
-
- /**
- * Finishes the session-id
- *
- * @return void
- */
- protected function finishSessionId () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_request_node_list');
- }
-
- /**
- * Finishes the accepted-object-types
- *
- * @return void
- */
- protected function finishAcceptedObjectTypes () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_request_node_list');
- }
-
- /**
- * Finishes the node-request-node-list
- *
- * @return void
- */
- protected function finishRequestNodeList () {
- // Pop the last entry
- $this->getStackInstance()->popNamed('node_request_node_list');
- }
-}
-
-// [EOF]
-?>
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Shipsimu\Hub\Template\Engine\Xml\Announcement;
+
+// 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 Announcement 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 XmlAnnouncementTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable {
+ /**
+ * Some XML nodes must be available for later data extraction
+ */
+ const ANNOUNCEMENT_DATA_SESSION_ID = 'session-id';
+ const ANNOUNCEMENT_DATA_NODE_ID = 'node-id';
+ const ANNOUNCEMENT_DATA_PRIVATE_KEY_HASH = 'private-key-hash';
+ const ANNOUNCEMENT_DATA_NODE_STATUS = 'node-status';
+ const ANNOUNCEMENT_DATA_NODE_MODE = 'node-mode';
+ const ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS = 'external-address';
+ const ANNOUNCEMENT_DATA_INTERNAL_ADDRESS = 'internal-address';
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Init array
+ $this->setSubNodes(array(
+ 'announcement-data',
+ 'listener',
+ self::ANNOUNCEMENT_DATA_NODE_STATUS,
+ self::ANNOUNCEMENT_DATA_NODE_MODE,
+ self::ANNOUNCEMENT_DATA_NODE_ID,
+ self::ANNOUNCEMENT_DATA_SESSION_ID,
+ self::ANNOUNCEMENT_DATA_PRIVATE_KEY_HASH,
+ self::ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS,
+ self::ANNOUNCEMENT_DATA_INTERNAL_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 createXmlAnnouncementTemplateEngine () {
+ // Get a new instance
+ $templateInstance = new XmlAnnouncementTemplateEngine();
+
+ // Init template instance
+ $templateInstance->initXmlTemplateEngine('node', 'announcement');
+
+ // 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('node_announcement'), $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 announcement
+ *
+ * @return void
+ */
+ protected function startAnnouncement () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_announcement', 'announcement');
+ }
+
+ /**
+ * Starts the announcement data
+ *
+ * @return void
+ */
+ protected function startAnnouncementData () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_announcement', 'announcement-data');
+ }
+
+ /**
+ * Starts the node status
+ *
+ * @return void
+ */
+ protected function startNodeStatus () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_announcement', self::ANNOUNCEMENT_DATA_NODE_STATUS);
+ }
+
+ /**
+ * Starts the node-mode
+ *
+ * @return void
+ */
+ protected function startNodeMode () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_announcement', self::ANNOUNCEMENT_DATA_NODE_MODE);
+ }
+
+ /**
+ * Starts the listener
+ *
+ * @return void
+ */
+ protected function startListener () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_announcement', 'listener');
+ }
+
+ /**
+ * Starts the session id
+ *
+ * @return void
+ */
+ protected function startSessionId () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_announcement', self::ANNOUNCEMENT_DATA_SESSION_ID);
+ }
+
+ /**
+ * Starts the node id
+ *
+ * @return void
+ */
+ protected function startNodeId () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_announcement', self::ANNOUNCEMENT_DATA_NODE_ID);
+ }
+
+ /**
+ * Starts the private key hash
+ *
+ * @return void
+ */
+ protected function startPrivateKeyHash () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_announcement', self::ANNOUNCEMENT_DATA_PRIVATE_KEY_HASH);
+ }
+
+ /**
+ * Starts the public ip
+ *
+ * @return void
+ */
+ protected function startExternalAddress () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_announcement', self::ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS);
+ }
+
+ /**
+ * Starts the private ip
+ *
+ * @return void
+ */
+ protected function startInternalAddress () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_announcement', self::ANNOUNCEMENT_DATA_INTERNAL_ADDRESS);
+ }
+
+ /**
+ * Starts the object type list
+ *
+ * @return void
+ */
+ protected function startObjectTypeList () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_announcement', 'object-type-list');
+ }
+
+ /**
+ * Starts the object type
+ *
+ * @return void
+ */
+ protected function startObjectType () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_announcement', 'object-type');
+ }
+
+ /**
+ * Finishes the object type
+ *
+ * @return void
+ */
+ protected function finishObjectType () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_announcement');
+ }
+
+ /**
+ * Finishes the object type list
+ *
+ * @return void
+ */
+ protected function finishObjectTypeList () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_announcement');
+ }
+
+ /**
+ * Finishes the private key hash
+ *
+ * @return void
+ */
+ protected function finishPrivateKeyHash () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_announcement');
+ }
+
+ /**
+ * Finishes the node id
+ *
+ * @return void
+ */
+ protected function finishNodeId () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_announcement');
+ }
+
+ /**
+ * Finishes the session id
+ *
+ * @return void
+ */
+ protected function finishSessionId () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_announcement');
+ }
+
+ /**
+ * Finishes the private ip
+ *
+ * @return void
+ */
+ protected function finishInternalAddress () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_announcement');
+ }
+
+ /**
+ * Finishes the public ip
+ *
+ * @return void
+ */
+ protected function finishExternalAddress () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_announcement');
+ }
+
+ /**
+ * Finishes the listener
+ *
+ * @return void
+ */
+ protected function finishListener () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_announcement');
+ }
+
+ /**
+ * Finishes the node mode
+ *
+ * @return void
+ */
+ protected function finishNodeMode () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_announcement');
+ }
+
+ /**
+ * Finishes the node status
+ *
+ * @return void
+ */
+ protected function finishNodeStatus () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_announcement');
+ }
+
+ /**
+ * Finishes the announcement data
+ *
+ * @return void
+ */
+ protected function finishAnnouncementData () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_announcement');
+ }
+
+ /**
+ * Finishes the announcement
+ *
+ * @return void
+ */
+ protected function finishAnnouncement () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_announcement');
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Shipsimu\Hub\Template\Engine\Xml\Answer\Announcement;
+
+// Import application-specific stuff
+use Org\Shipsimu\Hub\Template\Engine\Xml\Network\Answer\BaseXmlAnswerTemplateEngine;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Registry\Registerable;
+use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
+
+/**
+ * An AnnouncementAnswer 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 XmlAnnouncementAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine implements CompileableTemplate, Registerable {
+ /**
+ * Some XML nodes must be available for later data extraction
+ */
+ const ANNOUNCEMENT_DATA_NODE_ID = 'my-node-id';
+ const ANNOUNCEMENT_DATA_SESSION_ID = 'my-session-id';
+ const ANNOUNCEMENT_DATA_PRIVATE_KEY_HASH = 'my-private-key-hash';
+ const ANNOUNCEMENT_DATA_NODE_STATUS = 'my-status';
+ const ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS = 'my-external-address';
+ const ANNOUNCEMENT_DATA_INTERNAL_ADDRESS = 'my-internal-address';
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Init sub-nodes array
+ $this->setSubNodes(array(
+ // These nodes don't contain any data
+ 'my-data',
+ 'your-data',
+ // Data from *this* node
+ self::ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS,
+ self::ANNOUNCEMENT_DATA_INTERNAL_ADDRESS,
+ self::ANNOUNCEMENT_DATA_NODE_STATUS,
+ self::ANNOUNCEMENT_DATA_NODE_ID,
+ self::ANNOUNCEMENT_DATA_SESSION_ID,
+ self::ANNOUNCEMENT_DATA_PRIVATE_KEY_HASH,
+ // Data from other node
+ 'your-external-address',
+ 'your-internal-address',
+ 'your-node-id',
+ 'your-session-id',
+ 'your-private-key-hash',
+ // Answer status (generic field)
+ self::ANSWER_STATUS,
+ ));
+ }
+
+ /**
+ * 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 createXmlAnnouncementAnswerTemplateEngine () {
+ // Get a new instance
+ $templateInstance = new XmlAnnouncementAnswerTemplateEngine();
+
+ // Init instance
+ $templateInstance->initXmlTemplateEngine('node', 'announcement_answer');
+
+ // Return the prepared instance
+ return $templateInstance;
+ }
+
+ /**
+ * Currently not used
+ *
+ * @param $resource XML parser resource (currently ignored)
+ * @param $characters Characters to handle
+ * @return void
+ * @todo Find something useful with this!
+ */
+ 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('node_announcement_answer'), $characters);
+ }
+
+ /**
+ * Getter for cache file (FQFN)
+ *
+ * @return $fqfn Full-qualified file name of the menu cache
+ */
+ public function getAnnouncementAnswerCacheFqfn () {
+ $this->partialStub('Please implement this method.');
+ }
+
+ /**
+ * Starts the announcement-answer
+ *
+ * @return void
+ */
+ protected function startAnnouncementAnswer () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_announcement_answer', 'announcement-answer');
+ }
+
+ /**
+ * Starts the my-data
+ *
+ * @return void
+ */
+ protected function startMyData () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_announcement_answer', 'my-data');
+ }
+
+ /**
+ * Starts the my-external-address
+ *
+ * @return void
+ */
+ protected function startMyExternalAddress () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_announcement_answer', self::ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS);
+ }
+
+ /**
+ * Starts the my-internal-address
+ *
+ * @return void
+ */
+ protected function startMyInternalAddress () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_announcement_answer', self::ANNOUNCEMENT_DATA_INTERNAL_ADDRESS);
+ }
+
+ /**
+ * Starts the my-node-id
+ *
+ * @return void
+ */
+ protected function startMyNodeId () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_announcement_answer', self::ANNOUNCEMENT_DATA_NODE_ID);
+ }
+
+ /**
+ * Starts the my-session-id
+ *
+ * @return void
+ */
+ protected function startMySessionId () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_announcement_answer', self::ANNOUNCEMENT_DATA_SESSION_ID);
+ }
+
+ /**
+ * Starts the my-private-key-hash
+ *
+ * @return void
+ */
+ protected function startMyPrivateKeyHash () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_announcement_answer', self::ANNOUNCEMENT_DATA_PRIVATE_KEY_HASH);
+ }
+
+ /**
+ * Starts the my-status
+ *
+ * @return void
+ */
+ protected function startMyStatus () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_announcement_answer', self::ANNOUNCEMENT_DATA_NODE_STATUS);
+ }
+
+ /**
+ * Finishes the my-status
+ *
+ * @return void
+ */
+ protected function finishMyStatus () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_announcement_answer');
+ }
+
+ /**
+ * Finishes the my-private-key-hash
+ *
+ * @return void
+ */
+ protected function finishMyPrivateKeyhash () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_announcement_answer');
+ }
+
+ /**
+ * Finishes the my-session-id
+ *
+ * @return void
+ */
+ protected function finishMySessionId () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_announcement_answer');
+ }
+
+ /**
+ * Finishes the my-node-id
+ *
+ * @return void
+ */
+ protected function finishMyNodeId () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_announcement_answer');
+ }
+
+ /**
+ * Finishes the my-internal-address
+ *
+ * @return void
+ */
+ protected function finishMyInternalAddress () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_announcement_answer');
+ }
+
+ /**
+ * Finishes the my-external-address
+ *
+ * @return void
+ */
+ protected function finishMyExternalAddress () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_announcement_answer');
+ }
+
+ /**
+ * Finishes the my-data
+ *
+ * @return void
+ */
+ protected function finishMyData () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_announcement_answer');
+ }
+
+ /**
+ * Starts the your-data
+ *
+ * @return void
+ */
+ protected function startYourData () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_announcement_answer', 'your-data');
+ }
+
+ /**
+ * Starts the your-external-address
+ *
+ * @return void
+ */
+ protected function startYourExternalAddress () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_announcement_answer', 'your-external-address');
+ }
+
+ /**
+ * Starts the your-internal-address
+ *
+ * @return void
+ */
+ protected function startYourInternalAddress () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_announcement_answer', 'your-internal-address');
+ }
+
+ /**
+ * Starts the your-session-id
+ *
+ * @return void
+ */
+ protected function startYourSessionId () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_announcement_answer', 'your-session-id');
+ }
+
+ /**
+ * Starts the your-node-id
+ *
+ * @return void
+ */
+ protected function startYourNodeId () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_announcement_answer', 'your-node-id');
+ }
+
+ /**
+ * Starts the your-private-key-hash
+ *
+ * @return void
+ */
+ protected function startYourPrivateKeyHash () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_announcement_answer', 'your-private-key-hash');
+ }
+
+ /**
+ * Finishes the your-private-key-hash
+ *
+ * @return void
+ */
+ protected function finishYourPrivateKeyHash () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_announcement_answer');
+ }
+
+ /**
+ * Finishes the your-node-id
+ *
+ * @return void
+ */
+ protected function finishYourNodeId () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_announcement_answer');
+ }
+
+ /**
+ * Finishes the your-session-id
+ *
+ * @return void
+ */
+ protected function finishYourSessionId () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_announcement_answer');
+ }
+
+ /**
+ * Finishes the your-internal-address
+ *
+ * @return void
+ */
+ protected function finishYourInternalAddress () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_announcement_answer');
+ }
+
+ /**
+ * Finishes the your-external-address
+ *
+ * @return void
+ */
+ protected function finishYourExternalAddress () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_announcement_answer');
+ }
+
+ /**
+ * Finishes the your-data
+ *
+ * @return void
+ */
+ protected function finishYourData () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_announcement_answer');
+ }
+
+ /**
+ * Finishes the announcement-answer
+ *
+ * @return void
+ */
+ protected function finishAnnouncementAnswer () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_announcement_answer');
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Mxchange\Hub\Template\Engine\Xml\Network\Answer\;
+
+// Import application-specific stuff
+use Org\Mxchange\Hub\Template\Engine\Xml\Network\Answer\BaseXmlAnswerTemplateEngine;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Registry\Registerable;
+use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
+
+/**
+ * An ??? answer template engine class for XML templates
+ *
+ * @author Roland Haeder <webmaster@ship-simu.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.ship-simu.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 Xml???AnswerTemplateEngine extends BaseXmlAnswerTemplateEngine implements CompileableTemplate, Registerable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * 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 createXml???TemplateEngine () {
+ // Get a new instance
+ $templateInstance = new Xml???TemplateEngine();
+
+ // Init template instannce
+ $templateInstance->initXmlTemplateEngine('PREFIX', '!!!');
+
+ // 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 false;
+ } // END - if
+
+ // Assign data with matching variable here
+ parent::assignVariable($this->getStackInstance()->getNamed('!!!'), $characters);
+ }
+
+ /**
+ * Getter for cache file (FQFN)
+ *
+ * @return $fqfn Full-qualified file name of the menu cache
+ */
+ public function get???CacheFqfn () {
+ $this->partialStub('Please implement this method.');
+ }
+
+ /**
+ * Starts the |||
+ *
+ * @return void
+ */
+ protected function start??? () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('!!!', '|||');
+ }
+
+ /**
+ * Finishes the |||
+ *
+ * @return void
+ */
+ protected function finish??? () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('!!!');
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Shipsimu\Hub\Template\Engine\Xml\Network\Answer;
+
+// 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 generic answer 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/>.
+ */
+abstract class BaseXmlAnswerTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable {
+ /**
+ * Generic 'answer-status' field
+ */
+ const ANSWER_STATUS = 'answer-status';
+
+ /**
+ * Protected constructor
+ *
+ * @param $className Name of the class
+ * @return void
+ */
+ protected function __construct (string $className) {
+ // Call parent constructor
+ parent::__construct($className);
+ }
+
+ /**
+ * Starts the answer-status
+ *
+ * @return void
+ */
+ protected function startAnswerStatus () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed($this->getStackerName(), self::ANSWER_STATUS);
+ }
+
+ /**
+ * Finishes the answer-status
+ *
+ * @return void
+ */
+ protected function finishAnswerStatus () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed($this->getStackerName());
+ }
+
+}
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Shipsimu\Hub\Template\Engine\Xml\Answer\Dht\Bootstrap;
+
+// Import application-specific stuff
+use Org\Shipsimu\Hub\Template\Engine\Xml\Answer\Dht\Bootstrap\XmlDhtBootstrapAnswerTemplateEngine;
+use Org\Shipsimu\Hub\Template\Engine\Xml\Network\Answer\BaseXmlAnswerTemplateEngine;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Registry\Registerable;
+use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
+
+/**
+ * An DhtBootstrapAnswer 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 XmlDhtBootstrapAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine implements CompileableTemplate, Registerable {
+ /**
+ * Some XML nodes must be available for later data extraction
+ */
+ const DHT_BOOTSTRAP_DATA_SESSION_ID = 'my-session-id';
+ const DHT_BOOTSTRAP_DATA_PRIVATE_KEY_HASH = 'my-private-key-hash';
+ const DHT_BOOTSTRAP_DATA_NODE_STATUS = 'my-status';
+ const DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS = 'my-external-address';
+ const DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS = 'my-internal-address';
+ const DHT_BOOTSTRAP_DATA_NODE_LIST = 'dht-nodes-list';
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Init sub-nodes array
+ $this->setSubNodes(array(
+ // These nodes don't contain any data
+ 'my-data',
+ 'your-data',
+ // Data from *this* node
+ self::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS,
+ self::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS,
+ self::DHT_BOOTSTRAP_DATA_NODE_STATUS,
+ self::DHT_BOOTSTRAP_DATA_SESSION_ID,
+ // Data from other node
+ 'your-external-address',
+ 'your-internal-address',
+ 'your-session-id',
+ // Answer status (generic field)
+ self::ANSWER_STATUS,
+ // DHT node list
+ self::DHT_BOOTSTRAP_DATA_NODE_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 createXmlDhtBootstrapAnswerTemplateEngine () {
+ // Get a new instance
+ $templateInstance = new XmlDhtBootstrapAnswerTemplateEngine();
+
+ // Init instance
+ $templateInstance->initXmlTemplateEngine('node', 'dht_bootstrap_answer');
+
+ // Return the prepared instance
+ return $templateInstance;
+ }
+
+ /**
+ * Currently not used
+ *
+ * @param $resource XML parser resource (currently ignored)
+ * @param $characters Characters to handle
+ * @return void
+ * @todo Find something useful with this!
+ */
+ 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('node_dht_bootstrap_answer'), $characters);
+ }
+
+ /**
+ * Getter for cache file (FQFN)
+ *
+ * @return $fqfn Full-qualified file name of the menu cache
+ */
+ public function getDhtBootstrapAnswerCacheFqfn () {
+ $this->partialStub('Please implement this method.');
+ }
+
+ /**
+ * Starts the dht_bootstrap-answer
+ *
+ * @return void
+ */
+ protected function startDhtBootstrapAnswer () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_dht_bootstrap_answer', 'dht_bootstrap-answer');
+ }
+
+ /**
+ * Starts the my-data
+ *
+ * @return void
+ */
+ protected function startMyData () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_dht_bootstrap_answer', 'my-data');
+ }
+
+ /**
+ * Starts the my-external-address
+ *
+ * @return void
+ */
+ protected function startMyExternalAddress () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_dht_bootstrap_answer', self::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS);
+ }
+
+ /**
+ * Starts the my-internal-address
+ *
+ * @return void
+ */
+ protected function startMyInternalAddress () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_dht_bootstrap_answer', self::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS);
+ }
+
+ /**
+ * Starts the my-session-id
+ *
+ * @return void
+ */
+ protected function startMySessionId () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_dht_bootstrap_answer', self::DHT_BOOTSTRAP_DATA_SESSION_ID);
+ }
+
+ /**
+ * Starts the my-private-key-hash
+ *
+ * @return void
+ */
+ protected function startMyPrivateKeyHash () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_dht_bootstrap_answer', self::DHT_BOOTSTRAP_DATA_PRIVATE_KEY_HASH);
+ }
+
+ /**
+ * Starts the my-status
+ *
+ * @return void
+ */
+ protected function startMyStatus () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_dht_bootstrap_answer', self::DHT_BOOTSTRAP_DATA_NODE_STATUS);
+ }
+
+ /**
+ * Starts the dht-nodes-list
+ *
+ * @return void
+ */
+ protected function startDhtNodesList () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_dht_bootstrap_answer', self::DHT_BOOTSTRAP_DATA_NODE_LIST);
+ }
+
+ /**
+ * Finishes the dht-nodes-list
+ *
+ * @return void
+ */
+ protected function finishDhtNodesList () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_dht_bootstrap_answer');
+ }
+
+ /**
+ * Finishes the my-status
+ *
+ * @return void
+ */
+ protected function finishMyStatus () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_dht_bootstrap_answer');
+ }
+
+ /**
+ * Finishes the my-private-key-hash
+ *
+ * @return void
+ */
+ protected function finishMyPrivateKeyHash () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_dht_bootstrap_answer');
+ }
+
+ /**
+ * Finishes the my-session-id
+ *
+ * @return void
+ */
+ protected function finishMySessionId () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_dht_bootstrap_answer');
+ }
+
+ /**
+ * Finishes the my-internal-address
+ *
+ * @return void
+ */
+ protected function finishMyInternalAddress () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_dht_bootstrap_answer');
+ }
+
+ /**
+ * Finishes the my-external-address
+ *
+ * @return void
+ */
+ protected function finishMyExternalAddress () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_dht_bootstrap_answer');
+ }
+
+ /**
+ * Finishes the my-data
+ *
+ * @return void
+ */
+ protected function finishMyData () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_dht_bootstrap_answer');
+ }
+
+ /**
+ * Starts the your-data
+ *
+ * @return void
+ */
+ protected function startYourData () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_dht_bootstrap_answer', 'your-data');
+ }
+
+ /**
+ * Starts the your-external-address
+ *
+ * @return void
+ */
+ protected function startYourExternalAddress () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_dht_bootstrap_answer', 'your-external-address');
+ }
+
+ /**
+ * Starts the your-internal-address
+ *
+ * @return void
+ */
+ protected function startYourInternalAddress () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_dht_bootstrap_answer', 'your-internal-address');
+ }
+
+ /**
+ * Starts the your-session-id
+ *
+ * @return void
+ */
+ protected function startYourSessionId () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_dht_bootstrap_answer', 'your-session-id');
+ }
+
+ /**
+ * Starts the your-private-key-hash
+ *
+ * @return void
+ */
+ protected function startYourPrivateKeyHash () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_dht_bootstrap_answer', 'your-private-key-hash');
+ }
+
+ /**
+ * Finishes the your-private-key-hash
+ *
+ * @return void
+ */
+ protected function finishYourPrivateKeyHash () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_dht_bootstrap_answer');
+ }
+
+ /**
+ * Finishes the your-session-id
+ *
+ * @return void
+ */
+ protected function finishYourSessionId () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_dht_bootstrap_answer');
+ }
+
+ /**
+ * Finishes the your-internal-address
+ *
+ * @return void
+ */
+ protected function finishYourInternalAddress () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_dht_bootstrap_answer');
+ }
+
+ /**
+ * Finishes the your-external-address
+ *
+ * @return void
+ */
+ protected function finishYourExternalAddress () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_dht_bootstrap_answer');
+ }
+
+ /**
+ * Finishes the your-data
+ *
+ * @return void
+ */
+ protected function finishYourData () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_dht_bootstrap_answer');
+ }
+
+ /**
+ * Finishes the dht_bootstrap-answer
+ *
+ * @return void
+ */
+ protected function finishDhtBootstrapAnswer () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_dht_bootstrap_answer');
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Shipsimu\Hub\Template\Engine\Xml\Answer\Request\NodeList;
+
+// Import application-specific stuff
+use Org\Shipsimu\Hub\Template\Engine\Xml\Network\Answer\BaseXmlAnswerTemplateEngine;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Factory\Template\XmlTemplateEngineFactory;
+use Org\Mxchange\CoreFramework\Registry\Registerable;
+use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
+
+/**
+ * A RequestNodeListAnswer 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 XmlRequestNodeListAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine implements CompileableTemplate, Registerable {
+ // Constants for array elements
+ const REQUEST_DATA_SESSION_ID = 'session-id';
+ const REQUEST_DATA_NODE_LIST = 'node-list';
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Init sub-nodes array
+ $this->setSubNodes(array(
+ self::REQUEST_DATA_SESSION_ID,
+ self::REQUEST_DATA_NODE_LIST,
+ // Answer status (generic field)
+ self::ANSWER_STATUS,
+ ));
+ }
+
+ /**
+ * 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 createXmlRequestNodeListAnswerTemplateEngine () {
+ // Get a new instance
+ $templateInstance = new XmlRequestNodeListAnswerTemplateEngine();
+
+ // Init instance
+ $templateInstance->initXmlTemplateEngine('node', 'request_node_list_answer');
+
+ // Get a template instance for list entries (as they are dynamic)
+ $entriesInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance('node_request_node_list_entries_template_class');
+
+ // Set it here
+ $templateInstance->setTemplateInstance($entriesInstance);
+
+ // Return the prepared instance
+ return $templateInstance;
+ }
+
+ /**
+ * Currently not used
+ *
+ * @param $resource XML parser resource (currently ignored)
+ * @param $characters Characters to handle
+ * @return void
+ * @todo Find something useful with this!
+ */
+ 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('node_request_node_list_answer'), $characters);
+ }
+
+ /**
+ * Getter for cache file (FQFN)
+ *
+ * @return $fqfn Full-qualified file name of the menu cache
+ */
+ public function getRequestNodeListAnswerCacheFqfn () {
+ $this->partialStub('Please implement this method.');
+ }
+
+ /**
+ * Starts the 'request-node-list-answer'
+ *
+ * @return void
+ */
+ protected function startRequestNodeListAnswer () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_request_node_list_answer', 'request-node-list-answer');
+ }
+
+ /**
+ * Starts the session-id
+ *
+ * @return void
+ */
+ protected function startSessionId () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_request_node_list_answer', self::REQUEST_DATA_SESSION_ID);
+ }
+
+ /**
+ * Starts the node-list
+ *
+ * @return void
+ */
+ protected function startNodeList () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_request_node_list_answer', self::REQUEST_DATA_NODE_LIST);
+ }
+
+ /**
+ * Finishes the node-list
+ *
+ * @return void
+ */
+ protected function finishNodeList () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_request_node_list_answer');
+ }
+
+ /**
+ * Finishes the session-id
+ *
+ * @return void
+ */
+ protected function finishSessionId () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_request_node_list_answer');
+ }
+
+ /**
+ * Finishes the 'request-node-list-answer'
+ *
+ * @return void
+ */
+ protected function finishRequestNodeListAnswer () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_request_node_list_answer');
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Mxchange\Hub\Template\Engine\Xml\;
+
+// Import application-specific stuff
+use Org\Mxchange\Hub\Template\Engine\Xml\BaseXmlTemplateEngine;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Registry\Registerable;
+use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
+
+/**
+ * An ??? template engine class for XML templates
+ *
+ * @author Roland Haeder <webmaster@ship-simu.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.ship-simu.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 Xml???TemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * 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 createXml???TemplateEngine () {
+ // Get a new instance
+ $templateInstance = new Xml???TemplateEngine();
+
+ // Init template instannce
+ $templateInstance->initXmlTemplateEngine('PREFIX', '!!!');
+
+ // 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 false;
+ } // END - if
+
+ // Assign data with matching variable here
+ parent::assignVariable($this->getStackInstance()->getNamed('!!!'), $characters);
+ }
+
+ /**
+ * Getter for cache file (FQFN)
+ *
+ * @return $fqfn Full-qualified file name of the menu cache
+ */
+ public function get???CacheFqfn () {
+ $this->partialStub('Please implement this method.');
+ }
+
+ /**
+ * Starts the |||
+ *
+ * @return void
+ */
+ protected function start??? () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('!!!', '|||');
+ }
+
+ /**
+ * Finishes the |||
+ *
+ * @return void
+ */
+ protected function finish??? () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('!!!');
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Shipsimu\Hub\Template\Engine\Xml\SelfConnect;
+
+// Import application-specific stuff
+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\Engine\Xml\BaseXmlTemplateEngine;
+
+/**
+ * An SelfConnect 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 XmlSelfConnectTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable {
+ /**
+ * Data nodes
+ */
+ const SELF_CONNECT_DATA_NODE_ID = 'node-id';
+ const SELF_CONNECT_DATA_SESSION_ID = 'session-id';
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Init array
+ $this->setSubNodes(array(
+ 'self-connect-data',
+ self::SELF_CONNECT_DATA_NODE_ID,
+ self::SELF_CONNECT_DATA_SESSION_ID
+ ));
+ }
+
+ /**
+ * 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 createXmlSelfConnectTemplateEngine () {
+ // Get a new instance
+ $templateInstance = new XmlSelfConnectTemplateEngine();
+
+ // Init template instance
+ $templateInstance->initXmlTemplateEngine('node', Tagable::TAG_SELF_CONNECT);
+
+ // Return the prepared instance
+ return $templateInstance;
+ }
+
+ /**
+ * Currently not used
+ *
+ * @param $resource XML parser resource (currently ignored)
+ * @param $characters Characters to handle
+ * @return void
+ * @todo Find something useful with this!
+ */
+ 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('node_self_connect'), $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 self_connect
+ *
+ * @return void
+ */
+ protected function startSelfConnect () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_self_connect', 'self-connect');
+ }
+
+ /**
+ * Starts the self_connect data
+ *
+ * @return void
+ */
+ protected function startSelfConnectData () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_self_connect', 'self-connect-data');
+ }
+
+ /**
+ * Starts the node id
+ *
+ * @return void
+ */
+ protected function startNodeId () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_self_connect', self::SELF_CONNECT_DATA_NODE_ID);
+ }
+
+ /**
+ * Starts the session id
+ *
+ * @return void
+ */
+ protected function startSessionId () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_self_connect', self::SELF_CONNECT_DATA_SESSION_ID);
+ }
+
+ /**
+ * Finishes the session id
+ *
+ * @return void
+ */
+ protected function finishSessionId () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_self_connect');
+ }
+
+ /**
+ * Finishes the node id
+ *
+ * @return void
+ */
+ protected function finishNodeId () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_self_connect');
+ }
+
+ /**
+ * Finishes the self_connect data
+ *
+ * @return void
+ */
+ protected function finishSelfConnectData () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_self_connect');
+ }
+
+ /**
+ * Finishes the self_connect
+ *
+ * @return void
+ */
+ protected function finishSelfConnect () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_self_connect');
+ }
+
+}
--- /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\Request\NodeList;
+
+// 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 RequestNodeListEntry 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 XmlRequestNodeListEntryTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * 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 createXmlRequestNodeListEntryTemplateEngine () {
+ // Get a new instance
+ $templateInstance = new XmlRequestNodeListEntryTemplateEngine();
+
+ // Init template instannce
+ $templateInstance->initXmlTemplateEngine('node', 'request_node_list_entry');
+
+ // Return the prepared instance
+ return $templateInstance;
+ }
+
+ /**
+ * Currently not used
+ *
+ * @param $resource XML parser resource (currently ignored)
+ * @param $characters Characters to handle
+ * @return void
+ * @todo Find something useful with this!
+ */
+ 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 data with matching variable here
+ parent::assignVariable($this->getStackInstance()->getNamed('node_request_node_list_entry'), $characters);
+ }
+
+ /**
+ * Getter for cache file (FQFN)
+ *
+ * @return $fqfn Full-qualified file name of the menu cache
+ */
+ public function getRequestNodeListEntryCacheFqfn () {
+ $this->partialStub('Please implement this method.');
+ }
+
+ /**
+ * Starts the request-node-list-entry
+ *
+ * @return void
+ */
+ protected function startRequestNodeListEntry () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_request_node_list_entry', 'request-node-list-entry');
+ }
+
+ /**
+ * Finishes the request-node-list-entry
+ *
+ * @return void
+ */
+ protected function finishRequestNodeListEntry () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_request_node_list_entry');
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Shipsimu\Hub\Template\Engine\Xml\ObjectRegistry;
+
+// Import application-specific stuff
+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;
+
+/**
+ * An ObjectRegistry 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 XmlObjectRegistryTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable {
+ // Constants
+ const OBJECT_TYPE_DATA_NAME = 'object-name';
+ const OBJECT_TYPE_DATA_RECIPIENT_LIMITATION = 'object-recipient-limitation';
+ const OBJECT_TYPE_DATA_MAX_SPREAD = 'object-max-spread';
+ const OBJECT_TYPE_DATA_PROTOCOL = 'object-protocol';
+ const OBJECT_TYPE_DATA_RECIPIENT_TYPE = 'object-recipient-type';
+
+ /**
+ * Instance for the object registry
+ */
+ private $objectRegistryInstance = NULL;
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Init object type registry instance
+ $this->objectRegistryInstance = ObjectTypeRegistryFactory::createObjectTypeRegistryInstance();
+
+ // Init sub nodes
+ $this->setSubNodes(array(
+ 'object-list',
+ 'object-list-entry',
+ self::OBJECT_TYPE_DATA_NAME,
+ self::OBJECT_TYPE_DATA_RECIPIENT_LIMITATION,
+ self::OBJECT_TYPE_DATA_MAX_SPREAD,
+ self::OBJECT_TYPE_DATA_PROTOCOL,
+ self::OBJECT_TYPE_DATA_RECIPIENT_TYPE
+ ));
+ }
+
+ /**
+ * 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 createXmlObjectRegistryTemplateEngine () {
+ // Get a new instance
+ $templateInstance = new XmlObjectRegistryTemplateEngine();
+
+ // Init template instance
+ $templateInstance->initXmlTemplateEngine('node', 'object_registry');
+
+ // 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
+ //* 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);
+
+ // Is this string empty?
+ if (empty($characters)) {
+ // Then skip it silently
+ return;
+ } // END - if
+
+ // Get current XML node name as an array index
+ $nodeName = $this->getStackInstance()->getNamed('node_object_registry');
+
+ // Is the node name self::OBJECT_TYPE_DATA_NAME?
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('XML-OBJECT-REGISTRY-TEMPLATE-ENGINE: Checking nodeName=%s ...', $nodeName));
+ if ($nodeName == self::OBJECT_TYPE_DATA_NAME) {
+ // Output debug message
+ /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('XML-OBJECT-REGISTRY-TEMPLATE-ENGINE: Adding object type ' . $characters . ' to registry.');
+ } // END - if
+
+ // Add it to the registry
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('XML-OBJECT-REGISTRY-TEMPLATE-ENGINE: EXIT!');
+ $this->objectRegistryInstance->addEntry($nodeName, $characters);
+ }
+
+ /**
+ * Getter for cache file (FQFN)
+ *
+ * @return $fqfn Full-qualified file name of the menu cache
+ */
+ public function getObjectRegistryCacheFqfn () {
+ $this->partialStub('Please implement this method.');
+ }
+
+ /**
+ * Starts the object-registry
+ *
+ * @return void
+ */
+ protected function startObjectRegistry () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_object_registry', 'object-registry');
+ }
+
+ /**
+ * Starts the object-list
+ *
+ * @param $objectCount Count of all objects
+ * @return void
+ * @todo Handle $objectCount
+ */
+ protected function startObjectList ($objectCount) {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_object_registry', 'object-list');
+ }
+
+ /**
+ * Starts the object-list-entry
+ *
+ * @return void
+ */
+ protected function startObjectListEntry () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_object_registry', 'object-list-entry');
+ }
+
+ /**
+ * Starts the object-name
+ *
+ * @return void
+ */
+ protected function startObjectName () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_object_registry', self::OBJECT_TYPE_DATA_NAME);
+ }
+
+ /**
+ * Starts the object-recipient-limitation
+ *
+ * @return void
+ */
+ protected function startObjectRecipientLimitation () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_object_registry', self::OBJECT_TYPE_DATA_RECIPIENT_LIMITATION);
+ }
+
+ /**
+ * Starts the object-max-spread
+ *
+ * @return void
+ */
+ protected function startObjectMaxSpread () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_object_registry', self::OBJECT_TYPE_DATA_MAX_SPREAD);
+ }
+
+ /**
+ * Starts the object-protocol
+ *
+ * @return void
+ */
+ protected function startObjectProtocol () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_object_registry', self::OBJECT_TYPE_DATA_PROTOCOL);
+ }
+
+ /**
+ * Starts the object-recipient-type
+ *
+ * @return void
+ */
+ protected function startObjectRecipientType () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_object_registry', self::OBJECT_TYPE_DATA_RECIPIENT_TYPE);
+ }
+
+ /**
+ * Finishes the object-recipient-type
+ *
+ * @return void
+ */
+ protected function finishObjectRecipientType () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_object_registry');
+ }
+
+ /**
+ * Finishes the object-protocol
+ *
+ * @return void
+ */
+ protected function finishObjectProtocol () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_object_registry');
+ }
+
+ /**
+ * Finishes the object-max-spread
+ *
+ * @return void
+ */
+ protected function finishObjectMaxSpread () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_object_registry');
+ }
+
+ /**
+ * Finishes the object-recipient-limitation
+ *
+ * @return void
+ */
+ protected function finishObjectRecipientLimitation () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_object_registry');
+ }
+
+ /**
+ * Finishes the object-name
+ *
+ * @return void
+ */
+ protected function finishObjectName () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_object_registry');
+ }
+
+ /**
+ * Finishes the object-list-entry
+ *
+ * @return void
+ */
+ protected function finishObjectListEntry () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_object_registry');
+ }
+
+ /**
+ * Finishes the object-list
+ *
+ * @return void
+ */
+ protected function finishObjectList () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_object_registry');
+ }
+
+ /**
+ * Finishes the object-registry
+ *
+ * @return void
+ */
+ protected function finishObjectRegistry () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_object_registry');
+ }
+
+}
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Shipsimu\Hub\Cruncher\Template\Engine\Xml\TestUnit;
+
+// 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 TestUnit template engine class for XML templates
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2011 - 2014 - 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 XmlCruncherTestUnitTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Init sub nodes
+ $this->setSubNodes(array(
+ 'meta-data',
+ 'global-project-identifier',
+ 'test-unit-created',
+ 'cipher',
+ 'cipher-function',
+ 'cipher-name',
+ 'unprocessed-data',
+ 'encrypted-message',
+ 'cruncher-key-list',
+ 'cruncher-key',
+ 'key-id',
+ 'key-value'
+ ));
+ }
+
+ /**
+ * 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 createXmlCruncherTestUnitTemplateEngine () {
+ // Get a new instance
+ $templateInstance = new XmlCruncherTestUnitTemplateEngine();
+
+ // Init template instance
+ $templateInstance->initXmlTemplateEngine('cruncher', 'test_unit');
+
+ // 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('cruncher_test_unit'), $characters);
+ }
+
+ /**
+ * Getter for cache file (FQFN)
+ *
+ * @return $fqfn Full-qualified file name of the menu cache
+ */
+ public function getCruncherTestUnitCacheFqfn () {
+ $this->partialStub('Please implement this method.');
+ }
+
+ /**
+ * Starts the test-unit
+ *
+ * @return void
+ */
+ protected function startTestUnit () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('cruncher_test_unit', 'cruncher-test-unit');
+ }
+
+ /**
+ * Starts the meta-data
+ *
+ * @return void
+ */
+ protected function startMetaData () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('cruncher_test_unit', 'meta-data');
+ }
+
+ /**
+ * Starts the global-project-identifier
+ *
+ * @return void
+ */
+ protected function startGlobalProjectIdentifier () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('cruncher_test_unit', 'global-project-identifier');
+ }
+
+ /**
+ * Finishes the global-project-identifier
+ *
+ * @return void
+ */
+ protected function finishGlobalProjectIdentifier () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('cruncher_test_unit');
+ }
+
+ /**
+ * Starts the test-unit-created
+ *
+ * @return void
+ */
+ protected function startTestUnitCreated () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('cruncher_test_unit', 'test-unit-created');
+ }
+
+ /**
+ * Finishes the test-unit-created
+ *
+ * @return void
+ */
+ protected function finishTestUnitCreated () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('cruncher_test_unit');
+ }
+
+ /**
+ * Starts the cipher
+ *
+ * @return void
+ */
+ protected function startCipher () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('cruncher_test_unit', 'cipher');
+ }
+
+ /**
+ * Starts the cipher-function
+ *
+ * @return void
+ */
+ protected function startCipherFunction () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('cruncher_test_unit', 'cipher-function');
+ }
+
+ /**
+ * Finishes the cipher-function
+ *
+ * @return void
+ */
+ protected function finishCipherFunction () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('cruncher_test_unit');
+ }
+
+ /**
+ * Starts the cipher-name
+ *
+ * @return void
+ */
+ protected function startCipherName () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('cruncher_test_unit', 'cipher-name');
+ }
+
+ /**
+ * Finishes the cipher-name
+ *
+ * @return void
+ */
+ protected function finishCipherName () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('cruncher_test_unit');
+ }
+
+ /**
+ * Finishes the cipher
+ *
+ * @return void
+ */
+ protected function finishCipher () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('cruncher_test_unit');
+ }
+
+ /**
+ * Finishes the meta-data
+ *
+ * @return void
+ */
+ protected function finishMetaData () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('cruncher_test_unit');
+ }
+
+ /**
+ * Starts the unprocessed-data
+ *
+ * @return void
+ */
+ protected function startUnprocessedData () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('cruncher_test_unit', 'unprocessed-data');
+ }
+
+ /**
+ * Starts the encrypted-message
+ *
+ * @return void
+ */
+ protected function startEncryptedMessage () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('cruncher_test_unit', 'encrypted-message');
+ }
+
+ /**
+ * Finishes the encrypted-message
+ *
+ * @return void
+ */
+ protected function finishEncryptedMessage () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('cruncher_test_unit');
+ }
+
+ /**
+ * Starts the cruncher-key-list
+ *
+ * @param $keyCount Count of keys in this test unit
+ * @return void
+ * @todo Handle $keyCount
+ */
+ protected function startCruncherKeyList ($keyCount) {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('cruncher_test_unit', 'cruncher-key-list');
+ }
+
+ /**
+ * Starts the cruncher-key
+ *
+ * @return void
+ */
+ protected function startCruncherKey () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('cruncher_test_unit', 'cruncher-key');
+ }
+
+ /**
+ * Starts the key-id
+ *
+ * @return void
+ */
+ protected function startKeyId () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('cruncher_test_unit', 'key-id');
+ }
+
+ /**
+ * Finishes the key-id
+ *
+ * @return void
+ */
+ protected function finishKeyId () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('cruncher_test_unit');
+ }
+
+ /**
+ * Starts the key-value
+ *
+ * @return void
+ */
+ protected function startKeyValue () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('cruncher_test_unit', 'key-value');
+ }
+
+ /**
+ * Finishes the key-value
+ *
+ * @return void
+ */
+ protected function finishKeyValue () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('cruncher_test_unit');
+ }
+
+ /**
+ * Finishes the cruncher-key
+ *
+ * @return void
+ */
+ protected function finishCruncherKey () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('cruncher_test_unit');
+ }
+
+ /**
+ * Finishes the cruncher-key-list
+ *
+ * @return void
+ */
+ protected function finishCruncherKeyList () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('cruncher_test_unit');
+ }
+
+ /**
+ * Finishes the unprocessed-data
+ *
+ * @return void
+ */
+ protected function finishUnprocessedData () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('cruncher_test_unit');
+ }
+
+ /**
+ * Finishes the test-unit
+ *
+ * @return void
+ */
+ protected function finishTestUnit () {
+ // 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]
+?>
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Shipsimu\Hub\Template\Engine\Xml\Request\NodeList;
+
+// Import application-specific stuff
+use Org\Shipsimu\Hub\Template\Engine\Xml\Request\NodeList\XmlRequestNodeListTemplateEngine;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Registry\Registerable;
+use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
+use Org\Mxchange\CoreFramework\Template\Engine\Xml\BaseXmlTemplateEngine;
+
+/**
+ * An RequestNodeList 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 XmlRequestNodeListTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable {
+ // Constants for array elements
+ const REQUEST_DATA_ACCEPTED_OBJECT_TYPES = 'accepted-object-types';
+ const REQUEST_DATA_SESSION_ID = 'session-id';
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Init sub nodes
+ $this->setSubNodes(array(
+ self::REQUEST_DATA_ACCEPTED_OBJECT_TYPES,
+ self::REQUEST_DATA_SESSION_ID,
+ ));
+ }
+
+ /**
+ * 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 createXmlRequestNodeListTemplateEngine () {
+ // Get a new instance
+ $templateInstance = new XmlRequestNodeListTemplateEngine();
+
+ // Init template instance
+ $templateInstance->initXmlTemplateEngine('node', 'request_node_list');
+
+ // Return the prepared instance
+ return $templateInstance;
+ }
+
+ /**
+ * Currently not used
+ *
+ * @param $resource XML parser resource (currently ignored)
+ * @param $characters Characters to handle
+ * @return void
+ * @todo Find something useful with this!
+ */
+ 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 data with matching variable here
+ parent::assignVariable($this->getStackInstance()->getNamed('node_request_node_list'), $characters);
+ }
+
+ /**
+ * Getter for cache file (FQFN)
+ *
+ * @return $fqfn Full-qualified file name of the menu cache
+ */
+ public function getRequestNodeListCacheFqfn () {
+ $this->partialStub('Please implement this method.');
+ }
+
+ /**
+ * Starts the node-request-node-list
+ *
+ * @return void
+ */
+ protected function startRequestNodeList () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_request_node_list', 'node-request-node-list');
+ }
+
+ /**
+ * Starts the accepted-object-types
+ *
+ * @return void
+ */
+ protected function startAcceptedObjectTypes () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_request_node_list', self::REQUEST_DATA_ACCEPTED_OBJECT_TYPES);
+ }
+
+ /**
+ * Starts the session-id
+ *
+ * @return void
+ */
+ protected function startSessionId () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_request_node_list', self::REQUEST_DATA_SESSION_ID);
+ }
+
+ /**
+ * Finishes the session-id
+ *
+ * @return void
+ */
+ protected function finishSessionId () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_request_node_list');
+ }
+
+ /**
+ * Finishes the accepted-object-types
+ *
+ * @return void
+ */
+ protected function finishAcceptedObjectTypes () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_request_node_list');
+ }
+
+ /**
+ * Finishes the node-request-node-list
+ *
+ * @return void
+ */
+ protected function finishRequestNodeList () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_request_node_list');
+ }
+}
+
+// [EOF]
+?>
-Subproject commit 575accd328d27eccb2bf3caddb564b291e0780df
+Subproject commit a535464e99d3baa2b50830bdf57074db2f14340a