| 1 | 
 <? | 
 <? | 
| 2 | 
  | 
 /** | 
| 3 | 
  | 
  * This file contains the Application::AbstractBackend class. | 
| 4 | 
  | 
  * | 
| 5 | 
  | 
  * It's another (the final) code wrapper around the RPC-XML | 
| 6 | 
  | 
  * transport-part. (DataSource::Generic, DesignPattern::RemoteProxy | 
| 7 | 
  | 
  * and DataSource::Handler::RPCXML). | 
| 8 | 
  | 
  * The php core remote methods are vivified here. | 
| 9 | 
  | 
  * | 
| 10 | 
  | 
  * @author Andreas Motl <andreas.motl@ilo.de> | 
| 11 | 
  | 
  * @package org.netfrag.glib | 
| 12 | 
  | 
  * @name Application::AbstractBackend | 
| 13 | 
  | 
  * | 
| 14 | 
  | 
  */ | 
| 15 | 
  | 
  | 
| 16 | 
  | 
  | 
| 17 | 
 // --------------------------------------------------------------------------- | 
 // --------------------------------------------------------------------------- | 
| 18 | 
 //  $Id$ | 
 //  $Id$ | 
| 19 | 
 // --------------------------------------------------------------------------- | 
 // --------------------------------------------------------------------------- | 
| 20 | 
 //  $Log$ | 
 //  $Log$ | 
| 21 | 
  | 
 //  Revision 1.8  2003/04/04 21:17:27  joko | 
| 22 | 
  | 
 //  added comments | 
| 23 | 
  | 
 //  + dummy method 'function getTopics' (prepared) | 
| 24 | 
  | 
 // | 
| 25 | 
  | 
 //  Revision 1.7  2003/03/10 22:58:48  joko | 
| 26 | 
  | 
 //  + fixed metadata for phpDocumentor | 
| 27 | 
  | 
 // | 
| 28 | 
  | 
 //  Revision 1.6  2003/03/05 11:59:34  joko | 
| 29 | 
  | 
 //  renamed method | 
| 30 | 
  | 
 // | 
| 31 | 
  | 
 //  Revision 1.5  2003/03/03 21:11:01  joko | 
| 32 | 
  | 
 //  mungled the namespaces | 
| 33 | 
  | 
 // | 
| 34 | 
  | 
 //  Revision 1.4  2003/03/01 04:58:02  joko | 
| 35 | 
  | 
 //  shifted four methods one more level to concreteness | 
| 36 | 
  | 
 // | 
| 37 | 
  | 
 //  Revision 1.3  2003/02/28 04:16:19  joko | 
| 38 | 
  | 
 //  fix: getStatus now return status in bool | 
| 39 | 
  | 
 // | 
| 40 | 
 //  Revision 1.2  2003/02/27 14:37:56  jonen | 
 //  Revision 1.2  2003/02/27 14:37:56  jonen | 
| 41 | 
 //  + added function 'saveObjectByGuid()' | 
 //  + added function 'saveObjectByGuid()' | 
| 42 | 
 // | 
 // | 
| 46 | 
 // --------------------------------------------------------------------------- | 
 // --------------------------------------------------------------------------- | 
| 47 | 
  | 
  | 
| 48 | 
  | 
  | 
| 49 | 
  | 
 /** | 
| 50 | 
  | 
  * --- Application::AbstractBackend | 
| 51 | 
  | 
  * | 
| 52 | 
  | 
  * @author Andreas Motl <andreas.motl@ilo.de> | 
| 53 | 
  | 
  * @package org.netfrag.glib | 
| 54 | 
  | 
  * @subpackage Application | 
| 55 | 
  | 
  * @name Application::AbstractBackend | 
| 56 | 
  | 
  * | 
| 57 | 
  | 
  */ | 
