--- nfo/perl/libs/Data/Transfer/Sync/API.pm 2003/02/11 05:26:04 1.5 +++ nfo/perl/libs/Data/Transfer/Sync/API.pm 2003/05/13 08:16:44 1.9 @@ -1,11 +1,26 @@ -## $Id: API.pm,v 1.5 2003/02/11 05:26:04 joko Exp $ +## ------------------------------------------------------------------------- +## +## $Id: API.pm,v 1.9 2003/05/13 08:16:44 joko Exp $ ## ## Copyright (c) 2002 Andreas Motl ## -## See COPYRIGHT section in pod text below for usage and distribution rights. +## See COPYRIGHT section in associated pod text +## or below for usage and distribution rights. ## -## ---------------------------------------------------------------------------------------- +## ------------------------------------------------------------------------- ## $Log: API.pm,v $ +## Revision 1.9 2003/05/13 08:16:44 joko +## minor update: modified header +## +## Revision 1.8 2003/03/27 15:31:15 joko +## fixes to modules regarding new namespace(s) below Data::Mungle::* +## +## Revision 1.7 2003/02/21 08:00:24 joko +## debugging +## +## Revision 1.6 2003/02/14 12:58:47 joko +## + re-enabled the erase-mechanism +## ## Revision 1.5 2003/02/11 05:26:04 joko ## + sub _tellWhatIWillDo ## + re-enabled "branch to execution path for special targets" mechanism @@ -42,7 +57,7 @@ use Data::Dumper; use Hash::Merge qw( merge ); -use Data::Compare::Struct qw( isEmpty ); +use Data::Mungle::Compare::Struct qw( isEmpty ); # get logger instance my $logger = Log::Dispatch::Config->instance; @@ -148,6 +163,7 @@ my $self = shift; my $args = shift; + #$logger->notice( "========================== " . __PACKAGE__ . "->syncNodes =============="); $logger->debug( __PACKAGE__ . "->syncNodes: starting" ); #print Dumper($self); @@ -156,7 +172,9 @@ #print Dumper($self->{options}); $self->_prepareOptions(); -#print Dumper($self->{options}); + # trace + #print Dumper($self->{options}); + #exit; if (!$self->checkOptions()) { $logger->critical( __PACKAGE__ . "->syncNodes: 'Data::Transfer::Sync::checkOptions' failed."); @@ -179,6 +197,8 @@ # hash to sum up results # TODO: re-implement! (sync-statistics???) + #print Dumper($self->{options}->{process}); + # detect synchronization method to determine which optical symbol (directed arrow) to use my $mode = $self->{args}->{mode}; # V1 $mode ||= $self->{options}->{process}->{mode}; # V2 @@ -219,7 +239,7 @@ #print Dumper($self->{__bridge}); # just take the global application instance and # throw it into the context of the mapping module - this is heavy! ;-) (but again, who cares...) - # TODO: handle this more abstract *sometimes* + # TODO: handle this more abstract *sometime* #$self->{options}->{handler}->($self->{__bridge}->{parent}->{app}, $self->{options}); $self->{options}->{handler}->($self->{__bridge}->{parent}->{process}, $self->{options}); @@ -234,7 +254,17 @@ #print Dumper($self); #exit; - $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: + $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}]" ); + + # V2: + 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}]"; + #my $header = ("~.." x 7) . " " . $what . " " . ("~.." x 4); + #my $header = ("= " x 7) . " " . $what . " " . ("= " x 4); + #my $header = ("~=-_-=" x 3) . " " . $what . " " . ("~=-_-=" x 4); + my $header = ("_-=~=-" x 4) . " " . $what . " " . ("_-=~=-" x 4); + $logger->notice($header); + return if !$self->buildFieldmapping(); return if !$self->_touchNodeSet(); @@ -301,7 +331,8 @@ EOT - $logger->notice( $ql ); + chomp($ql); + $logger->info($ql); #exit; return; @@ -520,7 +551,7 @@ # import flag means: prepare the source node to be syncable # this is useful if there are e.g. no "ident" or "checksum" columns yet inside a DBI like (row-based) storage - if ($self->{args}->{prepare}) { + if ($self->{options}->{process}->{prepare}) { $self->_prepareNode_MetaProperties('source'); $self->_prepareNode_DummyIdent('source'); #return; @@ -529,7 +560,7 @@ # erase flag means: erase the target #if ($opts->{erase}) { - if ($self->{args}->{erase}) { + if ($self->{options}->{process}->{erase}) { # TODO: move this method to the scope of the synchronization core and wrap it around different handlers #print "ERASE", "\n"; $self->_erase_all('target');