| 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> |
| 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 |
<UL> |
<LI><A HREF="#features">FEATURES</A></LI> |
|
|
|
|
<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="#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> |
|
| 42 |
<UL> |
<UL> |
| 43 |
|
|
| 44 |
<LI><A HREF="#links:">Links:</A></LI> |
<LI><A HREF="#links / references">LINKS / REFERENCES</A></LI> |
| 45 |
</UL> |
</UL> |
| 46 |
|
|
| 47 |
</UL> |
</UL> |
| 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] -> Perl LWP:: -> Internet HTTP/FTP/* -> Host Daemon -> 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> |
| 89 |
); |
); |
| 90 |
$self->{storage}->insert($proxyObj);</PRE> |
$self->{storage}->insert($proxyObj);</PRE> |
| 91 |
<P> |
<P> |
| 92 |
|
<H2><A NAME="synchronization">SYNCHRONIZATION</A></H2> |
| 93 |
|
<PRE> |
| 94 |
|
my $nodemapping = { |
| 95 |
|
'LangText' => 'langtexts.csv', |
| 96 |
|
'Currency' => 'currencies.csv', |
| 97 |
|
'Country' => 'countries.csv', |
| 98 |
|
};</PRE> |
| 99 |
|
<PRE> |
| 100 |
|
my $propmapping = { |
| 101 |
|
'LangText' => [ |
| 102 |
|
[ 'source:lcountrykey' => 'target:country' ], |
| 103 |
|
[ 'source:lkey' => 'target:key' ], |
| 104 |
|
[ 'source:lvalue' => 'target:text' ], |
| 105 |
|
], |
| 106 |
|
'Currency' => [ |
| 107 |
|
[ 'source:ckey' => 'target:key' ], |
| 108 |
|
[ 'source:cname' => 'target:text' ], |
| 109 |
|
], |
| 110 |
|
'Country' => [ |
| 111 |
|
[ 'source:ckey' => 'target:key' ], |
| 112 |
|
[ 'source:cname' => '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->{erase} ||= 0;</PRE> |
| 127 |
|
<PRE> |
| 128 |
|
|
| 129 |
|
$logger->info( __PACKAGE__ . "->syncResource( node_source $node_source mode $mode erase $opts->{erase} )");</PRE> |
| 130 |
|
<PRE> |
| 131 |
|
|
| 132 |
|
# resolve metadata for syncing requested resource |
| 133 |
|
my $node_target = $nodemapping->{$node_source}; |
| 134 |
|
my $mapping = $propmapping->{$node_source};</PRE> |
| 135 |
|
<PRE> |
| 136 |
|
|
| 137 |
|
if (!$node_target || !$mapping) { |
| 138 |
|
# loggger.... "no target, sorry!" |
| 139 |
|
print "error while resolving resource metadata", "\n"; |
| 140 |
|
return; |
| 141 |
|
}</PRE> |
| 142 |
|
<PRE> |
| 143 |
|
|
| 144 |
|
if ($opts->{erase}) { |
| 145 |
|
$self->_erase_all($node_source); |
| 146 |
|
}</PRE> |
| 147 |
|
<PRE> |
| 148 |
|
|
| 149 |
|
# create new sync object |
| 150 |
|
my $sync = Data::Transfer::Sync->new( |
| 151 |
|
storages => { |
| 152 |
|
L => $self->{bizWorks}->{backend}, |
| 153 |
|
R => $self->{bizWorks}->{resources}, |
| 154 |
|
}, |
| 155 |
|
id_authorities => [qw( L ) ], |
| 156 |
|
checksum_authorities => [qw( L ) ], |
| 157 |
|
write_protected => [qw( R ) ], |
| 158 |
|
verbose => 1, |
| 159 |
|
);</PRE> |
| 160 |
|
<PRE> |
| 161 |
|
|
| 162 |
|
# sync |
| 163 |
|
# todo: filter!? |
| 164 |
|
$sync->syncNodes( { |
| 165 |
|
direction => $mode, # | +PUSH | +PULL | -FULL | +IMPORT | -EXPORT |
| 166 |
|
method => 'checksum', # | -timestamp | -manual |
| 167 |
|
source => "L:$node_source", |
| 168 |
|
source_ident => 'storage_method:id', |
| 169 |
|
source_exclude => [qw( id cs )], |
| 170 |
|
target => "R:$node_target", |
| 171 |
|
target_ident => 'property:oid', |
| 172 |
|
mapping => $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 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> |
| 182 |
|
<HR> |
| 183 |
|
<H1><A NAME="requirements">REQUIREMENTS</A></H1> |
| 184 |
|
<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 |
<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 "data structures / kinds of structured data" stored inside |
| 201 |
|
various "data containers". |
| 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 "on-the-fly" 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 and the <CODE>perl5-porters</CODE> for Perl, |
<PRE> |
| 231 |
Tim Bunce for DBI, Jean-Louis Leroy for Tangram and Set::Object, |
Larry Wall for Perl, Tim Bunce for DBI, Jean-Louis Leroy for Tangram and Set::Object, |
| 232 |
Sam Vilain for Class::Tangram.</P> |
Sam Vilain for Class::Tangram, Jochen Wiedmann and Jeff Zucker for DBD::CSV & 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 |
"Schema-Error detected, maybe (just) an inconsistency. |
"Schema-Error detected, maybe (just) an inconsistency. |
| 249 |
Please check if your declaration in schema-module "a" matches structure in database "b" or try to run" |
Please check if your declaration in schema-module "a" matches structure in database "b" or try to run" |
| 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 "db_setup.pl --dbkey=import --action=deploy" |
... when issuing "db_setup.pl --dbkey=import --action=deploy" |
| 254 |
on a database with an already deployed schema, use an additional "--update" then |
on a database with an already deployed schema, use an additional "--update" then |
| 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), |
| 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 "Co-operative UML Editor" from Uni Darmstadt. (web-/java-based) |
some other interesting stuff like the "Co-operative UML Editor" 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 |
|
- "Win32::UserAccountDb" |
| 302 |
|
- "*nix::UserAccountDb" |
| 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- & data!?) |
| 309 |
|
- where are the hooks needed then? |
| 310 |
|
- is Data::Storage & 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> |
| 341 |
PyUt (free): <A HREF="http://pyut.sourceforge.net/">http://pyut.sourceforge.net/</A> |
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>) |
(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> |
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 |
Voodoo (free): <A HREF="http://voodoo.sourceforge.net/">http://voodoo.sourceforge.net/</A></PRE> |
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 |
<PRE> |
<PRE> |
| 347 |
UML Tools: |
UML Tools: |
| 348 |
<A HREF="http://www.objectsbydesign.com/tools/umltools_byPrice.html">http://www.objectsbydesign.com/tools/umltools_byPrice.html</A></PRE> |
<A HREF="http://www.objectsbydesign.com/tools/umltools_byPrice.html">http://www.objectsbydesign.com/tools/umltools_byPrice.html</A></PRE> |