]> git.mxchange.org Git - hub.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sat, 20 May 2017 18:58:26 +0000 (20:58 +0200)
committerRoland Häder <roland@mxchange.org>
Fri, 21 Aug 2020 16:50:04 +0000 (18:50 +0200)
- Let's use (and cache) the UNL instance instead of fetching an array from it
  and then taking parts out of it. This way is more OOP-ed
- added getExternalUnl() and getInternalUnl() as first methods
- getUnlData() is now no longer used, see first comment why
- renamed path 'unl' -> 'locator' to have it same as in interfaces
- updated target year
- updated core framework

Signed-off-by: Roland Häder <roland@mxchange.org>
13 files changed:
application/hub/classes/database/frontend/node/class_NodeDistributedHashTableDatabaseWrapper.php
application/hub/classes/filter/miner/class_MinerPhpRequirementsFilter.php
application/hub/classes/filter/node/class_NodePhpRequirementsFilter.php
application/hub/classes/locator/.htaccess [new file with mode: 0644]
application/hub/classes/locator/class_UniversalNodeLocator.php [new file with mode: 0644]
application/hub/classes/nodes/boot/class_HubBootNode.php
application/hub/classes/nodes/class_BaseHubNode.php
application/hub/classes/unl/.htaccess [deleted file]
application/hub/classes/unl/class_UniversalNodeLocator.php [deleted file]
application/hub/interfaces/helper/nodes/class_NodeHelper.php
application/hub/interfaces/locator/class_LocateableNode.php
contrib/update_year.sh
core

index ab17c3e81a37d90b06d1e919b999086868a27c43..b8c64aa69acdf9ccb1ac77d1e901c44b47b28e1f 100644 (file)
@@ -174,13 +174,12 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem
                // Get Universal Node Locator and "explode" it
                $unlInstance = $nodeInstance->determineUniversalNodeLocator();
 
-               // Get UNL data from it
-               $unlData = $unlInstance->getUnlData();
+               // Get external UNL
+               $externalUnl = $unlInstance->getExternalUnl();
 
                // Make sure both is valid
                // @TODO Bad check on UNL, better use a proper validator
-               assert(isset($unlData[NodeInformationDatabaseWrapper::DB_COLUMN_EXTERNAL_UNL]));
-               assert($unlData[NodeInformationDatabaseWrapper::DB_COLUMN_EXTERNAL_UNL] !== 'invalid');
+               assert($externalUnl !== 'invalid');
 
                // Get an array of all accepted object types
                $objectList = $nodeInstance->getListFromAcceptedObjectTypes();
@@ -190,7 +189,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem
 
                // Add public node data
                $dataSetInstance->addCriteria(self::DB_COLUMN_NODE_MODE       , $requestInstance->getRequestElement('mode'));
-               $dataSetInstance->addCriteria(self::DB_COLUMN_EXTERNAL_ADDRESS, $unlData[NodeInformationDatabaseWrapper::DB_COLUMN_EXTERNAL_UNL]);
+               $dataSetInstance->addCriteria(self::DB_COLUMN_EXTERNAL_ADDRESS, $externalUnl);
                $dataSetInstance->addCriteria(self::DB_COLUMN_NODE_ID         , $nodeInstance->getNodeId());
                $dataSetInstance->addCriteria(self::DB_COLUMN_SESSION_ID      , $nodeInstance->getSessionId());
                $dataSetInstance->addCriteria(self::DB_COLUMN_PRIVATE_KEY_HASH, $nodeInstance->getPrivateKeyHash());
@@ -221,15 +220,15 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem
                $nodeInstance = NodeObjectFactory::createNodeInstance();
 
                // Get Universal Node Locator and "explode" it
-               $unlData = $nodeInstance->getUniversalNodeLocatorArray();
+               $unlInstance = $nodeInstance->determineUniversalNodeLocator();
 
                // Make sure the external address is set and not invalid
                // @TODO Bad check on UNL, better use a proper validator
-               assert(isset($unlData[NodeInformationDatabaseWrapper::DB_COLUMN_EXTERNAL_UNL]));
-               assert($unlData[NodeInformationDatabaseWrapper::DB_COLUMN_EXTERNAL_UNL] != 'invalid');
+               $externalUnl = $unlInstance->getExternalUnl();
+               assert($externalUnl != 'invalid');
 
                // Add Universal Node Locator/node id as criteria
