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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (hide annotations)
Sun Jan 19 03:12:12 2003 UTC (21 years, 4 months ago) by joko
Branch: MAIN
CVS Tags: HEAD
Changes since 1.5: +0 -0 lines
File MIME type: text/html
FILE REMOVED
- moved to Storage.README.xyz

1 joko 1.1 <HTML>
2     <HEAD>
3     <TITLE>Data::Storage</TITLE>
4     <LINK REV="made" HREF="mailto:">
5     </HEAD>
6    
7     <BODY>
8    
9     <A NAME="__index__"></A>
10     <!-- INDEX BEGIN -->
11    
12     <UL>
13    
14     <LI><A HREF="#name">NAME</A></LI>
15 joko 1.4 <LI><A HREF="#aims">AIMS</A></LI>
16 joko 1.1 <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
17     <UL>
18    
19 joko 1.4 <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 joko 1.1 <LI><A HREF="#note">NOTE</A></LI>
23     </UL>
24    
25 joko 1.3 <LI><A HREF="#requirements">REQUIREMENTS</A></LI>
26 joko 1.1 <LI><A HREF="#description">DESCRIPTION</A></LI>
27 joko 1.5 <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 joko 1.1 <LI><A HREF="#authors / copyright">AUTHORS / COPYRIGHT</A></LI>
35     <LI><A HREF="#acknowledgements">ACKNOWLEDGEMENTS</A></LI>
36     <LI><A HREF="#support / warranty">SUPPORT / WARRANTY</A></LI>
37     <LI><A HREF="#todo">TODO</A></LI>
38     <UL>
39    
40 joko 1.4 <LI><A HREF="#bugs">BUGS</A></LI>
41     <LI><A HREF="#features">FEATURES</A></LI>
42 joko 1.1 <UL>
43    
44 joko 1.4 <LI><A HREF="#links / references">LINKS / REFERENCES</A></LI>
45 joko 1.1 </UL>
46    
47     </UL>
48    
49     </UL>
50     <!-- INDEX END -->
51    
52     <HR>
53     <P>
54     <H1><A NAME="name">NAME</A></H1>
55 joko 1.5 <PRE>
56     Data::Storage - Interface for accessing various Storage implementations for Perl in an independent way</PRE>
57 joko 1.1 <P>
58     <HR>
59 joko 1.4 <H1><A NAME="aims">AIMS</A></H1>
60     <PRE>
61     - 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 joko 1.1 <H1><A NAME="synopsis">SYNOPSIS</A></H1>
69 joko 1.4 <P>
70     <H2><A NAME="basic access">BASIC ACCESS</A></H2>
71     <P>
72     <H2><A NAME="advanced access">ADVANCED ACCESS</A></H2>
73 joko 1.1 <PRE>
74     ... via inheritance:
75     </PRE>
76     <PRE>
77    
78     use Data::Storage;
79     my $proxyObj = new HttpProxy;
80     $proxyObj-&gt;{url} = $url;
81     $proxyObj-&gt;{payload} = $content;
82     $self-&gt;{storage}-&gt;insert($proxyObj);</PRE>
83     <PRE>
84    
85     use Data::Storage;
86     my $proxyObj = HttpProxy-&gt;new(
87     url =&gt; $url,
88     payload =&gt; $content,
89     );
90     $self-&gt;{storage}-&gt;insert($proxyObj);</PRE>
91     <P>
92 joko 1.4 <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 joko 1.1 <H2><A NAME="note">NOTE</A></H2>
178 joko 1.5 <PRE>
179     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 joko 1.3 <P>
182     <HR>
183     <H1><A NAME="requirements">REQUIREMENTS</A></H1>
184 joko 1.4 <PRE>
185     For full functionality:
186     DBI from CPAN
187     DBD::mysql from CPAN
188     Tangram 2.04 from CPAN (hmmm, 2.04 won't do in some cases)
189     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 joko 1.1 <P>
195     <HR>
196     <H1><A NAME="description">DESCRIPTION</A></H1>
197 joko 1.5 <P>
198     <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 joko 1.1 <P>
220     <HR>
221     <H1><A NAME="authors / copyright">AUTHORS / COPYRIGHT</A></H1>
222 joko 1.5 <PRE>
223     The Data::Storage module is Copyright (c) 2002 Andreas Motl.
224     All rights reserved.
225     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 joko 1.1 <P>
228     <HR>
229     <H1><A NAME="acknowledgements">ACKNOWLEDGEMENTS</A></H1>
230 joko 1.5 <PRE>
231     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 joko 1.1 <P>
235     <HR>
236     <H1><A NAME="support / warranty">SUPPORT / WARRANTY</A></H1>
237 joko 1.5 <PRE>
238     Data::Storage is free software. IT COMES WITHOUT WARRANTY OF ANY KIND.</PRE>
239 joko 1.1 <P>
240     <HR>
241     <H1><A NAME="todo">TODO</A></H1>
242     <P>
243 joko 1.4 <H2><A NAME="bugs">BUGS</A></H2>
244     <P>``DBI-Error [Tangram]: DBD::mysql::st execute failed: Unknown column 't1.requestdump' in 'field list'''</P>
245 joko 1.1 <PRE>
246 joko 1.4 ... occours when operating on object-attributes not introduced yet:
247     this should be detected and appended/replaced through:
248     &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;
250     db_setup.pl --dbkey=import --action=deploy</PRE>
251     <P>Compare schema (structure diff) with database ...</P>
252 joko 1.1 <PRE>
253     ... 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
255     to lift the schema inside the database to the current declared schema.
256     You will have to approve removals and changes on field-level while
257     new objects and new fields are introduced silently without any interaction needed.
258     In future versions there may be additional options to control silent processing of
259     removals and changes.
260     See this CRUD-table applying to the actions occouring on Classes and Class variables when deploying schemas,
261     don't mix this up with CRUD-actions on Objects, these are already handled by (e.g.) Tangram itself.
262     Classes:
263     C create -&gt; yes, handled automatically
264     R retrieve -&gt; no, not subject of this aspect since it is about deployment only
265     U update -&gt; yes, automatically for Class meta-attributes, yes/no for Class variables (look at the rules down here)
266     D delete -&gt; yes, just by user-interaction
267     Class variables:
268     C create -&gt; yes, handled automatically
269     R retrieve -&gt; no, not subject of this aspect since it is about deployment only
270     U update -&gt; yes, just by user-interaction; maybe automatically if it can be determined that data wouldn't be lost
271     D delete -&gt; yes, just by user-interaction
272 joko 1.2 </PRE>
273     <PRE>
274    
275     It's all about not to be able to loose data simply while this is in pre-alpha stage.
276     And loosing data by being able to modify and redeploy schemas easily is definitely quite easy.</PRE>
277     <PRE>
278    
279     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>
281 joko 1.1 <P>
282 joko 1.4 <H2><A NAME="features">FEATURES</A></H2>
283 joko 1.1 <PRE>
284 joko 1.2 - 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),
286     which seems to be most commonly used today, perhaps handle objects with OIFML.
287     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)
289     - Enable Round Trip Engineering. Keep code and diagrams in sync. Don't annoy/bother the programmers.
290 joko 1.4 - Add support for some more handlers/locators to be able to
291     access the following standards/protocols/interfaces/programs/apis transparently:
292     + DBD::CSV (via Data::Storage::Handler::DBI)
293     (-) Text::CSV, XML::CSV, XML::Excel
294     - 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 joko 1.5 - 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 joko 1.1 <P>
317 joko 1.4 <H3><A NAME="links / references">LINKS / REFERENCES</A></H3>
318 joko 1.1 <PRE>
319 joko 1.2 Specs:
320 joko 1.1 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>
321     XMI 1.1 Spec: <A HREF="http://cgi.omg.org/cgi-bin/doc?ad/99-10-02.pdf">http://cgi.omg.org/cgi-bin/doc?ad/99-10-02.pdf</A>
322     XMI 2.0 Spec: <A HREF="http://cgi.omg.org/docs/ad/01-06-12.pdf">http://cgi.omg.org/docs/ad/01-06-12.pdf</A>
323     ODMG: <A HREF="http://odmg.org/">http://odmg.org/</A>
324 joko 1.2 OIFML: <A HREF="http://odmg.org/library/readingroom/oifml.pdf">http://odmg.org/library/readingroom/oifml.pdf</A></PRE>
325     <PRE>
326     CASE Tools:
327     Rational Rose (commercial): <A HREF="http://www.rational.com/products/rose/">http://www.rational.com/products/rose/</A>
328     Together (commercial): <A HREF="http://www.oi.com/products/controlcenter/index.jsp">http://www.oi.com/products/controlcenter/index.jsp</A>
329     InCASE - Tangram-based Universal Object Editor
330     Sybase PowerDesigner: <A HREF="http://www.sybase.com/powerdesigner">http://www.sybase.com/powerdesigner</A>
331     </PRE>
332 joko 1.1 <PRE>
333 joko 1.2
334     UML Editors:
335     Fujaba (free, university): <A HREF="http://www.fujaba.de/">http://www.fujaba.de/</A>
336     ArgoUML (free): <A HREF="http://argouml.tigris.org/">http://argouml.tigris.org/</A>
337     Poseidon (commercial): <A HREF="http://www.gentleware.com/products/poseidonDE.php3">http://www.gentleware.com/products/poseidonDE.php3</A>
338     Co-operative UML Editor (research): <A HREF="http://www.darmstadt.gmd.de/concert/activities/internal/umledit.html">http://www.darmstadt.gmd.de/concert/activities/internal/umledit.html</A>
339     Metamill (commercial): <A HREF="http://www.metamill.com/">http://www.metamill.com/</A>
340     Violet (university, research, education): <A HREF="http://www.horstmann.com/violet/">http://www.horstmann.com/violet/</A>
341     PyUt (free): <A HREF="http://pyut.sourceforge.net/">http://pyut.sourceforge.net/</A>
342     (Dia (free): <A HREF="http://www.lysator.liu.se/~alla/dia/">http://www.lysator.liu.se/~alla/dia/</A>)
343     UMLet (free, university): <A HREF="http://www.swt.tuwien.ac.at/umlet/index.html">http://www.swt.tuwien.ac.at/umlet/index.html</A>
344 joko 1.3 Voodoo (free): <A HREF="http://voodoo.sourceforge.net/">http://voodoo.sourceforge.net/</A>
345     Umbrello UML Modeller: <A HREF="http://uml.sourceforge.net/">http://uml.sourceforge.net/</A></PRE>
346 joko 1.2 <PRE>
347     UML Tools:
348     <A HREF="http://www.objectsbydesign.com/tools/umltools_byPrice.html">http://www.objectsbydesign.com/tools/umltools_byPrice.html</A></PRE>
349     <PRE>
350     Further readings:
351 joko 1.1 <A HREF="http://www.google.com/search?q=web+based+uml+editor&amp">http://www.google.com/search?q=web+based+uml+editor&amp</A>;hl=en&amp;lr=&amp;ie=UTF-8&amp;oe=UTF-8&amp;start=10&amp;sa=N
352     <A HREF="http://www.fernuni-hagen.de/DVT/Aktuelles/01FHHeidelberg.pdf">http://www.fernuni-hagen.de/DVT/Aktuelles/01FHHeidelberg.pdf</A>
353     <A HREF="http://www.enhyper.com/src/documentation/">http://www.enhyper.com/src/documentation/</A>
354     <A HREF="http://cis.cs.tu-berlin.de/Dokumente/Diplomarbeiten/2001/skinner.pdf">http://cis.cs.tu-berlin.de/Dokumente/Diplomarbeiten/2001/skinner.pdf</A>
355     <A HREF="http://citeseer.nj.nec.com/vilain00diagrammatic.html">http://citeseer.nj.nec.com/vilain00diagrammatic.html</A>
356     <A HREF="http://archive.devx.com/uml/articles/Smith01/Smith01-3.asp">http://archive.devx.com/uml/articles/Smith01/Smith01-3.asp</A></PRE>
357    
358     </BODY>
359    
360     </HTML>

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