/[cvs]/nfo/php/libs/org.netfrag.glib/Application/AbstractBackend.php
ViewVC logotype

Contents of /nfo/php/libs/org.netfrag.glib/Application/AbstractBackend.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Thu Feb 27 14:37:56 2003 UTC (21 years, 6 months ago) by jonen
Branch: MAIN
Changes since 1.1: +9 -2 lines
+ added function 'saveObjectByGuid()'

1 <?
2 // ---------------------------------------------------------------------------
3 // $Id: AbstractBackend.php,v 1.1 2003/02/22 16:19:38 joko Exp $
4 // ---------------------------------------------------------------------------
5 // $Log: AbstractBackend.php,v $
6 // Revision 1.1 2003/02/22 16:19:38 joko
7 // + initial commit
8 //
9 // ---------------------------------------------------------------------------
10
11
12 class Application_AbstractBackend {
13
14 var $rpcinfo;
15
16 function Application_AbstractBackend($rpcinfo) {
17 $this->rpcinfo = $rpcinfo;
18 // debug
19 //print Dumper($this->rpcinfo);
20 }
21
22 function _remote_method() {
23 $arg_list = func_get_args();
24
25 $command = array_shift($arg_list);
26
27 $cache_key = join("-", array(session_id(), $command, join('_', $arg_list) ));
28 //print "cache_key: $cache_key<br>";
29
30 // FIXME: what if arg_list still contains more elements after doing this?
31 $query = array_shift($arg_list);
32
33 // -------------------- clone this & modify ----------
34 $rpcinfo = $this->rpcinfo;
35 //$rpcinfo[to_latin] = 1; // FIXME! implement this into Data::Driver::RPC::Remote!
36 $resultHandle = mkObject('Data::Driver::Proxy', $cache_key, array( key => 1, command => $command, query => $query, remote => 1, rpcinfo => $rpcinfo, cache => array( db => 0, session => 1 ) ) );
37 $result = $resultHandle->getAttributes();
38 return $result;
39 // -------------------- clone this & modify ----------
40
41 }
42
43 function getObjectList() {
44 return $this->_remote_method('getObjectList');
45 }
46
47 function getObjects($obj_type) {
48 return $this->_remote_method('getObjects', $obj_type);
49 }
50
51 function getObjectByGuid($obj_guid, $classname) {
52 return $this->_remote_method('getObjectByGuid', array('guid' => $obj_guid, 'classname' => $classname));
53 }
54
55 function saveObjectByGuid($obj, $classname) {
56 return $this->_remote_method('saveObjectByGuid', array('data' => $obj, 'guid' => $obj['guid'], 'classname' => $classname));
57 }
58
59 function getStatus() {
60 global $app;
61 //print Dumper($app);
62 $proxy = mkObject('Data::Driver::Proxy', null, array( remote => 1, rpcinfo => $app->getConfig("rpcinfo") ) );
63 //print Dumper($proxy);
64 $status_bool = $proxy->backend->isConnected();
65 $status_yesno = $status_bool ? 'yes' : 'no';
66 return $status_yesno;
67 }
68
69 function forceConnect() {
70 global $app;
71 //print Dumper($app);
72 $proxy = mkObject('Data::Driver::Proxy', null, array( remote => 1, rpcinfo => $app->getConfig("rpcinfo"), connect => 1 ) );
73 //print Dumper($proxy);
74 $proxy->backend->ping();
75 $status_bool = $proxy->backend->isConnected();
76 $status_yesno = $status_bool ? 'yes' : 'no';
77 return $status_yesno;
78 }
79
80 }
81
82 ?>

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