-               $searchInstance->addCriteria(self::DB_COLUMN_EXTERNAL_ADDRESS, $unlData[NodeInformationDatabaseWrapper::DB_COLUMN_EXTERNAL_UNL]);
+               $searchInstance->addCriteria(self::DB_COLUMN_EXTERNAL_ADDRESS, $externalUnl);
                $searchInstance->addCriteria(self::DB_COLUMN_NODE_ID         , $nodeInstance->getNodeId());
                $searchInstance->addCriteria(self::DB_COLUMN_SESSION_ID      , $nodeInstance->getSessionId());
                $searchInstance->setLimit(1);
index 4c15fe0ad78c8fe30729a83cdd7919bd6ede62c2..657edf86124a59f46ae7f8b0dc657067a6838cda 100644 (file)
@@ -77,11 +77,11 @@ class MinerPhpRequirementsFilter extends BaseMinerFilter implements Filterable {
                // If scrypt() is not found (ext-scrypt) then the "Hubcoins reward" is not working
                if ((extension_loaded('scrypt')) && (is_callable('scrypt'))) {
                        // Mark it as working
-                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILTER ext-scrypt and a callable scrypt() function found. "Hubcoin reward" feature possible.');
+                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILTER: ext-scrypt and a callable scrypt() function found. "Hubcoin reward" feature possible.');
                        $this->getConfigInstance()->setConfigEntry('extension_scrypt_loaded', TRUE);
                } else {
                        // Not working (not all have ext-scrypt installed
-                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILTER ext-scrypt not found or scrypt() function not found. "Hubcoin reward" feature disabled.');
+                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILTER: ext-scrypt not found or scrypt() function not found. "Hubcoin reward" feature disabled.');
                }
 
                // Are all tests passed?
index 098a5ae42d93ad2f46e1932a3e24396f08e660bb..39cc86cce868f05c18905f1b70b0cad2951e39d1 100644 (file)
@@ -80,21 +80,21 @@ class NodePhpRequirementsFilter extends BaseNodeFilter implements Filterable {
                // If scrypt() is not found (ext-scrypt) then the "Hubcoins reward" is not working
                if ((extension_loaded('scrypt')) && (is_callable('scrypt'))) {
                        // Mark it as working
-                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILTER ext-scrypt and a callable scrypt() function found. "Hubcoin reward" feature possible.');
+                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILTER: ext-scrypt and a callable scrypt() function found. "Hubcoin reward" feature possible.');
                        $this->getConfigInstance()->setConfigEntry('extension_scrypt_loaded', TRUE);
                } else {
                        // Not working (not all have ext-scrypt installed
-                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILTER ext-scrypt not found or scrypt() function not found. "Hubcoin reward" feature disabled.');
+                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILTER: ext-scrypt not found or scrypt() function not found. "Hubcoin reward" feature disabled.');
                }
 
                // If uuid_create() is not found (ext-uuid) then some keys are a bit weaker
                if ((extension_loaded('uuid')) && (is_callable('uuid_create'))) {
                        // Mark it as working
-                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILTER ext-uuid and a callable uuid_create() function found. UUID "entropy" available.');
+                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILTER: ext-uuid and a callable uuid_create() function found. UUID "entropy" available.');
                        $this->getConfigInstance()->setConfigEntry('extension_uuid_loaded', TRUE);
                } else {
                        // Not working (not all have ext-uuid installed
-                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILTER ext-uuid not found or uuid_create() function not found. UUID "entropy" disabled.');
+                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILTER: ext-uuid not found or uuid_create() function not found. UUID "entropy" disabled.');
                }
 
                // Are all tests passed?
diff --git a/application/hub/classes/locator/.htaccess b/application/hub/classes/locator/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/classes/locator/class_UniversalNodeLocator.php b/application/hub/classes/locator/class_UniversalNodeLocator.php
new file mode 100644 (file)
index 0000000..999d950
--- /dev/null
@@ -0,0 +1,159 @@
+<?php
+// Own namespace
+namespace Hub\Locator\Node;
+
+// Import application-specific stuff
+use Hub\Database\Frontend\Node\Information\NodeInformationDatabaseWrapper;
+use Hub\Generic\BaseHubSystem;
+
+/**
+ * A class for UNLs (Universal Node Locator)
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 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 UniversalNodeLocator extends BaseHubSystem implements LocateableNode {
+       //------- UNL parts -------
+       // Protocol
+       const UNL_PART_PROTOCOL = 'protocol';
+       // Address
+       const UNL_PART_ADDRESS  = 'address';
+       // Extra part
+       const UNL_PART_EXTRA    = 'extra';
+       // Port (if any)
+       const UNL_PART_PORT     = 'port';
+
+       /**
+        * UNL data array
+        */
+       private $unlData = array();
+
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @param       $current                An array with "raw" data from the database layer for the UNL. This parameter is optional.
+        * @return      $unlInstance    An instance of a LocateableNode class
+        */
+       public final static function createUniversalNodeLocator (array $current = array()) {
+               // Get new instance
+               $unlInstance = new UniversalNodeLocator();
+
+               // Init instance
+               $unlInstance->initUniversalNodeLocator($current);
+
+               // Return the prepared instance
+               return $unlInstance;
+       }
+
+       /**
+        * Initializes the UNL instance by givena array. If an entry is found, it
+        * will be copied, otherwise the entry is set empty.
+        *
+        * @param       $current        An array with "raw" data from the database layer for the UNL. This parameter is optional.
+        * @return      void
+        */
+       private function initUniversalNodeLocator (array $current = array()) {
+               // Init UNL array
+               $this->unlData = array();
+
+               // Copy all found entries
+               foreach (array(
+                       NodeInformationDatabaseWrapper::DB_COLUMN_NODE_ID,
+                       NodeInformationDatabaseWrapper::DB_COLUMN_SESSION_ID,
+                       NodeInformationDatabaseWrapper::DB_COLUMN_PRIVATE_KEY_HASH,
+                       NodeInformationDatabaseWrapper::DB_COLUMN_NODE_MODE,
+                       NodeInformationDatabaseWrapper::DB_COLUMN_INTERNAL_UNL,
+                       NodeInformationDatabaseWrapper::DB_COLUMN_EXTERNAL_UNL) as $key) {
+                               // Init entry
+                               $this->unlData[$key] = NULL;
+
+                               // Is the key found?
+                               if (isset($current[$key])) {
+                                       // The copy the entry
+                                       $this->unlData[$key] = $current[$key];
+                               } // END - if
+               } // END - foreach
+       }
+
+       /**
+        * Getter for UNL data array
+        *
+        * @return      $unlData        An array with UNL data
+        */
+       private function getUnlData () {
+               return $this->unlData;
+       }
+
+       /**
+        * Getter for external UNL
+        *
+        * @return      $externalUnl    External UNL
+        * @throws      MissingArrayElementsException   If DB_COLUMN_EXTERNAL_UNL is missing
+        */
+       public function getExternalUnl () {
+               // Get array
+               $unlData = $this->getUnlData();
+
+               // Is the element there?
+               if (!isset($unlData[NodeInformationDatabaseWrapper::DB_COLUMN_EXTERNAL_UNL])) {
+                       // Is not there
+                       throw new MissingArrayElementsException(array($this, 'unlData', array(NodeInformationDatabaseWrapper::DB_COLUMN_EXTERNAL_UNL)), self::EXCEPTION_ARRAY_ELEMENTS_MISSING);
+               } elseif ($unlData[NodeInformationDatabaseWrapper::DB_COLUMN_EXTERNAL_UNL] == 'invalid') {
+                       // Is not valid/method to early used
+                       throw new BadMethodCallException(sprintf('unlData[%s] is invalid. Maybe called this method to early?', NodeInformationDatabaseWrapper::DB_COLUMN_EXTERNAL_UNL));
+               }
+
+               // Return it
+               return $unlData[NodeInformationDatabaseWrapper::DB_COLUMN_EXTERNAL_UNL];
+       }
+
+       /**
+        * Getter for internal UNL
+        *
+        * @return      $internalUnl    Internal UNL
+        * @throws      MissingArrayElementsException   If DB_COLUMN_INTERNAL_UNL is missing
+        */
+       public function getInternalUnl () {
+               // Get array
+               $unlData = $this->getUnlData();
+
+               // Is the element there?
+               if (!isset($unlData[NodeInformationDatabaseWrapper::DB_COLUMN_INTERNAL_UNL])) {
+                       // Is not there
+                       throw new MissingArrayElementsException(array($this, 'unlData', array(NodeInformationDatabaseWrapper::DB_COLUMN_INTERNAL_UNL)), self::EXCEPTION_ARRAY_ELEMENTS_MISSING);
+               } elseif ($unlData[NodeInformationDatabaseWrapper::DB_COLUMN_INTERNAL_UNL] == 'invalid') {
+                       // Is not valid/method to early used
+                       throw new BadMethodCallException(sprintf('unlData[%s] is invalid. Maybe called this method to early?', NodeInformationDatabaseWrapper::DB_COLUMN_INTERNAL_UNL));
+               }
+
+               // Return it
+               return $unlData[NodeInformationDatabaseWrapper::DB_COLUMN_INTERNAL_UNL];
+       }
+
+}
index 4d8dfd58c4675e1b0fc8b5bef694cf11e569e3f0..d8acae0b6479c31eb1eb2b25092b8e465eb9ca0e 100644 (file)
@@ -86,7 +86,7 @@ class HubBootNode extends BaseHubNode implements NodeHelper, Registerable {
                        // Is the port the same?
                        if ($bootPort == $ourPort) {
                                // It is the same!
-                               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BOOTSTRAP: UNL matches bootstrap node ' . $this->getBootUniversalNodeLocator() . '.');
+                               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BOOTSTRAP: UNL matches bootstrap node "%s".', $this->getBootUniversalNodeLocator()));
 
                                // Now, does the mode match
                                if (FrameworkBootstrap::getRequestInstance()->getRequestElement('mode') == self::NODE_TYPE_BOOT) {
@@ -94,15 +94,15 @@ class HubBootNode extends BaseHubNode implements NodeHelper, Registerable {
                                        self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BOOTSTRAP: Our node is a valid bootstrap node.');
                                } else {
                                        // Output warning
-                                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BOOTSTRAP: WARNING: Mismatching mode ' . FrameworkBootstrap::getRequestInstance()->getRequestElement('mode') . '!=' . BaseHubNode::NODE_TYPE_BOOT . ' detected.');
+                                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BOOTSTRAP: WARNING: Mismatching mode %s!=%s detected.', FrameworkBootstrap::getRequestInstance()->getRequestElement('mode'), BaseHubNode::NODE_TYPE_BOOT));
                                }
                        } else {
                                // IP does match, but no port
-                               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BOOTSTRAP: WARNING: Our UNL ' . $unl . ' does match a known bootstrap-node but not the port ' . $ourPort . '/' . $bootPort . '.');
+                               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BOOTSTRAP: WARNING: Our UNL "%s" does match a known bootstrap-node but not the port %d/%d.', $unl, $ourPort, $bootPort));
                        }
                } else {
                        // Node does not match any know bootstrap-node
-                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BOOTSTRAP: WARNING: Our UNL ' . $unl . ' does not match any known bootstrap-nodes.');
+                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BOOTSTRAP: WARNING: Our UNL "%s" does not match any known bootstrap-nodes.', $unl));
                }
 
                // Enable acceptance of announcements
index d3282002dbe55ee404eba4be17d31bbb4f43a9f5..7d653a78643fa3a80e52dce53bf11c874fc511d4 100644 (file)
@@ -202,7 +202,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria {
                                $this->bootUnl = $unl;
 
                                // Output message
-                               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BOOTSTRAP: ' . __FUNCTION__ . ': UNL matches remote address ' . $unl . '.');
+                               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BOOTSTRAP: UNL matches remote address "%s".', $unl));
 
                                // Stop further searching
                                break;
@@ -217,7 +217,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria {
                                $this->bootUnl = $unl;
 
                                // Output message
-                               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BOOTSTRAP: ' . __FUNCTION__ . ': UNL matches listen address ' . $unl . '.');
+                               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BOOTSTRAP: UNL matches listening UNL "%s".', $unl));
 
                                // Stop further searching
                                break;
@@ -237,15 +237,15 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria {
                // Is "cache" set?
                if (!isset($GLOBALS[__METHOD__])) {
                        // Get the UNL array back
-                       $unlData = $this->getUniversalNodeLocatorArray();
+                       $unlInstance = $this->determineUniversalNodeLocator();
 
                        // There are 2 UNLs, internal and external.
                        if ($this->getConfigInstance()->getConfigEntry('allow_publish_internal_address') == 'N') {
                                // Public "external" UNL address
-                               $GLOBALS[__METHOD__] = $unlData[NodeInformationDatabaseWrapper::DB_COLUMN_EXTERNAL_UNL];
+                               $GLOBALS[__METHOD__] = $unlInstance->getExternalUnl();
                        } else {
                                // Non-public "internal" UNL address
-                               $GLOBALS[__METHOD__] = $unlData[NodeInformationDatabaseWrapper::DB_COLUMN_INTERNAL_UNL];
+                               $GLOBALS[__METHOD__] = $unlInstance->getInternalUnl();
                        }
                } // END - if
 
@@ -758,42 +758,19 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria {
                // Debug message
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: CALLED!');
 
-               // Determine UNL based on this node:
-               // 1) Get discovery class
-               $discoveryInstance = ObjectFactory::createObjectByConfiguredName('unl_discovery_class');
-
-               // 2) "Determine" it
-               $unlInstance = $discoveryInstance->discoverUniversalNodeLocatorByNode($this);
-
-               // 3) Return it
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: unlInstance= ' . $unlInstance->__toString() . ' - EXIT!');
-               return $unlInstance;
-       }
-
-       /**
-        * "Getter" for an array of an instance of a LocateableNode class
-        *
-        * @return      $unlData        An array from an instance of a LocateableNode class for this node
-        */
-       public final function getUniversalNodeLocatorArray () {
-               // Debug message
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: CALLED!');
-
-               // Get the Universal Node Locator (UNL) instance
-               $unlInstance = $this->determineUniversalNodeLocator();
+               // Is there cache?
+               if (!isset($GLOBALS[__METHOD__])) {
+                       // Determine UNL based on this node:
+                       // 1) Get discovery class
+                       $discoveryInstance = ObjectFactory::createObjectByConfiguredName('unl_discovery_class');
 
-               // Make sure the instance is valid
-               if (!$unlInstance instanceof LocateableNode) {
-                       // No valid instance, so better debug this
-                       $this->debugBackTrace('unlInstance[' . gettype($unlInstance) . ']=' . $unlInstance);
+                       // 2) "Determine" it
+                       $GLOBALS[__METHOD__] = $discoveryInstance->discoverUniversalNodeLocatorByNode($this);
                } // END - if
 
-               // ... and the array from it
-               $unlData = $unlInstance->getUnlData();
-
                // Return it
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: EXIT!');
-               return $unlData;
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: unlInstance= ' . $GLOBALS[__METHOD__]->__toString() . ' - EXIT!');
+               return $GLOBALS[__METHOD__];
        }
 
        /**
diff --git a/application/hub/classes/unl/.htaccess b/application/hub/classes/unl/.htaccess
deleted file mode 100644 (file)
index 3a42882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
diff --git a/application/hub/classes/unl/class_UniversalNodeLocator.php b/application/hub/classes/unl/class_UniversalNodeLocator.php
deleted file mode 100644 (file)
index 8618050..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-<?php
-// Own namespace
-namespace Hub\Locator\Node;
-
-// Import application-specific stuff
-use Hub\Database\Frontend\Node\Information\NodeInformationDatabaseWrapper;
-use Hub\Generic\BaseHubSystem;
-
-/**
- * A class for UNLs (Universal Node Locator)
- *
- * @author             Roland Haeder <webmaster@ship-simu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 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 UniversalNodeLocator extends BaseHubSystem implements LocateableNode {
-       //------- UNL parts -------
-       // Protocol
-       const UNL_PART_PROTOCOL = 'protocol';
-       // Address
-       const UNL_PART_ADDRESS  = 'address';
-       // Extra part
-       const UNL_PART_EXTRA    = 'extra';
-       // Port (if any)
-       const UNL_PART_PORT     = 'port';
-
-       /**
-        * UNL data array
-        */
-       private $unlData = array();
-
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-       }
-
-       /**
-        * Creates an instance of this class
-        *
-        * @param       $current                An array with "raw" data from the database layer for the UNL. This parameter is optional.
-        * @return      $unlInstance    An instance of a LocateableNode class
-        */
-       public final static function createUniversalNodeLocator (array $current = array()) {
-               // Get new instance
-               $unlInstance = new UniversalNodeLocator();
-
-               // Init instance
-               $unlInstance->initUniversalNodeLocator($current);
-
-               // Return the prepared instance
-               return $unlInstance;
-       }
-
-       /**
-        * Initializes the UNL instance by givena array. If an entry is found, it
-        * will be copied, otherwise the entry is set empty.
-        *
-        * @param       $current        An array with "raw" data from the database layer for the UNL. This parameter is optional.
-        * @return      void
-        */
-       private function initUniversalNodeLocator (array $current = array()) {
-               // Init UNL array
-               $this->unlData = array();
-
-               // Copy all found entries
-               foreach (array(
-                       NodeInformationDatabaseWrapper::DB_COLUMN_NODE_ID,
-                       NodeInformationDatabaseWrapper::DB_COLUMN_SESSION_ID,
-                       NodeInformationDatabaseWrapper::DB_COLUMN_PRIVATE_KEY_HASH,
-                       NodeInformationDatabaseWrapper::DB_COLUMN_NODE_MODE,
-                       NodeInformationDatabaseWrapper::DB_COLUMN_INTERNAL_UNL,
-                       NodeInformationDatabaseWrapper::DB_COLUMN_EXTERNAL_UNL) as $key) {
-                               // Init entry
-                               $this->unlData[$key] = NULL;
-
-                               // Is the key found?
-                               if (isset($current[$key])) {
-                                       // The copy the entry
-                                       $this->unlData[$key] = $current[$key];
-                               } // END - if
-               } // END - foreach
-       }
-
-       /**
-        * Getter for UNL data array
-        *
-        * @return      $unlData        An array with UNL data
-        */
-       public final function getUnlData () {
-               return $this->unlData;
-       }
-}
-
-// [EOF]
-?>
index dbac138ca2174df54ad4afe1b1a9cc118c519e45..4b657345e80035c0edce036bdb578f7c9c1b820e 100644 (file)
@@ -129,13 +129,6 @@ interface NodeHelper extends Helper, AddableCriteria {
         */
        function determineUniversalNodeLocator ();
 
-       /**
-        * "Getter for an array of an instance of a LocateableNode class
-        *
-        * @return      $unlData        An array of an instance of a LocateableNode class
-        */
-       function getUniversalNodeLocatorArray ();
-
        /**
         * Updates/refreshes node data (e.g. state).
         *
index dd45658d8f1575420993d3caebf6c8d4dfda8ac7..c9c98454abeeaa7ffbaa371155d444887224dc1f 100644 (file)
@@ -28,7 +28,20 @@ use Hub\Generic\HubInterface;
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 interface LocateableNode extends HubInterface {
-}
+       /**
+        * Getter for external UNL
+        *
+        * @return      $externalUnl    External UNL
+        * @throws      MissingArrayElementsException   If DB_COLUMN_EXTERNAL_UNL is missing
+        */
+       function getExternalUnl ();
+
+       /**
+        * Getter for internal UNL
+        *
+        * @return      $internalUnl    Internal UNL
+        * @throws      MissingArrayElementsException   If DB_COLUMN_INTERNAL_UNL is missing
+        */
+       function getInternalUnl ();
 
-// [EOF]
-?>
+}
index 5b353ce79f3969244717e1f4f17efb62d591fc2a..a9bfc8c5de7e3b9e81db6507431211d798723fef 100755 (executable)
@@ -1,4 +1,4 @@
 #!/bin/sh
 
 # Really lame ...
-find application/ -type f -print0 | xargs -0 sed -i 's/2015 Hub/2016 Hub/g'
+find application/ -type f -print0 | xargs -0 sed -i 's/2015 Hub/2017 Hub/g'
diff --git a/core b/core
index d9d2b0266fc21f4664087a8488d05c6d6068073b..aa76ddf7f1d5d302f1d752efcd113515ecf152a2 160000 (submodule)
--- a/core
+++ b/core
@@ -1 +1 @@
-Subproject commit d9d2b0266fc21f4664087a8488d05c6d6068073b
+Subproject commit aa76ddf7f1d5d302f1d752efcd113515ecf152a2