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 |
|
* @filesource |
9 |
|
* |
10 |
|
* |
11 |
|
* <b>Cvs-Log:</b> |
12 |
|
* |
13 |
|
* <pre> |
14 |
* ------------------------------------------------------------------------- |
* ------------------------------------------------------------------------- |
15 |
* $Id$ |
* $Id$ |
16 |
* ------------------------------------------------------------------------- |
* ------------------------------------------------------------------------- |
17 |
* $Log$ |
* $Log$ |
18 |
|
* Revision 1.4 2003/03/05 16:32:19 joko |
19 |
|
* updated docu (phpDocumentor testing....) |
20 |
|
* |
21 |
|
* Revision 1.3 2003/03/05 16:10:17 joko |
22 |
|
* updated docu (phpDocumentor testing....) |
23 |
|
* |
24 |
|
* Revision 1.2 2003/03/05 12:14:02 joko |
25 |
|
* renamed method |
26 |
|
* constructor argument expansion |
27 |
|
* |
28 |
* Revision 1.1 2003/03/03 22:06:46 joko |
* Revision 1.1 2003/03/03 22:06:46 joko |
29 |
* refactored from Data::Driver::Proxy |
* refactored from Data::Driver::Proxy |
30 |
* |
* |
112 |
* Revision 1.1 2002/10/09 00:51:39 cvsjoko |
* Revision 1.1 2002/10/09 00:51:39 cvsjoko |
113 |
* + new |
* + new |
114 |
* ------------------------------------------------------------------------- |
* ------------------------------------------------------------------------- |
115 |
|
* </pre> |
116 |
|
* |
117 |
*/ |
*/ |
118 |
|
|
119 |
|
|
120 |
|
|
121 |
|
|
122 |
/** |
/** |
123 |
|
* Load required modules: |
124 |
* |
* |
125 |
|
*/ |
126 |
|
loadModule('DesignPattern::Proxy'); |
127 |
|
|
128 |
|
|
129 |
|
/** |
130 |
* Data::Driver::Proxy -- Multiple stage data fetching and caching |
* Data::Driver::Proxy -- Multiple stage data fetching and caching |
131 |
* |
* |
132 |
* |
* |
141 |
* |
* |
142 |
* Multiple stage data fetching and caching: |
* Multiple stage data fetching and caching: |
143 |
* |
* |
144 |
|
* <pre> |
145 |
|
* |
146 |
* DATA, ... |
* DATA, ... |
147 |
* ... also refered to as data, should be handled as |
* ... also refered to as data, should be handled as |
148 |
* something called data. |
* something called data. |
185 |
* o Data::Driver::PEAR::DB |
* o Data::Driver::PEAR::DB |
186 |
* x Data::Driver::PEAR::Tree (via Data::Lift) |
* x Data::Driver::PEAR::Tree (via Data::Lift) |
187 |
* |
* |
188 |
*/ |
* </pre> |
189 |
|
* |
190 |
/** |
* |
191 |
* Todo: |
* An attempt to implement some software design patterns |
192 |
|
* --- RemoteProxyPattern |
193 |
|
* |
194 |
|
* @link http://c2.com/cgi-bin/wiki?ProxyPattern |
195 |
|
* |
196 |
|
* @author Andreas Motl <andreas.motl@ilo.de> |
197 |
|
* @link http://www.netfrag.org/~joko/ |
198 |
|
* |
199 |
|
* @copyright (c) 2003 - All Rights reserved. |
200 |
|
* @license GNU LGPL (GNU Lesser General Public License) |
201 |
|
* @link http://www.gnu.org/licenses/lgpl.txt |
202 |
|
* |
203 |
|
* @package org.netfrag.glib |
204 |
|
* @name DesignPattern::RemoteProxy |
205 |
|
* |
206 |
|
* |
207 |
|
* @todo |
208 |
|
* <pre> |
209 |
* 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 |
210 |
* o make feature available via runtime setter-method to these options |
* o make feature available via runtime setter-method to these options |
211 |
* o use PEAR::Cache for caching purposes!!! |
* o use PEAR::Cache for caching purposes!!! |
213 |
* o make database connection more flexible to make possible |
* o make database connection more flexible to make possible |
214 |
* to have different (probably named) proxy databases (besides a "main database") |
* to have different (probably named) proxy databases (besides a "main database") |
215 |
* 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? |
216 |
|
* </pre> |
217 |
* |
* |
218 |
*/ |
*/ |
|
|
|
|
/** |
|
|
* Load required modules: |
|
|
* |
|
|
*/ |
|
|
loadModule('DesignPattern::Proxy'); |
|
|
|
|
219 |
class DesignPattern_RemoteProxy extends DesignPattern_Proxy { |
class DesignPattern_RemoteProxy extends DesignPattern_Proxy { |
220 |
|
|
221 |
var $objectId; |
var $objectId; |
229 |
logp(get_class($this) . "->new()", PEAR_LOG_INFO); |
logp(get_class($this) . "->new()", PEAR_LOG_INFO); |
230 |
global $proxy; |
global $proxy; |
231 |
|
|
232 |
|
// 2003-03-05 - modified constructor |
233 |
|
// expand objectId |
234 |
|
if (is_array($objectId)) { |
235 |
|
$options = $objectId[1]; |
236 |
|
$objectId = $objectId[0]; |
237 |
|
} |
238 |
|
|
239 |
// trace |
// trace |
240 |
//print Dumper($objectId, $options); |
//print Dumper($objectId, $options); |
241 |
|
|
244 |
$this->_init_caching(); |
$this->_init_caching(); |
245 |
$this->_init_load(); |
$this->_init_load(); |
246 |
|
|
247 |
|
//print Dumper($this); |
248 |
|
|
249 |
} |
} |
250 |
|
|
251 |
function _init_meta_options( $objectId="", $options = array() ) { |
function _init_meta_options( $objectId="", $options = array() ) { |
270 |
|
|
271 |
if ($this->meta[remote]) { |
if ($this->meta[remote]) { |
272 |
//$this->backend = mkObject('Data::Driver::RPC::Remote', $this->meta[rpcinfo]); |
//$this->backend = mkObject('Data::Driver::RPC::Remote', $this->meta[rpcinfo]); |
273 |
$this->backend = mkObject('DataSource::Proxy::XMLRPC', $this->meta[rpcinfo]); |
$this->backend = php::mkComponent('DataSource::Proxy::XMLRPC', $this->meta[rpcinfo]); |
274 |
} |
} |
275 |
} |
} |
276 |
|
|
328 |
} |
} |
329 |
*/ |
*/ |
330 |
|
|
331 |
function getAttributes() { |
function getResult() { |
332 |
if (!$this->meta[decoded]) { |
if (!$this->meta[decoded]) { |
333 |
$this->_decode(); |
$this->_decode(); |
334 |
$this->_saveState(); |
$this->_saveState(); |