1 |
<?php |
<?php |
2 |
|
/** |
3 |
|
* This file contains the DesignPattern::RemoteProxy class |
4 |
|
* |
5 |
|
* @author Andreas Motl <andreas.motl@ilo.de> |
6 |
|
* @package org.netfrag.glib |
7 |
|
* @name DesignPattern::RemoteProxy |
8 |
|
* |
9 |
|
*/ |
10 |
|
|
11 |
/** |
/** |
12 |
* ------------------------------------------------------------------------- |
* ------------------------------------------------------------------------- |
13 |
* $Id$ |
* $Id$ |
14 |
* ------------------------------------------------------------------------- |
* ------------------------------------------------------------------------- |
15 |
* $Log$ |
* $Log$ |
16 |
|
* Revision 1.3 2003/03/05 16:10:17 joko |
17 |
|
* updated docu (phpDocumentor testing....) |
18 |
|
* |
19 |
|
* Revision 1.2 2003/03/05 12:14:02 joko |
20 |
|
* renamed method |
21 |
|
* constructor argument expansion |
22 |
|
* |
23 |
* Revision 1.1 2003/03/03 22:06:46 joko |
* Revision 1.1 2003/03/03 22:06:46 joko |
24 |
* refactored from Data::Driver::Proxy |
* refactored from Data::Driver::Proxy |
25 |
* |
* |
110 |
*/ |
*/ |
111 |
|
|
112 |
/** |
/** |
|
* |
|
113 |
* Data::Driver::Proxy -- Multiple stage data fetching and caching |
* Data::Driver::Proxy -- Multiple stage data fetching and caching |
114 |
* |
* |
115 |
* |
* |
169 |
*/ |
*/ |
170 |
|
|
171 |
/** |
/** |
172 |
* Todo: |
* An attempt to implement some software design patterns... |
173 |
|
* --- RemoteProxyPattern |
174 |
|
* |
175 |
|
* @link http://c2.com/cgi-bin/wiki?ProxyPattern |
176 |
|
* |
177 |
|
* @author Andreas Motl <andreas.motl@ilo.de> |
178 |
|
* @link http://www.netfrag.org/~joko/ |
179 |
|
* |
180 |
|
* @copyright (c) 2003 - All Rights reserved. |
181 |
|
* @license GNU LGPL (GNU Lesser General Public License) |
182 |
|
* @link http://www.gnu.org/licenses/lgpl.txt |
183 |
|
* |
184 |
|
* @package org.netfrag.glib |
185 |
|
* @name DesignPattern::RemoteProxy |
186 |
|
* |
187 |
|
*/ |
188 |
|
|
189 |
|
/** |
190 |
|
* @todo |
191 |
|
* <pre> |
192 |
* x extend options to en-/disable caching via a) session and/or b) database |
* x extend options to en-/disable caching via a) session and/or b) database |
193 |
* o make feature available via runtime setter-method to these options |
* o make feature available via runtime setter-method to these options |
194 |
* o use PEAR::Cache for caching purposes!!! |
* o use PEAR::Cache for caching purposes!!! |
196 |
* o make database connection more flexible to make possible |
* o make database connection more flexible to make possible |
197 |
* to have different (probably named) proxy databases (besides a "main database") |
* to have different (probably named) proxy databases (besides a "main database") |
198 |
* o rename this to Data::Proxy? or split into Data::Query, Data::Result and Data::Wrapper? |
* o rename this to Data::Proxy? or split into Data::Query, Data::Result and Data::Wrapper? |
199 |
|
* </pre> |
200 |
* |
* |
201 |
*/ |
*/ |
202 |
|
|
219 |
logp(get_class($this) . "->new()", PEAR_LOG_INFO); |
logp(get_class($this) . "->new()", PEAR_LOG_INFO); |
220 |
global $proxy; |
global $proxy; |
221 |
|
|
222 |
|
// 2003-03-05 - modified constructor |
223 |
|
// expand objectId |
224 |
|
if (is_array($objectId)) { |
225 |
|
$options = $objectId[1]; |
226 |
|
$objectId = $objectId[0]; |
227 |
|
} |
228 |
|
|
229 |
// trace |
// trace |
230 |
//print Dumper($objectId, $options); |
//print Dumper($objectId, $options); |
231 |
|
|
234 |
$this->_init_caching(); |
$this->_init_caching(); |
235 |
$this->_init_load(); |
$this->_init_load(); |
236 |
|
|
237 |
|
//print Dumper($this); |
238 |
|
|
239 |
} |
} |
240 |
|
|
241 |
function _init_meta_options( $objectId="", $options = array() ) { |
function _init_meta_options( $objectId="", $options = array() ) { |
260 |
|
|
261 |
if ($this->meta[remote]) { |
if ($this->meta[remote]) { |
262 |
//$this->backend = mkObject('Data::Driver::RPC::Remote', $this->meta[rpcinfo]); |
//$this->backend = mkObject('Data::Driver::RPC::Remote', $this->meta[rpcinfo]); |
263 |
$this->backend = mkObject('DataSource::Proxy::XMLRPC', $this->meta[rpcinfo]); |
$this->backend = php::mkComponent('DataSource::Proxy::XMLRPC', $this->meta[rpcinfo]); |
264 |
} |
} |
265 |
} |
} |
266 |
|
|
318 |
} |
} |
319 |
*/ |
*/ |
320 |
|
|
321 |
function getAttributes() { |
function getResult() { |
322 |
if (!$this->meta[decoded]) { |
if (!$this->meta[decoded]) { |
323 |
$this->_decode(); |
$this->_decode(); |
324 |
$this->_saveState(); |
$this->_saveState(); |