/[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.9 by joko, Mon Mar 10 23:05:25 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     *
9     *
10     */
11    
12    
13  /**  /**
14     * <b>Cvs-Log:</b>
15     *
16     * <pre>
17   * -------------------------------------------------------------------------   * -------------------------------------------------------------------------
18   *    $Id$   *    $Id$
19   * -------------------------------------------------------------------------   * -------------------------------------------------------------------------
20   *    $Log$   *    $Log$
21     *    Revision 1.9  2003/03/10 23:05:25  joko
22     *    + fixed metadata for phpDocumentor
23     *
24     *    Revision 1.8  2003/03/10 22:31:56  joko
25     *    + fixed metadata for phpDocumentor
26     *
27     *    Revision 1.7  2003/03/09 15:51:44  joko
28     *    + additional metadata for Autodia
29     *
30     *    Revision 1.6  2003/03/05 17:28:43  joko
31     *    updated docu (phpDocumentor testing....)
32     *
33     *    Revision 1.5  2003/03/05 17:02:22  joko
34     *    updated docu (phpDocumentor testing....)
35     *
36     *    Revision 1.4  2003/03/05 16:32:19  joko
37     *    updated docu (phpDocumentor testing....)
38     *
39     *    Revision 1.3  2003/03/05 16:10:17  joko
40     *    updated docu (phpDocumentor testing....)
41     *
42     *    Revision 1.2  2003/03/05 12:14:02  joko
43     *    renamed method
44     *    constructor argument expansion
45     *
46   *    Revision 1.1  2003/03/03 22:06:46  joko   *    Revision 1.1  2003/03/03 22:06:46  joko
47   *    refactored from Data::Driver::Proxy   *    refactored from Data::Driver::Proxy
48   *   *
# Line 92  Line 130 
130   *    Revision 1.1  2002/10/09 00:51:39  cvsjoko   *    Revision 1.1  2002/10/09 00:51:39  cvsjoko
131   *    + new   *    + new
132   * -------------------------------------------------------------------------   * -------------------------------------------------------------------------
133     * </pre>
134     *
135   */   */
136    
137    
138    
139    
140  /**  /**
141     * Load required modules:
142   *   *
143   * Data::Driver::Proxy  --  Multiple stage data fetching and caching   */
144    loadModule('DesignPattern::Proxy');
145    
146    
147    /**
148     * DesignPattern::RemoteProxy  --  Multiple stage data fetching and caching
149   *   *
150   *   *
151   * This class (Data::Driver::Proxy) provides an abstract framework   * This class (DesignPattern::RemoteProxy) provides an abstract framework
152   * for loading/saving arbitrary data from/to data storages interfaced   * for loading/saving arbitrary data from/to data storages interfaced
153   * by storage *proxy*-drivers.   * by storage *proxy*-drivers.
154   * Don't mix these up with the concrete storage *handle*-drivers   * Don't mix these up with the concrete storage *handle*-drivers
# Line 108  Line 157 
157   * providing a more highlevel, consistent API making   * providing a more highlevel, consistent API making
158   * it easier for Data::Driver::Proxy to do its main work:   * it easier for Data::Driver::Proxy to do its main work:
159   *   *
160     * quote from: http://home.earthlink.net/~huston2/dp/proxy.html
161     * "A remote proxy provides a local representative for an
162     * object that resides in a different address space. This is
163     * what the "stub" code in RPC and CORBA provides."
164     *
165     *
166   * Multiple stage data fetching and caching:   * Multiple stage data fetching and caching:
167   *   *
168     * <pre>
169     *
170   * DATA, ...   * DATA, ...
171   *    ... also refered to as data, should be handled as   *    ... also refered to as data, should be handled as
172   *    something called data.   *    something called data.
# Line 152  Line 209 
209   *    o Data::Driver::PEAR::DB   *    o Data::Driver::PEAR::DB
210   *    x Data::Driver::PEAR::Tree (via Data::Lift)   *    x Data::Driver::PEAR::Tree (via Data::Lift)
211   *   *
212   */   * </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?  
213   *   *
214   */   *
215     * An attempt to implement some software design patterns
216  /**   * --- RemoteProxyPattern
217   * Load required modules:   *
218     * @link http://www.agcs.com/supportv2/techpapers/patterns/papers/tutnotes/sld017.htm
219     * @link http://home.earthlink.net/~huston2/dp/proxy.html
220     * @link http://wiki.cs.uiuc.edu/PatternStories/RemoteObject
221     * @link http://c2.com/cgi-bin/wiki?ProxyPattern
222     * @link http://c2.com/cgi-bin/wiki?LazyProxies
223     *
224     * @author Andreas Motl <andreas.motl@ilo.de>
225     * @link http://www.netfrag.org/~joko/
226     *
227     * @copyright (c) 2003 - All Rights reserved.
228     * @license GNU LGPL (GNU Lesser General Public License)
229     * @link http://www.gnu.org/licenses/lgpl.txt
230     *
231     * @package org.netfrag.glib
232     * @subpackage DesignPattern
233     * @name DesignPattern::RemoteProxy
234     *
235     *
236     * @todo extend options to en-/disable caching via a) session and/or b) database
237     *           make feature available via runtime setter-method to these options
238     * @todo PEAR::Cache for caching purposes!!!
239     * @todo refactor database access: use PEAR for this! no more 'connectdb' here!!!
240     * @todo make database connection more flexible to make possible
241     *           to have different (probably named) proxy databases (besides a "main database")
242     * @todo rename this to Data::Proxy? or split into Data::Query, Data::Result and Data::Wrapper?
243     * @todo refactor this to a "RemoteObject" class!!! (inheriting from DesignPattern::RemoteObject)
244     * @todo rename this to "DesignPattern::LazyRemoteProxy"???
245   *   *
246   */   */
 loadModule('DesignPattern::Proxy');  
   
247  class DesignPattern_RemoteProxy extends DesignPattern_Proxy {  class DesignPattern_RemoteProxy extends DesignPattern_Proxy {
248    
249    var $objectId;    var $objectId;
# Line 185  class DesignPattern_RemoteProxy extends Line 257  class DesignPattern_RemoteProxy extends
257      logp(get_class($this) . "->new()", PEAR_LOG_INFO);      logp(get_class($this) . "->new()", PEAR_LOG_INFO);
258      global $proxy;      global $proxy;
259    
260        // 2003-03-05 - modified constructor
261        // expand objectId
262        if (is_array($objectId)) {
263          $options = $objectId[1];
264          $objectId = $objectId[0];
265        }
266    
267      // trace      // trace
268        //print Dumper($objectId, $options);        //print Dumper($objectId, $options);
269    
# Line 193  class DesignPattern_RemoteProxy extends Line 272  class DesignPattern_RemoteProxy extends
272        $this->_init_caching();        $this->_init_caching();
273        $this->_init_load();        $this->_init_load();
274    
275        //print Dumper($this);
276    
277    }    }
278    
279    function _init_meta_options( $objectId="", $options = array() ) {    function _init_meta_options( $objectId="", $options = array() ) {
# Line 215  class DesignPattern_RemoteProxy extends Line 296  class DesignPattern_RemoteProxy extends
296        session_register_safe("proxy");        session_register_safe("proxy");
297      }        }  
298    
299        /**
300         * <!-- Autodia -->
301         * can do: (this is metadata supplied for Autodia, don't delete!)
302         *  $this->backend = new DataSource_Proxy_XMLRPC()
303         *
304         */
305    
306      if ($this->meta[remote]) {      if ($this->meta[remote]) {
307        //$this->backend = mkObject('Data::Driver::RPC::Remote', $this->meta[rpcinfo]);        //$this->backend = mkObject('Data::Driver::RPC::Remote', $this->meta[rpcinfo]);
308        $this->backend = mkObject('DataSource::Proxy::XMLRPC', $this->meta[rpcinfo]);        $this->backend = php::mkComponent('DataSource::Proxy::XMLRPC', $this->meta[rpcinfo]);
309      }      }
310    }    }
311    
# Line 275  class DesignPattern_RemoteProxy extends Line 363  class DesignPattern_RemoteProxy extends
363    }      }  
364    */    */
365    
366    function getAttributes() {    function getResult() {
367      if (!$this->meta[decoded]) {      if (!$this->meta[decoded]) {
368        $this->_decode();        $this->_decode();
369        $this->_saveState();        $this->_saveState();

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

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