]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/helper/hub/connection/class_HubSelfConnectHelper.php
HubConnectionHelper is more a factory than a helper class, HelpableHub interface...
[hub.git] / application / hub / main / helper / hub / connection / class_HubSelfConnectHelper.php
index 53ce436500d25c52e28e7c179197b106334447a2..9f333fe21e76d5c327ccd956efe97fc312356f1d 100644 (file)
@@ -22,7 +22,7 @@
  * 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 HubSelfConnectHelper extends BaseHubHelper {
+class HubSelfConnectHelper extends BaseHubHelper implements HelpableHub {
        /**
         * Protected constructor
         *
@@ -46,13 +46,32 @@ class HubSelfConnectHelper extends BaseHubHelper {
                return $helperInstance;
        }
 
+       /**
+        * Loads the descriptor XML file
+        *
+        * @return      void
+        */
+       public function loadDescriptorXml () {
+               $this->partialStub('Please implement this method.');
+       }
+
        /**
         * Do the self-connect attempt by delivering a package to ourselfs
         *
         * @return      void
         */
-       public function doSelfConnect () {
-               $this->partialStub('Not yet finished.');
+       public function sendPackage () {
+               // Sanity check: Is the node in the approx. state? (active)
+               $this->getNodeInstance()->getStateInstance()->validateNodeStateIsActive();
+
+               // Compile the template, this inserts the loaded node data into the gaps.
+               $this->getTemplateInstance()->compileTemplate();
+
+               // Get a singleton network package instance
+               $packageInstance = NetworkPackageFactory::createNetworkPackageInstance();
+
+               // Next, feed the content in. The network package class is a pipe-through class.
+               $packageInstance->enqueueRawDataFromTemplate($this);
        }
 }