1 |
|
## ------------------------------------------------------------------------- |
2 |
|
## |
3 |
## $Id$ |
## $Id$ |
4 |
## |
## |
5 |
## Copyright (c) 2002 Andreas Motl <andreas.motl@ilo.de> |
## Copyright (c) 2002 Andreas Motl <andreas.motl@ilo.de> |
6 |
## |
## |
7 |
## See COPYRIGHT section in pod text below for usage and distribution rights. |
## See COPYRIGHT section in associated pod text |
8 |
|
## or below for usage and distribution rights. |
9 |
## |
## |
10 |
## ---------------------------------------------------------------------------------------- |
## ------------------------------------------------------------------------- |
11 |
## $Log$ |
## $Log$ |
12 |
|
## Revision 1.9 2003/05/13 08:16:44 joko |
13 |
|
## minor update: modified header |
14 |
|
## |
15 |
|
## Revision 1.8 2003/03/27 15:31:15 joko |
16 |
|
## fixes to modules regarding new namespace(s) below Data::Mungle::* |
17 |
|
## |
18 |
|
## Revision 1.7 2003/02/21 08:00:24 joko |
19 |
|
## debugging |
20 |
|
## |
21 |
|
## Revision 1.6 2003/02/14 12:58:47 joko |
22 |
|
## + re-enabled the erase-mechanism |
23 |
|
## |
24 |
## Revision 1.5 2003/02/11 05:26:04 joko |
## Revision 1.5 2003/02/11 05:26:04 joko |
25 |
## + sub _tellWhatIWillDo |
## + sub _tellWhatIWillDo |
26 |
## + re-enabled "branch to execution path for special targets" mechanism |
## + re-enabled "branch to execution path for special targets" mechanism |
57 |
use Data::Dumper; |
use Data::Dumper; |
58 |
use Hash::Merge qw( merge ); |
use Hash::Merge qw( merge ); |
59 |
|
|
60 |
use Data::Compare::Struct qw( isEmpty ); |
use Data::Mungle::Compare::Struct qw( isEmpty ); |
61 |
|
|
62 |
# get logger instance |
# get logger instance |
63 |
my $logger = Log::Dispatch::Config->instance; |
my $logger = Log::Dispatch::Config->instance; |
163 |
my $self = shift; |
my $self = shift; |
164 |
my $args = shift; |
my $args = shift; |
165 |
|
|
166 |
|
#$logger->notice( "========================== " . __PACKAGE__ . "->syncNodes =============="); |
167 |
$logger->debug( __PACKAGE__ . "->syncNodes: starting" ); |
$logger->debug( __PACKAGE__ . "->syncNodes: starting" ); |
168 |
|
|
169 |
#print Dumper($self); |
#print Dumper($self); |
172 |
#print Dumper($self->{options}); |
#print Dumper($self->{options}); |
173 |
$self->_prepareOptions(); |
$self->_prepareOptions(); |
174 |
|
|
175 |
#print Dumper($self->{options}); |
# trace |
176 |
|
#print Dumper($self->{options}); |
177 |
|
#exit; |
178 |
|
|
179 |
if (!$self->checkOptions()) { |
if (!$self->checkOptions()) { |
180 |
$logger->critical( __PACKAGE__ . "->syncNodes: 'Data::Transfer::Sync::checkOptions' failed."); |
$logger->critical( __PACKAGE__ . "->syncNodes: 'Data::Transfer::Sync::checkOptions' failed."); |
197 |
# hash to sum up results |
# hash to sum up results |
198 |
# TODO: re-implement! (sync-statistics???) |
# TODO: re-implement! (sync-statistics???) |
199 |
|
|
200 |
|
#print Dumper($self->{options}->{process}); |
201 |
|
|
202 |
# detect synchronization method to determine which optical symbol (directed arrow) to use |
# detect synchronization method to determine which optical symbol (directed arrow) to use |
203 |
my $mode = $self->{args}->{mode}; # V1 |
my $mode = $self->{args}->{mode}; # V1 |
204 |
$mode ||= $self->{options}->{process}->{mode}; # V2 |
$mode ||= $self->{options}->{process}->{mode}; # V2 |
239 |
#print Dumper($self->{__bridge}); |
#print Dumper($self->{__bridge}); |
240 |
# just take the global application instance and |
# just take the global application instance and |
241 |
# throw it into the context of the mapping module - this is heavy! ;-) (but again, who cares...) |
# throw it into the context of the mapping module - this is heavy! ;-) (but again, who cares...) |
242 |
# TODO: handle this more abstract *sometimes* |
# TODO: handle this more abstract *sometime* |
243 |
#$self->{options}->{handler}->($self->{__bridge}->{parent}->{app}, $self->{options}); |
#$self->{options}->{handler}->($self->{__bridge}->{parent}->{app}, $self->{options}); |
244 |
$self->{options}->{handler}->($self->{__bridge}->{parent}->{process}, $self->{options}); |
$self->{options}->{handler}->($self->{__bridge}->{parent}->{process}, $self->{options}); |
245 |
|
|
254 |
#print Dumper($self); |
#print Dumper($self); |
255 |
#exit; |
#exit; |
256 |
|
|
257 |
$logger->info( __PACKAGE__ . "->syncNodes: source=$self->{meta}->{source}->{dbKey}/$self->{meta}->{source}->{nodeName} [$self->{meta}->{source}->{nodeType}] $direction_arrow target=$self->{meta}->{target}->{dbKey}/$self->{meta}->{target}->{nodeName} [$self->{meta}->{target}->{nodeType}]" ); |
# V1: |
258 |
|
$logger->debug( __PACKAGE__ . "->syncNodes: source=$self->{meta}->{source}->{dbKey}/$self->{meta}->{source}->{nodeName} [$self->{meta}->{source}->{nodeType}] $direction_arrow target=$self->{meta}->{target}->{dbKey}/$self->{meta}->{target}->{nodeName} [$self->{meta}->{target}->{nodeType}]" ); |
259 |
|
|
260 |
|
# V2: |
261 |
|
my $what = "$self->{meta}->{source}->{dbKey}/$self->{meta}->{source}->{nodeName} [$self->{meta}->{source}->{nodeType}] $direction_arrow $self->{meta}->{target}->{dbKey}/$self->{meta}->{target}->{nodeName} [$self->{meta}->{target}->{nodeType}]"; |
262 |
|
#my $header = ("~.." x 7) . " " . $what . " " . ("~.." x 4); |
263 |
|
#my $header = ("= " x 7) . " " . $what . " " . ("= " x 4); |
264 |
|
#my $header = ("~=-_-=" x 3) . " " . $what . " " . ("~=-_-=" x 4); |
265 |
|
my $header = ("_-=~=-" x 4) . " " . $what . " " . ("_-=~=-" x 4); |
266 |
|
$logger->notice($header); |
267 |
|
|
268 |
|
|
269 |
return if !$self->buildFieldmapping(); |
return if !$self->buildFieldmapping(); |
270 |
return if !$self->_touchNodeSet(); |
return if !$self->_touchNodeSet(); |
331 |
EOT |
EOT |
332 |
|
|
333 |
|
|
334 |
$logger->notice( $ql ); |
chomp($ql); |
335 |
|
$logger->info($ql); |
336 |
|
|
337 |
#exit; |
#exit; |
338 |
return; |
return; |
551 |
|
|
552 |
# import flag means: prepare the source node to be syncable |
# import flag means: prepare the source node to be syncable |
553 |
# this is useful if there are e.g. no "ident" or "checksum" columns yet inside a DBI like (row-based) storage |
# this is useful if there are e.g. no "ident" or "checksum" columns yet inside a DBI like (row-based) storage |
554 |
if ($self->{args}->{prepare}) { |
if ($self->{options}->{process}->{prepare}) { |
555 |
$self->_prepareNode_MetaProperties('source'); |
$self->_prepareNode_MetaProperties('source'); |
556 |
$self->_prepareNode_DummyIdent('source'); |
$self->_prepareNode_DummyIdent('source'); |
557 |
#return; |
#return; |
560 |
|
|
561 |
# erase flag means: erase the target |
# erase flag means: erase the target |
562 |
#if ($opts->{erase}) { |
#if ($opts->{erase}) { |
563 |
if ($self->{args}->{erase}) { |
if ($self->{options}->{process}->{erase}) { |
564 |
# TODO: move this method to the scope of the synchronization core and wrap it around different handlers |
# TODO: move this method to the scope of the synchronization core and wrap it around different handlers |
565 |
#print "ERASE", "\n"; |
#print "ERASE", "\n"; |
566 |
$self->_erase_all('target'); |
$self->_erase_all('target'); |