]> git.mxchange.org Git - hub.git/commitdiff
Initial coding of hub node-mode.
authorRoland Häder <roland@mxchange.org>
Tue, 24 Mar 2009 07:32:57 +0000 (07:32 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 24 Mar 2009 07:32:57 +0000 (07:32 +0000)
- Directories created which should hold the classes for our different node types
  (aka. node-mode)
- README extended how to launch the hub...
- Exception handler does now output a warning message if you did not throw an
  exception which inherits our FrameworkException exception class

.gitattributes
application/hub/class_ApplicationHelper.php
application/hub/config.php
application/hub/exceptions.php
application/hub/main/nodes/.htaccess [new file with mode: 0644]
application/hub/main/nodes/boot/.htaccess [new file with mode: 0644]
application/hub/main/nodes/list/.htaccess [new file with mode: 0644]
application/hub/main/nodes/master/.htaccess [new file with mode: 0644]
application/hub/main/nodes/regular/.htaccess [new file with mode: 0644]
docs/README

index 765e0479320b890f31865c24696f92c4699656d4..b2d835ffacc5312c38ce7c0e6a9506d1e391e1e6 100644 (file)
@@ -12,6 +12,11 @@ application/hub/init.php -text
 application/hub/interfaces/.htaccess -text
 application/hub/loader.php -text
 application/hub/main/.htaccess -text
+application/hub/main/nodes/.htaccess -text
+application/hub/main/nodes/boot/.htaccess -text
+application/hub/main/nodes/list/.htaccess -text
+application/hub/main/nodes/master/.htaccess -text
+application/hub/main/nodes/regular/.htaccess -text
 application/hub/starter.php -text
 /clear-cache.sh -text
 db/.htaccess -text
index 85c51d124c9b0ac0be7f1fd10bb59bd2e321beb8..eb29ff7b16e6758c7e8f7312f0304c5ec6f11c2c 100644 (file)
@@ -153,7 +153,23 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
         * @return      void
         */
        public final function entryPoint () {
-               trigger_error(__METHOD__.": Cleared!");
+               // The default node mode is from config. This mode is being "transfered" into a class name
+               $nodeMode = $this->getConfigInstance()->readConfig('node_mode');
+
+               // Prepare a ConsoleRequest class to catch all parameters
+               $requestInstance = ObjectFactory::createObjectByName('ConsoleRequest');
+
+               // 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
+
+               // Now convert the node-mode in a class name
+               $className = 'Hub' . $this->convertToClassName($nodeMode) . 'Node';
+
+               // And try to instance it
+               $nodeInstance = ObjectFactory::createObjectByName($className);
        }
 
        /**
@@ -176,7 +192,7 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
         * @return      $masterTemplateName             Name of the master template
         */
        public function buildMasterTemplateName () {
-               return "hub_main";
+               return "node_main";
        }
 }
 
index 6db0076feba6d13a560e7106250e3df6ba45c5cf..dfa7194737b51bf897c3d98552f4b71d8305c1ef 100644 (file)
 // Some hub-specific configuration like port hostname where we will listen, etc.
 $cfg = FrameworkConfiguration::getInstance();
 
-// CFG: HUB-LISTEN-ADDR
-$cfg->setConfigEntry("hub_listen_addr", "0.0.0.0");
+// CFG: NODE-LISTEN-ADDR
+$cfg->setConfigEntry('node_listen_addr', "0.0.0.0");
 
-// CFG: HUB-LISTEN-PORT (zero = auto-choose)
-$cfg->setConfigEntry("hub_listen_port", 9060);
+// CFG: NODE-LISTEN-PORT
+$cfg->setConfigEntry('node_listen_port', 9060);
+
+// CFG: NODE-MODE (can be 'regular', 'list', 'master' or 'boot', default is 'regular')
+$cfg->setConfigEntry('node_mode', "regular");
 
 // CFG: TEMPLATE-ENGINE
-$cfg->setConfigEntry("tpl_engine", "ConsoleOutput");
+$cfg->setConfigEntry('tpl_engine', "ConsoleOutput");
 
 // CFG: WEB-ENGINE
-$cfg->setConfigEntry("web_engine", "DebugConsoleOutput");
+$cfg->setConfigEntry('web_engine', "DebugConsoleOutput");
 
 // CFG: DEBUG-ENGINE
-$cfg->setConfigEntry("debug_engine", "DebugErrorLogOutput");
+$cfg->setConfigEntry('debug_engine', "DebugErrorLogOutput");
 
 // CFG: WEB-CONTENT-TYPE
-$cfg->setConfigEntry("web_content_type", "");
+$cfg->setConfigEntry('web_content_type', "");
 
 // [EOF]
 ?>
index 69284bdcc8239d41224fc6aaa79448b20f1df5ef..c8fcdcb275a09cc5b435f5d832bcdd0ccea58528 100644 (file)
@@ -32,14 +32,14 @@ function hub_exception_handler ($exceptionInstance) {
                // Get 3 call levels
                $backTrace = "";
                for ($idx = 0; $idx < 3; $idx++) {
+                       // Copy array for argument analysis and init variable
                        $traceArray = $trace[$idx];
+                       $argsString = "";
 
                        // Convert arguments type into human-readable
-                       $args = $traceArray['args'];
-                       $argsString = "";
-                       foreach ($args as $arg) {
-                               $argsString .= ", ".gettype($arg);
-                       }
+                       foreach ($traceArray['args'] as $arg) {
+                               $argsString .= ", " . gettype($arg);
+                       } // END - foreach
                        $argsString = substr($argsString, 2);
 
                        $backTrace .= sprintf("---------- Pos %d: ----------
@@ -55,7 +55,7 @@ Line   : %d\n",
                                basename($traceArray['file']),
                                $traceArray['line']
                        );
-               }
+               } // END - for
 
                // Construct the message
                $message = sprintf("--------------------------------------------------------------------------------
@@ -79,7 +79,12 @@ Backtrace:
                );
 
                // Output the message
-               print $message;
+               print($message);
+       } else {
+               // Invalid exception instance detected! Do *only* throw exceptions that
+               // extends our own exception 'FrameworkException' to get such nice
+               // outputs like above.
+               print("exceptionInstance is invalid! Please inform the core developer team.\n");
        }
 }
 
diff --git a/application/hub/main/nodes/.htaccess b/application/hub/main/nodes/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/nodes/boot/.htaccess b/application/hub/main/nodes/boot/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/nodes/list/.htaccess b/application/hub/main/nodes/list/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/nodes/master/.htaccess b/application/hub/main/nodes/master/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/nodes/regular/.htaccess b/application/hub/main/nodes/regular/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
index f196a1dac5777c1011884ad10acf0fc35ce365db..2f4c925e21647b3d4b07fe3606fc50daf6f8089a 100644 (file)
@@ -1,4 +1,15 @@
 README
 ------
 
-This file needs some extending... ;)
+1.) How to launch the hub:
+--------------------------
+
+At the current stage of code base you need to launch the hub by entering the
+following command at at command prompt (Win32) or console (Linux etc.) in the
+root directory of this script:
+
+php index.php app=hub
+
+Another other (later added) parameters should be added after app=hub in the same
+way due to the "design" of the inc/includes.php script. We need to change that
+anyway.