/[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.3 - (show annotations)
Fri Feb 28 04:16:19 2003 UTC (21 years, 4 months ago) by joko
Branch: MAIN
Changes since 1.2: +6 -7 lines
fix: getStatus now return status in bool

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

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