application/hub/main/template/answer/requests/.htaccess -text svneol=unset#text/plain
application/hub/main/template/bootstrap/.htaccess -text svneol=unset#text/plain
application/hub/main/template/bootstrap/class_XmlBootstrapTemplateEngine.php svneol=native#text/plain
+application/hub/main/template/bootstrap/class_XmlDhtBootstrapTemplateEngine.php svneol=native#text/plain
application/hub/main/template/connect/.htaccess -text svneol=unset#text/plain
application/hub/main/template/connect/class_XmlSelfConnectTemplateEngine.php svneol=native#text/plain
application/hub/main/template/entries/.htaccess -text svneol=unset#text/plain
application/hub/templates/xml/cruncher/producer/.htaccess svneol=native#text/plain
application/hub/templates/xml/cruncher/producer/test_unit.xml svneol=native#text/plain
application/hub/templates/xml/cruncher/producer/work_unit.xml svneol=native#text/plain
+application/hub/templates/xml/dht_bootstrap/.htaccess -text svneol=unset#text/plain
+application/hub/templates/xml/dht_bootstrap/bootstrap.xml svneol=native#text/plain
application/hub/templates/xml/entries/.htaccess -text svneol=unset#text/plain
application/hub/templates/xml/node/.htaccess -text svneol=unset#text/plain
application/hub/templates/xml/node/node_status.xml svneol=native#text/plain
// CFG: WEB-CONTENT-TYPE
$cfg->setConfigEntry('web_content_type', '');
-// CFG: QUERY-CONNECTOR-CLASS
-$cfg->setConfigEntry('query_connector_class', 'LocalQueryConnector');
-
-// CFG: QUEUE-CONNECTOR-CLASS
-$cfg->setConfigEntry('queue_connector_class', 'LocalQueueConnector');
-
// CFG: LISTENER-POOL-CLAS
$cfg->setConfigEntry('listener_pool_class', 'DefaultListenerPool');
$cfg->setConfigEntry('node_request_node_list_entries_template_class', 'XmlRequestNodeListEntryTemplateEngine');
// CFG: DHT-BOOTSTRAP-TEMPLATE-CLASS
-$cfg->setConfigEntry('dht_bootstrap_template_class', 'XmlBootstrapTemplateEngine');
+$cfg->setConfigEntry('dht_bootstrap_template_class', 'XmlDhtBootstrapTemplateEngine');
// CFG: NODE-MESSAGE-TEMPLATE-EXTENSION
$cfg->setConfigEntry('node_message_template_extension', '.xml');
+// CFG: DHT-MESSAGE-TEMPLATE-EXTENSION
+$cfg->setConfigEntry('dht_message_template_extension', '.xml');
+
// CFG: NODE-ANNOUNCEMENT-ANSWER-TEMPLATE-EXTENSION
$cfg->setConfigEntry('node_announcement_answer_template_extension', '.xml');
// CFG: NODE-OBJECT-TYPE-REGISTRY-CLASS
$cfg->setConfigEntry('node_object_type_registry_class', 'ObjectTypeRegistry');
+// CFG: DHT-BOOTSTRAP-TEMPLATE-TYPE
+$cfg->setConfigEntry('dht_bootstrap_template_type', 'xml/dht_bootstrap');
+
// CFG: CODE-TEMPLATE-TYPE
$cfg->setConfigEntry('code_template_type', 'xml');
// CFG: CHUNK-HANDLER-STACKER-CLASS
$cfg->setConfigEntry('chunk_handler_stacker_class', 'FiFoStacker');
+// CFG: DHT-BOOTSTRAP-STACKER-CLASS
+$cfg->setConfigEntry('dht_bootstrap_stacker_class', 'FiFoStacker');
+
// CFG: PRODUCER-OUTGOING-QUEUE
$cfg->setConfigEntry('producer_outgoing_queue', 'FiFoStacker');
// CFG: STACKER-DECODED-PACKAGE-MAX-SIZE
$cfg->setConfigEntry('stacker_decoded_package_max_size', 100);
+// CFG: STACKER-DHT-BOOTSTRAP-MAX-SIZE
+$cfg->setConfigEntry('stacker_dht_bootstrap_max_size', 10);
+
// CFG: NEWS-MAIN-LIMIT
$cfg->setConfigEntry('news_main_limit', 5);
* from given helper's template instance and pushing it on the 'undeclared'
* stack.
*
- * @param $helperInstance An instance of a HelpableNode class
+ * @param $helperInstance An instance of a Helper class
* @param $protocol Name of used protocol (TCP/UDP)
* @return void
*/
- function enqueueRawDataFromTemplate (HelpableNode $helperInstance, $protocol);
+ function enqueueRawDataFromTemplate (Helper $helperInstance, $protocol);
/**
* Checks whether a package has been enqueued for delivery.
<?php
-/**
- * A general connector class
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Hub Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.ship-simu.org
- *
- * 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 BaseConnector extends BaseHubSystem {
- /**
- * Protected constructor
- *
- * @param $className Name of the class
- * @return void
- */
- protected function __construct ($className) {
- // Call parent constructor
- parent::__construct($className);
- }
-}
-
-// [EOF]
+// @DEPRECATED
?>
<?php
-/**
- * A ??? query connector class
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Hub Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.ship-simu.org
- * @todo Find an interface for: handleAllQueries()
- *
- * 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 ???QueryConnector extends BaseQueryConnector implements Connectable, Visitable {
- /**
- * Protected constructor
- *
- * @return void
- */
- protected function __construct () {
- // Call parent constructor
- parent::__construct(__CLASS__);
- }
-
- /**
- * Creates an instance of this query connector class
- *
- * @param $nodeInstance An instance of a node
- * @return $connectorInstance An instance of this query connector class
- */
- public final static function create???QueryConnector (NodeHelper $nodeInstance) {
- // Create the instance
- $connectorInstance = new ???QueryConnector();
-
- // Set the node instance
- $connectorInstance->setNodeInstance($nodeInstance);
-
- // Get a list instance
- $listInstance = ObjectFactory::createObjectByConfiguredName('!!!_query_list_class');
-
- // Set it in the connector
- $connectorInstance->setListInstance($listInstance);
-
- // Finally return the connector
- return $connectorInstance;
- }
-
- /**
- * Accepts the visitor to process the visit "request"
- *
- * @param $visitorInstance An instance of a Visitor class
- * @return void
- */
- public function accept (Visitor $visitorInstance) {
- // Visit the query connector
- $visitorInstance->visitQuery($this);
- }
-
- /**
- * Handles all unsent queries and should be called from a visitor
- *
- * @return void
- * @todo 0% done
- */
- public function handleAllQueries () {
- $this->partialStub('Please implement this method.');
- }
-
- /**
- * Processes all pending queries. This method should be called by the
- * ActiveTaskVisitor class and should use an iterator on all pending
- * queries.
- *
- * @return void
- * @todo 0% done
- */
- public function processAllPendingQueries () {
- $this->partialStub('Please implement this method.');
- }
-}
-
-// [EOF]
+// @DEPRECATED
?>
<?php
-/**
- * A general query connector class
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Hub Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.ship-simu.org
- *
- * 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 BaseQueryConnector extends BaseConnector {
- /**
- * Protected constructor
- *
- * @param $className Name of the class
- * @return void
- */
- protected function __construct ($className) {
- // Call parent constructor
- parent::__construct($className);
- }
-}
-
-// [EOF]
+// @DEPRECATED
?>
<?php
-/**
- * A local query connector class
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Hub Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.ship-simu.org
- * @todo Find an interface for: handleAllQueries()
- *
- * 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 LocalQueryConnector extends BaseQueryConnector implements Connectable, Visitable {
- /**
- * The query class instance
- */
- private $queryInstance = NULL;
-
- /**
- * Protected constructor
- *
- * @return void
- */
- protected function __construct () {
- // Call parent constructor
- parent::__construct(__CLASS__);
-
- // Init query instance
- $this->queryInstance = ObjectFactory::createObjectByConfiguredName('local_query_class');
- }
-
- /**
- * Creates an instance of this query connector class
- *
- * @param $nodeInstance An instance of a node
- * @return $connectorInstance An instance of this query connector class
- */
- public static final function createLocalQueryConnector (NodeHelper $nodeInstance) {
- // Create the instance
- $connectorInstance = new LocalQueryConnector();
-
- // Set the node instance
- $connectorInstance->setNodeInstance($nodeInstance);
-
- // Get a list instance
- $listInstance = ObjectFactory::createObjectByConfiguredName('local_query_list_class');
-
- // Set it in the connector
- $connectorInstance->setListInstance($listInstance);
-
- // Prepare iterator instance
- $iteratorInstance = $listInstance->getListIterator();
-
- // Set it, too
- $connectorInstance->setIteratorInstance($iteratorInstance);
-
- // Finally return the connector
- return $connectorInstance;
- }
-
- /**
- * Handles the in the list avaiable query (current) and hands it over to the
- * query processor instance
- *
- * @return void
- * @TODO 0% done: Unfinished work here
- */
- private function handleCurrentQuery () {
- // Is there a query available?
- if (!$this->getIteratorInstance()->valid()) {
- // Simply abort here
- return;
- } // END - if
-
- // Get the current query
- $currentQuery = $this->getIteratorInstance()->current();
-
- // Only while construction, else it would output to much!
- /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTOR: Handling query ' . $currentQuery);
- }
-
- /**
- * Accepts the visitor to process the visit "request"
- *
- * @param $visitorInstance An instance of a Visitor class
- * @return void
- */
- public function accept (Visitor $visitorInstance) {
- // Visit the query connector
- $visitorInstance->visitQueryConnector($this);
-
- // Visit the query as well
- $this->queryInstance->accept($visitorInstance);
- }
-
- /**
- * Handles all pending queries. This method should be called by the
- * ActiveTaskVisitor class and should use an iterator on all pending
- * queries.
- *
- * @return void
- */
- public function handlePending () {
- // Should we rewind?
- if (!$this->getIteratorInstance()->valid()) {
- // Rewind to the beginning for next loop
- $this->getIteratorInstance()->rewind();
-
- // Still not valid?
- if ($this->getIteratorInstance()->valid()) {
- /*
- * Then silently abort here because the queue is empty and to
- * save some calls.
- */
- return;
- } // END - if
- } // END - if
-
- // Try to execute the task
- $this->handleCurrentQuery();
-
- // Go to next entry
- $this->getIteratorInstance()->next();
- }
-}
-
-// [EOF]
+// @DEPRECATED
?>
<?php
-/**
- * A ??? queue connector class
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Hub Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.ship-simu.org
- *
- * 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 ???QueueConnector extends BaseQueueConnector implements Connectable, Queueable, Visitable {
- /**
- * Protected constructor
- *
- * @return void
- */
- protected function __construct () {
- // Call parent constructor
- parent::__construct(__CLASS__);
- }
-
- /**
- * Creates an instance of this queue connector class
- *
- * @return $connectorInstance An instance of this queue connector class
- */
- public final static function create???QueueConnector () {
- // Create the instance
- $connectorInstance = new ???QueueConnector();
-
- // Finally return it
- return $connectorInstance;
- }
-
- /**
- * Accepts the visitor to process the visit "request"
- *
- * @param $visitorInstance An instance of a Visitor class
- * @return void
- */
- public function accept (Visitor $visitorInstance) {
- // Visit the query connector
- $visitorInstance->visitQueue($this);
- }
-}
-
-// [EOF]
+// @DEPRECATED
?>
<?php
-/**
- * A general queue connector class
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Hub Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.ship-simu.org
- *
- * 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 BaseQueueConnector extends BaseConnector {
- /**
- * Protected constructor
- *
- * @param $className Name of the class
- * @return void
- */
- protected function __construct ($className) {
- // Call parent constructor
- parent::__construct($className);
- }
-}
-
-// [EOF]
+// @DEPRECATED
?>
<?php
-/**
- * A local queue connector class
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Hub Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.ship-simu.org
- *
- * 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 LocalQueueConnector extends BaseQueueConnector implements Connectable, Queueable, Visitable {
- /**
- * Protected constructor
- *
- * @param $className Name of the class
- * @return void
- */
- protected function __construct () {
- // Call parent constructor
- parent::__construct(__CLASS__);
- }
-
- /**
- * Creates an instance of this queue connector class
- *
- * @param $nodeInstance An instance of a hub node
- * @return $connectorInstance An instance of this queue connector class
- */
- public static final function createLocalQueueConnector (NodeHelper $nodeInstance) {
- // Create the instance
- $connectorInstance = new LocalQueueConnector();
-
- // Set the node instance
- $connectorInstance->setNodeInstance($nodeInstance);
-
- // Finally return it
- return $connectorInstance;
- }
-
- /**
- * Handles the in the list avaiable queues (current) and hands it over to the
- * queues processor instance
- *
- * @return void
- * @TODO 0% done: Unfinished work here
- */
- private function handleCurrentQueues () {
- // Is there a queues available?
- if (!$this->getIteratorInstance()->valid()) {
- // Simply abort here
- return;
- } // END - if
-
- // Get the current queues
- $currentQueues = $this->getIteratorInstance()->current();
-
- // Only while construction, else it would output to much!
- /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTOR: Handling queue entry ' . $currentQueues);
- }
-
- /**
- * Handles all pending queues. This method should be called by the
- * ActiveTaskVisitor class and should use an iterator on all pending
- * queues.
- *
- * @return void
- */
- public function handlePending () {
- // Should we rewind?
- if (!$this->getIteratorInstance()->valid()) {
- // Rewind to the beginning for next loop
- $this->getIteratorInstance()->rewind();
- } // END - if
-
- // Try to execute the task
- $this->handleCurrentQueue();
-
- // Go to next entry
- $this->getIteratorInstance()->next();
- }
-
- /**
- * Accepts the visitor to process the visit "request"
- *
- * @param $visitorInstance An instance of a Visitor class
- * @return void
- */
- public function accept (Visitor $visitorInstance) {
- // Visit the query connector
- $visitorInstance->visitQueue($this);
- }
-}
-
-// [EOF]
+// @DEPRECATED
?>
*
* @param $packageData Raw package data array
* @return void
+ * @todo Find a better way than this switch/case/default thing
*/
public function discoverRecipients (array $packageData) {
// We do some rudimentary checks but this might be a bit ugly
switch ($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT]) {
- // All upper hubs, these are currently the bootstrap nodes and later on prepended list-nodes
- case NetworkPackage::NETWORK_TARGET_UPPER_NODES:
+ case NetworkPackage::NETWORK_TARGET_UPPER_NODES: // All upper hubs, these are currently the bootstrap nodes and later on prepended list-nodes
// Get all bootstrap nodes
foreach (explode(BaseHubSystem::BOOTSTRAP_NODES_SEPARATOR, $this->getConfigInstance()->getConfigEntry('hub_bootstrap_nodes')) as $ipPort) {
// Is maximum reached?
} // END - foreach
break;
- // The target 'self' is always the external IP address!
- case NetworkPackage::NETWORK_TARGET_SELF:
+ case NetworkPackage::NETWORK_TARGET_SELF: // The target 'self' is always the external IP address!
// Determine own port
$port = $this->getConfigInstance()->getConfigEntry('node_listen_port');
} // END - if
break;
- // This may be a direct recipient (node's session id)
- default:
+ case NetworkPackage::NETWORK_TARGET_DHT: // The target 'dht' is a list from local DHT query
+ $this->partialStub('DHT recipient unimplemented: packageData=' . print_r($packageData, true));
+ break;
+
+ default: // This may be a direct recipient (node's session id)
/*
* Try to solve it, if an exception comes back, it is not a
* session-id, nor IP:port and not a hostname:port combination.
* 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 BaseHubSystemHelper extends BaseHubSystem {
+class BaseHubSystemHelper extends BaseHubSystem implements Helper {
/**
* Recipient type
*/
* from given helper's template instance and pushing it on the 'undeclared'
* stack.
*
- * @param $helperInstance An instance of a HelpableNode class
+ * @param $helperInstance An instance of a Helper class
* @param $protocol Name of used protocol (TCP/UDP)
* @return void
*/
- public function enqueueRawDataFromTemplate (HelpableNode $helperInstance, $protocolName) {
+ public function enqueueRawDataFromTemplate (Helper $helperInstance, $protocolName) {
// Get the raw content ...
$content = $helperInstance->getTemplateInstance()->getRawTemplateData();
//* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('content(' . strlen($content) . ')=' . $content);
<?php
-/**
- * An Bootstrap 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 - 2012 Core 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 XmlBootstrapTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable {
- /**
- * Some XML nodes must be available for later data extraction
- */
- const BOOTSTRAP_DATA_SESSION_ID = 'session-id';
- const BOOTSTRAP_DATA_NODE_STATUS = 'node-status';
- const BOOTSTRAP_DATA_NODE_MODE = 'node-mode';
- const BOOTSTRAP_DATA_EXTERNAL_IP = 'external-ip';
- const BOOTSTRAP_DATA_INTERNAL_IP = 'internal-ip';
- const BOOTSTRAP_DATA_LISTEN_PORT = 'listen-port';
-
- /**
- * Protected constructor
- *
- * @return void
- */
- protected function __construct () {
- // Call parent constructor
- parent::__construct(__CLASS__);
-
- // Init array
- $this->subNodes = array(
- 'bootstrap-data',
- 'listener',
- self::BOOTSTRAP_DATA_NODE_STATUS,
- self::BOOTSTRAP_DATA_NODE_MODE,
- self::BOOTSTRAP_DATA_LISTEN_PORT,
- self::BOOTSTRAP_DATA_SESSION_ID,
- self::BOOTSTRAP_DATA_EXTERNAL_IP,
- self::BOOTSTRAP_DATA_INTERNAL_IP,
- '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 createXmlBootstrapTemplateEngine () {
- // Get a new instance
- $templateInstance = new XmlBootstrapTemplateEngine();
-
- // Init template instance
- $templateInstance->initXmlTemplateEngine('node', '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 false;
- } // END - if
-
- /*
- * Assign the found characters to variable and use the last entry from
- * stack as the name.
- */
- parent::assignVariable($this->getStackerInstance()->getNamed('node_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 bootstrap
- *
- * @return void
- */
- protected function startBootstrap () {
- // Push the node name on the stacker
- $this->getStackerInstance()->pushNamed('node_bootstrap', 'node_bootstrap');
- }
-
- /**
- * Starts the bootstrap data
- *
- * @return void
- */
- protected function startBootstrapData () {
- // Push the node name on the stacker
- $this->getStackerInstance()->pushNamed('node_bootstrap', 'bootstrap-data');
- }
-
- /**
- * Starts the node status
- *
- * @return void
- */
- protected function startNodeStatus () {
- // Push the node name on the stacker
- $this->getStackerInstance()->pushNamed('node_bootstrap', self::BOOTSTRAP_DATA_NODE_STATUS);
- }
-
- /**
- * Starts the node-mode
- *
- * @return void
- */
- protected function startNodeMode () {
- // Push the node name on the stacker
- $this->getStackerInstance()->pushNamed('node_bootstrap', self::BOOTSTRAP_DATA_NODE_MODE);
- }
-
- /**
- * Starts the listener
- *
- * @return void
- */
- protected function startListener () {
- // Push the node name on the stacker
- $this->getStackerInstance()->pushNamed('node_bootstrap', 'listener');
- }
-
- /**
- * Starts the TCP/UDP listen port
- *
- * @return void
- */
- protected function startListenPort () {
- // Push the node name on the stacker
- $this->getStackerInstance()->pushNamed('node_bootstrap', self::BOOTSTRAP_DATA_LISTEN_PORT);
- }
-
- /**
- * Starts the session id
- *
- * @return void
- */
- protected function startSessionId () {
- // Push the node name on the stacker
- $this->getStackerInstance()->pushNamed('node_bootstrap', self::BOOTSTRAP_DATA_SESSION_ID);
- }
-
- /**
- * Starts the public ip
- *
- * @return void
- */
- protected function startExternalIp () {
- // Push the node name on the stacker
- $this->getStackerInstance()->pushNamed('node_bootstrap', self::BOOTSTRAP_DATA_EXTERNAL_IP);
- }
-
- /**
- * Starts the private ip
- *
- * @return void
- */
- protected function startInternalIp () {
- // Push the node name on the stacker
- $this->getStackerInstance()->pushNamed('node_bootstrap', self::BOOTSTRAP_DATA_INTERNAL_IP);
- }
-
- /**
- * Starts the object type list
- *
- * @return void
- */
- protected function startObjectTypeList () {
- // Push the node name on the stacker
- $this->getStackerInstance()->pushNamed('node_bootstrap', 'object-type-list');
- }
-
- /**
- * Starts the object type
- *
- * @return void
- */
- protected function startObjectType () {
- // Push the node name on the stacker
- $this->getStackerInstance()->pushNamed('node_bootstrap', 'object-type');
- }
-
- /**
- * Finishes the object type
- *
- * @return void
- */
- protected function finishObjectType () {
- // Pop the last entry
- $this->getStackerInstance()->popNamed('node_bootstrap');
- }
-
- /**
- * Finishes the object type list
- *
- * @return void
- */
- protected function finishObjectTypeList () {
- // Pop the last entry
- $this->getStackerInstance()->popNamed('node_bootstrap');
- }
-
- /**
- * Finishes the session id
- *
- * @return void
- */
- protected function finishSessionId () {
- // Pop the last entry
- $this->getStackerInstance()->popNamed('node_bootstrap');
- }
-
- /**
- * Finishes the private ip
- *
- * @return void
- */
- protected function finishInternalIp () {
- // Pop the last entry
- $this->getStackerInstance()->popNamed('node_bootstrap');
- }
-
- /**
- * Finishes the public ip
- *
- * @return void
- */
- protected function finishExternalIp () {
- // Pop the last entry
- $this->getStackerInstance()->popNamed('node_bootstrap');
- }
-
- /**
- * Finishes the TCP/UDP listen port
- *
- * @return void
- */
- protected function finishListenPort () {
- // Pop the last entry
- $this->getStackerInstance()->popNamed('node_bootstrap');
- }
-
- /**
- * Finishes the listener
- *
- * @return void
- */
- protected function finishListener () {
- // Pop the last entry
- $this->getStackerInstance()->popNamed('node_bootstrap');
- }
-
- /**
- * Finishes the node mode
- *
- * @return void
- */
- protected function finishNodeMode () {
- // Pop the last entry
- $this->getStackerInstance()->popNamed('node_bootstrap');
- }
-
- /**
- * Finishes the node status
- *
- * @return void
- */
- protected function finishNodeStatus () {
- // Pop the last entry
- $this->getStackerInstance()->popNamed('node_bootstrap');
- }
-
- /**
- * Finishes the bootstrap data
- *
- * @return void
- */
- protected function finishBootstrapData () {
- // Pop the last entry
- $this->getStackerInstance()->popNamed('node_bootstrap');
- }
-
- /**
- * Finishes the bootstrap
- *
- * @return void
- */
- protected function finishBootstrap () {
- // Pop the last entry
- $this->getStackerInstance()->popNamed('node_bootstrap');
- }
-}
-
-// [EOF]
+// @DEPRECATED
?>
--- /dev/null
+<?php
+/**
+ * An Bootstrap 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 - 2012 Core 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 XmlDhtBootstrapTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable {
+ /**
+ * Some XML nodes must be available for later data extraction
+ */
+ const BOOTSTRAP_DATA_SESSION_ID = 'session-id';
+ const BOOTSTRAP_DATA_NODE_STATUS = 'node-status';
+ const BOOTSTRAP_DATA_NODE_MODE = 'node-mode';
+ const BOOTSTRAP_DATA_EXTERNAL_IP = 'external-ip';
+ const BOOTSTRAP_DATA_INTERNAL_IP = 'internal-ip';
+ const BOOTSTRAP_DATA_LISTEN_PORT = 'listen-port';
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Init array
+ $this->subNodes = array(
+ 'bootstrap-data',
+ 'listener',
+ self::BOOTSTRAP_DATA_NODE_STATUS,
+ self::BOOTSTRAP_DATA_NODE_MODE,
+ self::BOOTSTRAP_DATA_LISTEN_PORT,
+ self::BOOTSTRAP_DATA_SESSION_ID,
+ self::BOOTSTRAP_DATA_EXTERNAL_IP,
+ self::BOOTSTRAP_DATA_INTERNAL_IP,
+ '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 createXmlDhtBootstrapTemplateEngine () {
+ // Get a new instance
+ $templateInstance = new XmlDhtBootstrapTemplateEngine();
+
+ // Init template instance
+ $templateInstance->initXmlTemplateEngine('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 false;
+ } // END - if
+
+ /*
+ * Assign the found characters to variable and use the last entry from
+ * stack as the name.
+ */
+ parent::assignVariable($this->getStackerInstance()->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 bootstrap
+ *
+ * @return void
+ */
+ protected function startBootstrap () {
+ // Push the node name on the stacker
+ $this->getStackerInstance()->pushNamed('dht_bootstrap', 'bootstrap');
+ }
+
+ /**
+ * Starts the bootstrap data
+ *
+ * @return void
+ */
+ protected function startBootstrapData () {
+ // Push the node name on the stacker
+ $this->getStackerInstance()->pushNamed('dht_bootstrap', 'bootstrap-data');
+ }
+
+ /**
+ * Starts the node status
+ *
+ * @return void
+ */
+ protected function startNodeStatus () {
+ // Push the node name on the stacker
+ $this->getStackerInstance()->pushNamed('dht_bootstrap', self::BOOTSTRAP_DATA_NODE_STATUS);
+ }
+
+ /**
+ * Starts the node-mode
+ *
+ * @return void
+ */
+ protected function startNodeMode () {
+ // Push the node name on the stacker
+ $this->getStackerInstance()->pushNamed('dht_bootstrap', self::BOOTSTRAP_DATA_NODE_MODE);
+ }
+
+ /**
+ * Starts the listener
+ *
+ * @return void
+ */
+ protected function startListener () {
+ // Push the node name on the stacker
+ $this->getStackerInstance()->pushNamed('dht_bootstrap', 'listener');
+ }
+
+ /**
+ * Starts the TCP/UDP listen port
+ *
+ * @return void
+ */
+ protected function startListenPort () {
+ // Push the node name on the stacker
+ $this->getStackerInstance()->pushNamed('dht_bootstrap', self::BOOTSTRAP_DATA_LISTEN_PORT);
+ }
+
+ /**
+ * Starts the session id
+ *
+ * @return void
+ */
+ protected function startSessionId () {
+ // Push the node name on the stacker
+ $this->getStackerInstance()->pushNamed('dht_bootstrap', self::BOOTSTRAP_DATA_SESSION_ID);
+ }
+
+ /**
+ * Starts the public ip
+ *
+ * @return void
+ */
+ protected function startExternalIp () {
+ // Push the node name on the stacker
+ $this->getStackerInstance()->pushNamed('dht_bootstrap', self::BOOTSTRAP_DATA_EXTERNAL_IP);
+ }
+
+ /**
+ * Starts the private ip
+ *
+ * @return void
+ */
+ protected function startInternalIp () {
+ // Push the node name on the stacker
+ $this->getStackerInstance()->pushNamed('dht_bootstrap', self::BOOTSTRAP_DATA_INTERNAL_IP);
+ }
+
+ /**
+ * Starts the object type list
+ *
+ * @return void
+ */
+ protected function startObjectTypeList () {
+ // Push the node name on the stacker
+ $this->getStackerInstance()->pushNamed('dht_bootstrap', 'object-type-list');
+ }
+
+ /**
+ * Starts the object type
+ *
+ * @return void
+ */
+ protected function startObjectType () {
+ // Push the node name on the stacker
+ $this->getStackerInstance()->pushNamed('dht_bootstrap', 'object-type');
+ }
+
+ /**
+ * Finishes the object type
+ *
+ * @return void
+ */
+ protected function finishObjectType () {
+ // Pop the last entry
+ $this->getStackerInstance()->popNamed('dht_bootstrap');
+ }
+
+ /**
+ * Finishes the object type list
+ *
+ * @return void
+ */
+ protected function finishObjectTypeList () {
+ // Pop the last entry
+ $this->getStackerInstance()->popNamed('dht_bootstrap');
+ }
+
+ /**
+ * Finishes the session id
+ *
+ * @return void
+ */
+ protected function finishSessionId () {
+ // Pop the last entry
+ $this->getStackerInstance()->popNamed('dht_bootstrap');
+ }
+
+ /**
+ * Finishes the private ip
+ *
+ * @return void
+ */
+ protected function finishInternalIp () {
+ // Pop the last entry
+ $this->getStackerInstance()->popNamed('dht_bootstrap');
+ }
+
+ /**
+ * Finishes the public ip
+ *
+ * @return void
+ */
+ protected function finishExternalIp () {
+ // Pop the last entry
+ $this->getStackerInstance()->popNamed('dht_bootstrap');
+ }
+
+ /**
+ * Finishes the TCP/UDP listen port
+ *
+ * @return void
+ */
+ protected function finishListenPort () {
+ // Pop the last entry
+ $this->getStackerInstance()->popNamed('dht_bootstrap');
+ }
+
+ /**
+ * Finishes the listener
+ *
+ * @return void
+ */
+ protected function finishListener () {
+ // Pop the last entry
+ $this->getStackerInstance()->popNamed('dht_bootstrap');
+ }
+
+ /**
+ * Finishes the node mode
+ *
+ * @return void
+ */
+ protected function finishNodeMode () {
+ // Pop the last entry
+ $this->getStackerInstance()->popNamed('dht_bootstrap');
+ }
+
+ /**
+ * Finishes the node status
+ *
+ * @return void
+ */
+ protected function finishNodeStatus () {
+ // Pop the last entry
+ $this->getStackerInstance()->popNamed('dht_bootstrap');
+ }
+
+ /**
+ * Finishes the bootstrap data
+ *
+ * @return void
+ */
+ protected function finishBootstrapData () {
+ // Pop the last entry
+ $this->getStackerInstance()->popNamed('dht_bootstrap');
+ }
+
+ /**
+ * Finishes the bootstrap
+ *
+ * @return void
+ */
+ protected function finishBootstrap () {
+ // Pop the last entry
+ $this->getStackerInstance()->popNamed('dht_bootstrap');
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+An XML for DHT bootstrapping
+
+@author Roland Haeder <webmaster@ship-simu.org>
+@version 0.0.0
+@copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Hub Developer Team
+@license GNU GPL 3.0 or any newer version
+@link http://www.ship-simu.org
+
+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/>
+//-->
+<bootstrap>
+</bootstrap>