| 58 | 
 class Application_AbstractBackend { | 
 class Application_AbstractBackend { | 
| 59 | 
  | 
  | 
| 60 | 
   var $rpcinfo; | 
   var $rpcinfo; | 
| 79 | 
     // --------------------   clone this & modify  ---------- | 
     // --------------------   clone this & modify  ---------- | 
| 80 | 
     $rpcinfo = $this->rpcinfo; | 
     $rpcinfo = $this->rpcinfo; | 
| 81 | 
     //$rpcinfo[to_latin] = 1;   // FIXME! implement this into Data::Driver::RPC::Remote! | 
     //$rpcinfo[to_latin] = 1;   // FIXME! implement this into Data::Driver::RPC::Remote! | 
| 82 | 
     $resultHandle = mkObject('Data::Driver::Proxy', $cache_key, array( key => 1, command => $command, query => $query, remote => 1, rpcinfo => $rpcinfo, cache => array( db => 0, session => 1 ) ) ); | 
     $resultHandle = mkObject('DesignPattern::RemoteProxy', $cache_key, array( key => 1, command => $command, query => $query, remote => 1, rpcinfo => $rpcinfo, cache => array( db => 0, session => 1 ) ) ); | 
| 83 | 
     $result = $resultHandle->getAttributes(); | 
     $result = $resultHandle->getResult(); | 
| 84 | 
  | 
     //print Dumper($result); exit; | 
| 85 | 
     return $result; | 
     return $result; | 
| 86 | 
     // --------------------   clone this & modify  ---------- | 
     // --------------------   clone this & modify  ---------- | 
| 87 | 
  | 
  | 
| 88 | 
   } | 
   } | 
| 89 | 
    | 
    | 
 | 
   function getObjectList() { | 
  | 
 | 
     return $this->_remote_method('getObjectList'); | 
  | 
 | 
   } | 
  | 
 | 
  | 
  | 
 | 
   function getObjects($obj_type) { | 
  | 
 | 
     return $this->_remote_method('getObjects', $obj_type); | 
  | 
 | 
   } | 
  | 
 | 
  | 
  | 
 | 
   function getObjectByGuid($obj_guid, $classname) { | 
  | 
 | 
     return $this->_remote_method('getObjectByGuid', array('guid' => $obj_guid, 'classname' => $classname)); | 
  | 
 | 
   } | 
  | 
 | 
  | 
  | 
 | 
   function saveObjectByGuid($obj, $classname) { | 
  | 
 | 
     return $this->_remote_method('saveObjectByGuid', array('data' => $obj, 'guid' => $obj['guid'], 'classname' => $classname)); | 
  | 
 | 
   } | 
  | 
 | 
  | 
  | 
| 90 | 
   function getStatus() { | 
   function getStatus() { | 
| 91 | 
     global $app; | 
     global $app; | 
| 92 | 
     //print Dumper($app); | 
     $proxy = mkObject('DesignPattern::RemoteProxy', null, array( remote => 1, rpcinfo => $app->getConfig("rpcinfo") ) ); | 
| 93 | 
     $proxy = mkObject('Data::Driver::Proxy', null, array( remote => 1, rpcinfo => $app->getConfig("rpcinfo") ) ); | 
     return $proxy->backend->isConnected(); | 
 | 
     //print Dumper($proxy); | 
  | 
 | 
     $status_bool = $proxy->backend->isConnected(); | 
  | 
 | 
     $status_yesno = $status_bool ? 'yes' : 'no'; | 
  | 
 | 
     return $status_yesno; | 
  | 
| 94 | 
   } | 
   } | 
| 95 | 
    | 
  | 
| 96 | 
   function forceConnect() { | 
   function forceConnect() { | 
| 97 | 
     global $app; | 
     global $app; | 
| 98 | 
     //print Dumper($app); | 
     //print Dumper($app); | 
| 99 | 
     $proxy = mkObject('Data::Driver::Proxy', null, array( remote => 1, rpcinfo => $app->getConfig("rpcinfo"), connect => 1 ) ); | 
     $proxy = mkObject('DesignPattern::RemoteProxy', null, array( remote => 1, rpcinfo => $app->getConfig("rpcinfo"), connect => 1 ) ); | 
| 100 | 
     //print Dumper($proxy); | 
     //print Dumper($proxy); | 
| 101 | 
     $proxy->backend->ping(); | 
     $proxy->backend->ping(); | 
| 102 | 
     $status_bool = $proxy->backend->isConnected(); | 
     $status_bool = $proxy->backend->isConnected(); | 
| 103 | 
     $status_yesno = $status_bool ? 'yes' : 'no'; | 
     $status_yesno = $status_bool ? 'yes' : 'no'; | 
| 104 | 
     return $status_yesno; | 
     return $status_yesno; | 
| 105 | 
   }     | 
   }     | 
| 106 | 
    | 
  | 
| 107 | 
  | 
   // TODO: | 
| 108 | 
  | 
   function getTopics($arg1) { | 
| 109 | 
  | 
     return $this->_remote_method('getTopics', $arg1); | 
| 110 | 
  | 
   } | 
| 111 | 
  | 
  | 
| 112 | 
 } | 
 } | 
| 113 | 
  | 
  | 
| 114 | 
 ?> | 
 ?> |