*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
/**
* 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;
}
// 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);
/**
* 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();