6 |
## |
## |
7 |
## ---------------------------------------------------------------------------------------- |
## ---------------------------------------------------------------------------------------- |
8 |
## $Log$ |
## $Log$ |
9 |
|
## Revision 1.5 2003/02/21 08:34:58 joko |
10 |
|
## modified object hierarchy |
11 |
|
## renamed method |
12 |
|
## |
13 |
|
## Revision 1.4 2003/02/14 14:06:20 joko |
14 |
|
## + minor fix to old metadata structure |
15 |
|
## |
16 |
|
## Revision 1.3 2003/02/11 06:28:24 joko |
17 |
|
## + changes to metadata structure |
18 |
|
## |
19 |
## Revision 1.2 2003/02/09 05:02:05 joko |
## Revision 1.2 2003/02/09 05:02:05 joko |
20 |
## + major structure changes |
## + major structure changes |
21 |
## - refactored code to sister modules |
## - refactored code to sister modules |
39 |
|
|
40 |
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - main |
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - main |
41 |
|
|
|
# get logger instance |
|
|
my $logger = Log::Dispatch::Config->instance; |
|
|
|
|
42 |
use Data::Dumper; |
use Data::Dumper; |
43 |
|
use libdb qw( quotesql ); |
44 |
|
use Data::Code::Ref qw( ref_slot ); |
45 |
|
|
46 |
|
# get logger instance |
47 |
|
my $logger = Log::Dispatch::Config->instance; |
48 |
|
|
49 |
# TODO: refactor (still)!!! take this list from already established/given metadata .... |
# TODO: refactor (still)!!! take this list from already established/given metadata .... |
50 |
# .... 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. |
53 |
|
|
54 |
$logger->debug( __PACKAGE__ . "->transformMetadata" ); |
$logger->debug( __PACKAGE__ . "->transformMetadata" ); |
55 |
|
|
56 |
#print Dumper($self->{options}); |
# trace |
57 |
|
#print Dumper($self->{options}); |
58 |
|
#print Dumper($self->{args_raw}); |
59 |
|
#exit; |
60 |
|
|
61 |
# decompose identifiers and write to metadata (for each descent) |
# decompose identifiers and write to metadata (for each descent) |
62 |
foreach ('source', 'target') { |
foreach ('source', 'target') { |
73 |
$self->{meta}->{$_}->{nodeName} = $self->{options}->{$_}->{nodeName}; |
$self->{meta}->{$_}->{nodeName} = $self->{options}->{$_}->{nodeName}; |
74 |
|
|
75 |
# Filter |
# Filter |
76 |
if (my $item_filter = $self->{args}->{$_ . '_filter'}) { |
if (my $item_filter = $self->{options}->{$_}->{filter}) { |
77 |
$self->{meta}->{$_}->{filter} = $item_filter; |
$self->{meta}->{$_}->{filter} = $item_filter; |
78 |
} |
} |
79 |
|
|
92 |
} |
} |
93 |
|
|
94 |
# TypeProvider |
# TypeProvider |
95 |
if (my $item_type = $self->{args}->{$_ . '_type'}) { |
# FIXME! this is still Vdeprecated!!! |
96 |
|
if (my $item_type = $self->{options}->{$_ . '_type'}) { |
97 |
my @item_type = split(':', $item_type); |
my @item_type = split(':', $item_type); |
98 |
$self->{meta}->{$_}->{TypeProvider} = { method => $item_type[0], arg => $item_type[1] }; |
$self->{meta}->{$_}->{TypeProvider} = { method => $item_type[0], arg => $item_type[1] }; |
99 |
} |
} |
100 |
|
|
101 |
|
# trace |
102 |
|
#print Dumper($self); |
103 |
|
#exit; |
104 |
|
|
105 |
# Callbacks - writers (will be triggered _before_ writing to target) |
# Callbacks - writers (will be triggered _before_ writing to target) |
106 |
if (my $item_writers = $self->{args}->{$_ . '_callbacks_write'}) { |
if (my $item_writers = $self->{options}->{$_}->{callbacks}->{write}) { |
107 |
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 |
108 |
map { $self->{meta}->{$descent}->{Callback}->{write}->{$_}++; } @$item_writers; |
map { $self->{meta}->{$descent}->{Callback}->{write}->{$_}++; } @$item_writers; |
109 |
} |
} |
110 |
|
|
111 |
# Callbacks - readers (will be triggered _after_ reading from source) |
# Callbacks - readers (will be triggered _after_ reading from source) |
112 |
if (my $item_readers = $self->{args}->{$_ . '_callbacks_read'}) { |
if (my $item_readers = $self->{options}->{$_}->{callbacks}->{read}) { |
113 |
my $descent = $_; |
my $descent = $_; |
114 |
map { $self->{meta}->{$descent}->{Callback}->{read}->{$_}++; } @$item_readers; |
map { $self->{meta}->{$descent}->{Callback}->{read}->{$_}++; } @$item_readers; |
115 |
} |
} |
116 |
|
|
117 |
# resolve storage objects |
# resolve storage handles |
118 |
$self->{meta}->{$_}->{storage} = $self->{options}->{$_}->{storage}->{handle}; |
$self->{meta}->{$_}->{storage} = $self->{options}->{$_}->{storage}->{handle}; |
119 |
|
|
120 |
|
# transfer storage handle options to metadata |
121 |
|
#map { $self->{meta}->{$_}->{isIdentAuthority} = 1 } @{$self->{id_authorities}}; |
122 |
|
#map { $self->{meta}->{$_}->{isChecksumAuthority} = 1; } @{$self->{checksum_authorities}}; |
123 |
|
#map { $self->{meta}->{$_}->{isWriteProtected} = 1; } @{$self->{write_protected}}; |
124 |
|
#print Dumper($self->{options}->{$_}); |
125 |
|
#exit; |
126 |
|
$self->{meta}->{$_}->{isIdentAuthority} = $self->{options}->{$_}->{storage}->{handle}->{locator}->{sync}->{isIdentAuthority}; |
127 |
|
$self->{meta}->{$_}->{isWriteProtected} = $self->{options}->{$_}->{storage}->{handle}->{locator}->{sync}->{isWriteProtected}; |
128 |
|
$self->{meta}->{$_}->{isChecksumAuthority} = $self->{options}->{$_}->{storage}->{handle}->{locator}->{sync}->{isChecksumAuthority}; |
129 |
|
|
130 |
} |
} |
131 |
|
|
132 |
#print Dumper($self->{meta}); |
#print Dumper($self->{meta}); |
279 |
# build callback map for helper function |
# build callback map for helper function |
280 |
#my $cbmap = { $self->{meta}->{source}->{IdentProvider}->{arg} => $cb_dispatcher }; |
#my $cbmap = { $self->{meta}->{source}->{IdentProvider}->{arg} => $cb_dispatcher }; |
281 |
my $cbmap = {}; |
my $cbmap = {}; |
282 |
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); |
283 |
$self->{node}->{source}->{propcache}->{value} = $value; |
$self->{node}->{source}->{propcache}->{value} = $value; |
284 |
} |
} |
285 |
|
|