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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by joko, Mon Mar 10 23:25:03 2003 UTC revision 1.9 by jonen, Thu Mar 27 16:24:26 2003 UTC
# Line 9  Line 9 
9   */   */
10    
11  /**  /**
12     * <b>Cvs-Log:</b>
13     *
14     * <pre>
15   * $Id$   * $Id$
16   *   *
17   * $Log$   * $Log$
18     * Revision 1.9  2003/03/27 16:24:26  jonen
19     * + mugled namespace
20     * + added enhanced 'queryData'
21     *
22     * Revision 1.8  2003/03/20 07:22:14  jonen
23     * + modified case 'object' to 'objects'
24     *   (cause its loads all *objects* of a given classname)
25     *
26     * Revision 1.7  2003/03/11 01:43:00  joko
27     * + fixed metadata for phpDocumentor
28     *
29     * Revision 1.6  2003/03/11 01:22:25  joko
30     * + fixed metadata for phpDocumentor
31     *
32     * Revision 1.5  2003/03/11 00:12:49  joko
33     * + fixed metadata for phpDocumentor
34     *
35   * Revision 1.4  2003/03/10 23:25:03  joko   * Revision 1.4  2003/03/10 23:25:03  joko
36   * + fixed metadata for phpDocumentor   * + fixed metadata for phpDocumentor
37   *   *
# Line 47  Line 67 
67   *   *
68   * Revision 1.1  2003/03/01 03:10:40  joko   * Revision 1.1  2003/03/01 03:10:40  joko
69   * + initial commit   * + initial commit
70   *   * </pre>
71   *   *
72   */   */
73    
# Line 126  loadModule('DesignPattern::AdapterProxy' Line 146  loadModule('DesignPattern::AdapterProxy'
146   * --- snipped into here from above ---   * --- snipped into here from above ---
147   * </pre>   * </pre>
148   *   *
149   *   * <p>
150   * !!!!!!  refactor this to Data::Driver::Proxy  !!!!!!     <-----------------   * !!!!!!  refactor this to Data::Driver::Proxy  !!!!!!     <-----------------
151   *   *
152   * Data::Driver::Proxy instantiates "handlers" below itself   * Data::Driver::Proxy instantiates "handlers" below itself
# Line 147  loadModule('DesignPattern::AdapterProxy' Line 167  loadModule('DesignPattern::AdapterProxy'
167   * </pre>   * </pre>
168   *   *
169   * !!!!!!  refactor this to Data::Driver::Proxy  !!!!!!     <-----------------   * !!!!!!  refactor this to Data::Driver::Proxy  !!!!!!     <-----------------
170     * </p>
171   *   *
172   *   *
173     * <p>
174   * <b>How to use?</b>   * <b>How to use?</b>
175   *   *
176   * Pass an array holding "locator metadata" to the constructor.   * Pass an array holding "locator metadata" to the constructor.
177   * GenericDataSource takes care of the rest.   * GenericDataSource takes care of the rest.
178   *   *
179     * <pre>
180   * Pass an array to the constructor: (e.g.)   * Pass an array to the constructor: (e.g.)
181   *   *
182   *  1. doing rpc-calls....   *  1. doing rpc-calls....
# Line 175  loadModule('DesignPattern::AdapterProxy' Line 198  loadModule('DesignPattern::AdapterProxy'
198   *    $source = ne w GenericDataSource($locator);   *    $source = ne w GenericDataSource($locator);
199   *    $this->set_data_source( &$source );   *    $this->set_data_source( &$source );
200   *    </code>   *    </code>
201     * </pre>
202     * </p>
203     *
204   *   *
205   * @link http://www.netfrag.org/~joko/   * @link http://www.netfrag.org/~joko/
206   * @author Andreas Motl <andreas.motl@ilo.de>   * @author Andreas Motl <andreas.motl@ilo.de>
# Line 193  loadModule('DesignPattern::AdapterProxy' Line 219  loadModule('DesignPattern::AdapterProxy'
219   * @name DataSource::Generic   * @name DataSource::Generic
220   *   *
221   * @todo this:   * @todo this:
222     * o mungle this to be able to be wrapped around phpHtmlLib's own storage-handles
223     * o implement another Data::Driver::Proxy container
224   *   *
225   * <ul>   * <pre>
  *  o mungle this to be able to be wrapped around phpHtmlLib's own storage-handles  
  *  o implement another Data::Driver::Proxy container  
  * </ul>  
  *  
