--- nfo/perl/libs/Data/Transfer/Sync/Metadata.pm 2003/02/09 05:02:05 1.2 +++ nfo/perl/libs/Data/Transfer/Sync/Metadata.pm 2003/02/21 08:34:58 1.5 @@ -1,4 +1,4 @@ -## $Id: Metadata.pm,v 1.2 2003/02/09 05:02:05 joko Exp $ +## $Id: Metadata.pm,v 1.5 2003/02/21 08:34:58 joko Exp $ ## ## Copyright (c) 2002 Andreas Motl ## @@ -6,6 +6,16 @@ ## ## ---------------------------------------------------------------------------------------- ## $Log: Metadata.pm,v $ +## Revision 1.5 2003/02/21 08:34:58 joko +## modified object hierarchy +## renamed method +## +## Revision 1.4 2003/02/14 14:06:20 joko +## + minor fix to old metadata structure +## +## Revision 1.3 2003/02/11 06:28:24 joko +## + changes to metadata structure +## ## Revision 1.2 2003/02/09 05:02:05 joko ## + major structure changes ## - refactored code to sister modules @@ -29,12 +39,12 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - main -# get logger instance -my $logger = Log::Dispatch::Config->instance; - use Data::Dumper; +use libdb qw( quotesql ); +use Data::Code::Ref qw( ref_slot ); - +# get logger instance +my $logger = Log::Dispatch::Config->instance; # TODO: refactor (still)!!! take this list from already established/given metadata .... # .... also internally: passing around and mungling these metadata doesn't make sense anymore. @@ -43,7 +53,10 @@ $logger->debug( __PACKAGE__ . "->transformMetadata" ); -#print Dumper($self->{options}); + # trace + #print Dumper($self->{options}); + #print Dumper($self->{args_raw}); + #exit; # decompose identifiers and write to metadata (for each descent) foreach ('source', 'target') { @@ -60,7 +73,7 @@ $self->{meta}->{$_}->{nodeName} = $self->{options}->{$_}->{nodeName}; # Filter - if (my $item_filter = $self->{args}->{$_ . '_filter'}) { + if (my $item_filter = $self->{options}->{$_}->{filter}) { $self->{meta}->{$_}->{filter} = $item_filter; } @@ -79,25 +92,41 @@ } # TypeProvider - if (my $item_type = $self->{args}->{$_ . '_type'}) { + # FIXME! this is still Vdeprecated!!! + if (my $item_type = $self->{options}->{$_ . '_type'}) { my @item_type = split(':', $item_type); $self->{meta}->{$_}->{TypeProvider} = { method => $item_type[0], arg => $item_type[1] }; } + + # trace + #print Dumper($self); + #exit; # Callbacks - writers (will be triggered _before_ writing to target) - if (my $item_writers = $self->{args}->{$_ . '_callbacks_write'}) { + if (my $item_writers = $self->{options}->{$_}->{callbacks}->{write}) { my $descent = $_; # this is important since the following code inside the map wants to use its own context variables map { $self->{meta}->{$descent}->{Callback}->{write}->{$_}++; } @$item_writers; } # Callbacks - readers (will be triggered _after_ reading from source) - if (my $item_readers = $self->{args}->{$_ . '_callbacks_read'}) { + if (my $item_readers = $self->{options}->{$_}->{callbacks}->{read}) { my $descent = $_; map { $self->{meta}->{$descent}->{Callback}->{read}->{$_}++; } @$item_readers; } - # resolve storage objects - $self->{meta}->{$_}->{storage} = $self->{options}->{$_}->{storage}->{handle}; + # resolve storage handles + $self->{meta}->{$_}->{storage} = $self->{options}->{$_}->{storage}->{handle}; + + # transfer storage handle options to metadata + #map { $self->{meta}->{$_}->{isIdentAuthority} = 1 } @{$self->{id_authorities}}; + #map { $self->{meta}->{$_}->{isChecksumAuthority} = 1; } @{$self->{checksum_authorities}}; + #map { $self->{meta}->{$_}->{isWriteProtected} = 1; } @{$self->{write_protected}}; + #print Dumper($self->{options}->{$_}); + #exit; + $self->{meta}->{$_}->{isIdentAuthority} = $self->{options}->{$_}->{storage}->{handle}->{locator}->{sync}->{isIdentAuthority}; + $self->{meta}->{$_}->{isWriteProtected} = $self->{options}->{$_}->{storage}->{handle}->{locator}->{sync}->{isWriteProtected}; + $self->{meta}->{$_}->{isChecksumAuthority} = $self->{options}->{$_}->{storage}->{handle}->{locator}->{sync}->{isChecksumAuthority}; + } #print Dumper($self->{meta}); @@ -250,7 +279,7 @@ # build callback map for helper function #my $cbmap = { $self->{meta}->{source}->{IdentProvider}->{arg} => $cb_dispatcher }; my $cbmap = {}; - my $value = refexpr2perlref($self->{node}->{source}->{payload}, $self->{node}->{source}->{propcache}->{property}, $cbmap); + my $value = ref_slot($self->{node}->{source}->{payload}, $self->{node}->{source}->{propcache}->{property}, $cbmap); $self->{node}->{source}->{propcache}->{value} = $value; }