5 |
* @author Andreas Motl <andreas.motl@ilo.de> |
* @author Andreas Motl <andreas.motl@ilo.de> |
6 |
* @package org.netfrag.glib |
* @package org.netfrag.glib |
7 |
* @name DesignPattern::RemoteProxy |
* @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.7 2003/03/09 15:51:44 joko |
19 |
|
* + additional metadata for Autodia |
20 |
|
* |
21 |
|
* Revision 1.6 2003/03/05 17:28:43 joko |
22 |
|
* updated docu (phpDocumentor testing....) |
23 |
|
* |
24 |
|
* Revision 1.5 2003/03/05 17:02:22 joko |
25 |
|
* updated docu (phpDocumentor testing....) |
26 |
|
* |
27 |
|
* Revision 1.4 2003/03/05 16:32:19 joko |
28 |
|
* updated docu (phpDocumentor testing....) |
29 |
|
* |
30 |
* Revision 1.3 2003/03/05 16:10:17 joko |
* Revision 1.3 2003/03/05 16:10:17 joko |
31 |
* updated docu (phpDocumentor testing....) |
* updated docu (phpDocumentor testing....) |
32 |
* |
* |
121 |
* Revision 1.1 2002/10/09 00:51:39 cvsjoko |
* Revision 1.1 2002/10/09 00:51:39 cvsjoko |
122 |
* + new |
* + new |
123 |
* ------------------------------------------------------------------------- |
* ------------------------------------------------------------------------- |
124 |
|
* </pre> |
125 |
|
* |
126 |
*/ |
*/ |
127 |
|
|
128 |
|
|
129 |
|
|
130 |
|
|
131 |
/** |
/** |
132 |
* Data::Driver::Proxy -- Multiple stage data fetching and caching |
* Load required modules: |
133 |
* |
* |
134 |
|
*/ |
135 |
|
loadModule('DesignPattern::Proxy'); |
136 |
|
|
137 |
|
|
138 |
|
/** |
139 |
|
* DesignPattern::RemoteProxy -- Multiple stage data fetching and caching |
140 |
* |
* |
141 |
* This class (Data::Driver::Proxy) provides an abstract framework |
* |
142 |
|
* This class (DesignPattern::RemoteProxy) provides an abstract framework |
143 |
* for loading/saving arbitrary data from/to data storages interfaced |
* for loading/saving arbitrary data from/to data storages interfaced |
144 |
* by storage *proxy*-drivers. |
* by storage *proxy*-drivers. |
145 |
* Don't mix these up with the concrete storage *handle*-drivers |
* Don't mix these up with the concrete storage *handle*-drivers |
148 |
* providing a more highlevel, consistent API making |
* providing a more highlevel, consistent API making |
149 |
* it easier for Data::Driver::Proxy to do its main work: |
* it easier for Data::Driver::Proxy to do its main work: |
150 |
* |
* |
151 |
|
* quote from: http://home.earthlink.net/~huston2/dp/proxy.html |
152 |
|
* "A remote proxy provides a local representative for an |
153 |
|
* object that resides in a different address space. This is |
154 |
|
* what the "stub" code in RPC and CORBA provides." |
155 |
|
* |
156 |
|
* |
157 |
* Multiple stage data fetching and caching: |
* Multiple stage data fetching and caching: |
158 |
* |
* |
159 |
|
* <pre> |
160 |
|
* |
161 |
* DATA, ... |
* DATA, ... |
162 |
* ... also refered to as data, should be handled as |
* ... also refered to as data, should be handled as |
163 |
* something called data. |
* something called data. |
200 |
* o Data::Driver::PEAR::DB |
* o Data::Driver::PEAR::DB |
201 |
* x Data::Driver::PEAR::Tree (via Data::Lift) |
* x Data::Driver::PEAR::Tree (via Data::Lift) |
202 |
* |
* |
203 |
*/ |
* </pre> |
204 |
|
* |
205 |
/** |
* |
206 |
* An attempt to implement some software design patterns... |
* An attempt to implement some software design patterns |
207 |
* --- RemoteProxyPattern |
* --- RemoteProxyPattern |
208 |
* |
* |
209 |
|
* @link http://www.agcs.com/supportv2/techpapers/patterns/papers/tutnotes/sld017.htm |
210 |
|
* @link http://home.earthlink.net/~huston2/dp/proxy.html |
211 |
|
* @link http://wiki.cs.uiuc.edu/PatternStories/RemoteObject |
212 |
* @link http://c2.com/cgi-bin/wiki?ProxyPattern |
* @link http://c2.com/cgi-bin/wiki?ProxyPattern |
213 |
|
* @link http://c2.com/cgi-bin/wiki?LazyProxies |
214 |
* |
* |
215 |
* @author Andreas Motl <andreas.motl@ilo.de> |
* @author Andreas Motl <andreas.motl@ilo.de> |
216 |
* @link http://www.netfrag.org/~joko/ |
* @link http://www.netfrag.org/~joko/ |
220 |
* @link http://www.gnu.org/licenses/lgpl.txt |
* @link http://www.gnu.org/licenses/lgpl.txt |
221 |
* |
* |
222 |
* @package org.netfrag.glib |
* @package org.netfrag.glib |
223 |
|
* @subpackage DesignPattern |
224 |
* @name DesignPattern::RemoteProxy |
* @name DesignPattern::RemoteProxy |
225 |
* |
* |
|
*/ |
|
|
|
|
|
/** |
|
|
* @todo |
|
|
* <pre> |
|
|
* x extend options to en-/disable caching via a) session and/or b) database |
|
|
* o make feature available via runtime setter-method to these options |
|
|
* o use PEAR::Cache for caching purposes!!! |
|
|
* o refactor database access: use PEAR for this! no more 'connectdb' here!!! |
|
|
* o make database connection more flexible to make possible |
|
|
* to have different (probably named) proxy databases (besides a "main database") |
|
|
* o rename this to Data::Proxy? or split into Data::Query, Data::Result and Data::Wrapper? |
|
|
* </pre> |
|
226 |
* |
* |
227 |
*/ |
* @todo extend options to en-/disable caching via a) session and/or b) database |
228 |
|
* make feature available via runtime setter-method to these options |
229 |
/** |
* @todo PEAR::Cache for caching purposes!!! |
230 |
* Load required modules: |
* @todo refactor database access: use PEAR for this! no more 'connectdb' here!!! |
231 |
|
* @todo make database connection more flexible to make possible |
232 |
|
* to have different (probably named) proxy databases (besides a "main database") |
233 |
|
* @todo rename this to Data::Proxy? or split into Data::Query, Data::Result and Data::Wrapper? |
234 |
|
* @todo refactor this to a "RemoteObject" class!!! (inheriting from DesignPattern::RemoteObject) |
235 |
|
* @todo rename this to "DesignPattern::LazyRemoteProxy"??? |
236 |
* |
* |
237 |
*/ |
*/ |
|
loadModule('DesignPattern::Proxy'); |
|
|
|
|
238 |
class DesignPattern_RemoteProxy extends DesignPattern_Proxy { |
class DesignPattern_RemoteProxy extends DesignPattern_Proxy { |
239 |
|
|
240 |
var $objectId; |
var $objectId; |
287 |
session_register_safe("proxy"); |
session_register_safe("proxy"); |
288 |
} |
} |
289 |
|
|
290 |
|
/** |
291 |
|
* <!-- Autodia --> |
292 |
|
* can do: (this is metadata supplied for Autodia, don't delete!) |
293 |
|
* $this->backend = new DataSource_Proxy_XMLRPC() |
294 |
|
* |
295 |
|
*/ |
296 |
|
|
297 |
if ($this->meta[remote]) { |
if ($this->meta[remote]) { |
298 |
//$this->backend = mkObject('Data::Driver::RPC::Remote', $this->meta[rpcinfo]); |
//$this->backend = mkObject('Data::Driver::RPC::Remote', $this->meta[rpcinfo]); |
299 |
$this->backend = php::mkComponent('DataSource::Proxy::XMLRPC', $this->meta[rpcinfo]); |
$this->backend = php::mkComponent('DataSource::Proxy::XMLRPC', $this->meta[rpcinfo]); |