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