| 15 |
* $Id$ |
* $Id$ |
| 16 |
* |
* |
| 17 |
* $Log$ |
* $Log$ |
| 18 |
|
* Revision 1.18 2003/04/11 00:55:49 joko |
| 19 |
|
* updated 'datasource_handler_buildoptions': action dispatcher now aware of 'delete' |
| 20 |
|
* |
| 21 |
|
* Revision 1.17 2003/04/09 02:07:33 joko |
| 22 |
|
* CHANGE: renamed key 'classname' through 'nodename' |
| 23 |
|
* |
| 24 |
|
* Revision 1.16 2003/04/08 17:55:20 joko |
| 25 |
|
* CHANGE: renamed property 'datasource' to 'transport' |
| 26 |
|
* NEW: new case 'method' in 'function datasource_handler_buildoptions' |
| 27 |
|
* minor fixes: updated logging/debugging messages |
| 28 |
|
* |
| 29 |
|
* Revision 1.15 2003/04/06 04:46:33 joko |
| 30 |
|
* renamed linking function |
| 31 |
|
* mozilla fixes |
| 32 |
|
* |
| 33 |
* Revision 1.14 2003/04/04 21:19:21 joko |
* Revision 1.14 2003/04/04 21:19:21 joko |
| 34 |
* modified exception handling (enhanced, purged redundant code) |
* modified exception handling (enhanced, purged redundant code) |
| 35 |
* |
* |
| 294 |
* other presets. |
* other presets. |
| 295 |
* |
* |
| 296 |
* See '_buildLocator' which acts as a dispatcher |
* See '_buildLocator' which acts as a dispatcher |
| 297 |
* depending on $_options[datasource]. |
* depending on $_options[transport]. |
| 298 |
* (main dispatching level) |
* (main dispatching level) |
| 299 |
* |
* |
| 300 |
* The structure of a full blown locator looks like this: |
* The structure of a full blown locator looks like this: |
| 383 |
function DataSource_Generic( &$locator, $query ) { |
function DataSource_Generic( &$locator, $query ) { |
| 384 |
|
|
| 385 |
// copy parameter from query to locator |
// copy parameter from query to locator |
| 386 |
//$this->_locator->merge_to($this->_locator, array( datasource_type => $query[datasource] ), '_'); |
//$this->_locator->merge_to($this->_locator, array( datasource_type => $query[transport] ), '_'); |
| 387 |
//$this->_locator->_datasource_type = $query[datasource]; |
//$this->_locator->_datasource_type = $query[transport]; |
| 388 |
//$locator[_datasource_type] = $query[datasource]; |
//$locator[_datasource_type] = $query[transport]; |
| 389 |
|
|
| 390 |
/** |
/** |
| 391 |
* <!-- Autodia --> |
* <!-- Autodia --> |
| 395 |
*/ |
*/ |
| 396 |
|
|
| 397 |
// build master locator |
// build master locator |
| 398 |
$this->_locator = php::mkComponent('DataSource::Locator', $locator, array( datasource_type => $query[datasource] ) ); |
$this->_locator = php::mkComponent('DataSource::Locator', $locator, array( datasource_type => $query[transport] ) ); |
| 399 |
//exit; |
//exit; |
| 400 |
//$this->_locator = php::mkComponent('DataSource::Locator'); |
//$this->_locator = php::mkComponent('DataSource::Locator'); |
| 401 |
|
|
| 432 |
// pre-flight: check locator metadata |
// pre-flight: check locator metadata |
| 433 |
//$locator->build(); |
//$locator->build(); |
| 434 |
if (!$this->_locator->check()) { |
if (!$this->_locator->check()) { |
| 435 |
user_error("locator-check failed."); |
user_error("DataSource::Generic: locator-check failed." . "<br/>" . "Locator was: " . Dumper($this->_locator) ); |
| 436 |
exit; |
//exit; |
| 437 |
//return; |
return; |
| 438 |
} |
} |
| 439 |
|
|
| 440 |
//exit; |
//exit; |
| 506 |
|
|
| 507 |
break; |
break; |
| 508 |
default: |
default: |
| 509 |
user_error("DataSource::GenericDataSource: no Adapter could be selected!"); |
user_error("DataSource::Generic: no Adapter could be selected!"); |
| 510 |
break; |
break; |
| 511 |
} |
} |
| 512 |
|
|
| 711 |
case 'objects': |
case 'objects': |
| 712 |
if (!$this->_query[classname]) { |
if (!$this->_query[classname]) { |
| 713 |
$msg = "_query[vartype] == 'objects' requires _query[classname]"; |
$msg = "_query[vartype] == 'objects' requires _query[classname]"; |
| 714 |
user_error("GenericDataSource::query_data() - failed: " . $msg); |
user_error("DataSource::Generic: query_data() - failed: " . $msg); |
| 715 |
} |
} |
| 716 |
array_push($args, $this->_query[classname]); |
array_push($args, $this->_query[classname]); |
| 717 |
break; |
break; |
| 720 |
$query_args = array(); |
$query_args = array(); |
| 721 |
switch ($this->_query[abstract_type]) { |
switch ($this->_query[abstract_type]) { |
| 722 |
case 'list': |
case 'list': |
| 723 |
if (!$this->_query[classname]) { |
if (!$this->_query[nodename]) { |
| 724 |
$msg = "_query[vartype] == 'objects' requires _query[classname]"; |
$msg = "_query[vartype] == 'objects' requires _query[nodename]"; |
| 725 |
user_error("GenericDataSource::query_data() - failed: " . $msg); |
user_error("DataSource::Generic: query_data() - failed: " . $msg); |
| 726 |
} |
} |
| 727 |
//array_push($query_args, $this->_query[classname]); |
//array_push($query_args, $this->_query[nodename]); |
| 728 |
$query_args[classname] = $this->_query[classname]; |
$query_args[nodename] = $this->_query[nodename]; |
| 729 |
break; |
break; |
| 730 |
case 'item': |
case 'item': |
| 731 |
if (!$this->_query[classname]) { |
if (!$this->_query[nodename]) { |
| 732 |
$msg = "_query[vartype] == 'objects' requires _query[classname]"; |
$msg = "_query[vartype] == 'objects' requires _query[nodename]"; |
| 733 |
user_error("GenericDataSource::query_data() - failed: " . $msg); |
user_error("DataSource::Generic: query_data() - failed: " . $msg); |
| 734 |
} |
} |
| 735 |
$query_args[guid] = $this->_query[ident]; |
$query_args[guid] = $this->_query[ident]; |
| 736 |
$query_args[classname] = $this->_query[classname]; |
$query_args[nodename] = $this->_query[nodename]; |
| 737 |
break; |
break; |
| 738 |
} |
} |
| 739 |
if($this->_query[action] == 'write') { |
|
| 740 |
|
// dispatch action |
| 741 |
|
if ($this->_query[action] == 'write') { |
| 742 |
$query_args[action] = $this->_query[action]; |
$query_args[action] = $this->_query[action]; |
| 743 |
$query_args[data] = $this->_query[data]; |
$query_args[data] = $this->_query[data]; |
| 744 |
|
} elseif ($this->_query[action] == 'delete') { |
| 745 |
|
$query_args[action] = $this->_query[action]; |
| 746 |
} |
} |
| 747 |
$args = array( |
$args = array( |
| 748 |
'data_type' => $this->_query[abstract_type], |
'data_type' => $this->_query[abstract_type], |
| 756 |
$command = 'querySchema'; |
$command = 'querySchema'; |
| 757 |
$args = array( $this->_query[filter] ); |
$args = array( $this->_query[filter] ); |
| 758 |
break; |
break; |
| 759 |
|
|
| 760 |
|
// remoteMethod |
| 761 |
|
case 'method': |
| 762 |
|
$command = $this->_query[method]; |
| 763 |
|
$args = $this->_query[args]; |
| 764 |
|
break; |
| 765 |
|
|
| 766 |
} |
} |
| 767 |
|
|
| 768 |
|
|
| 769 |
|
// FIXME: bad behaviour? |
| 770 |
|
if (!is_array($args)) { $args = array( $args ); } |
| 771 |
|
|
| 772 |
/* |
/* |
| 773 |
$this->_query[rpc_command] = $command; |
$this->_query[rpc_command] = $command; |
| 812 |
// pre-flight checks |
// pre-flight checks |
| 813 |
if (!$call[method]) { |
if (!$call[method]) { |
| 814 |
$msg = "Remote method is empty, please pass in proper metadata or check configuration."; |
$msg = "Remote method is empty, please pass in proper metadata or check configuration."; |
| 815 |
user_error("GenericDataSource::query_data() - failed: " . $msg); |
user_error("DataSource::Generic: query_data() - failed: " . $msg); |
| 816 |
return; |
return; |
| 817 |
} |
} |
| 818 |
|
|
| 865 |
$locatorbox->add( Dumper($this->_locator) ); |
$locatorbox->add( Dumper($this->_locator) ); |
| 866 |
|
|
| 867 |
// FIXME: ie/mozilla? |
// FIXME: ie/mozilla? |
| 868 |
//$locatorbox->set_style('visibility:false;'); |
//$locatorbox->set_style('display:none;'); |
| 869 |
$locatorbox->set_style('display:none;'); |
//$locatorbox->set_style('visibility:hidden;'); |
| 870 |
|
// already duplicate inside Tracer!!! |
| 871 |
|
$locatorbox->set_style('visibility:hidden; position:absolute; z-index:1; margin-top:30px; padding:5px;'); |
| 872 |
|
|
| 873 |
$statusbox->add( html_span('boxlabel_darkgreen', "Locator:"), jsAnchor( 'toggle_vis', array("locatorbox_$boxcount"), '[show]'), $locatorbox, html_br() ); |
$statusbox->add( html_span('boxlabel_darkgreen', "Locator:"), link::js_function( 'toggleVisibility', array("locatorbox_$boxcount"), '[show]'), $locatorbox, html_br() ); |
| 874 |
$call = $this->_locator->get_call(); |
$call = $this->_locator->get_call(); |
| 875 |
$statusbox->add( html_span('boxlabel_darkgreen', "Method:"), $call[method], html_br() ); |
$statusbox->add( html_span('boxlabel_darkgreen', "Method:"), $call[method], html_br() ); |
| 876 |
if (sizeof($call[args])) { |
if (sizeof($call[args])) { |