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 |
<LI><A HREF="#aims">AIMS</A></LI> |
16 |
<LI><A HREF="#synopsis">SYNOPSIS</A></LI> |
17 |
<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> |
23 |
</UL> |
24 |
|
25 |
<LI><A HREF="#requirements">REQUIREMENTS</A></LI> |
26 |
<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> |
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 |
<LI><A HREF="#bugs">BUGS</A></LI> |
41 |
<LI><A HREF="#features">FEATURES</A></LI> |
42 |
<UL> |
43 |
|
44 |
<LI><A HREF="#links / references">LINKS / REFERENCES</A></LI> |
45 |
</UL> |
46 |
|
47 |
</UL> |
48 |
|
49 |
</UL> |
50 |
<!-- INDEX END --> |
51 |
|
52 |
<HR> |
53 |
<P> |
54 |
<HR> |
55 |
<H1><A NAME="name">NAME</A></H1> |
56 |
<PRE> |
57 |
Data::Storage - Interface for accessing various Storage implementations for Perl in an independent way</PRE> |
58 |
<P> |
59 |
<HR> |
60 |
<H1><A NAME="aims">AIMS</A></H1> |
61 |
<PRE> |
62 |
- should encapsulate Tangram, DBI, DBD::CSV and LWP:: to access them in an unordinary (more convenient) way ;) |
63 |
- introduce a generic layered structure, refactor *SUBLAYER*-stuff, make (e.g.) this possible: |
64 |
Perl Data::Storage[DBD::CSV] -> Perl LWP:: -> Internet HTTP/FTP/* -> Host Daemon -> csv-file |
65 |
- provide generic synchronization mechanisms across arbitrary/multiple storages based on ident/checksum |
66 |
maybe it's possible to have schema-, structural- and semantical modifications synchronized???</PRE> |
67 |
<P> |
68 |
<HR> |
69 |
<H1><A NAME="synopsis">SYNOPSIS</A></H1> |
70 |
<P> |
71 |
<H2><A NAME="basic access">BASIC ACCESS</A></H2> |
72 |
<P> |
73 |
<H2><A NAME="advanced access">ADVANCED ACCESS</A></H2> |
74 |
<PRE> |
75 |
... via inheritance: |
76 |
</PRE> |
77 |
<PRE> |
78 |
|
79 |
use Data::Storage; |
80 |
my $proxyObj = new HttpProxy; |
81 |
$proxyObj->{url} = $url; |
82 |
$proxyObj->{payload} = $content; |
83 |
$self->{storage}->insert($proxyObj);</PRE> |
84 |
<PRE> |
85 |
|
86 |
use Data::Storage; |
87 |
my $proxyObj = HttpProxy->new( |
88 |
url => $url, |
89 |
payload => $content, |
90 |
); |
91 |
$self->{storage}->insert($proxyObj);</PRE> |
92 |
<P> |
93 |
<H2><A NAME="synchronization">SYNCHRONIZATION</A></H2> |
94 |
<PRE> |
95 |
my $nodemapping = { |
96 |
'LangText' => 'langtexts.csv', |
97 |
'Currency' => 'currencies.csv', |
98 |
'Country' => 'countries.csv', |
99 |
};</PRE> |
100 |
<PRE> |
101 |
my $propmapping = { |
102 |
'LangText' => [ |
103 |
[ 'source:lcountrykey' => 'target:country' ], |
104 |
[ 'source:lkey' => 'target:key' ], |
105 |
[ 'source:lvalue' => 'target:text' ], |
106 |
], |
107 |
'Currency' => [ |
108 |
[ 'source:ckey' => 'target:key' ], |
109 |
[ 'source:cname' => 'target:text' ], |
110 |
], |
111 |
'Country' => [ |
112 |
[ 'source:ckey' => 'target:key' ], |
113 |
[ 'source:cname' => 'target:text' ], |
114 |
], |
115 |
};</PRE> |
116 |
<PRE> |
117 |
s ub syncResource {</PRE> |
118 |
<PRE> |
119 |
my $self = shift; |
120 |
my $node_source = shift; |
121 |
my $mode = shift; |
122 |
my $opts = shift; |
123 |
</PRE> |
124 |
<PRE> |
125 |
|
126 |
$mode ||= ''; |
127 |
$opts->{erase} ||= 0;</PRE> |
128 |
<PRE> |
129 |
|
130 |
$logger->info( __PACKAGE__ . "->syncResource( node_source $node_source mode $mode erase $opts->{erase} )");</PRE> |
131 |
<PRE> |
132 |
|
133 |
# resolve metadata for syncing requested resource |
134 |
my $node_target = $nodemapping->{$node_source}; |
135 |
my $mapping = $propmapping->{$node_source};</PRE> |
136 |
<PRE> |
137 |
|
138 |
if (!$node_target || !$mapping) { |
139 |
# loggger.... "no target, sorry!" |
140 |
print "error while resolving resource metadata", "\n"; |
141 |
return; |
142 |
}</PRE> |
143 |
<PRE> |
144 |
|
145 |
if ($opts->{erase}) { |
146 |
$self->_erase_all($node_source); |
147 |
}</PRE> |
148 |
<PRE> |
149 |
|
150 |
# create new sync object |
151 |
my $sync = Data::Transfer::Sync->new( |
152 |
storages => { |
153 |
L => $self->{bizWorks}->{backend}, |
154 |
R => $self->{bizWorks}->{resources}, |
155 |
}, |
156 |
id_authorities => [qw( L ) ], |
157 |
checksum_authorities => [qw( L ) ], |
158 |
write_protected => [qw( R ) ], |
159 |
verbose => 1, |
160 |
);</PRE> |
161 |
<PRE> |
162 |
|
163 |
# sync |
164 |
# todo: filter!? |
165 |
$sync->syncNodes( { |
166 |
direction => $mode, # | +PUSH | +PULL | -FULL | +IMPORT | -EXPORT |
167 |
method => 'checksum', # | -timestamp | -manual |
168 |
source => "L:$node_source", |
169 |
source_ident => 'storage_method:id', |
170 |
source_exclude => [qw( id cs )], |
171 |
target => "R:$node_target", |
172 |
target_ident => 'property:oid', |
173 |
mapping => $mapping, |
174 |
} );</PRE> |
175 |
<PRE> |
176 |
}</PRE> |
177 |
<P> |
178 |
<H2><A NAME="note">NOTE</A></H2> |
179 |
<PRE> |
180 |
This module heavily relies on DBI and Tangram, but adds a lot of additional bugs and quirks. |
181 |
Please look at their documentation and/or this code for additional information.</PRE> |
182 |
<P> |
183 |
<HR> |
184 |
<H1><A NAME="requirements">REQUIREMENTS</A></H1> |
185 |
<PRE> |
186 |
For full functionality: |
187 |
DBI from CPAN |
188 |
DBD::mysql from CPAN |
189 |
Tangram 2.04 from CPAN (hmmm, 2.04 won't do in some cases) |
190 |
Tangram 2.05 from <A HREF="http://">http://</A>... (2.05 seems okay but there are also additional patches from our side) |
191 |
Class::Tangram from CPAN |
192 |
DBD::CSV from CPAN |
193 |
MySQL::Diff from <A HREF="http://adamspiers.org/computing/mysqldiff/">http://adamspiers.org/computing/mysqldiff/</A> |
194 |
... and all their dependencies</PRE> |
195 |
<P> |
196 |
<HR> |
197 |
<H1><A NAME="description">DESCRIPTION</A></H1> |
198 |
<P> |
199 |
<H2><A NAME="data::storage">Data::Storage</A></H2> |
200 |
<PRE> |
201 |
Data::Storage is a module for accessing various "data structures / kinds of structured data" stored inside |
202 |
various "data containers". |
203 |
We tried to use the AdapterPattern to implement a wrapper-layer around known CPAN modules. |
204 |
(e.g. DBI, Tangram, XML::Simple) |
205 |
References: |
206 |
- <A HREF="http://c2.com/cgi/wiki?AdapterPattern">http://c2.com/cgi/wiki?AdapterPattern</A> |
207 |
- <A HREF="http://home.earthlink.net/~huston2/dp/adapter.html">http://home.earthlink.net/~huston2/dp/adapter.html</A></PRE> |
208 |
<P> |
209 |
<H2><A NAME="why">Why?</A></H2> |
210 |
<PRE> |
211 |
You will get a better code-structure (not bad for later maintenance) in growing Perl code projects, |
212 |
especially when using multiple database connections at the same time. |
213 |
You will be able to switch between different _kinds_ of implementations used for storing data. |
214 |
Your code will use the very same API to access these storage layers. |
215 |
... implementation has to be changed for now |
216 |
Maybe you will be able to switch "on-the-fly" without changing any bits in code in the future.... |
217 |
... but that's not the focus</PRE> |
218 |
<P> |
219 |
<H2><A NAME="what else">What else?</A></H2> |
220 |
<PRE> |
221 |
Having this, we were able to do implement a generic data synchronization module more easy, |
222 |
please look at Data::Transfer.</PRE> |
223 |
<P> |
224 |
<HR> |
225 |
<H1><A NAME="authors / copyright">AUTHORS / COPYRIGHT</A></H1> |
226 |
<PRE> |
227 |
The Data::Storage module is Copyright (c) 2002 Andreas Motl. |
228 |
All rights reserved. |
229 |
You may distribute it under the terms of either the GNU General Public |
230 |
License or the Artistic License, as specified in the Perl README file.</PRE> |
231 |
<P> |
232 |
<HR> |
233 |
<H1><A NAME="acknowledgements">ACKNOWLEDGEMENTS</A></H1> |
234 |
<PRE> |
235 |
Larry Wall for Perl, Tim Bunce for DBI, Jean-Louis Leroy for Tangram and Set::Object, |
236 |
Sam Vilain for Class::Tangram, Jochen Wiedmann and Jeff Zucker for DBD::CSV & Co., |
237 |
Adam Spiers for MySQL::Diff and all contributors.</PRE> |
238 |
<P> |
239 |
<HR> |
240 |
<H1><A NAME="support / warranty">SUPPORT / WARRANTY</A></H1> |
241 |
<PRE> |
242 |
Data::Storage is free software. IT COMES WITHOUT WARRANTY OF ANY KIND.</PRE> |
243 |
<P> |
244 |
<HR> |
245 |
<H1><A NAME="todo">TODO</A></H1> |
246 |
<P> |
247 |
<H2><A NAME="bugs">BUGS</A></H2> |
248 |
<P>``DBI-Error [Tangram]: DBD::mysql::st execute failed: Unknown column 't1.requestdump' in 'field list'''</P> |
249 |
<PRE> |
250 |
... occours when operating on object-attributes not introduced yet: |
251 |
this should be detected and appended/replaced through: |
252 |
"Schema-Error detected, maybe (just) an inconsistency. |
253 |
Please check if your declaration in schema-module "a" matches structure in database "b" or try to run" |
254 |
db_setup.pl --dbkey=import --action=deploy</PRE> |
255 |
<P>Compare schema (structure diff) with database ...</P> |
256 |
<PRE> |
257 |
... when issuing "db_setup.pl --dbkey=import --action=deploy" |
258 |
on a database with an already deployed schema, use an additional "--update" then |
259 |
to lift the schema inside the database to the current declared schema. |
260 |
You will have to approve removals and changes on field-level while |
261 |
new objects and new fields are introduced silently without any interaction needed. |
262 |
In future versions there may be additional options to control silent processing of |
263 |
removals and changes. |
264 |
See this CRUD-table applying to the actions occouring on Classes and Class variables when deploying schemas, |
265 |
don't mix this up with CRUD-actions on Objects, these are already handled by (e.g.) Tangram itself. |
266 |
Classes: |
267 |
C create -> yes, handled automatically |
268 |
R retrieve -> no, not subject of this aspect since it is about deployment only |
269 |
U update -> yes, automatically for Class meta-attributes, yes/no for Class variables (look at the rules down here) |
270 |
D delete -> yes, just by user-interaction |
271 |
Class variables: |
272 |
C create -> yes, handled automatically |
273 |
R retrieve -> no, not subject of this aspect since it is about deployment only |
274 |
U update -> yes, just by user-interaction; maybe automatically if it can be determined that data wouldn't be lost |
275 |
D delete -> yes, just by user-interaction |
276 |
</PRE> |
277 |
<PRE> |
278 |
|
279 |
It's all about not to be able to loose data simply while this is in pre-alpha stage. |
280 |
And loosing data by being able to modify and redeploy schemas easily is definitely quite easy.</PRE> |
281 |
<PRE> |
282 |
|
283 |
As we can see, creations of Classes and new Class variables is handled |
284 |
automatically and this is believed to be the most common case under normal circumstances.</PRE> |
285 |
<P> |
286 |
<H2><A NAME="features">FEATURES</A></H2> |
287 |
<PRE> |
288 |
- Get this stuff together with UML (Unified Modeling Language) and/or standards from ODMG. |
289 |
- Make it possible to load/save schemas in XMI (XML Metadata Interchange), |
290 |
which seems to be most commonly used today, perhaps handle objects with OIFML. |
291 |
Integrate/bundle this with a web-/html-based UML modeling tool or |
292 |
some other interesting stuff like the "Co-operative UML Editor" from Uni Darmstadt. (web-/java-based) |
293 |
- Enable Round Trip Engineering. Keep code and diagrams in sync. Don't annoy/bother the programmers. |
294 |
- Add support for some more handlers/locators to be able to |
295 |
access the following standards/protocols/interfaces/programs/apis transparently: |
296 |
+ DBD::CSV (via Data::Storage::Handler::DBI) |
297 |
(-) Text::CSV, XML::CSV, XML::Excel |
298 |
- MAPI |
299 |
- LDAP |
300 |
- DAV (look at PerlDAV: <A HREF="http://www.webdav.org/perldav/">http://www.webdav.org/perldav/</A>) |
301 |
- Mbox (use formail for seperating/splitting entries/nodes) |
302 |
- Cyrus (cyrdeliver - what about cyrretrieve (export)???) |
303 |
- use File::DiffTree, use File::Compare |
304 |
- Hibernate |
305 |
- "Win32::UserAccountDb" |
306 |
- "*nix::UserAccountDb" |
307 |
- .wab - files (Windows Address Book) |
308 |
- .pst - files (Outlook Post Storage?) |
309 |
- XML (e.g. via XML::Simple?) |
310 |
- Move to t3, look at InCASE |
311 |
- some kind of security layer for methods/objects |
312 |
- acls (stored via tangram/ldap?) for functions, methods and objects (entity- & data!?) |
313 |
- where are the hooks needed then? |
314 |
- is Data::Storage & Co. okay, or do we have to touch the innards of DBI and/or Tangram? |
315 |
- an attempt to start could be: |
316 |
- 'sub getACLByObjectId($id, $context)' |
317 |
- 'sub getACLByMethodname($id, $context)' |
318 |
- 'sub getACLByName($id, $context)' |
319 |
( would require a kinda registry to look up these very names pointing to arbitrary locations (code, data, ...) ) |
320 |
- add more hooks and various levels |
321 |
- better integrate introduced 'getObjectByGuid'-mechanism from Data::Storage::Handler::Tangram</PRE> |
322 |
<P> |
323 |
<H3><A NAME="links / references">LINKS / REFERENCES</A></H3> |
324 |
<PRE> |
325 |
Specs: |
326 |
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> |
327 |
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> |
328 |
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> |
329 |
ODMG: <A HREF="http://odmg.org/">http://odmg.org/</A> |
330 |
OIFML: <A HREF="http://odmg.org/library/readingroom/oifml.pdf">http://odmg.org/library/readingroom/oifml.pdf</A></PRE> |
331 |
<PRE> |
332 |
CASE Tools: |
333 |
Rational Rose (commercial): <A HREF="http://www.rational.com/products/rose/">http://www.rational.com/products/rose/</A> |
334 |
Together (commercial): <A HREF="http://www.oi.com/products/controlcenter/index.jsp">http://www.oi.com/products/controlcenter/index.jsp</A> |
335 |
InCASE - Tangram-based Universal Object Editor |
336 |
Sybase PowerDesigner: <A HREF="http://www.sybase.com/powerdesigner">http://www.sybase.com/powerdesigner</A> |
337 |
</PRE> |
338 |
<PRE> |
339 |
|
340 |
UML Editors: |
341 |
Fujaba (free, university): <A HREF="http://www.fujaba.de/">http://www.fujaba.de/</A> |
342 |
ArgoUML (free): <A HREF="http://argouml.tigris.org/">http://argouml.tigris.org/</A> |
343 |
Poseidon (commercial): <A HREF="http://www.gentleware.com/products/poseidonDE.php3">http://www.gentleware.com/products/poseidonDE.php3</A> |
344 |
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> |
345 |
Metamill (commercial): <A HREF="http://www.metamill.com/">http://www.metamill.com/</A> |
346 |
Violet (university, research, education): <A HREF="http://www.horstmann.com/violet/">http://www.horstmann.com/violet/</A> |
347 |
PyUt (free): <A HREF="http://pyut.sourceforge.net/">http://pyut.sourceforge.net/</A> |
348 |
(Dia (free): <A HREF="http://www.lysator.liu.se/~alla/dia/">http://www.lysator.liu.se/~alla/dia/</A>) |
349 |
UMLet (free, university): <A HREF="http://www.swt.tuwien.ac.at/umlet/index.html">http://www.swt.tuwien.ac.at/umlet/index.html</A> |
350 |
Voodoo (free): <A HREF="http://voodoo.sourceforge.net/">http://voodoo.sourceforge.net/</A> |
351 |
Umbrello UML Modeller: <A HREF="http://uml.sourceforge.net/">http://uml.sourceforge.net/</A></PRE> |
352 |
<PRE> |
353 |
UML Tools: |
354 |
<A HREF="http://www.objectsbydesign.com/tools/umltools_byPrice.html">http://www.objectsbydesign.com/tools/umltools_byPrice.html</A></PRE> |
355 |
<PRE> |
356 |
Further readings: |
357 |
<A HREF="http://www.google.com/search?q=web+based+uml+editor&">http://www.google.com/search?q=web+based+uml+editor&</A>;hl=en&lr=&ie=UTF-8&oe=UTF-8&start=10&sa=N |
358 |
<A HREF="http://www.fernuni-hagen.de/DVT/Aktuelles/01FHHeidelberg.pdf">http://www.fernuni-hagen.de/DVT/Aktuelles/01FHHeidelberg.pdf</A> |
359 |
<A HREF="http://www.enhyper.com/src/documentation/">http://www.enhyper.com/src/documentation/</A> |
360 |
<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> |
361 |
<A HREF="http://citeseer.nj.nec.com/vilain00diagrammatic.html">http://citeseer.nj.nec.com/vilain00diagrammatic.html</A> |
362 |
<A HREF="http://archive.devx.com/uml/articles/Smith01/Smith01-3.asp">http://archive.devx.com/uml/articles/Smith01/Smith01-3.asp</A></PRE> |
363 |
|
364 |
</BODY> |
365 |
|
366 |
</HTML> |