/[cvs]/nfo/php/libs/org.netfrag.glib/DataSource/Locator.php
ViewVC logotype

Diff of /nfo/php/libs/org.netfrag.glib/DataSource/Locator.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by joko, Wed Mar 5 15:01:10 2003 UTC revision 1.6 by joko, Wed Mar 5 16:10:08 2003 UTC
# Line 5  Line 5 
5   * It acts as a container for DataSource connection   * It acts as a container for DataSource connection
6   * metadata. Think of it as an enhanced dsn.   * metadata. Think of it as an enhanced dsn.
7   *   *
8   * It gets used by DataSource::GenericDataSource   * It gets used by DataSource::Generic
9   * to be informed about the most important stuff it   * to be informed about the most important stuff it
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   *   *
# Line 19  Line 20 
20   * $Id$   * $Id$
21   *   *
22   * $Log$   * $Log$
23     * Revision 1.6  2003/03/05 16:10:08  joko
24     * updated docu (phpDocumentor testing....)
25     *
26     * Revision 1.5  2003/03/05 15:40:39  joko
27     * updated docu (phpDocumentor testing....)
28     *
29     * Revision 1.4  2003/03/05 15:26:23  joko
30     * updated docu (phpDocumentor testing....)
31     *
32     * Revision 1.3  2003/03/05 15:21:54  joko
33     * updated docu (phpDocumentor testing....)
34     *
35   * Revision 1.2  2003/03/05 15:01:10  joko   * Revision 1.2  2003/03/05 15:01:10  joko
36   * updated docu   * updated docu
37   *   *
# Line 29  Line 42 
42   */   */
43    
44  /**  /**
45   * It helps GenericDataSource working in different "operation modes".   * It helps DataSource::Generic working in different "operation modes".
  *  
  *    o Pass-Through-Reference: php Object will get passed through all layers  
  *    o Pass-Through-Memory: reference to a memory area will get used  
  *    x Build-Locator: build locator from datasource-type and adapter-type  
  *    o Use-Locator: directly use DataSource::Locator instance passed in  
  *    o Merge-Locators: merge metadata of two or more DataSource::Locator instances  
  *    o Build-AutoLocator: use global constants making up our metadata  
46   *   *
47   *   * - Pass-Through-Reference: php Object will get passed through all layers
48   * It can/should contain (flexible, just some parameters are required for each operation mode)   * - Pass-Through-Memory: reference to a memory area will get used
49   *   * + Build-Locator: build locator from datasource-type and adapter-type
50   * o an oldschool "dsn"-string (e.g. for rdbms-connection via PEAR)   * - Use-Locator: directly use DataSource::Locator instance passed in
51     * - Merge-Locators: merge metadata of two or more DataSource::Locator instances
52     * - Build-AutoLocator: use global constants making up our metadata
53     *
54     * <b>It can/should contain:</b>
55     *
56     * <pre>
57     * (flexible, just some parameters are required for each operation mode)
58     * - an oldschool "dsn"-string (e.g. for rdbms-connection via PEAR)
59   * + 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
60   *   (e.g. DataSource::Proxy::XMLRPC via DesignPattern::RemoteProxy)   *   (e.g. DataSource::Proxy::XMLRPC via DesignPattern::RemoteProxy)
61   * + 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')
62   * 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')
63   *   this will get propagated (pass-through-mode)   *   this will get propagated (pass-through-mode)
64   * + a datasource-type (of 'rpc|mysql|csv-file|xml-file')   * - a datasource-type (of 'rpc|mysql|csv-file|xml-file')
65   *   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*
66   *   by the GenericDataSource at runtime   *   by the DataSource::Generic at runtime
67   * + an adapter-type (of 'phpHtmlLib|pear')   * + an adapter-type (of 'phpHtmlLib|pear')
68   *   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*
69   *   by the GenericDataSource at runtime   *   by the DataSource::Generic at runtime
70   * o names of global constants where to find these informations   * - names of global constants where to find these informations
71   * o datasource-type ('rpc|csv-file|...') <-> datasource-family ('orm|rdbms|odbms')   * - datasource-type ('rpc|csv-file|...') <-> datasource-family ('orm|rdbms|odbms')
72     * </pre>
73   *   *
74   *   *
75   * --- It can do   * <b>It can do</b>
76   *    x 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
77   *    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
78   *    o direct fallback mode to some predefined values if just *everything* fails   * o direct fallback mode to some predefined values if just *everything* fails
79   *   *
80   *   *
81   * --- How to use?   * <b>How to use?</b>
82   *   *
83   * Pass an array holding "locator metadata" to the constructor.   * Pass an array holding "locator metadata" to the constructor.
84   * This module takes care of the rest.   * This module takes care of the rest.
# Line 71  Line 86 
86   * Pass an array to the constructor: (e.g.)   * Pass an array to the constructor: (e.g.)
87   *   *
88   *  1. for doing rpc-calls....   *  1. for doing rpc-calls....
89     *    <code>
90   *    $locator = array(   *    $locator = array(
91   *      datasource_type => 'rpc',   *      datasource_type => 'rpc',
92   *      [adapter_type => 'phpHtmlLib',]   *      [adapter_type => 'phpHtmlLib',]
93   *      metadata => array( Host => 'localhost', Port => '8765' ),   *      metadata => array( Host => 'localhost', Port => '8765' ),
94   *    );   *    );
95   *    $source = new GenericDataSource($locator);   *    $source = new DataSource::Generic($locator);
96   *    $this->set_data_source( &$source );   *    $this->set_data_source( &$source );
97     *    </code>
98   *   *
99   *  2. [proposal] for common/oldschool datahandles....   *  2. [proposal] for common/oldschool datahandles....
100     *    <code>
101   *    $locator = array(   *    $locator = array(
102   *      dsn => 'known dsn markup',   *      dsn => 'known dsn markup',
103   *    );   *    );
104   *    $source = new GenericDataSource($locator);   *    $source = new DataSource::Generic($locator);
105   *    $this->set_data_source( &$source );   *    $this->set_data_source( &$source );
106     *    </code>
107   *   *
108   *   *
109   *   *
# Line 95  Line 114 
114   * @license GNU LGPL (GNU Lesser General Public License)   * @license GNU LGPL (GNU Lesser General Public License)
115   * @link http://www.gnu.org/licenses/lgpl.txt   * @link http://www.gnu.org/licenses/lgpl.txt
116   *   *
  * @subpackage DataSource  
117   * @name DataSource::Locator   * @name DataSource::Locator
118   * @filesource   * @filesource
119   *   *
# Line 110  class DataSource_Locator { Line 128  class DataSource_Locator {
128      * using metadata from $_options and some      * using metadata from $_options and some
129      * other presets.      * other presets.
130      *      *
131      * See '_buildLocator' which acts as a dispatcher      * @see function build, which acts as a dispatcher
132      * depending on $_options[datasource].      * depending on $_options[datasource].
133      * (main dispatching level)      * (main dispatching level)
134      *      *
135      * The structure of a full blown locator looks like this:      * The structure of a full blown locator looks like this:
136      *      *
137        * <code>
138      *  $locator = array(      *  $locator = array(
139      *    type => '<your type specifying the datasource-type>',      *    type => '<your type specifying the datasource-type>',
140      *    metadata => array(      *    metadata => array(
# Line 123  class DataSource_Locator { Line 142  class DataSource_Locator {
142      *    ),      *    ),
143      *    [dsn => '<your dsn markup>'],      *    [dsn => '<your dsn markup>'],
144      *  );      *  );
145        * </code>
146      *      *
147      * 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:
148        * <code>
149      *  $locator = array(      *  $locator = array(
150      *    dsn => 'mysql://username:password@localhost/database',      *    dsn => 'mysql://username:password@localhost/database',
151      *  );      *  );
152        * </code>
153      *      *
154      * 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):
155        * <code>
156      *  $locator = array(      *  $locator = array(
157      *    type => 'rpc',      *    type => 'rpc',
158      *    metadata => array(      *    metadata => array(
# Line 138  class DataSource_Locator { Line 161  class DataSource_Locator {
161      *      Port => '8765',      *      Port => '8765',
162      *    )      *    )
163      *  );      *  );
164        * </code>
165        *
166        * @deprecated
167      *      *
168      */      */
169            var $_locator_metadata = NULL;
     //var $_locator_metadata = NULL;  
