]> git.mxchange.org Git - hub.git/blobdiff - application/hub/class_ApplicationHelper.php
Double-quotes rewritten to single-quotes
[hub.git] / application / hub / class_ApplicationHelper.php
index 2ec172bf8ab3cd1a89db8b8cae4ab47b1f3b07ff..6f29c8d9219ef148e2d048b1106fcc50464313ef 100644 (file)
@@ -22,7 +22,7 @@
  *
  * @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
@@ -68,20 +68,15 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
                // Call parent constructor
                parent::__construct(__CLASS__);
 
-               // Set description
-               $this->setObjectDescription("Application-Helper");
-
-               // Create an unique ID
-               $this->generateUniqueId();
-
                // 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?
@@ -104,13 +99,12 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
        /**
         * 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;
        }
 
        /**
@@ -125,13 +119,12 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
        /**
         * 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;;
        }
 
        /**
@@ -146,13 +139,12 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
        /**
         * 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;
        }
 
        /**
@@ -161,29 +153,28 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
         * @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');
 
-               // Output some text
-               $hubInstance->outputIntro();
+               // Prepare a ConsoleRequest class to catch all parameters
+               $requestInstance = ObjectFactory::createObjectByName('ConsoleRequest');
 
-               // Contact the master hub
-               $hubInstance->contactMasterHub();
+               // 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
 
-               // The main loop begins here
-               $hubInstance->coreLoop();
+               // Now convert the node-mode in a class name
+               $className = 'Hub' . $this->convertToClassName($nodeMode) . 'Node';
 
-               // Shutdown the hub
-               $hubInstance->shutdownHub();
-       }
+               // And try to instance it
+               $nodeInstance = ObjectFactory::createObjectByName($className);
 
-       /**
-        * Getter for master template name
-        *
-        * @return      $masterTemplate         Name of the master template
-        */
-       public final function getMasterTemplate () {
-               return "hub_main";
+               // --------------------- Bootstrapping phase ---------------------
+               // Try to bootstrap the node and pass the request instance to it
+               $nodeInstance->doBootstrapping($requestInstance);
        }
 
        /**
@@ -199,6 +190,15 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
                        die("MSG:".$message);
                }
        }
+
+       /**
+        * Builds the master template's name
+        *
+        * @return      $masterTemplateName             Name of the master template
+        */
+       public function buildMasterTemplateName () {
+               return "node_main";
+       }
 }
 
 // [EOF]