]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/discovery/node/class_UniversalNodeLocatorDiscovery.php
Added more UNL (Universal Node Locator) stuff:
[hub.git] / application / hub / main / discovery / node / class_UniversalNodeLocatorDiscovery.php
index b5c3126b4a2146fceee7d23b29ada9745295db86..8011b3aa60d8653464b62843822dc947f68dee14 100644 (file)
@@ -44,6 +44,24 @@ class UniversalNodeLocatorDiscovery extends BaseNodeDiscovery implements Discove
                // Return the prepared instance
                return $discoveryInstance;
        }
+
+       /**
+        * "Discovers" an instance of a LocateableNode class for given NodeHelper class
+        *
+        * @param       $nodeInstance   An instance of a NodeHelper class
+        * @return      $unlInstance    An instance of a LocateableNode class
+        */
+       public function discoverUniversalNodeLocatorByNode (NodeHelper $nodeInstance) {
+               /*
+                * First get an instance from the configured hub communication protocol
+                * type (which is mostly TCP, so you get a TcpProtocolResolver here).
+                */
+               $resolverInstance = ProtocolResolverFactory::createResolverFromConfiguredProtocol();
+
+               // Then resolve the node instance into an UNL instance
+               $unlInstance = $resolverInstance->resolveUniversalResourceLocatorFromNodeHelper($nodeInstance);
+               die(__METHOD__ . ':unlInstance=' . print_r($unlInstance, TRUE));
+       }
 }
 
 // [EOF]