*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright(c) 2007 - 2009 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
*
* This program is free software: you can redistribute it and/or modify
// Call parent constructor
parent::__construct(__CLASS__);
- // Set description
- $this->setObjectDescription("Application-Helper");
-
- // Create an unique ID
- $this->createUniqueID();
-
// Tidy up a little
$this->removeSystemArray();
+ $this->removeNumberFormaters();
}
/**
* Getter for an instance of this class
*
- * @return $thisInstance An instance of this class
+ * @return $thisInstance An instance of this class
*/
public final static function getInstance () {
// Is the instance there?
/**
* Setter for the version number
*
- * @param $appVersion The application's version number
+ * @param $appVersion The application's version number
* @return void
*/
public final function setAppVersion ($appVersion) {
// Cast and set it
- $appVersion = (string) $appVersion;
- $this->appVersion = $appVersion;
+ $this->appVersion = (string) $appVersion;
}
/**
/**
* Setter for human-readable name
*
- * @param $appName The application's human-readable name
+ * @param $appName The application's human-readable name
* @return void
*/
public final function setAppName ($appName) {
// Cast and set it
- $appName = (string) $appName;
- $this->appName = $appName;
+ $this->appName = (string) $appName;;
}
/**
/**
* Setter for short uni*-like name
*
- * @param $shortName The application's short uni*-like name
+ * @param $shortName The application's short uni*-like name
* @return void
*/
public final function setAppShortName ($shortName) {
// Cast and set it
- $shortName = (string) $shortName;
- $this->shortName = $shortName;
+ $this->shortName = (string) $shortName;
}
/**
* @return void
*/
public final function entryPoint () {
- // Get a core loop instance
- $hubInstance = HubCoreLoop::createHubCoreLoop();
+ // --------------------- Init phase ---------------------
+ // The default node-mode is from our configuration
+ $nodeMode = $this->getConfigInstance()->readConfig('node_mode');
+
+ // Prepare a ConsoleRequest class to catch all parameters
+ $requestInstance = ObjectFactory::createObjectByName('ConsoleRequest');
- // Output some text
- $hubInstance->outputIntro();
+ // Is the node 'mode' parameter set?
+ if ($requestInstance->isRequestElementSet('mode')) {
+ // Then use this which overrides the config entry temporarily
+ $nodeMode = $requestInstance->getRequestElement('mode');
+ } // END - if
- // Contact the master hub
- $hubInstance->contactMasterHub();
+ // Now convert the node-mode in a class name
+ $className = 'Hub' . $this->convertToClassName($nodeMode) . 'Node';
- // The main loop begins here
- $hubInstance->coreLoop();
+ // And try to instance it
+ $nodeInstance = ObjectFactory::createObjectByName($className);
+
+ // --------------------- Bootstrapping phase ---------------------
+ // Try to bootstrap the node and pass the request instance to it
+ $nodeInstance->doBootstrapping($requestInstance);
+ }
- // Shutdown the hub
- $hubInstance->shutdownHub();
+ /**
+ * Handle the indexed array of fatal messages and puts them out in an
+ * acceptable fasion
+ *
+ * @param $messageList An array of fatal messages
+ * @return void
+ */
+ public function handleFatalMessages (array $messageList) {
+ // Walk through all messages
+ foreach ($messageList as $message) {
+ die("MSG:".$message);
+ }
}
/**
- * Getter for master template name
+ * Builds the master template's name
*
- * @return $masterTemplate Name of the master template
+ * @return $masterTemplateName Name of the master template
*/
- public final function getMasterTemplate () {
- return "hub_main";
+ public function buildMasterTemplateName () {
+ return "node_main";
}
}