Changeset 2751 for trunk/workflow
- Timestamp:
- 05/10/10 16:19:31 (14 years ago)
- Location:
- trunk/workflow
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/workflow/inc/class.run_activity.inc.php
r2591 r2751 198 198 */ 199 199 private $workflowSmarty = null; 200 /** 201 * @var object Log Object 202 * @access private 203 */ 204 private $logger = null; 200 205 201 206 /** … … 218 223 219 224 $this->workflowSmarty = &Factory::getInstance('workflow_smarty', false); 225 226 // never configure a log of type "firebug" here. This will make goAjax stop running well =( 227 $this->logger = &Factory::getInstance('Logger', array('file')); 220 228 221 229 // TODO: open a new connection to the database under a different username to allow privilege handling on tables … … 236 244 function go($activity_id=0, $iid=0, $auto=0) 237 245 { 246 $totalTime = microtime(true); 247 238 248 $result=Array(); 239 249 … … 431 441 432 442 /* BEGIN WORKFLOW MVC SETTINGS */ 433 $env = array( );//create settings vector443 $env = array(); //create settings vector 434 444 $env['view'] =& $smarty; //view layer instance 435 445 $env['template_file'] =& $_template_name; //template file to be shown 436 $env['dao'] =& wf_create_object('wf_db');//data access object instance446 $env['dao'] =& Factory::getInstance('wf_db'); //data access object instance 437 447 $env['workflow'] =& $GLOBALS['workflow']; //workflow environment information 438 448 $env['instance'] =& $instance; //process manager instance … … 441 451 $env['request'] =& $security->process($_REQUEST); //sanitizes input data from client 442 452 $env['factory'] =& Factory::getInstance('ProcessWrapperFactory'); //instantiation controller class 443 $env['natural'] =& wf_create_object('wf_natural'); //data access object instance for mainframe453 $env['natural'] =& Factory::getInstance('wf_natural'); //data access object instance for mainframe 444 454 /* END WORKFLOW MVC SETTINGS */ 445 455 … … 485 495 486 496 /* include the files */ 497 $processTime = microtime(true); 498 487 499 foreach ($_engineFiles as $_engineFile) 488 500 require $_engineFile; 501 502 $processTime = (microtime(true) - $processTime); 489 503 490 504 unset($GLOBALS['workflow_env']); … … 528 542 } 529 543 544 $totalTime = (microtime(true) - $totalTime); 545 546 $logTime = sprintf("GO [pid=%s,iid=%s,uid=%s,aid=%s] [eng=%ss,proc=%ss]", 547 $this->process_id, 548 $this->instance_id, 549 $GLOBALS['user'], 550 $this->activity_id, 551 number_format(($totalTime - $processTime),3), 552 number_format($processTime,3) ); 553 554 $this->logger->debug($logTime); 555 530 556 // TODO: process instance comments 531 532 557 $instructions = $this->runtime->handle_postUserCode(_DEBUG); 533 558 switch($instructions['action']) … … 593 618 function goAjax($activity_id=0, $iid=0, $auto=0) 594 619 { 620 $totalTime = microtime(true); 621 595 622 $result=Array(); 596 623 … … 702 729 703 730 /* BEGIN WORKFLOW MVC SETTINGS */ 704 $env = array( );//create settings vector705 $env['dao'] =& wf_create_object('wf_db');//data access object instance731 $env = array(); //create settings vector 732 $env['dao'] =& Factory::getInstance('wf_db'); //data access object instance 706 733 $env['workflow'] =& $GLOBALS['workflow']; //workflow environment information 707 734 $env['instance'] =& $instance; //process manager instance … … 710 737 $env['request'] =& $security->process($_REQUEST); //sanitizes input data from client 711 738 $env['factory'] =& Factory::newInstance('ProcessWrapperFactory'); //instantiation controller class 712 $env['natural'] =& wf_create_object('wf_natural'); //data access object instance for mainframe739 $env['natural'] =& Factory::getInstance('wf_natural'); //data access object instance for mainframe 713 740 /* END WORKFLOW MVC SETTINGS */ 714 741 … … 727 754 * the messages for the process factory instead of Workflow 728 755 * factory. Note that this is the same comment as the previous 729 * function... boooring.. =}756 * function... boooring.. 730 757 */ 731 758 Security::enable(); … … 734 761 $nc = &Factory::newInstance('NanoController'); 735 762 $nc->setClassPath(GALAXIA_PROCESSES . SEP . $this->process->getNormalizedName(). SEP . 'code'); 763 764 $processTime = microtime(true); 736 765 $nc->iterateOverVirtualRequests(); 766 $processTime = microtime(true) - $processTime; 767 737 768 $nc->outputResultData(); 738 769 unset($GLOBALS['workflow_env']); … … 740 771 if (!is_null($iid)) 741 772 $instance->instance->sync(); 773 774 $totalTime = microtime(true) - $totalTime; 775 776 $logTime = sprintf("GOAJAX [pid=%s,iid=%s,uid=%s,aid=%s] [eng=%ss,proc=%ss]", 777 $this->process_id, 778 $this->instance_id, 779 $GLOBALS['user'], 780 $this->activity_id, 781 number_format(($totalTime - $processTime),3), 782 number_format($processTime,3) ); 783 784 $this->logger->debug($logTime); 742 785 } 743 786 -
trunk/workflow/inc/local/classes/class.wf_natural.php
r795 r2751 1 1 <?php 2 require_once(PHPGW_SERVER_ROOT.SEP.'workflow'.SEP.'inc'.SEP.'natural'.SEP.'class.natural.php'); 2 /**************************************************************************\ 3 * eGroupWare * 4 * http://www.egroupware.org * 5 * -------------------------------------------- * 6 * This program is free software; you can redistribute it and/or modify it * 7 * under the terms of the GNU General Public License as published by the * 8 * Free Software Foundation; either version 2 of the License, or (at your * 9 * option) any later version. * 10 \**************************************************************************/ 11 12 require_once(PHPGW_SERVER_ROOT.SEP.'workflow'.SEP.'inc'.SEP.'natural'.SEP.'class.natural.php'); 13 14 /** 15 * Mainframe connection to workflow 16 * 17 * TODO - This class should be removed from here. Its based on a not 18 * public protocol, thus cannot be used for everybody. 19 * 20 * @package Workflow 21 * @subpackage local 22 * @license http://www.gnu.org/copyleft/gpl.html GPL 23 * @author Everton Flávio Rufino Seára 24 */ 25 class wf_natural extends Natural 26 { 3 27 4 28 /** 5 * Mainframe connection to workflow 6 * @author Everton Flávio Rufino Seára 7 * @package Workflow 8 * @subpackage local 9 * @license http://www.gnu.org/copyleft/gpl.html GPL 10 **/ 29 * @var object Log Object 30 * @access private 31 */ 32 private $logger = null; 11 33 12 class wf_natural extends Natural34 function __construct() 13 35 { 36 parent::Natural(); 14 37 15 function __construct() 16 { 17 parent::Natural(); 38 $natconf = array( 39 'mainframe_ip' => '', 40 'mainframe_port' => '', 41 'mainframe_key' => '', 42 'mainframe_password' => '', 43 'mainframe_environment' => '' 44 ); 18 45 19 $natconf = array( 20 'mainframe_ip' => '', 21 'mainframe_port' => '', 22 'mainframe_key' => '', 23 'mainframe_password' => '', 24 'mainframe_environment' => '' 25 ); 46 $nat_conf_values = &Factory::getInstance('workflow_wfruntime')->getConfigValues($natconf); 26 47 27 $nat_conf_values = $GLOBALS['workflow']['wf_runtime']->getConfigValues($natconf); 48 $this->setIPAddress($nat_conf_values['mainframe_ip']); 49 $this->setServerPort($nat_conf_values['mainframe_port']); 50 $this->setKey($nat_conf_values['mainframe_key']); 51 $this->setPassword($nat_conf_values['mainframe_password']); 52 $this->setApplication($nat_conf_values['mainframe_environment']); 28 53 29 $this->setIPAddress($nat_conf_values['mainframe_ip']); 30 $this->setServerPort($nat_conf_values['mainframe_port']); 31 $this->setKey($nat_conf_values['mainframe_key']); 32 $this->setPassword($nat_conf_values['mainframe_password']); 33 $this->setApplication($nat_conf_values['mainframe_environment']); 54 $this->logger = &Factory::getInstance('Logger', array('file')); 55 } 56 57 /** 58 * This method MUST be called before using execute method 59 * It specifies the natural sub-program to be accessed. 60 * 61 * @param Object $obj Object that specifies natural sub-program properties 62 * @return void 63 */ 64 public function configure($obj) 65 { 66 $this->obj = $obj; 67 68 $this->initialize($obj->name); 69 70 if ($obj->server != NULL){ 71 $this->setIPAddress($obj->server); 34 72 } 35 36 /** 37 * Method to configure the access to mainframe 38 * This method MUST be called before using execute method, else 'false' will be returned 39 * 40 * Only the first and second param are mandatory. 41 * 42 * @param String $subProgram - Name of sub-program 43 * @param String $inputParameter - Input parameters to sub-program 44 * 45 * @param String $ip - IP Address of Mainfram 46 * @param int $port - ServerPort to access the mainframe 47 * @param String $key - Access key (user) 48 * @param String $password - Key (user) password 49 * @param char $environment - Application environment access 'D' (development) or 'P' (production) 50 51 */ 52 53 public function configure($obj) 54 { 55 $this->obj = $obj; 56 57 $this->initialize($obj->name); 58 59 if ($obj->server != NULL){ 60 $this->setIPAddress($obj->server); 61 } 62 if ($obj->port != NULL){ 63 $this->setServerPort($obj->port); 64 } 65 if ($obj->key != NULL){ 66 $this->setKey($obj->key); 67 } 68 if ($obj->password != NULL){ 69 $this->setPassword($obj->password); 70 } 71 if ($obj->environment != NULL){ 72 $this->setApplication($obj->environment); 73 } 74 if ($obj->logon != NULL){ 75 $this->setLogon($obj->logon); 76 } 77 if ($obj->system != NULL){ 78 $this->setSystem($obj->system); 79 } 80 if ($obj->rc != NULL){ 81 $this->setRC($obj->rc); 82 } 73 if ($obj->port != NULL){ 74 $this->setServerPort($obj->port); 83 75 } 84 85 /* 86 87 public function configure($subProgram, $inputParameter, $ip = NULL, $port = NULL, 88 $key = NULL, $password = NULL, $environment = NULL, $logon = NULL, $system = NULL, $rc = NULL) 89 { 90 $this->initialize($subProgram, $inputParameter); 91 92 if ($ip != NULL){ 93 $this->setIPAddress($ip); 94 } 95 if ($port != NULL){ 96 $this->setServerPort($port); 97 } 98 if ($key != NULL){ 99 $this->setKey($key); 100 } 101 if ($password != NULL){ 102 $this->setPassword($password); 103 } 104 if ($environment != NULL){ 105 $this->setApplication($environment); 106 } 107 if ($logon != NULL){ 108 $this->setLogon($logon); 109 } 110 if ($system != NULL){ 111 $this->setSystem($system); 112 } 113 if ($rc != NULL){ 114 $this->setRC($rc); 115 } 116 76 if ($obj->key != NULL){ 77 $this->setKey($obj->key); 117 78 } 118 119 */ 120 121 /** 122 * Access and retrieve data from mainframe 123 * @return bool 124 */ 125 public function execute($inputParams = "") 126 { 127 return parent::execute($inputParams); 79 if ($obj->password != NULL){ 80 $this->setPassword($obj->password); 81 } 82 if ($obj->environment != NULL){ 83 $this->setApplication($obj->environment); 84 } 85 if ($obj->logon != NULL){ 86 $this->setLogon($obj->logon); 87 } 88 if ($obj->system != NULL){ 89 $this->setSystem($obj->system); 90 } 91 if ($obj->rc != NULL){ 92 $this->setRC($obj->rc); 128 93 } 129 94 } 95 96 /** 97 * Method for accessing and retrieving data from mainframe 98 * @return bool 99 */ 100 public function execute($inputParams = "") 101 { 102 // execute action and log wasted time 103 $totalTime = microtime(true); 104 $result = parent::execute($inputParams); 105 $totalTime = microtime(time) - $totalTime; 106 $log = sprintf("WF_NATURAL [subprogram=%s] [time=%ss]", 107 $this->obj->name, 108 number_format($totalTime,3) 109 ); 110 $this->logger->debug($log); 111 return $result; 112 } 113 } 130 114 ?> -
trunk/workflow/lib/factory/WorkflowFactory.php
r2591 r2751 63 63 $this->registerFileInfo('Thread', 'class.Thread.inc.php', 'inc'); 64 64 $this->registerFileInfo('Paging', 'class.Paging.inc.php', 'inc'); 65 $this->registerFileInfo('Logger', 'class.Logger.inc.php', 'inc'); 65 66 $this->registerFileInfo('FsUtils', 'class.fsutils.inc.php', 'inc'); 66 67 $this->registerFileInfo('UserPictureProvider', 'class.UserPictureProvider.inc.php', 'inc'); … … 168 169 169 170 171 /** 172 * TODO - This is another ATR - Alternative Technical Resource (common known 173 * as workaround) to allow instantiation of "wf" classes. Although these classes 174 * should have not been instanciated by the workflow module, some of them are 175 * instantiated by run_activity during every execution. =( 176 * In a new version of MVC these objects must be created by the Processes. 177 */ 178 $this->registerFileInfo('wf_natural', 'class.wf_natural.php', 'inc/local/classes'); 179 $this->registerFileInfo('wf_db', 'class.wf_db.php', 'inc/local/classes'); 180 181 170 182 /* ok. no more instances of this class.. */ 171 183 self::$_instantiated = true;
Note: See TracChangeset
for help on using the changeset viewer.