/[cvs]/nfo/perl/libs/Data/Transfer/Sync/Metadata.pm
ViewVC logotype

Diff of /nfo/perl/libs/Data/Transfer/Sync/Metadata.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by joko, Sun Feb 9 05:02:05 2003 UTC revision 1.6 by joko, Fri Mar 28 03:08:17 2003 UTC
# Line 6  Line 6 
6  ##  ##
7  ##    ----------------------------------------------------------------------------------------  ##    ----------------------------------------------------------------------------------------
8  ##    $Log$  ##    $Log$
9    ##    Revision 1.6  2003/03/28 03:08:17  joko
10    ##    fix regarding namespace update
11    ##
12    ##    Revision 1.5  2003/02/21 08:34:58  joko
13    ##    modified object hierarchy
14    ##    renamed method
15    ##
16    ##    Revision 1.4  2003/02/14 14:06:20  joko
17    ##    + minor fix to old metadata structure
18    ##
19    ##    Revision 1.3  2003/02/11 06:28:24  joko
20    ##    + changes to metadata structure
21    ##
22  ##    Revision 1.2  2003/02/09 05:02:05  joko  ##    Revision 1.2  2003/02/09 05:02:05  joko
23  ##    + major structure changes  ##    + major structure changes
24  ##    - refactored code to sister modules  ##    - refactored code to sister modules
# Line 29  use mixin::with qw( Data::Transfer::Sync Line 42  use mixin::with qw( Data::Transfer::Sync
42    
43  # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   main  # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   main
44    
 # get logger instance  
 my $logger = Log::Dispatch::Config->instance;  
   
45  use Data::Dumper;  use Data::Dumper;
46    use libdb qw( quotesql );
47    use Data::Mungle::Code::Ref qw( ref_slot );
48    
49    # get logger instance
50    my $logger = Log::Dispatch::Config->instance;
51    
52  # TODO: refactor (still)!!! take this list from already established/given metadata ....  # TODO: refactor (still)!!! take this list from already established/given metadata ....
53  # .... also internally: passing around and mungling these metadata doesn't make sense anymore.  # .... also internally: passing around and mungling these metadata doesn't make sense anymore.
# Line 43  sub options2metadata { Line 56  sub options2metadata {
56    
57    $logger->debug( __PACKAGE__ . "->transformMetadata" );    $logger->debug( __PACKAGE__ . "->transformMetadata" );
58    
59  #print Dumper($self->{options});    # trace
60        #print Dumper($self->{options});
61        #print Dumper($self->{args_raw});
62        #exit;
63    
64    # decompose identifiers and write to metadata (for each descent)    # decompose identifiers and write to metadata (for each descent)
65    foreach ('source', 'target') {    foreach ('source', 'target') {
# Line 60  sub options2metadata { Line 76  sub options2metadata {
76      $self->{meta}->{$_}->{nodeName} = $self->{options}->{$_}->{nodeName};      $self->{meta}->{$_}->{nodeName} = $self->{options}->{$_}->{nodeName};
77            
78      # Filter      # Filter
79      if (my $item_filter = $self->{args}->{$_ . '_filter'}) {      if (my $item_filter = $self->{options}->{$_}->{filter}) {
80        $self->{meta}->{$_}->{filter} = $item_filter;        $self->{meta}->{$_}->{filter} = $item_filter;
81      }      }
82    
# Line 79  sub options2metadata { Line 95  sub options2metadata {
95      }      }
96            
97      # TypeProvider      # TypeProvider
98      if (my $item_type = $self->{args}->{$_ . '_type'}) {      # FIXME! this is still Vdeprecated!!!
99        if (my $item_type = $self->{options}->{$_ . '_type'}) {
100        my @item_type = split(':', $item_type);        my @item_type = split(':', $item_type);
101        $self->{meta}->{$_}->{TypeProvider} = { method => $item_type[0], arg => $item_type[1] };        $self->{meta}->{$_}->{TypeProvider} = { method => $item_type[0], arg => $item_type[1] };
102      }      }
103    
104        # trace
105          #print Dumper($self);
106          #exit;
107            
108      # Callbacks - writers (will be triggered _before_ writing to target)      # Callbacks - writers (will be triggered _before_ writing to target)
109      if (my $item_writers = $self->{args}->{$_ . '_callbacks_write'}) {      if (my $item_writers = $self->{options}->{$_}->{callbacks}->{write}) {
110        my $descent = $_;     # this is important since the following code inside the map wants to use its own context variables        my $descent = $_;     # this is important since the following code inside the map wants to use its own context variables
111        map { $self->{meta}->{$descent}->{Callback}->{write}->{$_}++; } @$item_writers;        map { $self->{meta}->{$descent}->{Callback}->{write}->{$_}++; } @$item_writers;
112      }      }
113            
114      # Callbacks - readers (will be triggered _after_ reading from source)      # Callbacks - readers (will be triggered _after_ reading from source)
115      if (my $item_readers = $self->{args}->{$_ . '_callbacks_read'}) {      if (my $item_readers = $self->{options}->{$_}->{callbacks}->{read}) {
116        my $descent = $_;        my $descent = $_;
117        map { $self->{meta}->{$descent}->{Callback}->{read}->{$_}++; } @$item_readers;        map { $self->{meta}->{$descent}->{Callback}->{read}->{$_}++; } @$item_readers;
118      }      }
119            
120      # resolve storage objects      # resolve storage handles
121      $self->{meta}->{$_}->{storage} = $self->{options}->{$_}->{storage}->{handle};        $self->{meta}->{$_}->{storage} = $self->{options}->{$_}->{storage}->{handle};
122    
123        # transfer storage handle options to metadata
124          #map { $self->{meta}->{$_}->{isIdentAuthority} = 1 } @{$self->{id_authorities}};
125          #map { $self->{meta}->{$_}->{isChecksumAuthority} = 1; } @{$self->{checksum_authorities}};
126          #map { $self->{meta}->{$_}->{isWriteProtected} = 1; } @{$self->{write_protected}};
127          #print Dumper($self->{options}->{$_});
128          #exit;
129          $self->{meta}->{$_}->{isIdentAuthority} = $self->{options}->{$_}->{storage}->{handle}->{locator}->{sync}->{isIdentAuthority};
130          $self->{meta}->{$_}->{isWriteProtected} = $self->{options}->{$_}->{storage}->{handle}->{locator}->{sync}->{isWriteProtected};
131          $self->{meta}->{$_}->{isChecksumAuthority} = $self->{options}->{$_}->{storage}->{handle}->{locator}->{sync}->{isChecksumAuthority};
132    
133    }    }
134    
135    #print Dumper($self->{meta});    #print Dumper($self->{meta});
# Line 250  sub buildAttributeMap { Line 282  sub buildAttributeMap {
282            # build callback map for helper function            # build callback map for helper function
283            #my $cbmap = { $self->{meta}->{source}->{IdentProvider}->{arg} => $cb_dispatcher };            #my $cbmap = { $self->{meta}->{source}->{IdentProvider}->{arg} => $cb_dispatcher };
284            my $cbmap = {};            my $cbmap = {};
285            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);
286            $self->{node}->{source}->{propcache}->{value} = $value;            $self->{node}->{source}->{propcache}->{value} = $value;
287          }          }
288    

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.6

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed