/[cvs]/nfo/perl/libs/Data/README.html
ViewVC logotype

Diff of /nfo/perl/libs/Data/README.html

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

revision 1.3 by joko, Sat Nov 9 01:05:20 2002 UTC revision 1.5 by joko, Wed Dec 11 06:53:19 2002 UTC
# Line 12  Line 12 
12  <UL>  <UL>
13    
14          <LI><A HREF="#name">NAME</A></LI>          <LI><A HREF="#name">NAME</A></LI>
15            <LI><A HREF="#aims">AIMS</A></LI>
16          <LI><A HREF="#synopsis">SYNOPSIS</A></LI>          <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
17          <UL>          <UL>
18    
19                    <LI><A HREF="#basic access">BASIC ACCESS</A></LI>
20                    <LI><A HREF="#advanced access">ADVANCED ACCESS</A></LI>
21                    <LI><A HREF="#synchronization">SYNCHRONIZATION</A></LI>
22                  <LI><A HREF="#note">NOTE</A></LI>                  <LI><A HREF="#note">NOTE</A></LI>
23          </UL>          </UL>
24    
25          <LI><A HREF="#requirements">REQUIREMENTS</A></LI>          <LI><A HREF="#requirements">REQUIREMENTS</A></LI>
26          <LI><A HREF="#description">DESCRIPTION</A></LI>          <LI><A HREF="#description">DESCRIPTION</A></LI>
27            <UL>
28    
29                    <LI><A HREF="#data::storage">Data::Storage</A></LI>
30                    <LI><A HREF="#why">Why?</A></LI>
31                    <LI><A HREF="#what else">What else?</A></LI>
32            </UL>
33    
34          <LI><A HREF="#authors / copyright">AUTHORS / COPYRIGHT</A></LI>          <LI><A HREF="#authors / copyright">AUTHORS / COPYRIGHT</A></LI>
35          <LI><A HREF="#acknowledgements">ACKNOWLEDGEMENTS</A></LI>          <LI><A HREF="#acknowledgements">ACKNOWLEDGEMENTS</A></LI>
36          <LI><A HREF="#support / warranty">SUPPORT / WARRANTY</A></LI>          <LI><A HREF="#support / warranty">SUPPORT / WARRANTY</A></LI>
37          <LI><A HREF="#todo">TODO</A></LI>          <LI><A HREF="#todo">TODO</A></LI>
38          <UL>          <UL>
39    
40                  <LI><A HREF="#handle the following errors/cases:">Handle the following errors/cases:</A></LI>                  <LI><A HREF="#bugs">BUGS</A></LI>
41                    <LI><A HREF="#features">FEATURES</A></LI>
42                  <UL>                  <UL>
43    
44                          <LI><A HREF="#dbierror [tangram]: dbd::mysql::st execute failed: unknown column 't1.requestdump' in 'field list'">``DBI-Error [Tangram]: DBD::mysql::st execute failed: Unknown column 't1.requestdump' in 'field list'''</A></LI>                          <LI><A HREF="#links / references">LINKS / REFERENCES</A></LI>
                         <LI><A HREF="#compare schema (structure diff) with database ...">Compare schema (structure diff) with database ...</A></LI>  
                 </UL>  
   
                 <LI><A HREF="#introduce some features:">Introduce some features:</A></LI>  
                 <UL>  
   
                         <LI><A HREF="#links:">Links:</A></LI>  
45                  </UL>                  </UL>
46    
47          </UL>          </UL>
# Line 47  Line 52 
52  <HR>  <HR>
53  <P>  <P>
54  <H1><A NAME="name">NAME</A></H1>  <H1><A NAME="name">NAME</A></H1>
55  <P>Data::Storage - Interface for accessing various Storage implementations for Perl in an independent way</P>  <PRE>
56      Data::Storage - Interface for accessing various Storage implementations for Perl in an independent way</PRE>
57  <P>  <P>
58  <HR>  <HR>
59  <H1><A NAME="synopsis">SYNOPSIS</A></H1>  <H1><A NAME="aims">AIMS</A></H1>
60  <PRE>  <PRE>
61    ... the basic way:</PRE>    - should encapsulate Tangram, DBI, DBD::CSV and LWP:: to access them in an unordinary (more convenient) way ;)
62      - introduce a generic layered structure, refactor *SUBLAYER*-stuff, make (e.g.) this possible:
63        Perl Data::Storage[DBD::CSV]  -&gt;  Perl LWP::  -&gt;  Internet HTTP/FTP/*  -&gt;  Host Daemon  -&gt;  csv-file
64      - provide generic synchronization mechanisms across arbitrary/multiple storages based on ident/checksum
65        maybe it's possible to have schema-, structural- and semantical modifications synchronized???</PRE>
66    <P>
67    <HR>
68    <H1><A NAME="synopsis">SYNOPSIS</A></H1>
69    <P>
70    <H2><A NAME="basic access">BASIC ACCESS</A></H2>
71    <P>
72    <H2><A NAME="advanced access">ADVANCED ACCESS</A></H2>
73  <PRE>  <PRE>
74    ... via inheritance:    ... via inheritance:
75  </PRE>  </PRE>
# Line 72  Line 89 
89      );      );
90      $self-&gt;{storage}-&gt;insert($proxyObj);</PRE>      $self-&gt;{storage}-&gt;insert($proxyObj);</PRE>
91  <P>  <P>
92    <H2><A NAME="synchronization">SYNCHRONIZATION</A></H2>
93    <PRE>
94      my $nodemapping = {
95        'LangText' =&gt; 'langtexts.csv',
96        'Currency' =&gt; 'currencies.csv',
97        'Country'  =&gt; 'countries.csv',
98      };</PRE>
99    <PRE>
100      my $propmapping = {
101        'LangText' =&gt; [
102          [ 'source:lcountrykey'  =&gt;  'target:country' ],
103          [ 'source:lkey'         =&gt;  'target:key' ],
104          [ 'source:lvalue'       =&gt;  'target:text' ],
105        ],
106        'Currency' =&gt; [
107          [ 'source:ckey'         =&gt;  'target:key' ],
108          [ 'source:cname'        =&gt;  'target:text' ],
109        ],
110        'Country' =&gt; [
111          [ 'source:ckey'         =&gt;  'target:key' ],
112          [ 'source:cname'        =&gt;  'target:text' ],
113        ],
114      };</PRE>
115    <PRE>
116      sub syncResource {</PRE>
117    <PRE>
118        my $self = shift;
119        my $node_source = shift;
120        my $mode = shift;
121        my $opts = shift;
122    </PRE>
123    <PRE>
124    
125        $mode ||= '';
126        $opts-&gt;{erase} ||= 0;</PRE>
127    <PRE>
128    
129        $logger-&gt;info( __PACKAGE__ . &quot;-&gt;syncResource( node_source $node_source mode $mode erase $opts-&gt;{erase} )&quot;);</PRE>
130    <PRE>
131    
132        # resolve metadata for syncing requested resource
133        my $node_target = $nodemapping-&gt;{$node_source};
134        my $mapping = $propmapping-&gt;{$node_source};</PRE>
135    <PRE>
136    
137        if (!$node_target || !$mapping) {
138          # loggger.... &quot;no target, sorry!&quot;
139          print &quot;error while resolving resource metadata&quot;, &quot;\n&quot;;
140          return;
141        }</PRE>
142    <PRE>
143    
144        if ($opts-&gt;{erase}) {
145          $self-&gt;_erase_all($node_source);
146        }</PRE>
147    <PRE>
148    
149        # create new sync object
150        my $sync = Data::Transfer::Sync-&gt;new(
151          storages =&gt; {
152            L =&gt; $self-&gt;{bizWorks}-&gt;{backend},
153            R =&gt; $self-&gt;{bizWorks}-&gt;{resources},
154          },
155          id_authorities        =&gt;  [qw( L ) ],
156          checksum_authorities  =&gt;  [qw( L ) ],
157          write_protected       =&gt;  [qw( R ) ],
158          verbose               =&gt;  1,
159        );</PRE>
160    <PRE>
161    
162        # sync
163        # todo: filter!?
164        $sync-&gt;syncNodes( {
165          direction       =&gt;  $mode,                 # | +PUSH | +PULL | -FULL | +IMPORT | -EXPORT
166          method          =&gt;  'checksum',            # | -timestamp | -manual
167          source          =&gt;  &quot;L:$node_source&quot;,
168          source_ident    =&gt;  'storage_method:id',
169          source_exclude  =&gt;  [qw( id cs )],
170          target          =&gt;  &quot;R:$node_target&quot;,
171          target_ident    =&gt;  'property:oid',
172          mapping         =&gt;  $mapping,
173        } );</PRE>
174    <PRE>
175      }</PRE>
176    <P>
177  <H2><A NAME="note">NOTE</A></H2>  <H2><A NAME="note">NOTE</A></H2>
178  <P>This module heavily relies on DBI and Tangram, but adds a lot of additional bugs and quirks.  <PRE>
179  Please look at their documentation and/or this code for additional information.</P>    This module heavily relies on DBI and Tangram, but adds a lot of additional bugs and quirks.
180      Please look at their documentation and/or this code for additional information.</PRE>
181  <P>  <P>
182  <HR>  <HR>
183  <H1><A NAME="requirements">REQUIREMENTS</A></H1>  <H1><A NAME="requirements">REQUIREMENTS</A></H1>
184  <P>For full functionality:  <PRE>
185    DBI              from CPAN    For full functionality:
186    Tangram          from CPAN      DBI              from CPAN
187    Class::Tangram   from CPAN      DBD::mysql       from CPAN
188    MySQL::Diff      from <A HREF="http://adamspiers.org/computing/mysqldiff/">http://adamspiers.org/computing/mysqldiff/</A>      Tangram 2.04     from CPAN         (hmmm, 2.04 won't do in some cases)
189    ... and all their dependencies</P>      Tangram 2.05     from <A HREF="http://">http://</A>...   (2.05 seems okay but there are also additional patches from our side)
190        Class::Tangram   from CPAN
191        DBD::CSV         from CPAN
192        MySQL::Diff      from <A HREF="http://adamspiers.org/computing/mysqldiff/">http://adamspiers.org/computing/mysqldiff/</A>
193        ... and all their dependencies</PRE>
194  <P>  <P>
195  <HR>  <HR>
196  <H1><A NAME="description">DESCRIPTION</A></H1>  <H1><A NAME="description">DESCRIPTION</A></H1>
197  <P>Data::Storage is module for a accessing various ``data structures'' stored inside  <P>
198  various ``data containers''. It sits on top of DBI and/or Tangram.</P>  <H2><A NAME="data::storage">Data::Storage</A></H2>
199    <PRE>
200      Data::Storage is a module for accessing various &quot;data structures / kinds of structured data&quot; stored inside
201      various &quot;data containers&quot;.
202      We tried to use the AdapterPattern (<A HREF="http://c2.com/cgi/wiki?AdapterPattern">http://c2.com/cgi/wiki?AdapterPattern</A>) to implement a wrapper-layer
203      around core CPAN modules (Tangram, DBI).</PRE>
204    <P>
205    <H2><A NAME="why">Why?</A></H2>
206    <PRE>
207      You will get a better code-structure (not bad for later maintenance) in growing Perl code projects,
208      especially when using multiple database connections at the same time.
209      You will be able to switch between different _kinds_ of implementations used for storing data.
210      Your code will use the very same API to access these storage layers.
211          ... implementation has to be changed for now
212      Maybe you will be able to switch &quot;on-the-fly&quot; without changing any bits in code in the future....
213          ... but that's not the focus</PRE>
214    <P>
215    <H2><A NAME="what else">What else?</A></H2>
216    <PRE>
217      Having this, we were able to do implement a generic data synchronization module more easy,
218      please look at Data::Transfer.</PRE>
219  <P>  <P>
220  <HR>  <HR>
221  <H1><A NAME="authors / copyright">AUTHORS / COPYRIGHT</A></H1>  <H1><A NAME="authors / copyright">AUTHORS / COPYRIGHT</A></H1>
222  <P>The Data::Storage module is Copyright (c) 2002 Andreas Motl.  <PRE>
223  All rights reserved.</P>    The Data::Storage module is Copyright (c) 2002 Andreas Motl.
224  <P>You may distribute it under the terms of either the GNU General Public    All rights reserved.
225  License or the Artistic License, as specified in the Perl README file.</P>    You may distribute it under the terms of either the GNU General Public
226      License or the Artistic License, as specified in the Perl README file.</PRE>
227  <P>  <P>
228  <HR>  <HR>
229  <H1><A NAME="acknowledgements">ACKNOWLEDGEMENTS</A></H1>  <H1><A NAME="acknowledgements">ACKNOWLEDGEMENTS</A></H1>
230  <P>Larry Wall for Perl, Tim Bunce for DBI, Jean-Louis Leroy for Tangram and Set::Object,  <PRE>
231  Sam Vilain for Class::Tangram, Adam Spiers for MySQL::Diff and all contributors.</P>    Larry Wall for Perl, Tim Bunce for DBI, Jean-Louis Leroy for Tangram and Set::Object,
232      Sam Vilain for Class::Tangram, Jochen Wiedmann and Jeff Zucker for DBD::CSV &amp; Co.,
233      Adam Spiers for MySQL::Diff and all contributors.</PRE>
234  <P>  <P>
235  <HR>  <HR>
236  <H1><A NAME="support / warranty">SUPPORT / WARRANTY</A></H1>  <H1><A NAME="support / warranty">SUPPORT / WARRANTY</A></H1>
237  <P>Data::Storage is free software. IT COMES WITHOUT WARRANTY OF ANY KIND.</P>  <PRE>
238      Data::Storage is free software. IT COMES WITHOUT WARRANTY OF ANY KIND.</PRE>
239  <P>  <P>
240  <HR>  <HR>
241  <H1><A NAME="todo">TODO</A></H1>  <H1><A NAME="todo">TODO</A></H1>
242  <P>  <P>
243  <H2><A NAME="handle the following errors/cases:">Handle the following errors/cases:</A></H2>  <H2><A NAME="bugs">BUGS</A></H2>
244  <P>  <P>``DBI-Error [Tangram]: DBD::mysql::st execute failed: Unknown column 't1.requestdump' in 'field list'''</P>
 <H3><A NAME="dbierror [tangram]: dbd::mysql::st execute failed: unknown column 't1.requestdump' in 'field list'">``DBI-Error [Tangram]: DBD::mysql::st execute failed: Unknown column 't1.requestdump' in 'field list'''</A></H3>  
245  <PRE>  <PRE>
246      ... occours when operating on object-attributes not introduced yet:    ... occours when operating on object-attributes not introduced yet:
247      this should be detected and appended/replaced through:    this should be detected and appended/replaced through:
248      &quot;Schema-Error detected, maybe (just) an inconsistency.    &quot;Schema-Error detected, maybe (just) an inconsistency.
249      Please check if your declaration in schema-module &quot;a&quot; matches structure in database &quot;b&quot; or try to run&quot;    Please check if your declaration in schema-module &quot;a&quot; matches structure in database &quot;b&quot; or try to run&quot;
250      db_setup.pl --dbkey=import --action=deploy</PRE>    db_setup.pl --dbkey=import --action=deploy</PRE>
251  <P>  <P>Compare schema (structure diff) with database ...</P>
 <H3><A NAME="compare schema (structure diff) with database ...">Compare schema (structure diff) with database ...</A></H3>  
252  <PRE>  <PRE>
253    ... when issuing &quot;db_setup.pl --dbkey=import --action=deploy&quot;    ... when issuing &quot;db_setup.pl --dbkey=import --action=deploy&quot;
254    on a database with an already deployed schema, use an additional &quot;--update&quot; then    on a database with an already deployed schema, use an additional &quot;--update&quot; then
# Line 150  Sam Vilain for Class::Tangram, Adam Spie Line 279  Sam Vilain for Class::Tangram, Adam Spie
279    As we can see, creations of Classes and new Class variables is handled    As we can see, creations of Classes and new Class variables is handled
280    automatically and this is believed to be the most common case under normal circumstances.</PRE>    automatically and this is believed to be the most common case under normal circumstances.</PRE>
281  <P>  <P>
282  <H2><A NAME="introduce some features:">Introduce some features:</A></H2>  <H2><A NAME="features">FEATURES</A></H2>
283  <PRE>  <PRE>
284    - Get this stuff together with UML (Unified Modeling Language) and/or standards from ODMG.    - Get this stuff together with UML (Unified Modeling Language) and/or standards from ODMG.
285    - Make it possible to load/save schemas in XMI (XML Metadata Interchange),    - Make it possible to load/save schemas in XMI (XML Metadata Interchange),
# Line 158  Sam Vilain for Class::Tangram, Adam Spie Line 287  Sam Vilain for Class::Tangram, Adam Spie
287      Integrate/bundle this with a web-/html-based UML modeling tool or      Integrate/bundle this with a web-/html-based UML modeling tool or
288      some other interesting stuff like the &quot;Co-operative UML Editor&quot; from Uni Darmstadt. (web-/java-based)      some other interesting stuff like the &quot;Co-operative UML Editor&quot; from Uni Darmstadt. (web-/java-based)
289    - Enable Round Trip Engineering. Keep code and diagrams in sync. Don't annoy/bother the programmers.    - Enable Round Trip Engineering. Keep code and diagrams in sync. Don't annoy/bother the programmers.
290    - Add some more handlers:    - Add support for some more handlers/locators to be able to
291      - look at DBD::CSV, Text::CSV, XML::CSV, XML::Excel       access the following standards/protocols/interfaces/programs/apis transparently:
292    - Add some more locations/locators:      +  DBD::CSV (via Data::Storage::Handler::DBI)
293      - PerlDAV: <A HREF="http://www.webdav.org/perldav/">http://www.webdav.org/perldav/</A>     (-) Text::CSV, XML::CSV, XML::Excel
294    - Move to t3, use InCASE</PRE>      -  MAPI
295        -  LDAP
296        -  DAV (look at PerlDAV: <A HREF="http://www.webdav.org/perldav/">http://www.webdav.org/perldav/</A>)
297        -  Mbox (use formail for seperating/splitting entries/nodes)
298        -  Cyrus (cyrdeliver - what about cyrretrieve (export)???)
299        -  use File::DiffTree, use File::Compare
300        -  Hibernate
301        -  &quot;Win32::UserAccountDb&quot;
302        -  &quot;*nix::UserAccountDb&quot;
303        -  .wab - files (Windows Address Book)
304        -  .pst - files (Outlook Post Storage?)
305        -  XML (e.g. via XML::Simple?)
306      - Move to t3, look at InCASE
307      - some kind of security layer for methods/objects
308        - acls (stored via tangram/ldap?) for functions, methods and objects (entity- &amp; data!?)
309        - where are the hooks needed then?
310          - is Data::Storage &amp; Co. okay, or do we have to touch the innards of DBI and/or Tangram?
311          - an attempt to start could be:
312             - 'sub getACLByObjectId($id, $context)'
313             - 'sub getACLByMethodname($id, $context)'
314             - 'sub getACLByName($id, $context)'
315                ( would require a kinda registry to look up these very names pointing to arbitrary locations (code, data, ...) )</PRE>
316  <P>  <P>
317  <H3><A NAME="links:">Links:</A></H3>  <H3><A NAME="links / references">LINKS / REFERENCES</A></H3>
318  <PRE>  <PRE>
319    Specs:    Specs:
320      UML 1.3 Spec: <A HREF="http://cgi.omg.org/cgi-bin/doc?ad/99-06-08.pdf">http://cgi.omg.org/cgi-bin/doc?ad/99-06-08.pdf</A>      UML 1.3 Spec: <A HREF="http://cgi.omg.org/cgi-bin/doc?ad/99-06-08.pdf">http://cgi.omg.org/cgi-bin/doc?ad/99-06-08.pdf</A>

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.5

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