2 |
Data::Storage - Interface for accessing various Storage implementations |
Data::Storage - Interface for accessing various Storage implementations |
3 |
for Perl in an independent way |
for Perl in an independent way |
4 |
|
|
5 |
|
AIMS |
6 |
|
- should encapsulate Tangram, DBI, DBD::CSV and LWP:: to access them in an unordinary (more convenient) way ;) |
7 |
|
- introduce a generic layered structure, refactor *SUBLAYER*-stuff, make (e.g.) this possible: |
8 |
|
Perl Data::Storage[DBD::CSV] -> Perl LWP:: -> Internet HTTP/FTP/* -> Host Daemon -> csv-file |
9 |
|
- provide generic synchronization mechanisms across arbitrary/multiple storages based on ident/checksum |
10 |
|
maybe it's possible to have schema-, structural- and semantical modifications synchronized??? |
11 |
|
|
12 |
SYNOPSIS |
SYNOPSIS |
13 |
... the basic way: |
BASIC ACCESS |
14 |
|
|
15 |
|
ADVANCED ACCESS |
16 |
|
|
17 |
... via inheritance: |
... via inheritance: |
18 |
|
|
29 |
); |
); |
30 |
$self->{storage}->insert($proxyObj); |
$self->{storage}->insert($proxyObj); |
31 |
|
|
32 |
|
SYNCHRONIZATION |
33 |
|
|
34 |
|
my $nodemapping = { |
35 |
|
'LangText' => 'langtexts.csv', |
36 |
|
'Currency' => 'currencies.csv', |
37 |
|
'Country' => 'countries.csv', |
38 |
|
}; |
39 |
|
|
40 |
|
my $propmapping = { |
41 |
|
'LangText' => [ |
42 |
|
[ 'source:lcountrykey' => 'target:country' ], |
43 |
|
[ 'source:lkey' => 'target:key' ], |
44 |
|
[ 'source:lvalue' => 'target:text' ], |
45 |
|
], |
46 |
|
'Currency' => [ |
47 |
|
[ 'source:ckey' => 'target:key' ], |
48 |
|
[ 'source:cname' => 'target:text' ], |
49 |
|
], |
50 |
|
'Country' => [ |
51 |
|
[ 'source:ckey' => 'target:key' ], |
52 |
|
[ 'source:cname' => 'target:text' ], |
53 |
|
], |
54 |
|
}; |
55 |
|
|
56 |
|
sub syncResource { |
57 |
|
|
58 |
|
my $self = shift; |
59 |
|
my $node_source = shift; |
60 |
|
my $mode = shift; |
61 |
|
my $opts = shift; |
62 |
|
|
63 |
|
$mode ||= ''; |
64 |
|
$opts->{erase} ||= 0; |
65 |
|
|
66 |
|
$logger->info( __PACKAGE__ . "->syncResource( node_source $node_source mode $mode erase $opts->{erase} )"); |
67 |
|
|
68 |
|
# resolve metadata for syncing requested resource |
69 |
|
my $node_target = $nodemapping->{$node_source}; |
70 |
|
my $mapping = $propmapping->{$node_source}; |
71 |
|
|
72 |
|
if (!$node_target || !$mapping) { |
73 |
|
# loggger.... "no target, sorry!" |
74 |
|
print "error while resolving resource metadata", "\n"; |
75 |
|
return; |
76 |
|
} |
77 |
|
|
78 |
|
if ($opts->{erase}) { |
79 |
|
$self->_erase_all($node_source); |
80 |
|
} |
81 |
|
|
82 |
|
# create new sync object |
83 |
|
my $sync = Data::Transfer::Sync->new( |
84 |
|
storages => { |
85 |
|
L => $self->{bizWorks}->{backend}, |
86 |
|
R => $self->{bizWorks}->{resources}, |
87 |
|
}, |
88 |
|
id_authorities => [qw( L ) ], |
89 |
|
checksum_authorities => [qw( L ) ], |
90 |
|
write_protected => [qw( R ) ], |
91 |
|
verbose => 1, |
92 |
|
); |
93 |
|
|
94 |
|
# sync |
95 |
|
# todo: filter!? |
96 |
|
$sync->syncNodes( { |
97 |
|
direction => $mode, # | +PUSH | +PULL | -FULL | +IMPORT | -EXPORT |
98 |
|
method => 'checksum', # | -timestamp | -manual |
99 |
|
source => "L:$node_source", |
100 |
|
source_ident => 'storage_method:id', |
101 |
|
source_exclude => [qw( id cs )], |
102 |
|
target => "R:$node_target", |
103 |
|
target_ident => 'property:oid', |
104 |
|
mapping => $mapping, |
105 |
|
} ); |
106 |
|
|
107 |
|
} |
108 |
|
|
109 |
NOTE |
NOTE |
110 |
|
|
111 |
This module heavily relies on DBI and Tangram, but adds a lot of |
This module heavily relies on DBI and Tangram, but adds a lot of |
112 |
additional bugs and quirks. Please look at their documentation and this |
additional bugs and quirks. Please look at their documentation and/or |
113 |
code for additional information. |
this code for additional information. |
114 |
|
|
115 |
|
REQUIREMENTS |
116 |
|
For full functionality: |
117 |
|
DBI from CPAN |
118 |
|
DBD::mysql from CPAN |
119 |
|
Tangram 2.04 from CPAN (hmmm, 2.04 won't do in some cases) |
120 |
|
Tangram 2.05 from http://... (2.05 seems okay but there are also additional patches from our side) |
121 |
|
Class::Tangram from CPAN |
122 |
|
DBD::CSV from CPAN |
123 |
|
MySQL::Diff from http://adamspiers.org/computing/mysqldiff/ |
124 |
|
... and all their dependencies |
125 |
|
|
126 |
DESCRIPTION |
DESCRIPTION |
127 |
Data::Storage is module for a accessing various "data structures" stored |
Data::Storage is a module for accessing various "data structures" stored |
128 |
inside various "data containers". It sits on top of DBI and/or Tangram. |
inside various "data containers". It sits on top of DBI and/or Tangram. |
129 |
|
|
130 |
AUTHORS / COPYRIGHT |
AUTHORS / COPYRIGHT |
135 |
License or the Artistic License, as specified in the Perl README file. |
License or the Artistic License, as specified in the Perl README file. |
136 |
|
|
137 |
ACKNOWLEDGEMENTS |
ACKNOWLEDGEMENTS |
138 |
Larry Wall and the "perl5-porters" for Perl, Tim Bunce for DBI, |
Larry Wall for Perl, Tim Bunce for DBI, Jean-Louis Leroy for Tangram and |
139 |
Jean-Louis Leroy for Tangram and Set::Object, Sam Vilain for |
Set::Object, Sam Vilain for Class::Tangram, Jochen Wiedmann and Jeff |
140 |
Class::Tangram. |
Zucker for DBD::CSV and related, Adam Spiers for MySQL::Diff and all |
141 |
|
contributors. |
142 |
|
|
143 |
SUPPORT / WARRANTY |
SUPPORT / WARRANTY |
144 |
Data::Storage is free software. IT COMES WITHOUT WARRANTY OF ANY KIND. |
Data::Storage is free software. IT COMES WITHOUT WARRANTY OF ANY KIND. |
145 |
|
|
146 |
TODO |
TODO |
147 |
Handle the following errors/cases: |
BUGS |
148 |
|
|
149 |
"DBI-Error [Tangram]: DBD::mysql::st execute failed: Unknown column 't1.requestdump' in 'field list'" |
"DBI-Error [Tangram]: DBD::mysql::st execute failed: Unknown column |
150 |
|
't1.requestdump' in 'field list'" |
151 |
|
|
152 |
... occours when operating on object-attributes not introduced yet: |
... occours when operating on object-attributes not introduced yet: |
153 |
this should be detected and appended/replaced through: |
this should be detected and appended/replaced through: |
154 |
"Schema-Error detected, maybe (just) an inconsistency. |
"Schema-Error detected, maybe (just) an inconsistency. |
155 |
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" |
156 |
db_setup.pl --dbkey=import --action=deploy |
db_setup.pl --dbkey=import --action=deploy |
157 |
|
|
158 |
Compare schema (structure diff) with database ... |
Compare schema (structure diff) with database ... |
159 |
|
|
160 |
... when issuing "db_setup.pl --dbkey=import --action=deploy" |
... when issuing "db_setup.pl --dbkey=import --action=deploy" |
161 |
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 |
176 |
R retrieve -> no, not subject of this aspect since it is about deployment only |
R retrieve -> no, not subject of this aspect since it is about deployment only |
177 |
U update -> yes, just by user-interaction; maybe automatically if it can be determined that data wouldn't be lost |
U update -> yes, just by user-interaction; maybe automatically if it can be determined that data wouldn't be lost |
178 |
D delete -> yes, just by user-interaction |
D delete -> yes, just by user-interaction |
179 |
It's all about not to be able to loose data simply while this is in alpha stage. |
|
180 |
|
It's all about not to be able to loose data simply while this is in pre-alpha stage. |
181 |
|
And loosing data by being able to modify and redeploy schemas easily is definitely quite easy. |
182 |
|
|
183 |
|
As we can see, creations of Classes and new Class variables is handled |
184 |
|
automatically and this is believed to be the most common case under normal circumstances. |
185 |
|
|
186 |
Introduce some features: |
FEATURES |
187 |
|
|
188 |
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. |
189 |
Make it possible to load/save schemas in XMI (XML Metadata Interchange), |
- Make it possible to load/save schemas in XMI (XML Metadata Interchange), |
190 |
which seems to be most commonly used today, perhaps handle objects with OIFML. |
which seems to be most commonly used today, perhaps handle objects with OIFML. |
191 |
Integrate/bundle this with a web-/html-based UML modeling tool or |
Integrate/bundle this with a web-/html-based UML modeling tool or |
192 |
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) |
193 |
Enable Round Trip Engineering. Keep code and diagrams in sync. Don't annoy/bother the programmer. |
- Enable Round Trip Engineering. Keep code and diagrams in sync. Don't annoy/bother the programmers. |
194 |
|
- Add support for some more handlers/locators to be able to |
195 |
|
access the following standards/protocols/interfaces/programs/apis transparently: |
196 |
|
+ DBD::CSV (via Data::Storage::Handler::DBI) |
197 |
|
(-) Text::CSV, XML::CSV, XML::Excel |
198 |
|
- MAPI |
199 |
|
- LDAP |
200 |
|
- DAV (look at PerlDAV: http://www.webdav.org/perldav/) |
201 |
|
- Mbox (use formail for seperating/splitting entries/nodes) |
202 |
|
- Cyrus (cyrdeliver - what about cyrretrieve (export)???) |
203 |
|
- use File::DiffTree, use File::Compare |
204 |
|
- Hibernate |
205 |
|
- "Win32::UserAccountDb" |
206 |
|
- "*nix::UserAccountDb" |
207 |
|
- .wab - files (Windows Address Book) |
208 |
|
- .pst - files (Outlook Post Storage?) |
209 |
|
- XML (e.g. via XML::Simple?) |
210 |
|
- Move to t3, look at InCASE |
211 |
|
|
212 |
Links: |
LINKS / REFERENCES |
213 |
|
|
214 |
|
Specs: |
215 |
UML 1.3 Spec: http://cgi.omg.org/cgi-bin/doc?ad/99-06-08.pdf |
UML 1.3 Spec: http://cgi.omg.org/cgi-bin/doc?ad/99-06-08.pdf |
216 |
XMI 1.1 Spec: http://cgi.omg.org/cgi-bin/doc?ad/99-10-02.pdf |
XMI 1.1 Spec: http://cgi.omg.org/cgi-bin/doc?ad/99-10-02.pdf |
217 |
XMI 2.0 Spec: http://cgi.omg.org/docs/ad/01-06-12.pdf |
XMI 2.0 Spec: http://cgi.omg.org/docs/ad/01-06-12.pdf |
218 |
ODMG: http://odmg.org/ |
ODMG: http://odmg.org/ |
219 |
OIFML: http://odmg.org/library/readingroom/oifml.pdf |
OIFML: http://odmg.org/library/readingroom/oifml.pdf |
|
Co-operative UML Editor: http://www.darmstadt.gmd.de/concert/activities/internal/umledit.html |
|
220 |
|
|
221 |
further readings: |
CASE Tools: |
222 |
|
Rational Rose (commercial): http://www.rational.com/products/rose/ |
223 |
|
Together (commercial): http://www.oi.com/products/controlcenter/index.jsp |
224 |
|
InCASE - Tangram-based Universal Object Editor |
225 |
|
Sybase PowerDesigner: http://www.sybase.com/powerdesigner |
226 |
|
|
227 |
|
UML Editors: |
228 |
|
Fujaba (free, university): http://www.fujaba.de/ |
229 |
|
ArgoUML (free): http://argouml.tigris.org/ |
230 |
|
Poseidon (commercial): http://www.gentleware.com/products/poseidonDE.php3 |
231 |
|
Co-operative UML Editor (research): http://www.darmstadt.gmd.de/concert/activities/internal/umledit.html |
232 |
|
Metamill (commercial): http://www.metamill.com/ |
233 |
|
Violet (university, research, education): http://www.horstmann.com/violet/ |
234 |
|
PyUt (free): http://pyut.sourceforge.net/ |
235 |
|
(Dia (free): http://www.lysator.liu.se/~alla/dia/) |
236 |
|
UMLet (free, university): http://www.swt.tuwien.ac.at/umlet/index.html |
237 |
|
Voodoo (free): http://voodoo.sourceforge.net/ |
238 |
|
Umbrello UML Modeller: http://uml.sourceforge.net/ |
239 |
|
|
240 |
|
UML Tools: |
241 |
|
http://www.objectsbydesign.com/tools/umltools_byPrice.html |
242 |
|
|
243 |
|
Further readings: |
244 |
http://www.google.com/search?q=web+based+uml+editor&hl=en&lr=&ie=UTF-8&oe=UTF-8&start=10&sa=N |
http://www.google.com/search?q=web+based+uml+editor&hl=en&lr=&ie=UTF-8&oe=UTF-8&start=10&sa=N |
245 |
http://www.fernuni-hagen.de/DVT/Aktuelles/01FHHeidelberg.pdf |
http://www.fernuni-hagen.de/DVT/Aktuelles/01FHHeidelberg.pdf |
246 |
http://www.enhyper.com/src/documentation/ |
http://www.enhyper.com/src/documentation/ |
248 |
http://citeseer.nj.nec.com/vilain00diagrammatic.html |
http://citeseer.nj.nec.com/vilain00diagrammatic.html |
249 |
http://archive.devx.com/uml/articles/Smith01/Smith01-3.asp |
http://archive.devx.com/uml/articles/Smith01/Smith01-3.asp |
250 |
|
|
|
maybe useful for / to be integrated with: |
|
|
ArapXML: http://xml.coverpages.org/ni2001-09-24-b.html |
|