/[cvs]/nfo/php/libs/org.netfrag.glib/DataSource/Generic.php
ViewVC logotype

Annotation of /nfo/php/libs/org.netfrag.glib/DataSource/Generic.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (hide annotations)
Tue Mar 11 01:22:25 2003 UTC (21 years, 4 months ago) by joko
Branch: MAIN
Changes since 1.5: +8 -2 lines
+ fixed metadata for phpDocumentor

1 joko 1.1 <?php
2     /**
3     * This file contains the GenericDataSource child class
4     *
5     * @author Andreas Motl <andreas.motl@ilo.de>
6 joko 1.2 * @package org.netfrag.glib
7     * @name DataSource::Generic
8 joko 1.1 *
9     */
10    
11     /**
12 joko 1.6 * <b>Cvs-Log:</b>
13     *
14     * <pre>
15     * $Id: Generic.php,v 1.5 2003/03/11 00:12:49 joko Exp $
16 joko 1.2 *
17     * $Log: Generic.php,v $
18 joko 1.6 * Revision 1.5 2003/03/11 00:12:49 joko
19     * + fixed metadata for phpDocumentor
20     *
21 joko 1.5 * Revision 1.4 2003/03/10 23:25:03 joko
22     * + fixed metadata for phpDocumentor
23     *
24 joko 1.4 * Revision 1.3 2003/03/09 15:50:36 joko
25     * + additional metadata for Autodia
26     *
27 joko 1.3 * Revision 1.2 2003/03/05 17:28:43 joko
28     * updated docu (phpDocumentor testing....)
29     *
30 joko 1.2 * Revision 1.1 2003/03/05 12:04:00 joko
31     * + initial commit, from GenericDataSource
32 joko 1.1 *
33     * Revision 1.3 2003/03/03 21:24:18 joko
34     * now based on DesignPattern::RemoteProxy
35     *
36     * Revision 1.2 2003/03/02 01:05:13 joko
37     * - purged old code
38     *
39     * Revision 1.1 2003/03/01 21:47:15 joko
40     * renamed from AbstractDataSource.inc
41     *
42     * Revision 1.1 2003/03/01 20:17:15 joko
43     * renamed from GenericDataSource.inc
44     * replaced '_proxy' through '_handler' to better associate the ability to act as a generic dispatcher handler
45     *
46     * Revision 1.3 2003/03/01 15:36:11 joko
47     * + debugging
48     * + renamed some methods regarding new proposal (build_handler_options, fetch_result, etc.)
49     *
50     * Revision 1.2 2003/03/01 04:50:27 joko
51     * encapsulated all output into tracing mode
52     * disabled tracing
53     *
54     * Revision 1.1 2003/03/01 03:10:40 joko
55     * + initial commit
56 joko 1.6 * </pre>
57 joko 1.1 *
58     */
59    
60     /**
61     * This requires the MemoryDataSource base class
62     *
63     */
64    
65     // V1: compile-time-include, stable since years ;-)
66     //include_once($phphtmllib."/widgets/data_source/MemoryDataSource.inc");
67    
68     // V2: runtime-load proposal, more flexible
69     // loadModule('MemoryDataSource', 'inc'); // doesn't work (would do if basepath of module is in libpath)
70     // loadModule($phphtmllib . '::widgets::data_source::MemoryDataSource', 'inc'); // works (by accident)
71     // loadModule($phphtmllib . "/widgets/data_source/MemoryDataSource", "inc"); // works (should be stable)
72     // loadModule($phphtmllib . "/widgets/data_source/MemoryDataSource.inc", null); // works (should be stable)
73    
74    
75    
76     /**
77     * Have to have PEAR and DB included
78     * the pear dir must be in the
79     * include path.
80     */
81     // require_once("PEAR.php"); // FIXME: what about PEAR::XML::RPC?
82     // require_once("DB.php");
83    
84 joko 1.2
85     loadModule('DesignPattern::Proxy');
86     loadModule('DesignPattern::TransparentProxy');
87     loadModule('DesignPattern::RemoteProxy');
88    
89     //class GenericDataSource extends MemoryDataSource {
90     //class GenericDataSource extends DesignPattern_Proxy {
91     //class GenericDataSource extends DesignPattern_RemoteProxy {
92     //class GenericDataSource extends DesignPattern_TransparentProxy {
93    
94     //class GenericDataSource extends MemoryDataSource {
95     //loadModule("DataSource::Proxy::Memory");
96     //class GenericDataSource extends DataSource_Proxy_Memory {
97     //class DataSource_GenericDataSource extends DataSource_Proxy_Memory {
98     //class DataSource_GenericDataSource extends DesignPattern_Proxy {
99     //class DataSource_GenericDataSource extends DataSource_Proxy_Memory {
100    
101     // now independent!!! new class-inheritance-tree possible now!
102     // solved by having an Adapter *and* a Proxy here!
103     //class GenericDataSource {
104    
105     loadModule('DesignPattern::AdapterProxy');
106    
107    
108    
109 joko 1.1 /**
110     * This GenericDataSource child class is *completely* independent
111     * of a specific storage implementation and intended to be a wrapper
112 joko 1.2 * class on the way from phpHtmlLib to Xyz. <br>
113 joko 1.1 * ("Yyz" gets represented by Data::Storage by now.....)
114     *
115     * GenericDataSource interacts with an intermediate "proxy" object
116 joko 1.2 * (e.g. Data::Driver::Proxy) when doing queries. <br>
117     * <pre>
118 joko 1.1 * Don't mix this up with a persistent database handle which gets
119     * reused each and every time for different queries.
120     * Here *is* a new instance of Data::Driver::Proxy for *each* query.
121 joko 1.2 * </pre>
122 joko 1.1 *
123     * But the point is: Caching! The actual *data* isn't read redundant!
124     *
125 joko 1.2 * <pre>
126     * --- snipped into here from above ---
127     * that may use arbitrary code modules as database handlers.
128     * It's aims are to get together:
129     * o phpHtmlLibs "source-handlers"
130     * o PEAR's database handlers
131     * o custom ones (e.g. Data::Driver::Proxy object, which talks to a remote rpc server)
132     * --- snipped into here from above ---
133     * </pre>
134     *
135 joko 1.1 *
136     * !!!!!! refactor this to Data::Driver::Proxy !!!!!! <-----------------
137     *
138     * Data::Driver::Proxy instantiates "handlers" below itself
139     * which act as encapsulated workers to actually do the stuff to do.
140     * It can cache data for "disconnected mode" using the
141     * php PEAR DB abstraction objects.
142     * One worker already implemented is Data::Driver::RPC::Remote, which
143     * talks to a RPC::XML server (todo: talk SOAP!) using PEAR::XML::RPC.
144     *
145 joko 1.2 * <pre>
146 joko 1.1 * --- refactored here, but: redundant somehow ---
147     * Data::Driver::Proxy uses a PEAR XML::RPC object to actually
148     * talk HTTP and serialize data chunks to and from XML,
149     * but adds some caching to this "process of fetching data from a remote side".
150     * It "proxies" arbitrary data chunks a) inside a native php4 session,
151     * b) by talking to a rdbms (single proxy-table) or c) [TODO] using PEAR::Cache.
152     * --- refactored here, but: redundant somehow ---
153 joko 1.2 * </pre>
154 joko 1.1 *
155     * !!!!!! refactor this to Data::Driver::Proxy !!!!!! <-----------------
156     *
157     *
158 joko 1.2 * <b>How to use?</b>
159 joko 1.1 *
160     * Pass an array holding "locator metadata" to the constructor.
161     * GenericDataSource takes care of the rest.
162     *
163     * Pass an array to the constructor: (e.g.)
164     *
165     * 1. doing rpc-calls....
166 joko 1.2 * <code>
167 joko 1.1 * $locator = array(
168     * type => 'rpc',
169     * metadata => array( Host => 'localhost', Port => '8765' ),
170     * );
171 joko 1.3 * $source = ne w GenericDataSource($locator);
172 joko 1.1 * $this->set_data_source( &$source );
173 joko 1.2 * </code>
174 joko 1.1 *
175     * 2. [proposal] common datahandles....
176 joko 1.2 * <code>
177 joko 1.1 * $locator = array(
178     * type => 'mysql',
179     * dsn => 'known dsn markup',
180     * );
181 joko 1.3 * $source = ne w GenericDataSource($locator);
182 joko 1.1 * $this->set_data_source( &$source );
183 joko 1.2 * </code>
184 joko 1.1 *
185 joko 1.2 * @link http://www.netfrag.org/~joko/
186 joko 1.1 * @author Andreas Motl <andreas.motl@ilo.de>
187 joko 1.2 *
188     * @link http://www.netfrag.org/~jonen/
189 joko 1.1 * @author Sebastian Utz <seut@tunemedia.de>
190 joko 1.2 *
191 joko 1.1 * @copyright (c) 2003 - All Rights reserved.
192 joko 1.2 *
193     * @link http://www.gnu.org/licenses/lgpl.txt
194 joko 1.1 * @license GNU LGPL (GNU Lesser General Public License)
195     *
196     *
197 joko 1.2 * @package org.netfrag.glib
198     * @subpackage DataSource
199     * @name DataSource::Generic
200 joko 1.1 *
201 joko 1.4 * @todo this:
202     *
203 joko 1.5 * o mungle this to be able to be wrapped around phpHtmlLib's own storage-handles
204     * o implement another Data::Driver::Proxy container
205 joko 1.1 *
206 joko 1.5 * <pre>
207 joko 1.4 * !!!!!!!! THIS IS THE PROBLEM !!!!!!!!
208     * !!!!!!!! here is it where we have to break inheritance again !!!!!!!!
209     *
210     * THE CONFLICT: Beeing in phpHtmlLib *and* DesignPattern::TransparentProxy
211     * inheritance trees at the same time, which is *not* possible at
212     * declare-time. We *do* need some runtime-infrastructure to solve this!
213     *
214     * TODO: move build- and check-locator stuff from ObjectList to this place!!!
215     *
216     * ABOUT:
217     * 1. otherwhere: WebApp - scope:
218     * x handles page vs. block vs. widget; dispatches MVC-View
219     * 2. here: DataSource - scope:
220     * x handles bridge to frameworks (e.g. phpHtmlLib) vs. actual data driver libs (PEAR, etc.))
221     * o clean implementation using a DesignPattern::AdapterProxy
222 joko 1.5 * </pre>
223 joko 1.4 *
224     *
225     */
226 joko 1.1 class DataSource_Generic extends DesignPattern_AdapterProxy {
227    
228     // !!!!!!!! here is it where we have to break inheritance again !!!!!!!!
229     // !!!!!!!! THIS IS THE PROBLEM !!!!!!!!
230    
231    
232    
233     /**
234     * This var holds the locator metadata hash
235     * that is used to feed metadata to a per-query-instance
236     * of an Adapter object.
237     *
238     */
239     //var $_locator = NULL;
240    
241     /**
242     * This var holds the locator metadata hash
243     * which is built from some predefined rules
244     * using metadata from $_options and some
245     * other presets.
246     *
247     * See '_buildLocator' which acts as a dispatcher
248     * depending on $_options[datasource].
249     * (main dispatching level)
250     *
251     * The structure of a full blown locator looks like this:
252     *
253     * $locator = array(
254     * type => '<your type specifying the datasource-type>',
255     * metadata => array(
256     * ... your arbitrary deep metadata structure ...
257     * ),
258     * [dsn => '<your dsn markup>'],
259     * );
260     *
261     * Example 1 - data is inside a rdbms, using a dsn to connect to it:
262     * $locator = array(
263     * type => 'sql',
264     * dsn => 'mysql://username:password@localhost/database',
265     * );
266     *
267     * Example 2 - data is inside an odbms, reachable by doing remote procedure calls (rpc):
268     * $locator = array(
269     * type => 'rpc',
270     * metadata => array(
271     * package => 'Data::Driver::Proxy',
272     * Host => 'localhost',
273     * Port => '8765',
274     * )
275     * );
276     *
277     */
278     var $_locator = NULL;
279    
280    
281     /**
282     * This var holds the module information required to
283     * create instances of a Proxy and an Adapter.
284     * Information might get extracted from a
285     * DataSource::Locator instance.
286     *
287     * --- A skeleton:
288     *
289     * $this->_modules = array(
290     * _proxy => array( _id => '', _module => '', _options = array(), _instance => &$obj),
291     * _adapter => array( _id => '', _module => '', _options = array(), _instance => &$obj),
292     * );
293     *
294     *
295     * --- An example:
296     *
297     * $this->_modules = array(
298     * _proxy => array( _id => 'rpc', _module => 'DesignPattern::RemoteProxy', _instance => &$obj),
299     * _adapter => array( _id => 'phpHtmlLib', _module => 'DataSource::Adapter::phpHtmlLib::DataListSource', _instance => &$obj),
300     * );
301     *
302     *
303     */
304     //var $_modules = NULL;
305    
306    
307     /**
308     * This var holds the query hash
309     * that is used to feed as query to a per-query-instance
310     * of a Data::Driver::Proxy object.
311     *
312     */
313     var $_query = NULL;
314    
315    
316     /**
317     * this holds the query result from the
318     * Data::Driver::Proxy->queryXyz() call
319     *
320     */
321     var $_result = NULL;
322    
323    
324    
325     /**
326     * The constructor is used to pass in the
327     * locator metadata hash.
328     *
329     * @param LocatorMetadataHash array - layout: array( type => '', metadata => '', dsn => '' )
330     * @param Query array - layout: array( type => '', metadata => '', dsn => '' )
331     */
332    
333    
334     function DataSource_Generic( &$locator, $query ) {
335    
336     // copy parameter from query to locator
337     //$this->_locator->merge_to($this->_locator, array( datasource_type => $query[datasource] ), '_');
338     //$this->_locator->_datasource_type = $query[datasource];
339     //$locator[_datasource_type] = $query[datasource];
340    
341 joko 1.3 /**
342     * <!-- Autodia -->
343     * can do: (this is metadata supplied for Autodia, don't delete!)
344     * $this->_locator = new DataSource_Locator()
345     *
346     */
347    
348 joko 1.1 // build master locator
349     $this->_locator = php::mkComponent('DataSource::Locator', $locator, array( datasource_type => $query[datasource] ) );
350     //exit;
351     //$this->_locator = php::mkComponent('DataSource::Locator');
352    
353     $this->_locator->check();
354    
355     // trace
356     //print "locator-obj: " . Dumper($this->_locator);
357     //print "locator-data: " . Dumper($locator_data);
358     //exit;
359    
360    
361    
362     /*
363     $this->_modules = array(
364     _proxy => array( _id => $locator->_datasource_type ),
365     _adapter => array( _id => $locator->_adapter_type ),
366     );
367     */
368    
369     //$this->set_locator( $locator );
370     $this->set_query( $query );
371    
372    
373    
374     /*
375     // V1:
376     // pre-flight: establish and check locator metadata
377     $this->_buildLocator();
378     $this->_checkLocator();
379     */
380    
381    
382    
383     // pre-flight: check locator metadata
384     //$locator->build();
385     if (!$this->_locator->check()) {
386     user_error("locator-check failed.");
387     exit;
388     //return;
389     }
390    
391     //exit;
392    
393    
394 joko 1.3 /**
395     * <!-- Autodia -->
396     * can do: (this is metadata supplied for Autodia, don't delete!)
397     * $proxy = new DesignPattern_RemoteProxy()
398     *
399     */
400    
401    
402 joko 1.1 // --- Proxy selector/dispatcher ...
403    
404     switch ($this->_locator->_datasource_type) {
405     case 'rpc':
406     //$locator_data = $this->_locator->get_metadata();
407     //$this->_modules[_proxy][_options] = array( locator => $this->_locator, query => $query );
408     //$this->_modules[_proxy][_module] = 'DataSource::Proxy::XMLRPC';
409    
410     //$this->_modules[_proxy][_module] = 'DesignPattern::RemoteProxy';
411     //$this->_modules[_proxy][_options] = $locator_data;
412    
413     //$this->set_component_name('DesignPattern::RemoteProxy');
414     //$this->set_component_options($locator_data);
415    
416     $this->set_component_name('DesignPattern::RemoteProxy');
417    
418     break;
419     default:
420     user_error("Site::GenericPage: no Proxy could be selected!");
421     break;
422     }
423    
424    
425    
426     /*
427     // V1:
428     // make up dummy args by now
429     $args = array(
430     adapter => 'phpHtmlLib',
431     );
432     */
433    
434     // V2: now propagated from caller!
435    
436     //print Dumper(array( locator => $locator, query => $query ));
437     //exit;
438    
439     //$this->create_adapter($this->module, $this->function, $this->arguments);
440     //$this->set_handler( $this->get_adapter() );
441    
442    
443     // --- Adapter selector/dispatcher ...
444     // ... resolves this._modules.adapter._id to this._modules.adapter._module
445    
446     switch ($locator->_adapter_type) {
447     case 'phpHtmlLib':
448     //$adapter_arguments = $args[title];
449    
450     $this->set_adapter_module('DataSource::Adapter::phpHtmlLib::DataListSource');
451    
452     // in order to let the Adapter communicate with the Proxy,
453     // instantiate a wrapper method in a third namespace via
454     // Exporter::export_symbol(from, to)
455     $this->set_adapter_options($this);
456    
457    
458     break;
459     default:
460     user_error("DataSource::GenericDataSource: no Adapter could be selected!");
461     break;
462     }
463    
464    
465    
466     // --- module instantiation - Proxy and Adapter
467    
468     //user_error("handle proxy here!");
469     //$this->create_proxy();
470    
471     //print Dumper($this);
472    
473     //print "this: " . Dumper($this);
474    
475     // V1:
476     /*
477     $proxy = php::mkComponent($this->_modules[_proxy][_module], $this->_modules[_proxy][_options]);
478     print "proxy: " . Dumper($proxy);
479     //exit;
480     */
481    
482     // V2:
483     /*
484     $resultHandle = mkObject('DesignPattern::RemoteProxy', $cache_key, array( key => 1, command => $command, query => $query, remote => 1, rpcinfo => $rpcinfo, cache => array( db => 0, session => 1 ) ) );
485     $result = $resultHandle->getAttributes();
486     return $result;
487     */
488    
489     // V3:
490     // $this->set_handler( $proxy );
491    
492     // V4: use _component_name & _component_options (proposal from GenericPage)
493     // $this->_component_name = ...
494     // $this->create_handler();
495    
496 joko 1.3
497     /**
498     * <!-- Autodia -->
499     * can do: (this is metadata supplied for Autodia, don't delete!)
500     * $adapter = new DataSource_Adapter_phpHtmlLib_DataListSource()
501     *
502     */
503 joko 1.1
504     // V1:
505     //$this->create_adapter($adapter_module, $this->function, $this->arguments);
506    
507     // V2: FIXME - better use V1?
508     $adapter = php::mkComponent($this->get_adapter_module(), $this->get_adapter_options());
509     $this->set_adapter($adapter);
510    
511    
512    
513    
514     }
515    
516     function make_adapter_transparent() {
517    
518     // ... known from Site::Adapter::php::Class:
519    
520     // At this place the Adapter becomes a Proxy.
521     // This functionality currently correlates to the
522     // name of our ancestor, DesignPattern::AdapterProxy.
523     // FIXME: move this code to its namespace!!!
524     // FIXME: rename to set_proxy...
525    
526     // The reason this has to occour here is required
527     // by the TransparentProxy to actually make the
528     // _handler (_proxy) transparent later....
529     //$this->set_proxy( $this->get_adapter() );
530     }
531    
532     /**
533     * Set the metadata information
534     * (a DataSource::Locator) we will use
535     * to build encapsulated instances
536     * of both a Proxy and an Adapter.
537     *
538     * @param LocatorMetadataHash array -
539     *
540     */
541     function set_metadata( &$locator ) {
542     $this->_locator = &$locator;
543     }
544    
545     function &get_metadata() {
546     return $this->_locator;
547     }
548    
549    
550     /**
551     * Set the query metadata hash we will feed *completely*
552     * to an encapsulated Proxy instance.
553     *
554     * @param QueryDeclaration array -
555     *
556     */
557     function set_query( $query ) {
558     $this->_query = $query;
559     }
560    
561     /**
562     * Issue remote/proxy call
563     * Stolen from Application_AbstractBackend::_remote_method (RefactoringProposal?)
564     * Tweaked a bit: proxy package now taken from $this->_handler_name
565     *
566     * Create a new instance of a proxy and store it for later reuse.
567     * Read the locator metadata hash and create
568     * the proxy handler instance using passed-in name.
569     *
570     * @param string - $proxy_name (namespaced classname - perl syntax - e.g.: Data::Driver::Proxy)
571     *
572     */
573     function datasource_handler_call() {
574    
575    
576     // 1. read args and build cache key
577    
578     $arg_list = func_get_args();
579     $command = array_shift($arg_list);
580     $cache_key = join("-", array(session_id(), $command, join('_', $arg_list) ));
581     //print "cache_key: $cache_key<br>";
582    
583     // FIXME: what if arg_list still contains more elements after doing this?
584     $query = array_shift($arg_list);
585    
586     // 2. prepare proxy-options (read from locator)
587    
588     //print "this: " . Dumper($this);
589     //exit;
590    
591     // read from locator metadata
592     //$proxy_name = $this->_locator[metadata][package];
593    
594     // V1:
595     //$rpcinfo = array( Host => $this->_locator[metadata][Host], Port => $this->_locator[metadata][Port] );
596    
597     // V2:
598     $rpcinfo = $this->_locator->get_metadata();
599    
600     // FIXME! implement this into Data::Driver::RPC::Remote!
601     //$rpcinfo[to_latin] = 1;
602    
603     // FIXME! patch query
604     if (sizeof($query) == 1) {
605     $query = $query[0];
606     }
607    
608     //print "query: " . Dumper($query);
609    
610     // !!! use DesignPattern::Proxy here !!!
611     // $proxy = new DesignPattern_Proxy($proxy_name, ...)
612     // or:
613     // $proxy = mkObject('DesignPattern::Proxy');
614     // $this->set_handler( $proxy );
615     // or:
616     // $proxy = mkObject('DesignPattern::Proxy');
617     // $proxy->
618     // $this->set_handler( $proxy );
619    
620    
621    
622     //$this->set_component_name( $proxy_name );
623     $this->set_component_options( $cache_key, array( key => 1, command => $command, query => $query, remote => 1, rpcinfo => $rpcinfo, cache => array( db => 0, session => 1 ) ) );
624     //print Dumper($this);
625     //exit;
626    
627     $this->create_proxy();
628    
629     //print Dumper($this);
630     //exit;
631    
632     /*
633     // -------------------- clone this & modify ----------
634     $proxy = mkObject($proxy_name, $cache_key, array( key => 1, command => $command, query => $query, remote => 1, rpcinfo => $rpcinfo, cache => array( db => 0, session => 1 ) ) );
635     $this->set_handler( $proxy );
636     //$result = $resultHandle->getAttributes();
637     //return $result;
638     //$this->_result = $resultHandle->getAttributes();
639     //$this->_result = $this->_handler->getAttributes();
640     // -------------------- clone this & modify ----------
641     */
642    
643     }
644    
645    
646     function datasource_handler_buildoptions() {
647    
648     //print Dumper($this->_query);
649     //exit;
650    
651     // make up a command from metadata
652     // FIXME: abstract this some more (e.g. via a CommandMapper|Registry)
653     switch ($this->_query[metatype]) {
654     case 'data':
655     //$command = 'queryData';
656     $command = 'getObjects'; // FIXME!!!
657     //$this->_locator->set_option('metadata.command', $command);
658     $args = array();
659     switch ($this->_query[vartype]) {
660     case 'object':
661     if (!$this->_query[classname]) {
662     $msg = "_query[vartype] == 'object' requires _query[classname]";
663     user_error("GenericDataSource::query_data() - failed: " . $msg);
664     }
665     array_push($args, $this->_query[classname]);
666     break;
667     }
668     break;
669     case 'schema':
670     $command = 'querySchema';
671     break;
672     }
673    
674    
675     /*
676     $this->_query[rpc_command] = $command;
677     $this->_query[rpc_args] = $command;
678     */
679    
680     // methods!!!
681     $this->_locator->_call[_method] = $command;
682     $this->_locator->_call[_arguments] = $args;
683    
684     //$adapter = $this->get_adapter();
685    
686     // trace
687     /*
688     print Dumper(null, '<b>= = = = = = = = = = = = = = = = = = = = = =</b>');
689     print Dumper('datasource_handler_buildoptions', array(
690     "_locator" => $this->_locator,
691     "_query" => $this->_query,
692     "command" => '<b>' . $command . "</b>",
693     "args" => $args
694     ));
695     */
696    
697     /*
698     $this->_handler_options = array(
699     method => $command,
700     args => $args,
701     );
702     */
703    
704     }
705    
706     function &fetch_result() {
707    
708     $this->datasource_handler_buildoptions();
709    
710     $method = $this->_locator->_call[_method];
711     $args = $this->_locator->_call[_arguments];
712    
713     // pre-flight checks
714     if (!$method) {
715     $msg = "Remote command could not be resolved, please pass in or check configuration.";
716     user_error("GenericDataSource::query_data() - failed: " . $msg);
717     return;
718     }
719    
720     //print "fetch_result: this->_handler=" . Dumper($this->_handler);
721    
722     // do remote call here and get result
723     // FIXME: handle synchronous/asynchronous mode here!!!
724     $this->datasource_handler_call($method, $args);
725    
726    
727     // TODO: ... = $this->poll_handler_result and $this->get_handler_result
728     $proxy = $this->get_proxy();
729     $this->_result = $proxy->getResult();
730     //print "result: " . Dumper($this->_result); exit;
731    
732     $this->_result_count = sizeof($this->_result);
733    
734     // trace
735     if ($this->_debug[notice]) {
736     //print "_result = " . Dumper($this->_result);
737     print "DataSource::Generic->_result_count = " . $this->_result_count . "<br/>";
738     }
739    
740     return $this->_result;
741    
742     }
743    
744    
745     function &query_data() {
746     //print "query!<br/>";
747     return $this->fetch_result();
748     //$this->handle_result();
749     }
750    
751     function query_schema() {
752     user_error("FIXME: query_schema");
753     // $this->datasource_handler_call( ... );
754     }
755    
756     function &get_result() {
757     return $this->_result;
758     }
759    
760     }
761    
762     ?>

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed