/[cvs]/nfo/php/libs/org.netfrag.glib/DesignPattern/RemoteProxy.php
ViewVC logotype

Diff of /nfo/php/libs/org.netfrag.glib/DesignPattern/RemoteProxy.php

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

revision 1.1 by joko, Mon Mar 3 22:06:46 2003 UTC revision 1.6 by joko, Wed Mar 5 17:28:43 2003 UTC
# Line 1  Line 1 
1  <?php  <?php
   
2  /**  /**
3     * This file contains the DesignPattern::RemoteProxy class
4     *
5     * @author Andreas Motl <andreas.motl@ilo.de>
6     * @package org.netfrag.glib
7     * @name DesignPattern::RemoteProxy
8     * @filesource
9     *
10     *
11     * <b>Cvs-Log:</b>
12     *
13     * <pre>
14   * -------------------------------------------------------------------------   * -------------------------------------------------------------------------
15   *    $Id$   *    $Id$
16   * -------------------------------------------------------------------------   * -------------------------------------------------------------------------
17   *    $Log$   *    $Log$
18     *    Revision 1.6  2003/03/05 17:28:43  joko
19     *    updated docu (phpDocumentor testing....)
20     *
21     *    Revision 1.5  2003/03/05 17:02:22  joko
22     *    updated docu (phpDocumentor testing....)
23     *
24     *    Revision 1.4  2003/03/05 16:32:19  joko
25     *    updated docu (phpDocumentor testing....)
26     *
27     *    Revision 1.3  2003/03/05 16:10:17  joko
28     *    updated docu (phpDocumentor testing....)
29     *
30     *    Revision 1.2  2003/03/05 12:14:02  joko
31     *    renamed method
32     *    constructor argument expansion
33     *
34   *    Revision 1.1  2003/03/03 22:06:46  joko   *    Revision 1.1  2003/03/03 22:06:46  joko
35   *    refactored from Data::Driver::Proxy   *    refactored from Data::Driver::Proxy
36   *   *
# Line 92  Line 118 
118   *    Revision 1.1  2002/10/09 00:51:39  cvsjoko   *    Revision 1.1  2002/10/09 00:51:39  cvsjoko
119   *    + new   *    + new
120   * -------------------------------------------------------------------------   * -------------------------------------------------------------------------
121     * </pre>
122     *
123   */   */
124    
125    
126    
127    
128  /**  /**
129     * Load required modules:
130   *   *
131     */
132    loadModule('DesignPattern::Proxy');
133    
134    
135    /**
136   * Data::Driver::Proxy  --  Multiple stage data fetching and caching   * Data::Driver::Proxy  --  Multiple stage data fetching and caching
137   *   *
138   *   *
# Line 110  Line 147 
147   *   *
148   * Multiple stage data fetching and caching:   * Multiple stage data fetching and caching:
149   *   *
150     * <pre>
151     *
152   * DATA, ...   * DATA, ...
153   *    ... also refered to as data, should be handled as   *    ... also refered to as data, should be handled as
154   *    something called data.   *    something called data.
# Line 152  Line 191 
191   *    o Data::Driver::PEAR::DB   *    o Data::Driver::PEAR::DB
192   *    x Data::Driver::PEAR::Tree (via Data::Lift)   *    x Data::Driver::PEAR::Tree (via Data::Lift)
193   *   *
194   */   * </pre>
   
 /**  
  * Todo:  
  *  x extend options to en-/disable caching via a) session and/or b) database  
  *    o make feature available via runtime setter-method to these options  
  *  o use PEAR::Cache for caching purposes!!!  
  *  o refactor database access: use PEAR for this! no more 'connectdb' here!!!  
  *  o make database connection more flexible to make possible  
  *      to have different (probably named) proxy databases (besides a "main database")  
  *  o rename this to Data::Proxy? or split into Data::Query, Data::Result and Data::Wrapper?  
195   *   *
196   */   *
197     * An attempt to implement some software design patterns
198  /**   * --- RemoteProxyPattern
199   * Load required modules:   *
200     * @link http://c2.com/cgi-bin/wiki?ProxyPattern
201     *
202     * @author Andreas Motl <andreas.motl@ilo.de>
203     * @link http://www.netfrag.org/~joko/
204     *
205     * @copyright (c) 2003 - All Rights reserved.
206     * @license GNU LGPL (GNU Lesser General Public License)
207     * @link http://www.gnu.org/licenses/lgpl.txt
208     *
209     * @package org.netfrag.glib
210     * @subpackage DesignPattern
211     * @name DesignPattern::RemoteProxy
212     *
213     *
214     * @todo
215     * <pre>
216     * x extend options to en-/disable caching via a) session and/or b) database
217     *   o make feature available via runtime setter-method to these options
218     * o use PEAR::Cache for caching purposes!!!
219     * o refactor database access: use PEAR for this! no more 'connectdb' here!!!
220     * o make database connection more flexible to make possible
221     *     to have different (probably named) proxy databases (besides a "main database")
222     * o rename this to Data::Proxy? or split into Data::Query, Data::Result and Data::Wrapper?
223     * </pre>
224   *   *
225   */   */
 loadModule('DesignPattern::Proxy');  
   
226  class DesignPattern_RemoteProxy extends DesignPattern_Proxy {  class DesignPattern_RemoteProxy extends DesignPattern_Proxy {
227    
228    var $objectId;    var $objectId;
# Line 185  class DesignPattern_RemoteProxy extends Line 236  class DesignPattern_RemoteProxy extends
236      logp(get_class($this) . "->new()", PEAR_LOG_INFO);      logp(get_class($this) . "->new()", PEAR_LOG_INFO);
237      global $proxy;      global $proxy;
238    
239        // 2003-03-05 - modified constructor
240        // expand objectId
241        if (is_array($objectId)) {
242          $options = $objectId[1];
243          $objectId = $objectId[0];
244        }
245    
246      // trace      // trace
247        //print Dumper($objectId, $options);        //print Dumper($objectId, $options);
248    
# Line 193  class DesignPattern_RemoteProxy extends Line 251  class DesignPattern_RemoteProxy extends
251        $this->_init_caching();        $this->_init_caching();
252        $this->_init_load();        $this->_init_load();
253    
254        //print Dumper($this);
255    
256    }    }
257    
258    function _init_meta_options( $objectId="", $options = array() ) {    function _init_meta_options( $objectId="", $options = array() ) {
# Line 217  class DesignPattern_RemoteProxy extends Line 277  class DesignPattern_RemoteProxy extends
277    
278      if ($this->meta[remote]) {      if ($this->meta[remote]) {
279        //$this->backend = mkObject('Data::Driver::RPC::Remote', $this->meta[rpcinfo]);        //$this->backend = mkObject('Data::Driver::RPC::Remote', $this->meta[rpcinfo]);
280        $this->backend = mkObject('DataSource::Proxy::XMLRPC', $this->meta[rpcinfo]);        $this->backend = php::mkComponent('DataSource::Proxy::XMLRPC', $this->meta[rpcinfo]);
281      }      }
282    }    }
283    
# Line 275  class DesignPattern_RemoteProxy extends Line 335  class DesignPattern_RemoteProxy extends
335    }      }  
336    */    */
337    
338    function getAttributes() {    function getResult() {
339      if (!$this->meta[decoded]) {      if (!$this->meta[decoded]) {
340        $this->_decode();        $this->_decode();
341        $this->_saveState();        $this->_saveState();

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.6

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