6 |
## |
## |
7 |
## ---------------------------------------------------------------------------------------- |
## ---------------------------------------------------------------------------------------- |
8 |
## $Log$ |
## $Log$ |
9 |
|
## Revision 1.8 2003/03/27 15:31:15 joko |
10 |
|
## fixes to modules regarding new namespace(s) below Data::Mungle::* |
11 |
|
## |
12 |
|
## Revision 1.7 2003/02/21 08:00:24 joko |
13 |
|
## debugging |
14 |
|
## |
15 |
|
## Revision 1.6 2003/02/14 12:58:47 joko |
16 |
|
## + re-enabled the erase-mechanism |
17 |
|
## |
18 |
## Revision 1.5 2003/02/11 05:26:04 joko |
## Revision 1.5 2003/02/11 05:26:04 joko |
19 |
## + sub _tellWhatIWillDo |
## + sub _tellWhatIWillDo |
20 |
## + re-enabled "branch to execution path for special targets" mechanism |
## + re-enabled "branch to execution path for special targets" mechanism |
51 |
use Data::Dumper; |
use Data::Dumper; |
52 |
use Hash::Merge qw( merge ); |
use Hash::Merge qw( merge ); |
53 |
|
|
54 |
use Data::Compare::Struct qw( isEmpty ); |
use Data::Mungle::Compare::Struct qw( isEmpty ); |
55 |
|
|
56 |
# get logger instance |
# get logger instance |
57 |
my $logger = Log::Dispatch::Config->instance; |
my $logger = Log::Dispatch::Config->instance; |
157 |
my $self = shift; |
my $self = shift; |
158 |
my $args = shift; |
my $args = shift; |
159 |
|
|
160 |
|
#$logger->notice( "========================== " . __PACKAGE__ . "->syncNodes =============="); |
161 |
$logger->debug( __PACKAGE__ . "->syncNodes: starting" ); |
$logger->debug( __PACKAGE__ . "->syncNodes: starting" ); |
162 |
|
|
163 |
#print Dumper($self); |
#print Dumper($self); |
166 |
#print Dumper($self->{options}); |
#print Dumper($self->{options}); |
167 |
$self->_prepareOptions(); |
$self->_prepareOptions(); |
168 |
|
|
169 |
#print Dumper($self->{options}); |
# trace |
170 |
|
#print Dumper($self->{options}); |
171 |
|
#exit; |
172 |
|
|
173 |
if (!$self->checkOptions()) { |
if (!$self->checkOptions()) { |
174 |
$logger->critical( __PACKAGE__ . "->syncNodes: 'Data::Transfer::Sync::checkOptions' failed."); |
$logger->critical( __PACKAGE__ . "->syncNodes: 'Data::Transfer::Sync::checkOptions' failed."); |
191 |
# hash to sum up results |
# hash to sum up results |
192 |
# TODO: re-implement! (sync-statistics???) |
# TODO: re-implement! (sync-statistics???) |
193 |
|
|
194 |
|
#print Dumper($self->{options}->{process}); |
195 |
|
|
196 |
# detect synchronization method to determine which optical symbol (directed arrow) to use |
# detect synchronization method to determine which optical symbol (directed arrow) to use |
197 |
my $mode = $self->{args}->{mode}; # V1 |
my $mode = $self->{args}->{mode}; # V1 |
198 |
$mode ||= $self->{options}->{process}->{mode}; # V2 |
$mode ||= $self->{options}->{process}->{mode}; # V2 |
233 |
#print Dumper($self->{__bridge}); |
#print Dumper($self->{__bridge}); |
234 |
# just take the global application instance and |
# just take the global application instance and |
235 |
# 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...) |
236 |
# TODO: handle this more abstract *sometimes* |
# TODO: handle this more abstract *sometime* |
237 |
#$self->{options}->{handler}->($self->{__bridge}->{parent}->{app}, $self->{options}); |
#$self->{options}->{handler}->($self->{__bridge}->{parent}->{app}, $self->{options}); |
238 |
$self->{options}->{handler}->($self->{__bridge}->{parent}->{process}, $self->{options}); |
$self->{options}->{handler}->($self->{__bridge}->{parent}->{process}, $self->{options}); |
239 |
|
|
248 |
#print Dumper($self); |
#print Dumper($self); |
249 |
#exit; |
#exit; |
250 |
|
|
251 |
$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: |
252 |
|
$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}]" ); |
253 |
|
|
254 |
|
# V2: |
255 |
|
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}]"; |
256 |
|
#my $header = ("~.." x 7) . " " . $what . " " . ("~.." x 4); |
257 |
|
#my $header = ("= " x 7) . " " . $what . " " . ("= " x 4); |
258 |
|
#my $header = ("~=-_-=" x 3) . " " . $what . " " . ("~=-_-=" x 4); |
259 |
|
my $header = ("_-=~=-" x 4) . " " . $what . " " . ("_-=~=-" x 4); |
260 |
|
$logger->notice($header); |
261 |
|
|
262 |
|
|
263 |
return if !$self->buildFieldmapping(); |
return if !$self->buildFieldmapping(); |
264 |
return if !$self->_touchNodeSet(); |
return if !$self->_touchNodeSet(); |
325 |
EOT |
EOT |
326 |
|
|
327 |
|
|
328 |
$logger->notice( $ql ); |
chomp($ql); |
329 |
|
$logger->info($ql); |
330 |
|
|
331 |
#exit; |
#exit; |
332 |
return; |
return; |
545 |
|
|
546 |
# import flag means: prepare the source node to be syncable |
# import flag means: prepare the source node to be syncable |
547 |
# 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 |
548 |
if ($self->{args}->{prepare}) { |
if ($self->{options}->{process}->{prepare}) { |
549 |
$self->_prepareNode_MetaProperties('source'); |
$self->_prepareNode_MetaProperties('source'); |
550 |
$self->_prepareNode_DummyIdent('source'); |
$self->_prepareNode_DummyIdent('source'); |
551 |
#return; |
#return; |
554 |
|
|
555 |
# erase flag means: erase the target |
# erase flag means: erase the target |
556 |
#if ($opts->{erase}) { |
#if ($opts->{erase}) { |
557 |
if ($self->{args}->{erase}) { |
if ($self->{options}->{process}->{erase}) { |
558 |
# 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 |
559 |
#print "ERASE", "\n"; |
#print "ERASE", "\n"; |
560 |
$self->_erase_all('target'); |
$self->_erase_all('target'); |