/[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.3 by joko, Sun Mar 9 15:50:36 2003 UTC revision 1.10 by joko, Fri Mar 28 03:01:02 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.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
36     * + fixed metadata for phpDocumentor
37     *
38     * Revision 1.4  2003/03/10 23:25:03  joko
39     * + fixed metadata for phpDocumentor
40     *
41   * Revision 1.3  2003/03/09 15:50:36  joko   * Revision 1.3  2003/03/09 15:50:36  joko
42   * + additional metadata for Autodia   * + additional metadata for Autodia
43   *   *
# Line 44  Line 70 
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    
# Line 123  loadModule('DesignPattern::AdapterProxy' Line 149  loadModule('DesignPattern::AdapterProxy'
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
# Line 144  loadModule('DesignPattern::AdapterProxy' Line 170  loadModule('DesignPattern::AdapterProxy'
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....
# Line 172  loadModule('DesignPattern::AdapterProxy' Line 201  loadModule('DesignPattern::AdapterProxy'
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>
# Line 189  loadModule('DesignPattern::AdapterProxy' Line 221  loadModule('DesignPattern::AdapterProxy'
221   * @subpackage DataSource   * @subpackage DataSource
222   * @name DataSource::Generic   * @name DataSource::Generic
223   *   *
224   * @todo   * @todo this:
225   * <ul>   * o mungle this to be able to be wrapped around phpHtmlLib's own storage-handles
226   *  o mungle this to be able to be wrapped around phpHtmlLib's own storage-handles   * o implement another Data::Driver::Proxy container
  *  o implement another Data::Driver::Proxy container  
  * </ul>  
227   *   *
228     * <pre>
229  //              !!!!!!!!          THIS IS THE PROBLEM          !!!!!!!!   *              !!!!!!!!          THIS IS THE PROBLEM          !!!!!!!!
230  //    !!!!!!!!   here is it where we have to break inheritance again   !!!!!!!!   *    !!!!!!!!   here is it where we have to break inheritance again   !!!!!!!!
231  //   *
232  //    THE CONFLICT: Beeing in phpHtmlLib *and* DesignPattern::TransparentProxy   *    THE CONFLICT: Beeing in phpHtmlLib *and* DesignPattern::TransparentProxy
233  //    inheritance trees at the same time, which is *not* possible at   *    inheritance trees at the same time, which is *not* possible at
234  //    declare-time. We *do* need some runtime-infrastructure to solve this!   *    declare-time. We *do* need some runtime-infrastructure to solve this!
235  //   *
236  //    TODO: move build- and check-locator stuff from ObjectList to this place!!!   *    TODO: move build- and check-locator stuff from ObjectList to this place!!!
237  //   *
238  //    ABOUT:   *    ABOUT:
239  //      1. otherwhere: WebApp - scope:   *      1. otherwhere: WebApp - scope:
240  //          x handles page vs. block vs. widget; dispatches MVC-View   *          x handles page vs. block vs. widget; dispatches MVC-View
241  //      2. here: DataSource - scope:   *      2. here: DataSource - scope:
242  //          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.))
243  //          o clean implementation using a DesignPattern::AdapterProxy   *          o clean implementation using a DesignPattern::AdapterProxy
244  //   * </pre>
245     *
246  */   *
247     */
248  class DataSource_Generic extends DesignPattern_AdapterProxy {  class DataSource_Generic extends DesignPattern_AdapterProxy {
249    
250  //    !!!!!!!!   here is it where we have to break inheritance again   !!!!!!!!  //    !!!!!!!!   here is it where we have to break inheritance again   !!!!!!!!
# Line 438  class DataSource_Generic extends DesignP Line 469  class DataSource_Generic extends DesignP
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
# Line 643  class DataSource_Generic extends DesignP Line 674  class DataSource_Generic extends DesignP
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          }          }
# Line 725  class DataSource_Generic extends DesignP Line 784  class DataSource_Generic extends DesignP
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;

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.10

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