/[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.14 by joko, Wed Apr 9 02:06:45 2003 UTC revision 1.16 by jonen, Wed Jul 2 13:51:38 2003 UTC
# Line 18  Line 18 
18   *    $Id$   *    $Id$
19   * -------------------------------------------------------------------------   * -------------------------------------------------------------------------
20   *    $Log$   *    $Log$
21     *    Revision 1.16  2003/07/02 13:51:38  jonen
22     *    removed debug dumper
23     *
24     *    Revision 1.15  2003/04/11 01:32:21  joko
25     *    renamed logging function
26     *
27   *    Revision 1.14  2003/04/09 02:06:45  joko   *    Revision 1.14  2003/04/09 02:06:45  joko
28   *    errormessage now shown preformatted   *    errormessage now shown preformatted
29   *   *
# Line 269  class DesignPattern_RemoteProxy extends Line 275  class DesignPattern_RemoteProxy extends
275    var $backend;    var $backend;
276    
277    function DesignPattern_RemoteProxy($objectId = "", $options = array() ) {    function DesignPattern_RemoteProxy($objectId = "", $options = array() ) {
278      logp(get_class($this) . "->new()", PEAR_LOG_INFO);      php::log(get_class($this) . "->new()", PEAR_LOG_INFO);
279      global $proxy;      global $proxy;
280    
281      // 2003-03-05 - modified constructor      // 2003-03-05 - modified constructor
# Line 333  class DesignPattern_RemoteProxy extends Line 339  class DesignPattern_RemoteProxy extends
339    
340    
341    function load() {    function load() {
342      logp(get_class($this) . "->load()", PEAR_LOG_INFO);      php::log(get_class($this) . "->load()", PEAR_LOG_INFO);
343      if (!$this->_loadState()) {      if (!$this->_loadState()) {
344        if (!$this->_loadProxy()) {        if (!$this->_loadProxy()) {
345    
# Line 409  class DesignPattern_RemoteProxy extends Line 415  class DesignPattern_RemoteProxy extends
415        //print Dumper($this);        //print Dumper($this);
416    
417      // debug      // debug
418        logp(get_class($this) . "->_loadState()");        php::log(get_class($this) . "->_loadState()");
419                
420      if ($this->attributes = $proxy[$this->objectId]) {      if ($this->attributes = $proxy[$this->objectId]) {
421        //print "_loadState:" . dumpVar($this->attributes);        //print "_loadState:" . dumpVar($this->attributes);
# Line 421  class DesignPattern_RemoteProxy extends Line 427  class DesignPattern_RemoteProxy extends
427    
428    function _saveState() {    function _saveState() {
429      global $proxy;      global $proxy;
430      logp(get_class($this) . "->_saveState()");      php::log(get_class($this) . "->_saveState()");
431      $proxy[$this->objectId] = $this->attributes;      $proxy[$this->objectId] = $this->attributes;
432      //print "_saveState: " . dumpVar($this->attributes);      //print "_saveState: " . dumpVar($this->attributes);
433      // TODO: throw exception-message back to user if operation fails      // TODO: throw exception-message back to user if operation fails
# Line 434  class DesignPattern_RemoteProxy extends Line 440  class DesignPattern_RemoteProxy extends
440            
441      // trace & debug      // trace & debug
442        //print Dumper($this);        //print Dumper($this);
443        logp(get_class($this) . "->_loadProxy()");        php::log(get_class($this) . "->_loadProxy()");
444                
445      connectdb();      connectdb();
446      $sql = "SELECT payload FROM f_proxy WHERE oid='$this->objectId'";      $sql = "SELECT payload FROM f_proxy WHERE oid='$this->objectId'";
# Line 454  class DesignPattern_RemoteProxy extends Line 460  class DesignPattern_RemoteProxy extends
460      // FIXME!      // FIXME!
461      if (!$this->meta[cache][db]) { return; }      if (!$this->meta[cache][db]) { return; }
462    
463      logp(get_class($this) . "->_saveProxy()");      php::log(get_class($this) . "->_saveProxy()");
464          connectdb();          connectdb();
465          if ($this->payload) {          if ($this->payload) {
466        //$sql = "INSERT INTO f_proxy SET payload='$this->payload' WHERE oid='$this->objectId'";        //$sql = "INSERT INTO f_proxy SET payload='$this->payload' WHERE oid='$this->objectId'";
# Line 467  class DesignPattern_RemoteProxy extends Line 473  class DesignPattern_RemoteProxy extends
473    }    }
474        
475    function _loadRemote() {    function _loadRemote() {
476      logp(get_class($this) . "->_loadRemote()");      php::log(get_class($this) . "->_loadRemote()");
477            
478      // trace      // trace
479        //print Dumper($this->meta);        //print Dumper($this->meta);
# Line 476  class DesignPattern_RemoteProxy extends Line 482  class DesignPattern_RemoteProxy extends
482            
483      // 1. check backend-handle      // 1. check backend-handle
484      if (!$this->backend) {      if (!$this->backend) {
485        logp(get_class($this) . "->_loadRemote: no backend handle, please check argument 'rpcinfo'", PEAR_LOG_CRIT);        php::log(get_class($this) . "->_loadRemote: no backend handle, please check argument 'rpcinfo'", PEAR_LOG_CRIT);
486        return;        return;
487      }      }
488            
# Line 484  class DesignPattern_RemoteProxy extends Line 490  class DesignPattern_RemoteProxy extends
490        // check for guid or oid        // check for guid or oid
491        if ($this->meta[guid]) {        if ($this->meta[guid]) {
492          if (!$this->objectId) {          if (!$this->objectId) {
493            logp(get_class($this) . "->_loadRemote: argument 'guid' requires valid objectId", PEAR_LOG_WARNING);            php::log(get_class($this) . "->_loadRemote: argument 'guid' requires valid objectId", PEAR_LOG_WARNING);
494            return;            return;
495          }          }
496          if (!$this->meta[classname]) {          if (!$this->meta[classname]) {
497            logp(get_class($this) . "->_loadRemote: argument 'guid' requires 'classname'", PEAR_LOG_WARNING);            php::log(get_class($this) . "->_loadRemote: argument 'guid' requires 'classname'", PEAR_LOG_WARNING);
498            return;            return;
499          }          }
500          logp(get_class($this) . "->_loadRemote: getObjectByGuid", PEAR_LOG_DEBUG);          php::log(get_class($this) . "->_loadRemote: getObjectByGuid", PEAR_LOG_DEBUG);
501          $args = array( guid => $this->objectId, classname => $this->meta[classname] );          $args = array( guid => $this->objectId, classname => $this->meta[classname] );
502          $result = $this->backend->send('getObjectByGuid', $args );          $result = $this->backend->send('getObjectByGuid', $args );
503    
504        } elseif ($this->meta[oid]) {        } elseif ($this->meta[oid]) {
505          if (!$this->objectId) {          if (!$this->objectId) {
506            logp(get_class($this) . "->_loadRemote: argument 'oid' requires valid objectId", PEAR_LOG_WARNING);            php::log(get_class($this) . "->_loadRemote: argument 'oid' requires valid objectId", PEAR_LOG_WARNING);
507            return;            return;
508          }          }
509          logp(get_class($this) . "->_loadRemote: getObject", PEAR_LOG_DEBUG);          php::log(get_class($this) . "->_loadRemote: getObject", PEAR_LOG_DEBUG);
510          $result = $this->backend->send('getObject', $this->objectId);          $result = $this->backend->send('getObject', $this->objectId);
511    
512        } elseif ($this->meta[key]) {        } elseif ($this->meta[key]) {
513          if (!$this->meta[command]) {          if (!$this->meta[command]) {
514            logp(get_class($this) . "->_loadRemote: argument 'key' requires 'command'", PEAR_LOG_WARNING);            php::log(get_class($this) . "->_loadRemote: argument 'key' requires 'command'", PEAR_LOG_WARNING);
515            return;            return;
516          }          }
517          /*          /*
518          if (!$this->meta[query]) {          if (!$this->meta[query]) {
519            logp(get_class($this) . "->_loadRemote: argument 'key' requires 'query'", PEAR_LOG_WARNING);            php::log(get_class($this) . "->_loadRemote: argument 'key' requires 'query'", PEAR_LOG_WARNING);
520            return;            return;
521          }          }
522          */          */
523          //logp(get_class($this) . "->_loadRemote: $this->meta[command](" . join(' ', $this->meta[query]) . ")", PEAR_LOG_DEBUG);          //php::log(get_class($this) . "->_loadRemote: $this->meta[command](" . join(' ', $this->meta[query]) . ")", PEAR_LOG_DEBUG);
524          //print Dumper(array($this->meta[command], $this->meta[query]));          //print Dumper(array($this->meta[command], $this->meta[query]));
525          $result = $this->backend->send($this->meta[command], $this->meta[query]);          $result = $this->backend->send($this->meta[command], $this->meta[query]);
526                    
# Line 568  function draw_error_box($status) { Line 574  function draw_error_box($status) {
574    }    }
575        
576    $message = "Error while talking to remote side. Please check wire, socket or api.";    $message = "Error while talking to remote side. Please check wire, socket or api.";
577    logp($message, PEAR_LOG_CRIT);    php::log($message, PEAR_LOG_CRIT);
578    $statusbox->add( html_span('boxlabel_yellow', "Critical:"), $message, html_br() );    $statusbox->add( html_span('boxlabel_yellow', "Critical:"), $message, html_br() );
579    
580    // V1    // V1
# Line 590  function draw_error_box($status) { Line 596  function draw_error_box($status) {
596    
597    
598    function _saveBackend($result) {    function _saveBackend($result) {
599      logp(get_class($this) . "->_saveBackend()");      php::log(get_class($this) . "->_saveBackend()");
600    
601      //$encoder = new TextEncode($result);      //$encoder = new TextEncode($result);
602      //$encoder->toUTF8();      //$encoder->toUTF8();
# Line 621  function draw_error_box($status) { Line 627  function draw_error_box($status) {
627    
628  }  }
629    
 ?>  
630    ?>

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.16

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