226   *              !!!!!!!!          THIS IS THE PROBLEM          !!!!!!!!   *              !!!!!!!!          THIS IS THE PROBLEM          !!!!!!!!
227   *    !!!!!!!!   here is it where we have to break inheritance again   !!!!!!!!   *    !!!!!!!!   here is it where we have to break inheritance again   !!!!!!!!
228   *   *
# Line 214  loadModule('DesignPattern::AdapterProxy' Line 238  loadModule('DesignPattern::AdapterProxy'
238   *      2. here: DataSource - scope:   *      2. here: DataSource - scope:
239   *          x handles bridge to frameworks (e.g. phpHtmlLib) vs. actual data driver libs (PEAR, etc.))   *          x handles bridge to frameworks (e.g. phpHtmlLib) vs. actual data driver libs (PEAR, etc.))
240   *          o clean implementation using a DesignPattern::AdapterProxy   *          o clean implementation using a DesignPattern::AdapterProxy
241     * </pre>
242   *   *
243   *   *
244   */   */
# Line 441  class DataSource_Generic extends DesignP Line 466  class DataSource_Generic extends DesignP
466            case 'phpHtmlLib':            case 'phpHtmlLib':
467              //$adapter_arguments = $args[title];              //$adapter_arguments = $args[title];
468    
469              $this->set_adapter_module('DataSource::Adapter::phpHtmlLib::DataListSource');              $this->set_adapter_module('DataSource::Adapter::phpHtmlLib::DataSource');
470                            
471              // in order to let the Adapter communicate with the Proxy,              // in order to let the Adapter communicate with the Proxy,
472              // instantiate a wrapper method in a third namespace via              // instantiate a wrapper method in a third namespace via
# Line 646  class DataSource_Generic extends DesignP Line 671  class DataSource_Generic extends DesignP
671        // FIXME: abstract this some more (e.g. via a CommandMapper|Registry)        // FIXME: abstract this some more (e.g. via a CommandMapper|Registry)
672          switch ($this->_query[metatype]) {          switch ($this->_query[metatype]) {
673            case 'data':            case 'data':
674              //$command = 'queryData';              $command = 'queryData';
675              $command = 'getObjects';   // FIXME!!!              //$command = 'getObjects';   // FIXME!!!
676              //$this->_locator->set_option('metadata.command', $command);              //$this->_locator->set_option('metadata.command', $command);
677    /*
678              $args = array();              $args = array();
679              switch ($this->_query[vartype]) {              switch ($this->_query[vartype]) {
680                case 'object':                case 'objects':
681                  if (!$this->_query[classname]) {                  if (!$this->_query[classname]) {
682                    $msg = "_query[vartype] == 'object' requires _query[classname]";                    $msg = "_query[vartype] == 'objects' requires _query[classname]";
683                    user_error("GenericDataSource::query_data() - failed: " . $msg);                    user_error("GenericDataSource::query_data() - failed: " . $msg);
684                  }                  }
685                  array_push($args, $this->_query[classname]);                  array_push($args, $this->_query[classname]);
686                  break;                  break;
687              }              }
688              break;   */
689                $query_args = array();
690                 switch ($this->_query[abstract_type]) {
691                  case 'list':
692                    if (!$this->_query[classname]) {
693                      $msg = "_query[vartype] == 'objects' requires _query[classname]";
694                      user_error("GenericDataSource::query_data() - failed: " . $msg);
695                    }
696                    //array_push($query_args, $this->_query[classname]);
697                    $query_args[classname] = $this->_query[classname];
698                    break;
699                  case 'item':
700                    if (!$this->_query[classname]) {
701                      $msg = "_query[vartype] == 'objects' requires _query[classname]";
702                      user_error("GenericDataSource::query_data() - failed: " . $msg);
703                    }
704                    $query_args[guid] = $this->_query[ident];
705                    $query_args[classname] = $this->_query[classname];
706                    break;              
707                }
708                $args = array(
709                              'data_type' => $this->_query[abstract_type],
710                              'query_args' => $query_args
711                              );
712               break;
713    
714              // querySchema
715            case 'schema':            case 'schema':
716                //print "Testing schema:" . "<br>";
717              $command = 'querySchema';              $command = 'querySchema';
718              break;              break;
719          }          }

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.9

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