| 15 |
* $Id$ |
* $Id$ |
| 16 |
* |
* |
| 17 |
* $Log$ |
* $Log$ |
| 18 |
|
* Revision 1.17 2003/04/09 02:07:33 joko |
| 19 |
|
* CHANGE: renamed key 'classname' through 'nodename' |
| 20 |
|
* |
| 21 |
|
* Revision 1.16 2003/04/08 17:55:20 joko |
| 22 |
|
* CHANGE: renamed property 'datasource' to 'transport' |
| 23 |
|
* NEW: new case 'method' in 'function datasource_handler_buildoptions' |
| 24 |
|
* minor fixes: updated logging/debugging messages |
| 25 |
|
* |
| 26 |
* Revision 1.15 2003/04/06 04:46:33 joko |
* Revision 1.15 2003/04/06 04:46:33 joko |
| 27 |
* renamed linking function |
* renamed linking function |
| 28 |
* mozilla fixes |
* mozilla fixes |
| 291 |
* other presets. |
* other presets. |
| 292 |
* |
* |
| 293 |
* See '_buildLocator' which acts as a dispatcher |
* See '_buildLocator' which acts as a dispatcher |
| 294 |
* depending on $_options[datasource]. |
* depending on $_options[transport]. |
| 295 |
* (main dispatching level) |
* (main dispatching level) |
| 296 |
* |
* |
| 297 |
* The structure of a full blown locator looks like this: |
* The structure of a full blown locator looks like this: |
| 380 |
function DataSource_Generic( &$locator, $query ) { |
function DataSource_Generic( &$locator, $query ) { |
| 381 |
|
|
| 382 |
// copy parameter from query to locator |
// copy parameter from query to locator |
| 383 |
//$this->_locator->merge_to($this->_locator, array( datasource_type => $query[datasource] ), '_'); |
//$this->_locator->merge_to($this->_locator, array( datasource_type => $query[transport] ), '_'); |
| 384 |
//$this->_locator->_datasource_type = $query[datasource]; |
//$this->_locator->_datasource_type = $query[transport]; |
| 385 |
//$locator[_datasource_type] = $query[datasource]; |
//$locator[_datasource_type] = $query[transport]; |
| 386 |
|
|
| 387 |
/** |
/** |
| 388 |
* <!-- Autodia --> |
* <!-- Autodia --> |
| 392 |
*/ |
*/ |
| 393 |
|
|
| 394 |
// build master locator |
// build master locator |
| 395 |
$this->_locator = php::mkComponent('DataSource::Locator', $locator, array( datasource_type => $query[datasource] ) ); |
$this->_locator = php::mkComponent('DataSource::Locator', $locator, array( datasource_type => $query[transport] ) ); |
| 396 |
//exit; |
//exit; |
| 397 |
//$this->_locator = php::mkComponent('DataSource::Locator'); |
//$this->_locator = php::mkComponent('DataSource::Locator'); |
| 398 |
|
|
| 429 |
// pre-flight: check locator metadata |
// pre-flight: check locator metadata |
| 430 |
//$locator->build(); |
//$locator->build(); |
| 431 |
if (!$this->_locator->check()) { |
if (!$this->_locator->check()) { |
| 432 |
user_error("locator-check failed."); |
user_error("DataSource::Generic: locator-check failed." . "<br/>" . "Locator was: " . Dumper($this->_locator) ); |
| 433 |
exit; |
//exit; |
| 434 |
//return; |
return; |
| 435 |
} |
} |
| 436 |
|
|
| 437 |
//exit; |
//exit; |
| 503 |
|
|
| 504 |
break; |
break; |
| 505 |
default: |
default: |
| 506 |
user_error("DataSource::GenericDataSource: no Adapter could be selected!"); |
user_error("DataSource::Generic: no Adapter could be selected!"); |
| 507 |
break; |
break; |
| 508 |
} |
} |
| 509 |
|
|
| 708 |
case 'objects': |
case 'objects': |
| 709 |
if (!$this->_query[classname]) { |
if (!$this->_query[classname]) { |
| 710 |
$msg = "_query[vartype] == 'objects' requires _query[classname]"; |
$msg = "_query[vartype] == 'objects' requires _query[classname]"; |
| 711 |
user_error("GenericDataSource::query_data() - failed: " . $msg); |
user_error("DataSource::Generic: query_data() - failed: " . $msg); |
| 712 |
} |
} |
| 713 |
array_push($args, $this->_query[classname]); |
array_push($args, $this->_query[classname]); |
| 714 |
break; |
break; |
| 717 |
$query_args = array(); |
$query_args = array(); |
| 718 |
switch ($this->_query[abstract_type]) { |
switch ($this->_query[abstract_type]) { |
| 719 |
case 'list': |
case 'list': |
| 720 |
if (!$this->_query[classname]) { |
if (!$this->_query[nodename]) { |
| 721 |
$msg = "_query[vartype] == 'objects' requires _query[classname]"; |
$msg = "_query[vartype] == 'objects' requires _query[nodename]"; |
| 722 |
user_error("GenericDataSource::query_data() - failed: " . $msg); |
user_error("DataSource::Generic: query_data() - failed: " . $msg); |
| 723 |
} |
} |
| 724 |
//array_push($query_args, $this->_query[classname]); |
//array_push($query_args, $this->_query[nodename]); |
| 725 |
$query_args[classname] = $this->_query[classname]; |
$query_args[nodename] = $this->_query[nodename]; |
| 726 |
break; |
break; |
| 727 |
case 'item': |
case 'item': |
| 728 |
if (!$this->_query[classname]) { |
if (!$this->_query[nodename]) { |
| 729 |
$msg = "_query[vartype] == 'objects' requires _query[classname]"; |
$msg = "_query[vartype] == 'objects' requires _query[nodename]"; |
| 730 |
user_error("GenericDataSource::query_data() - failed: " . $msg); |
user_error("DataSource::Generic: query_data() - failed: " . $msg); |
| 731 |
} |
} |
| 732 |
$query_args[guid] = $this->_query[ident]; |
$query_args[guid] = $this->_query[ident]; |
| 733 |
$query_args[classname] = $this->_query[classname]; |
$query_args[nodename] = $this->_query[nodename]; |
| 734 |
break; |
break; |
| 735 |
} |
} |
| 736 |
if($this->_query[action] == 'write') { |
if($this->_query[action] == 'write') { |
| 749 |
$command = 'querySchema'; |
$command = 'querySchema'; |
| 750 |
$args = array( $this->_query[filter] ); |
$args = array( $this->_query[filter] ); |
| 751 |
break; |
break; |
| 752 |
|
|
| 753 |
|
// remoteMethod |
| 754 |
|
case 'method': |
| 755 |
|
$command = $this->_query[method]; |
| 756 |
|
$args = $this->_query[args]; |
| 757 |
|
break; |
| 758 |
|
|
| 759 |
} |
} |
| 760 |
|
|
| 761 |
|
|
| 762 |
|
// FIXME: bad behaviour? |
| 763 |
|
if (!is_array($args)) { $args = array( $args ); } |
| 764 |
|
|
| 765 |
/* |
/* |
| 766 |
$this->_query[rpc_command] = $command; |
$this->_query[rpc_command] = $command; |
| 805 |
// pre-flight checks |
// pre-flight checks |
| 806 |
if (!$call[method]) { |
if (!$call[method]) { |
| 807 |
$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."; |
| 808 |
user_error("GenericDataSource::query_data() - failed: " . $msg); |
user_error("DataSource::Generic: query_data() - failed: " . $msg); |
| 809 |
return; |
return; |
| 810 |
} |
} |
| 811 |
|
|