170    
171    
172          /**     /**
173           * This var holds the arguments passed in to the constructor.      * This var holds the arguments passed in to the constructor.
174           * We will try to build full blown locator metadata information from that.      * We will try to build full blown locator metadata information from that.
175           *      *
176           */      * @deprecated
177          //var $_in = NULL;      *
178        */
179        var $_in = NULL;
180    
181          /**     /**
182           * This var holds the locator metadata informations inside      * This var holds the locator metadata informations inside
183           * a single hash. This is returned from '->get()'.      * a single hash. This is returned from '->get()'.
184           *      *
185           */      * @deprecated
186          //var $_out = NULL;      *
187        */
188        var $_out = NULL;
189    
190    
191          /**          /**
# Line 170  class DataSource_Locator { Line 199  class DataSource_Locator {
199      // name of an Adapter module      // name of an Adapter module
200      var $_adapter_type;      var $_adapter_type;
201            
202      // additional information required (passed on to the Proxy by GenericDataSource)      // additional information required (passed on to the Proxy by DataSource::Generic)
203      var $_metadata = array();      var $_metadata = array();
204            
205      //var $_dsn;      //var $_dsn;
# Line 180  class DataSource_Locator { Line 209  class DataSource_Locator {
209           * The constructor is used to pass in the           * The constructor is used to pass in the
210           * locator metadata hash.           * locator metadata hash.
211           *           *
212           * @param LocatorMetadataHash array - layout: array( type => '', metadata => '', dsn => '' )           * @param object(DataSource::Locator)|hash optional: a &$locator instance
          * @param Query array - layout: array( type => '', metadata => '', dsn => '' )  
213           */           */
214          function DataSource_Locator() {          function DataSource_Locator() {
215        $args_multi = func_get_args();        $args_multi = func_get_args();
# Line 257  class DataSource_Locator { Line 285  class DataSource_Locator {
285                    
286          /**          /**
287       * Set the locator metadata hash we will feed *partly*       * Set the locator metadata hash we will feed *partly*
288       * to an encapsulated Data::Driver::Proxy instance.       * to an encapsulated Data::Driver::Proxy instance
289       *       *
290       * @param LocatorMetadataHash array -       * @param LocatorMetadataHash array -
291       *       *
# Line 284  class DataSource_Locator { Line 312  class DataSource_Locator {
312          $metadata = array(          $metadata = array(
313            //package => 'Data::Driver::Proxy',            //package => 'Data::Driver::Proxy',
314            //package => 'DataSource::Proxy::XMLRPC',            //package => 'DataSource::Proxy::XMLRPC',
315            //package => 'DataSource::GenericDataSource',            //package => 'DataSource::Generic',
316            //package => 'DesignPattern::RemoteProxy',            //package => 'DesignPattern::RemoteProxy',
317            Host => RPC_HOSTNAME,            Host => RPC_HOSTNAME,
318            Port => RPC_PORT,            Port => RPC_PORT,

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.6

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