/** * ExecutionAction executes the required methods */ function executionAction(&$amfbody) { $specialHandling = $amfbody->getSpecialHandling(); if (!$amfbody->isSpecialHandling() || $amfbody->isSpecialHandling(array('describeService', 'pageFetch', 'RemotingMessage'))) { $construct =& $amfbody->getClassConstruct(); $method = $amfbody->methodName; $args = $amfbody->getValue(); if ($specialHandling == 'describeService') { include_once AMFPHP_BASE . "util/DescribeService.php"; $ds = new DescribeService(); $results = $ds->describe($construct, $amfbody->className); } else { if ($specialHandling == 'pageFetch') { $args[count($args) - 2] = $args[count($args) - 2] - 1; $dataset = Executive::doMethodCall($amfbody, $construct, $method, $args); $results = array("cursor" => $args[count($args) - 2] + 1, "data" => $dataset); $amfbody->setMetadata('type', '__DYNAMIC_PAGE__'); } else { /* if(isset($construct->methodTable[$method]['pagesize'])) { //Check if counting method was overriden if(isset($construct->methodTable[$method]['countMethod'])) { $counter = $construct->methodTable[$method]['countMethod']; } else { $counter = $method . '_count'; } $dataset = Executive::doMethodCall($amfbody, $construct, $method, $args); // do the magic $count = Executive::doMethodCall($amfbody, $construct, $counter, $args); //Include the wrapper $results = array('class' => $amfbody->uriClassPath, 'method' => $amfbody->methodName, 'count' => $count, "args" => $args, "data" => $dataset); $amfbody->setMetadata('type', '__DYNAMIC_PAGEABLE_RESULTSET__'); $amfbody->setMetadata('pagesize', $construct->methodTable[$method]['pagesize']); */ //} //else //{ //The usual $time = microtime_float(); $results = Executive::doMethodCall($amfbody, $construct, $method, $args); // do the magic global $amfphp; $amfphp['callTime'] += microtime_float() - $time; //} } } if ($results !== '__amfphp_error') { if ($specialHandling == 'RemotingMessage') { $wrapper = new AcknowledgeMessage($amfbody->getMetadata("messageId"), $amfbody->getMetadata("clientId")); $wrapper->body = $results; $amfbody->setResults($wrapper); } else { $amfbody->setResults($results); } $amfbody->responseURI = $amfbody->responseIndex . "/onResult"; } return false; } elseif ($specialHandling == 'Ping') { $wrapper = new AcknowledgeMessage($amfbody->getMetadata("messageId"), $amfbody->getMetadata("clientId")); $amfbody->setResults($wrapper); $amfbody->responseURI = $amfbody->responseIndex . "/onResult"; } else { if ($specialHandling == 'pageRelease') { //Ignore PageAbleResult.release $amfbody->setResults(true); $amfbody->setMetaData('type', 'boolean'); $amfbody->responseURI = $amfbody->responseIndex . "/onResult"; return false; } } return true; }
/** * ExecutionAction executes the required methods */ function executionAction(&$amfbody) { $specialHandling = $amfbody->getSpecialHandling(); if (!$amfbody->isSpecialHandling() || $amfbody->isSpecialHandling(array('describeService', 'pageFetch'))) { $construct =& $amfbody->getClassConstruct(); $method = $amfbody->methodName; $args = $amfbody->getValue(); if (isset($construct->methodTable[$method]['fastArray']) && $construct->methodTable[$method]['fastArray'] == true) { $amfbody->setMetaData('fastArray', true); } if ($specialHandling == 'describeService') { include_once AMFPHP_BASE . "util/DescribeService.php"; $ds = new DescribeService(); $results = $ds->describe($construct, $amfbody->className); } else { if ($specialHandling == 'pageFetch') { $args[count($args) - 2] = $args[count($args) - 2] - 1; $dataset = Executive::doMethodCall($amfbody, $construct, $method, $args); $results = array("cursor" => $args[count($args) - 2] + 1, "data" => $dataset); $amfbody->setMetadata('type', '__DYNAMIC_PAGE__'); } else { if (isset($construct->methodTable[$method]['pagesize'])) { //Check if counting method was overriden if (isset($construct->methodTable[$method]['countMethod'])) { $counter = $construct->methodTable[$method]['countMethod']; } else { $counter = $method . '_count'; } $dataset = Executive::doMethodCall($amfbody, $construct, $method, $args); // do the magic $count = Executive::doMethodCall($amfbody, $construct, $counter, $args); //Include the wrapper $results = array('class' => $amfbody->uriClassPath, 'method' => $amfbody->methodName, 'count' => $count, "args" => $args, "data" => $dataset); $amfbody->setMetadata('type', '__DYNAMIC_PAGEABLE_RESULTSET__'); $amfbody->setMetadata('pagesize', $construct->methodTable[$method]['pagesize']); } else { //The usual $results = Executive::doMethodCall($amfbody, $construct, $method, $args); // do the magic } } } if ($results !== '__amfphp_error') { $amfbody->setResults($results); if (isset($construct->methodTable[$method]['returns']) && !isset($construct->methodTable[$method]['pagesize'])) { $amfbody->setMetadata('type', $construct->methodTable[$method]['returns']); } $amfbody->responseURI = $amfbody->responseIndex . "/onResult"; } return false; } else { if ($specialHandling == 'pageRelease') { //Ignore PageAbleResult.release $amfbody->setResults(true); $amfbody->setMetaData('type', 'boolean'); $amfbody->responseURI = $amfbody->responseIndex . "/onResult"; return false; } } return true; }