| 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 |
| 113 |
this code for additional information. |
this code for additional information. |
| 114 |
|
|
| 115 |
REQUIREMENTS |
REQUIREMENTS |
| 116 |
For full functionality: DBI from CPAN Tangram from CPAN Class::Tangram |
For full functionality: |
| 117 |
from CPAN MySQL::Diff from http://adamspiers.org/computing/mysqldiff/ |
DBI from CPAN |
| 118 |
... and all their dependencies |
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 |
| 136 |
|
|
| 137 |
ACKNOWLEDGEMENTS |
ACKNOWLEDGEMENTS |
| 138 |
Larry Wall for Perl, Tim Bunce for DBI, Jean-Louis Leroy for Tangram and |
Larry Wall for Perl, Tim Bunce for DBI, Jean-Louis Leroy for Tangram and |
| 139 |
Set::Object, Sam Vilain for Class::Tangram, Adam Spiers for MySQL::Diff |
Set::Object, Sam Vilain for Class::Tangram, Jochen Wiedmann and Jeff |
| 140 |
and all contributors. |
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 |
| 183 |
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 |
| 184 |
automatically and this is believed to be the most common case under normal circumstances. |
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), |
| 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 programmers. |
- Enable Round Trip Engineering. Keep code and diagrams in sync. Don't annoy/bother the programmers. |
| 194 |
- Add some more handlers: |
- Add support for some more handlers/locators to be able to |
| 195 |
- look at DBD::CSV, Text::CSV, XML::CSV, XML::Excel |
access the following standards/protocols/interfaces/programs/apis transparently: |
| 196 |
- Add some more locations/locators: |
+ DBD::CSV (via Data::Storage::Handler::DBI) |
| 197 |
- PerlDAV: http://www.webdav.org/perldav/ |
(-) Text::CSV, XML::CSV, XML::Excel |
| 198 |
- Move to t3, use InCASE |
- 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: |
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 |