/[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.8 - (show annotations)
Fri Apr 4 21:17:27 2003 UTC (21 years, 3 months ago) by joko
Branch: MAIN
Changes since 1.7: +15 -2 lines
added comments
+ dummy method 'function getTopics' (prepared)

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: AbstractBackend.php,v 1.7 2003/03/10 22:58:48 joko Exp $
19 // ---------------------------------------------------------------------------
20 // $Log: AbstractBackend.php,v $
21 // Revision 1.7 2003/03/10 22:58:48 joko
22 // + fixed metadata for phpDocumentor
23 //
24 // Revision 1.6 2003/03/05 11:59:34 joko
25 // renamed method
26 //
27 // Revision 1.5 2003/03/03 21:11:01 joko
28 // mungled the namespaces
29 //
30 // Revision 1.4 2003/03/01 04:58:02 joko
31 // shifted four methods one more level to concreteness
32 //
33 // Revision 1.3 2003/02/28 04:16:19 joko
34 // fix: getStatus now return status in bool
35 //
36 // Revision 1.2 2003/02/27 14:37:56 jonen
37 // + added function 'saveObjectByGuid()'
38 //
39 // Revision 1.1 2003/02/22 16:19:38 joko
40 // + initial commit
41 //
42 // ---------------------------------------------------------------------------
43
44
45 /**
46 * --- Application::AbstractBackend
47 *
48 * @author Andreas Motl <andreas.motl@ilo.de>
49 * @package org.netfrag.glib
50 * @subpackage Application
51 * @name Application::AbstractBackend
52 *
53 */
54 class Application_AbstractBackend {
55
56 var $rpcinfo;
57
58 function Application_AbstractBackend($rpcinfo) {
59 $this->rpcinfo = $rpcinfo;
60 // debug
61 //print Dumper($this->rpcinfo);
62 }
63
64 function _remote_method() {
65 $arg_list = func_get_args();
66
67 $command = array_shift($arg_list);
68
69 $cache_key = join("-", array(session_id(), $command, join('_', $arg_list) ));
70 //print "cache_key: $cache_key<br>";
71
72 // FIXME: what if arg_list still contains more elements after doing this?
73 $query = array_shift($arg_list);
74
75 // -------------------- clone this & modify ----------
76 $rpcinfo = $this->rpcinfo;
77 //$rpcinfo[to_latin] = 1; // FIXME! implement this into Data::Driver::RPC::Remote!
78 $resultHandle = mkObject('DesignPattern::RemoteProxy', $cache_key, array( key => 1, command => $command, query => $query, remote => 1, rpcinfo => $rpcinfo, cache => array( db => 0, session => 1 ) ) );
79 $result = $resultHandle->getResult();
80 //print Dumper($result); exit;
81 return $result;
82 // -------------------- clone this & modify ----------
83
84 }
85
86 function getStatus() {
87 global $app;
88 $proxy = mkObject('DesignPattern::RemoteProxy', null, array( remote => 1, rpcinfo => $app->getConfig("rpcinfo") ) );
89 return $proxy->backend->isConnected();
90 }
91
92 function forceConnect() {
93 global $app;
94 //print Dumper($app);
95 $proxy = mkObject('DesignPattern::RemoteProxy', null, array( remote => 1, rpcinfo => $app->getConfig("rpcinfo"), connect => 1 ) );
96 //print Dumper($proxy);
97 $proxy->backend->ping();
98 $status_bool = $proxy->backend->isConnected();
99 $status_yesno = $status_bool ? 'yes' : 'no';
100 return $status_yesno;
101 }
102
103 // TODO:
104 function getTopics($arg1) {
105 return $this->_remote_method('getTopics', $arg1);
106 }
107
108 }
109
110 ?>

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