]> git.mxchange.org Git - hub.git/commitdiff
Is the XxxxDefaultController deprecated?
authorRoland Häder <roland@mxchange.org>
Sat, 18 Jul 2009 07:20:14 +0000 (07:20 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 18 Jul 2009 07:20:14 +0000 (07:20 +0000)
application/hub/class_ApplicationHelper.php
application/hub/config.php

index b15862e2dad0848b03c2e60a001c0c21d1938600..bc1f8c954fb7d3643fb42e6fa01e1f9479eb05f4 100644 (file)
@@ -153,9 +153,52 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
         * @return      void
         */
        public final function entryPoint () {
+               // Create a new request object
+               $requestInstance = ObjectFactory::createObjectByName('ConsoleRequest');
+
+               // Remember request instance here
+               $this->setRequestInstance($requestInstance);
+
+               // Default response is console
+               $response = 'console';
+               $responseType = 'console';
+
+               // Do we have another response?
+               if ($requestInstance->isRequestElementSet('request')) {
+                       // Then use it
+                       $response = strtolower($requestInstance->getRequestElement('request'));
+                       $responseType = $response;
+               } // END - if
+
+               // ... and a new response object
+               $responseClass = sprintf("%sResponse", $this->convertToClassName($response));
+               $responseInstance = ObjectFactory::createObjectByName($responseClass, array($this));
+
+               // Remember response instance here
+               $this->setResponseInstance($responseInstance);
+
+               // Get the parameter from the request
+               $commandName = $requestInstance->getRequestElement('page');
+
+               // If it is null then get default command
+               if (is_null($commandName)) {
+                       $commandName = $responseInstance->getDefaultCommand();
+               } // END - if
+
+               // Get a resolver
+               $resolverClass = sprintf("%sControllerResolver", $this->convertToClassName($responseType));
+               $resolverInstance = ObjectFactory::createObjectByName($resolverClass, array($commandName, $this));
+
+               // Get a controller instance as well
+               $this->controllerInstance = $resolverInstance->resolveController();
+
+               // Handle the request
+               $this->controllerInstance->handleRequest($requestInstance, $responseInstance);
                // ----------------------------- Init phase ---------------------------
+
                // The default node-mode is from our configuration
                $nodeMode = $this->getConfigInstance()->readConfig('node_mode');
+               die("Until here!\n");
 
                // Prepare a ConsoleRequest class to catch all parameters
                $requestInstance = ObjectFactory::createObjectByName('ConsoleRequest');
@@ -179,6 +222,9 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
 
                        // Set the app instance
                        $nodeInstance->setApplicationInstance($this);
+
+                       // Initialize all filters
+                       $nodeInstance->initializeFilters();
                } catch (ClassNotFoundException $e) {
                        // This exception means, the node mode is invalid.
                        // @TODO Can we rewrite this to app_die() ?
@@ -242,7 +288,7 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
         * @return      $masterTemplateName             Name of the master template
         */
        public function buildMasterTemplateName () {
-               return "node_main";
+               return 'node_main';
        }
 }
 
index 8065d1ec73e13c330846bcc2475896f1ddc35879..da92087ded5d074a6179051c6a080d04c5e0e052 100644 (file)
@@ -81,5 +81,11 @@ $cfg->setConfigEntry('client_udp_listener_class', "ClientUdpListenerDecorator");
 // CFG: CLIENT-POOL-CLASS
 $cfg->setConfigEntry('client_pool_class', "DefaultClientPool");
 
+// CFG: DEFAULT-CONSOLE-COMMAND
+$cfg->setConfigEntry('default_console_command', "main");
+
+// CFG: CONSOLE-CMD-RESOLVER-CLASS
+$cfg->setConfigEntry('console_cmd_resolver_class', "ConsoleCommandResolver");
+
 // [EOF]
 ?>