X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=application%2Fhub%2Fmain%2Fhelper%2Fhub%2Fconnection%2Fclass_HubSelfConnectHelper.php;h=1f210fba22f5d2ff26e7189ba5e34929d6f3bcb8;hb=e10aa2b808ead315a4b8924f7b2ec2cc349ff414;hp=33289725a3ea9c5d5710faa0b2f09e83c87d48d6;hpb=3063bcd88a9ce09b88064593e890cfe5fc9f2204;p=hub.git diff --git a/application/hub/main/helper/hub/connection/class_HubSelfConnectHelper.php b/application/hub/main/helper/hub/connection/class_HubSelfConnectHelper.php index 33289725a..1f210fba2 100644 --- a/application/hub/main/helper/hub/connection/class_HubSelfConnectHelper.php +++ b/application/hub/main/helper/hub/connection/class_HubSelfConnectHelper.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Core Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @todo Find an interface for hub helper @@ -44,16 +44,12 @@ class HubSelfConnectHelper extends BaseHubHelper implements HelpableHub { /** * Creates the helper class * - * @param $nodeInstance An instance of a NodeHelper class * @return $helperInstance A prepared instance of this helper */ - public final static function createHubSelfConnectHelper (NodeHelper $nodeInstance) { + public static final function createHubSelfConnectHelper () { // Get new instance $helperInstance = new HubSelfConnectHelper(); - // Set the node instance - $helperInstance->setNodeInstance($nodeInstance); - // Return the prepared instance return $helperInstance; } @@ -67,20 +63,8 @@ class HubSelfConnectHelper extends BaseHubHelper implements HelpableHub { // Debug message $this->debugOutput('HELPER: Attempting self-connect...'); - // Get the application instance - $appInstance = Registry::getRegistry()->getInstance('app'); - // Get a XML template instance - $templateInstance = ObjectFactory::createObjectByConfiguredName('self_connect_template_class', array($appInstance)); - - // Disable language support - $templateInstance->enableLanguageSupport(false); - - /* - * Enable compacting/rewriting of the XML to save bandwidth from XML - * comments. This is expensive and should be avoided in general. - */ - $templateInstance->enableXmlCompacting(); + $templateInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance('node_self_connect_template_class'); // Set it for later use $this->setTemplateInstance($templateInstance); @@ -95,11 +79,12 @@ class HubSelfConnectHelper extends BaseHubHelper implements HelpableHub { /** * Do the self-connect attempt by delivering a package to ourselfs * + * @param $nodeInstance An instance of a NodeHelper class * @return void */ - public function sendPackage () { + public function sendPackage (NodeHelper $nodeInstance) { // Sanity check: Is the node in the approx. state? (active) - $this->getNodeInstance()->getStateInstance()->validateNodeStateIsActive(); + $nodeInstance->getStateInstance()->validateNodeStateIsActiveOrAnnounced(); // Compile the template, this inserts the loaded node data into the gaps. $this->getTemplateInstance()->compileTemplate();