9 |
*/ |
*/ |
10 |
|
|
11 |
/** |
/** |
12 |
|
* <b>Cvs-Log:</b> |
13 |
|
* |
14 |
|
* <pre> |
15 |
* $Id$ |
* $Id$ |
16 |
* |
* |
17 |
* $Log$ |
* $Log$ |
18 |
|
* Revision 1.10 2003/03/28 03:01:02 joko |
19 |
|
* more fancy debugging-output |
20 |
|
* |
21 |
|
* Revision 1.9 2003/03/27 16:24:26 jonen |
22 |
|
* + mugled namespace |
23 |
|
* + added enhanced 'queryData' |
24 |
|
* |
25 |
|
* Revision 1.8 2003/03/20 07:22:14 jonen |
26 |
|
* + modified case 'object' to 'objects' |
27 |
|
* (cause its loads all *objects* of a given classname) |
28 |
|
* |
29 |
|
* Revision 1.7 2003/03/11 01:43:00 joko |
30 |
|
* + fixed metadata for phpDocumentor |
31 |
|
* |
32 |
|
* Revision 1.6 2003/03/11 01:22:25 joko |
33 |
|
* + fixed metadata for phpDocumentor |
34 |
|
* |
35 |
* Revision 1.5 2003/03/11 00:12:49 joko |
* Revision 1.5 2003/03/11 00:12:49 joko |
36 |
* + fixed metadata for phpDocumentor |
* + fixed metadata for phpDocumentor |
37 |
* |
* |
70 |
* |
* |
71 |
* Revision 1.1 2003/03/01 03:10:40 joko |
* Revision 1.1 2003/03/01 03:10:40 joko |
72 |
* + initial commit |
* + initial commit |
73 |
* |
* </pre> |
74 |
* |
* |
75 |
*/ |
*/ |
76 |
|
|
149 |
* --- snipped into here from above --- |
* --- snipped into here from above --- |
150 |
* </pre> |
* </pre> |
151 |
* |
* |
152 |
* |
* <p> |
153 |
* !!!!!! refactor this to Data::Driver::Proxy !!!!!! <----------------- |
* !!!!!! refactor this to Data::Driver::Proxy !!!!!! <----------------- |
154 |
* |
* |
155 |
* Data::Driver::Proxy instantiates "handlers" below itself |
* Data::Driver::Proxy instantiates "handlers" below itself |
170 |
* </pre> |
* </pre> |
171 |
* |
* |
172 |
* !!!!!! refactor this to Data::Driver::Proxy !!!!!! <----------------- |
* !!!!!! refactor this to Data::Driver::Proxy !!!!!! <----------------- |
173 |
|
* </p> |
174 |
* |
* |
175 |
* |
* |
176 |
|
* <p> |
177 |
* <b>How to use?</b> |
* <b>How to use?</b> |
178 |
* |
* |
179 |
* Pass an array holding "locator metadata" to the constructor. |
* Pass an array holding "locator metadata" to the constructor. |
180 |
* GenericDataSource takes care of the rest. |
* GenericDataSource takes care of the rest. |
181 |
* |
* |
182 |
|
* <pre> |
183 |
* Pass an array to the constructor: (e.g.) |
* Pass an array to the constructor: (e.g.) |
184 |
* |
* |
185 |
* 1. doing rpc-calls.... |
* 1. doing rpc-calls.... |
201 |
* $source = ne w GenericDataSource($locator); |
* $source = ne w GenericDataSource($locator); |
202 |
* $this->set_data_source( &$source ); |
* $this->set_data_source( &$source ); |
203 |
* </code> |
* </code> |
204 |
|
* </pre> |
205 |
|
* </p> |
206 |
|
* |
207 |
* |
* |
208 |
* @link http://www.netfrag.org/~joko/ |
* @link http://www.netfrag.org/~joko/ |
209 |
* @author Andreas Motl <andreas.motl@ilo.de> |
* @author Andreas Motl <andreas.motl@ilo.de> |
222 |
* @name DataSource::Generic |
* @name DataSource::Generic |
223 |
* |
* |
224 |
* @todo this: |
* @todo this: |
|
* |
|
225 |
* o mungle this to be able to be wrapped around phpHtmlLib's own storage-handles |
* o mungle this to be able to be wrapped around phpHtmlLib's own storage-handles |
226 |
* o implement another Data::Driver::Proxy container |
* o implement another Data::Driver::Proxy container |
227 |
* |
* |
469 |
case 'phpHtmlLib': |
case 'phpHtmlLib': |
470 |
//$adapter_arguments = $args[title]; |
//$adapter_arguments = $args[title]; |
471 |
|
|
472 |
$this->set_adapter_module('DataSource::Adapter::phpHtmlLib::DataListSource'); |
$this->set_adapter_module('DataSource::Adapter::phpHtmlLib::DataSource'); |
473 |
|
|
474 |
// in order to let the Adapter communicate with the Proxy, |
// in order to let the Adapter communicate with the Proxy, |
475 |
// instantiate a wrapper method in a third namespace via |
// instantiate a wrapper method in a third namespace via |
674 |
// FIXME: abstract this some more (e.g. via a CommandMapper|Registry) |
// FIXME: abstract this some more (e.g. via a CommandMapper|Registry) |
675 |
switch ($this->_query[metatype]) { |
switch ($this->_query[metatype]) { |
676 |
case 'data': |
case 'data': |
677 |
//$command = 'queryData'; |
$command = 'queryData'; |
678 |
$command = 'getObjects'; // FIXME!!! |
//$command = 'getObjects'; // FIXME!!! |
679 |
//$this->_locator->set_option('metadata.command', $command); |
//$this->_locator->set_option('metadata.command', $command); |
680 |
|
/* |
681 |
$args = array(); |
$args = array(); |
682 |
switch ($this->_query[vartype]) { |
switch ($this->_query[vartype]) { |
683 |
case 'object': |
case 'objects': |
684 |
if (!$this->_query[classname]) { |
if (!$this->_query[classname]) { |
685 |
$msg = "_query[vartype] == 'object' requires _query[classname]"; |
$msg = "_query[vartype] == 'objects' requires _query[classname]"; |
686 |
user_error("GenericDataSource::query_data() - failed: " . $msg); |
user_error("GenericDataSource::query_data() - failed: " . $msg); |
687 |
} |
} |
688 |
array_push($args, $this->_query[classname]); |
array_push($args, $this->_query[classname]); |
689 |
break; |
break; |
690 |
} |
} |
691 |
break; |
*/ |
692 |
|
$query_args = array(); |
693 |
|
switch ($this->_query[abstract_type]) { |
694 |
|
case 'list': |
695 |
|
if (!$this->_query[classname]) { |
696 |
|
$msg = "_query[vartype] == 'objects' requires _query[classname]"; |
697 |
|
user_error("GenericDataSource::query_data() - failed: " . $msg); |
698 |
|
} |
699 |
|
//array_push($query_args, $this->_query[classname]); |
700 |
|
$query_args[classname] = $this->_query[classname]; |
701 |
|
break; |
702 |
|
case 'item': |
703 |
|
if (!$this->_query[classname]) { |
704 |
|
$msg = "_query[vartype] == 'objects' requires _query[classname]"; |
705 |
|
user_error("GenericDataSource::query_data() - failed: " . $msg); |
706 |
|
} |
707 |
|
$query_args[guid] = $this->_query[ident]; |
708 |
|
$query_args[classname] = $this->_query[classname]; |
709 |
|
break; |
710 |
|
} |
711 |
|
$args = array( |
712 |
|
'data_type' => $this->_query[abstract_type], |
713 |
|
'query_args' => $query_args |
714 |
|
); |
715 |
|
break; |
716 |
|
|
717 |
|
// querySchema |
718 |
case 'schema': |
case 'schema': |
719 |
|
//print "Testing schema:" . "<br>"; |
720 |
$command = 'querySchema'; |
$command = 'querySchema'; |
721 |
break; |
break; |
722 |
} |
} |
784 |
// trace |
// trace |
785 |
if ($this->_debug[notice]) { |
if ($this->_debug[notice]) { |
786 |
//print "_result = " . Dumper($this->_result); |
//print "_result = " . Dumper($this->_result); |
787 |
print "DataSource::Generic->_result_count = " . $this->_result_count . "<br/>"; |
print "<div><b><font color=\"darkgreen\">Debug:</font></b> DataSource::Generic->_result_count = <b>" . $this->_result_count . "</b></div>"; |
788 |
} |
} |
789 |
|
|
790 |
return $this->_result; |
return $this->_result; |