10 |
* has to do. |
* has to do. |
11 |
* |
* |
12 |
* |
* |
13 |
|
* @author Andreas Motl <andreas.motl@ilo.de> |
14 |
* @package org.netfrag.glib |
* @package org.netfrag.glib |
15 |
* @module DataSource::Locator |
* @module DataSource::Locator |
16 |
* |
* |
20 |
* $Id$ |
* $Id$ |
21 |
* |
* |
22 |
* $Log$ |
* $Log$ |
23 |
|
* Revision 1.5 2003/03/05 15:40:39 joko |
24 |
|
* updated docu (phpDocumentor testing....) |
25 |
|
* |
26 |
|
* Revision 1.4 2003/03/05 15:26:23 joko |
27 |
|
* updated docu (phpDocumentor testing....) |
28 |
|
* |
29 |
* Revision 1.3 2003/03/05 15:21:54 joko |
* Revision 1.3 2003/03/05 15:21:54 joko |
30 |
* updated docu (phpDocumentor testing....) |
* updated docu (phpDocumentor testing....) |
31 |
* |
* |
41 |
/** |
/** |
42 |
* It helps DataSource::Generic working in different "operation modes". |
* It helps DataSource::Generic working in different "operation modes". |
43 |
* |
* |
44 |
* o Pass-Through-Reference: php Object will get passed through all layers |
* - Pass-Through-Reference: php Object will get passed through all layers |
45 |
* o Pass-Through-Memory: reference to a memory area will get used |
* - Pass-Through-Memory: reference to a memory area will get used |
46 |
* + Build-Locator: build locator from datasource-type and adapter-type |
* + Build-Locator: build locator from datasource-type and adapter-type |
47 |
* o Use-Locator: directly use DataSource::Locator instance passed in |
* - Use-Locator: directly use DataSource::Locator instance passed in |
48 |
* o Merge-Locators: merge metadata of two or more DataSource::Locator instances |
* - Merge-Locators: merge metadata of two or more DataSource::Locator instances |
49 |
* o Build-AutoLocator: use global constants making up our metadata |
* - Build-AutoLocator: use global constants making up our metadata |
50 |
* |
* |
51 |
* |
* <b>It can/should contain:</b> |
52 |
* <b>It can/should contain (flexible, just some parameters are required for each operation mode)</b> |
* (flexible, just some parameters are required for each operation mode) |
53 |
* |
* - an oldschool "dsn"-string (e.g. for rdbms-connection via PEAR) |
|
* o an oldschool "dsn"-string (e.g. for rdbms-connection via PEAR) |
|
54 |
* + name of a Proxy module to use to *wrap/hide* the connection/transport-layer |
* + name of a Proxy module to use to *wrap/hide* the connection/transport-layer |
55 |
* (e.g. DataSource::Proxy::XMLRPC via DesignPattern::RemoteProxy) |
* (e.g. DataSource::Proxy::XMLRPC via DesignPattern::RemoteProxy) |
56 |
* + metadata (a hash) directly describing *where* to connect to (e.g. 'Host', 'Port') |
* + metadata (a hash) directly describing *where* to connect to (e.g. 'Host', 'Port') |
57 |
* o an instance of an already instantiated arbitrary datasource handler (e.g. 'source') |
* - an instance of an already instantiated arbitrary datasource handler (e.g. 'source') |
58 |
* this will get propagated (pass-through-mode) |
* this will get propagated (pass-through-mode) |
59 |
* + a datasource-type (of 'rpc|mysql|csv-file|xml-file') |
* - a datasource-type (of 'rpc|mysql|csv-file|xml-file') |
60 |
* this will be mapped to a module name and used as a *Proxy* |
* this will be mapped to a module name and used as a *Proxy* |
61 |
* by the DataSource::Generic at runtime |
* by the DataSource::Generic at runtime |
62 |
* + an adapter-type (of 'phpHtmlLib|pear') |
* + an adapter-type (of 'phpHtmlLib|pear') |
63 |
* this will be mapped to a module name and used as an *Adapter* |
* this will be mapped to a module name and used as an *Adapter* |
64 |
* by the DataSource::Generic at runtime |
* by the DataSource::Generic at runtime |
65 |
* o names of global constants where to find these informations |
* - names of global constants where to find these informations |
66 |
* o datasource-type ('rpc|csv-file|...') <-> datasource-family ('orm|rdbms|odbms') |
* - datasource-type ('rpc|csv-file|...') <-> datasource-family ('orm|rdbms|odbms') |
67 |
* |
* |
68 |
* |
* |
69 |
* --- It can do |
* <b>It can do</b> |
70 |
* + builds a larger locator from a minimum of information passed in via constructor-arguments |
* + builds a larger locator from a minimum of information passed in via constructor-arguments |
71 |
* o direct fallback mode to some predefined constant names if locator is empty and above method fails |
* o direct fallback mode to some predefined constant names if locator is empty and above method fails |
72 |
* o direct fallback mode to some predefined values if just *everything* fails |
* o direct fallback mode to some predefined values if just *everything* fails |
73 |
* |
* |
74 |
* |
* |
75 |
* --- How to use? |
* <b>How to use?</b> |
76 |
* |
* |
77 |
* Pass an array holding "locator metadata" to the constructor. |
* Pass an array holding "locator metadata" to the constructor. |
78 |
* This module takes care of the rest. |
* This module takes care of the rest. |
80 |
* Pass an array to the constructor: (e.g.) |
* Pass an array to the constructor: (e.g.) |
81 |
* |
* |
82 |
* 1. for doing rpc-calls.... |
* 1. for doing rpc-calls.... |
83 |
|
* <code> |
84 |
* $locator = array( |
* $locator = array( |
85 |
* datasource_type => 'rpc', |
* datasource_type => 'rpc', |
86 |
* [adapter_type => 'phpHtmlLib',] |
* [adapter_type => 'phpHtmlLib',] |
88 |
* ); |
* ); |
89 |
* $source = new DataSource::Generic($locator); |
* $source = new DataSource::Generic($locator); |
90 |
* $this->set_data_source( &$source ); |
* $this->set_data_source( &$source ); |
91 |
|
* </code> |
92 |
* |
* |
93 |
* 2. [proposal] for common/oldschool datahandles.... |
* 2. [proposal] for common/oldschool datahandles.... |
94 |
|
* <code> |
95 |
* $locator = array( |
* $locator = array( |
96 |
* dsn => 'known dsn markup', |
* dsn => 'known dsn markup', |
97 |
* ); |
* ); |
98 |
* $source = new DataSource::Generic($locator); |
* $source = new DataSource::Generic($locator); |
99 |
* $this->set_data_source( &$source ); |
* $this->set_data_source( &$source ); |
100 |
|
* </code> |
101 |
* |
* |
102 |
* |
* |
103 |
* |
* |
108 |
* @license GNU LGPL (GNU Lesser General Public License) |
* @license GNU LGPL (GNU Lesser General Public License) |
109 |
* @link http://www.gnu.org/licenses/lgpl.txt |
* @link http://www.gnu.org/licenses/lgpl.txt |
110 |
* |
* |
|
* @subpackage DataSource |
|
111 |
* @name DataSource::Locator |
* @name DataSource::Locator |
112 |
* @filesource |
* @filesource |
113 |
* |
* |
122 |
* using metadata from $_options and some |
* using metadata from $_options and some |
123 |
* other presets. |
* other presets. |
124 |
* |
* |
125 |
* See '_buildLocator' which acts as a dispatcher |
* @see function build, which acts as a dispatcher |
126 |
* depending on $_options[datasource]. |
* depending on $_options[datasource]. |
127 |
* (main dispatching level) |
* (main dispatching level) |
128 |
* |
* |
129 |
* The structure of a full blown locator looks like this: |
* The structure of a full blown locator looks like this: |
130 |
* |
* |
131 |
|
* <code> |
132 |
* $locator = array( |
* $locator = array( |
133 |
* type => '<your type specifying the datasource-type>', |
* type => '<your type specifying the datasource-type>', |
134 |
* metadata => array( |
* metadata => array( |
136 |
* ), |
* ), |
137 |
* [dsn => '<your dsn markup>'], |
* [dsn => '<your dsn markup>'], |
138 |
* ); |
* ); |
139 |
|
* </code> |
140 |
* |
* |
141 |
* Example 1 - data is inside a rdbms, using a dsn to connect to it: |
* Example 1 - data is inside a rdbms, using a dsn to connect to it: |
142 |
|
* <code> |
143 |
* $locator = array( |
* $locator = array( |
144 |
* dsn => 'mysql://username:password@localhost/database', |
* dsn => 'mysql://username:password@localhost/database', |
145 |
* ); |
* ); |
146 |
|
* </code> |
147 |
* |
* |
148 |
* Example 2 - data is inside an odbms, reachable by doing remote procedure calls (rpc): |
* Example 2 - data is inside an odbms, reachable by doing remote procedure calls (rpc): |
149 |
|
* <code> |
150 |
* $locator = array( |
* $locator = array( |
151 |
* type => 'rpc', |
* type => 'rpc', |
152 |
* metadata => array( |
* metadata => array( |
155 |
* Port => '8765', |
* Port => '8765', |
156 |
* ) |
* ) |
157 |
* ); |
* ); |
158 |
|
* </code> |
159 |
|
* |
160 |
|
* @deprecated |
161 |
* |
* |
162 |
*/ |
*/ |
163 |
|
var $_locator_metadata = NULL; |
|
//var $_locator_metadata = NULL; |
|
164 |
|
|
165 |
|
|
166 |
/** |
/** |
167 |
* This var holds the arguments passed in to the constructor. |
* This var holds the arguments passed in to the constructor. |
168 |
* We will try to build full blown locator metadata information from that. |
* We will try to build full blown locator metadata information from that. |
169 |
* |
* |
170 |
*/ |
* @deprecated |
171 |
//var $_in = NULL; |
* |
172 |
|
*/ |
173 |
|
var $_in = NULL; |
174 |
|
|
175 |
/** |
/** |
176 |
* This var holds the locator metadata informations inside |
* This var holds the locator metadata informations inside |
177 |
* a single hash. This is returned from '->get()'. |
* a single hash. This is returned from '->get()'. |
178 |
* |
* |
179 |
*/ |
* @deprecated |
180 |
//var $_out = NULL; |
* |
181 |
|
*/ |
182 |
|
var $_out = NULL; |
183 |
|
|
184 |
|
|
185 |
/** |
/** |