]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/nodes/class_BaseHubNode.php
Rewritten class structure to make it more OOP-friendly (stupid comment, I know)
[hub.git] / application / hub / main / nodes / class_BaseHubNode.php
index 03f8f5052393fed1020b9200240cf14442966035..319ae987a6be10b0506c2409e7eeb1cc7df9b46e 100644 (file)
@@ -120,7 +120,7 @@ class BaseHubNode extends BaseFrameworkSystem implements Updateable {
         *
         * @return      void
         */
-       private function outputConsoleTeaser () {
+       protected function outputConsoleTeaser () {
                // Get the app instance (for shortening our code)
                $app = $this->getApplicationInstance();
 
@@ -139,12 +139,12 @@ class BaseHubNode extends BaseFrameworkSystem implements Updateable {
         * Do generic things for bootup phase. This can be e.g. checking if the
         * right node mode is selected for this hub's IP number.
         *
-        * @todo        This method is maybe not yet finished.
         * @return      void
+        * @todo        This method is maybe not yet finished.
         */
        protected function doGenericBootstrapping () {
-               // Finally output our teaser. This should be the last line!
-               $this->outputConsoleTeaser();
+               // @TODO Empty method
+               $this->partialStub('Add some generic bootstrap steps here.');
        }
 
        /**
@@ -152,10 +152,9 @@ class BaseHubNode extends BaseFrameworkSystem implements Updateable {
         * based on many pseudo-random data. On any later run, unless the id
         * got not removed from database, it will be restored from the database.
         *
-        * @param       $requestInstance        An instance of a Requestable class
         * @return      void
         */
-       public function acquireHubId (Requestable $requestInstance) {
+       protected function acquireHubId () {
                // Get a wrapper instance
                $wrapperInstance = ObjectFactory::createObjectByConfiguredName('node_info_db_wrapper_class');
 
@@ -164,7 +163,7 @@ class BaseHubNode extends BaseFrameworkSystem implements Updateable {
 
                // Search for the node number zero which is hard-coded the default
                $searchInstance->addCriteria(NodeInformationDatabaseWrapper::DB_COLUMN_NODE_NR, 1);
-               $searchInstance->addCriteria(NodeInformationDatabaseWrapper::DB_COLUMN_NODE_TYPE, $requestInstance->getRequestElement('mode'));
+               $searchInstance->addCriteria(NodeInformationDatabaseWrapper::DB_COLUMN_NODE_TYPE, $this->getRequestInstance()->getRequestElement('mode'));
                $searchInstance->setLimit(1);
 
                // Get a result back
@@ -185,7 +184,7 @@ class BaseHubNode extends BaseFrameworkSystem implements Updateable {
                        $rngInstance = ObjectFactory::createObjectByConfiguredName('rng_class');
 
                        // Generate a pseudo-random string
-                       $randomString = $rngInstance->randomString(255) . ':' . $requestInstance->getRequestElement('mode');
+                       $randomString = $rngInstance->randomString(255) . ':' . $this->getRequestInstance()->getRequestElement('mode');
 
                        // Get a crypto instance
                        $cryptoInstance = ObjectFactory::createObjectByConfiguredName('crypto_class');
@@ -194,7 +193,7 @@ class BaseHubNode extends BaseFrameworkSystem implements Updateable {
                        $this->setNodeId($cryptoInstance->hashString($cryptoInstance->encryptString($randomString)));
 
                        // Register the node id with our wrapper
-                       $wrapperInstance->registerNodeId($this, $requestInstance);
+                       $wrapperInstance->registerNodeId($this, $this->getRequestInstance());
 
                        // Output message
                        $this->getDebugInstance()->output('Created new node-id: ' . $this->getNodeId() . '');