]> git.mxchange.org Git - hub.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sun, 22 Nov 2020 17:58:49 +0000 (18:58 +0100)
committerRoland Häder <roland@mxchange.org>
Sun, 22 Nov 2020 17:58:49 +0000 (18:58 +0100)
- moved $listInstance from monothlithic BaseFrameworkSystem to proper classes
- NodePingTask had compared to all other tasks a parameter in factory method,
  now this is initialized within the factory method
- updated core framework

Signed-off-by: Roland Häder <roland@mxchange.org>
application/hub/classes/discovery/recipient/class_BaseRecipientDiscovery.php
application/hub/classes/filter/task/node/class_NodeTaskHandlerInitializerFilter.php
application/hub/classes/tasks/node/ping/class_NodePingTask.php
core

index aada8e8386047066998b3a0e5a98515bb906d7e3..0591f214f9786dc70b9e16b93cec5da85e3f6246 100644 (file)
@@ -2,11 +2,14 @@
 // Own namespace
 namespace Org\Shipsimu\Hub\Discovery\Recipient;
 
-// Import framework stuff
+// Import application-specific stuff
 use Org\Shipsimu\Hub\Discovery\Node\BaseNodeDiscovery;
 use Org\Shipsimu\Hub\Discovery\Recipient\DiscoverableRecipient;
 use Org\Shipsimu\Hub\Factory\Lists\Recipient\RecipientListFactory;
 
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Lists\Listable;
+
 /**
  * A PackageRecipient discovery class
  *
@@ -30,6 +33,11 @@ use Org\Shipsimu\Hub\Factory\Lists\Recipient\RecipientListFactory;
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 abstract class BaseRecipientDiscovery extends BaseNodeDiscovery implements DiscoverableRecipient {
+       /**
+        * Instance of the list
+        */
+       private $listInstance = NULL;
+
        /**
         * Protected constructor
         *
@@ -48,6 +56,25 @@ abstract class BaseRecipientDiscovery extends BaseNodeDiscovery implements Disco
                $this->setListInstance($listInstance);
        }
 
+       /**
+        * Setter for the list instance
+        *
+        * @param       $listInstance   A list of Listable
+        * @return      void
+        */
+       protected final function setListInstance (Listable $listInstance) {
+               $this->listInstance = $listInstance;
+       }
+
+       /**
+        * Getter for the list instance
+        *
+        * @return      $listInstance   A list of Listable
+        */
+       protected final function getListInstance () {
+               return $this->listInstance;
+       }
+
        /**
         * "Getter" for recipient iterator
         *
index dd980171d32da5b96b708b56d55a485739606208..d9ae4421da3c7330ce0e6696b04566947285b312 100644 (file)
@@ -151,11 +151,8 @@ class NodeTaskHandlerInitializerFilter extends BaseNodeFilter implements Filtera
                // Register it
                $handlerInstance->registerTask('update_check', $taskInstance);
 
-               // Get list instance here
-               $listInstance = $nodeInstance->getListenerPoolInstance()->getPoolEntriesInstance();
-
                // Prepare a ping task
-               $taskInstance = ObjectFactory::createObjectByConfiguredName('node_ping_task_class', array($listInstance));
+               $taskInstance = ObjectFactory::createObjectByConfiguredName('node_ping_task_class');
 
                // Register it
                $handlerInstance->registerTask('ping', $taskInstance);
index 7d952ee28eec5819e3c5aa64d3151b71b4eed6e9..c16243450805f94c3f73b0bc7a1ce05aaa3b8845 100644 (file)
@@ -3,6 +3,7 @@
 namespace Org\Shipsimu\Hub\Node\Ping;
 
 // Import application-specific stuff
+use Org\Shipsimu\Hub\Factory\Node\NodeObjectFactory;
 use Org\Shipsimu\Hub\Task\BaseHubTask;
 
 // Import framework stuff
@@ -27,7 +28,7 @@ use Org\Mxchange\CoreFramework\Visitor\Visitor;
  * (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
+ * but WITHOUT ANY WARRANTY; without even the6 implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
@@ -35,6 +36,11 @@ use Org\Mxchange\CoreFramework\Visitor\Visitor;
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 class NodePingTask extends BaseHubTask implements Taskable, Visitable {
+       /**
+        * Instance of the list
+        */
+       private $listInstance = NULL;
+
        /**
         * Protected constructor
         *
@@ -48,26 +54,44 @@ class NodePingTask extends BaseHubTask implements Taskable, Visitable {
        /**
         * Creates an instance of this class
         *
-        * @param       $listInstance   A Listable instance
         * @return      $taskInstance   An instance of a Taskable/Visitable class
         */
-       public static final function createNodePingTask (Listable $listInstance) {
+       public static final function createNodePingTask () {
                // Get new instance
                $taskInstance = new NodePingTask();
 
-               // Se the list instance in this task
-               $taskInstance->setListInstance($listInstance);
+               // Get node instance
+               $nodeInstance = NodeObjectFactory::createNodeInstance();
 
-               // Init ping iterator instance
-               $iteratorInstance = $listInstance->getListIterator();
+               // Get list instance from it
+               $listInstance = $nodeInstance->getListenerPoolInstance()->getPoolEntriesInstance();
 
-               // Set it as well
-               $taskInstance->setIteratorInstance($iteratorInstance);
+               // Set the list instance in this task
+               $taskInstance->setListInstance($listInstance);
 
                // Return the prepared instance
                return $taskInstance;
        }
 
+       /**
+        * Setter for the list instance
+        *
+        * @param       $listInstance   A list of Listable
+        * @return      void
+        */
+       protected final function setListInstance (Listable $listInstance) {
+               $this->listInstance = $listInstance;
+       }
+
+       /**
+        * Getter for the list instance
+        *
+        * @return      $listInstance   A list of Listable
+        */
+       protected final function getListInstance () {
+               return $this->listInstance;
+       }
+
        /**
         * Accepts the visitor to process the visitor
         *
diff --git a/core b/core
index df3701b7230349ee2bc711caba98809ac943363c..8c96c0cfa128e4d536788feec87d60719db198fa 160000 (submodule)
--- a/core
+++ b/core
@@ -1 +1 @@
-Subproject commit df3701b7230349ee2bc711caba98809ac943363c
+Subproject commit 8c96c0cfa128e4d536788feec87d60719db198fa