4 |
## $Id$ |
## $Id$ |
5 |
## -------------------------------------------------------------------------------- |
## -------------------------------------------------------------------------------- |
6 |
## $Log$ |
## $Log$ |
7 |
|
## Revision 1.2 2003/02/11 09:48:57 joko |
8 |
|
## - moved notice output out of this module |
9 |
|
## + some fixes |
10 |
|
## |
11 |
## Revision 1.1 2003/02/09 16:27:06 joko |
## Revision 1.1 2003/02/09 16:27:06 joko |
12 |
## + initial commit |
## + initial commit |
13 |
## |
## |
109 |
my $self = shift; |
my $self = shift; |
110 |
$self->_before_run(); |
$self->_before_run(); |
111 |
$self->prepare(); |
$self->prepare(); |
112 |
$self->tellWhatIAmDoing(); |
#$self->tellWhatIAmDoing(); |
113 |
$self->sync(); |
$self->sync(); |
114 |
} |
} |
115 |
|
|
|
my $c_string_default = ''; |
|
|
sub c_string { |
|
|
my $value = shift; |
|
|
$value ||= "[$c_string_default]"; |
|
|
return $value; |
|
|
} |
|
|
|
|
|
sub tellWhatIAmDoing { |
|
|
my $self = shift; |
|
|
|
|
|
$c_string_default = 'n/a'; |
|
|
my $source = c_string($self->{opt}->{'source'}); |
|
|
my $source_node = c_string($self->{opt}->{'source-node'}); |
|
|
my $source_type = c_string($self->{opt}->{'source-type'}); |
|
|
my $target = c_string($self->{opt}->{'target'}); |
|
|
my $target_node = c_string($self->{opt}->{'target-node'}); |
|
|
my $target_type = c_string($self->{opt}->{'target-type'}); |
|
|
|
|
|
my $mapping_module = c_string($self->{opt}->{'mapping-module'}); |
|
|
my $mode = uc c_string($self->{opt}->{'mode'}); |
|
|
|
|
|
my $ql = "$mode INTO $source NODE $source_node TYPE $source_type SELECT NODE $target_node TYPE $target_type FROM $target USING MODULE $mapping_module;"; |
|
|
#$logger->notice( __PACKAGE__ . ": $ql" ); |
|
|
$logger->notice( $ql ); |
|
|
|
|
|
return; |
|
|
|
|
|
my $actioning = ucfirst $self->{opt}->{'action'} . 'ing'; |
|
|
|
|
|
# FIXME: this is weird! |
|
|
my $long = <<EOT; |
|
|
|
|
|
- $actioning data of type $target_type and |
|
|
filtered by $target_node from the storage named $target |
|
|
to the storage named $source - filtered by $source_node. |
|
|
- Will attempt to convert the data to $source_type. |
|
|
EOT |
|
|
chomp($long); |
|
|
$logger->notice( __PACKAGE__ . ": $long" ); |
|
|
|
|
|
} |
|
|
|
|
116 |
sub prepare { |
sub prepare { |
117 |
my $self = shift; |
my $self = shift; |
118 |
|
|
158 |
$sync_version ||= 'V1'; |
$sync_version ||= 'V1'; |
159 |
|
|
160 |
# create a new synchronization object |
# create a new synchronization object |
161 |
my $sync = Data::Transfer::Sync->new( 'sync_version' => $sync_version ); |
my $sync = Data::Transfer::Sync->new( 'sync_version' => $sync_version, __parent => $self ); |
162 |
|
|
163 |
# trace |
# trace |
164 |
#print Dumper($self); |
#print Dumper($self); |
165 |
|
#print Dumper($self); |
166 |
|
#exit; |
167 |
|
|
168 |
|
|
169 |
# configure the synchronization-object |
# configure the synchronization-object |
170 |
$sync->configure( |
$sync->configure( |
172 |
storage => { |
storage => { |
173 |
#handle => $mapiStorage, |
#handle => $mapiStorage, |
174 |
handle => $self->{app}->{$self->{opt}->{source}}, |
handle => $self->{app}->{$self->{opt}->{source}}, |
175 |
writeProtected => 1, |
#isIdentAuthority => $self->{app}->{config}->{{$self->{opt}->{source}}, |
176 |
|
#isChecksumAuthority => 1, |
177 |
|
#writeProtected => 1, |
178 |
}, |
}, |
179 |
}, |
}, |
180 |
target => { |
target => { |
181 |
storage => { |
storage => { |
182 |
#handle => $ldapStorage, |
#handle => $ldapStorage, |
183 |
handle => $self->{app}->{$self->{opt}->{target}}, |
handle => $self->{app}->{$self->{opt}->{target}}, |
184 |
idAuthority => 1, |
#idAuthority => 1, |
185 |
isChecksumAuthority => 1, |
#isChecksumAuthority => 1, |
186 |
writeProtected => 0, |
#isWriteProtected => 0, |
187 |
}, |
}, |
188 |
}, |
}, |
189 |
verbose => 1, |
verbose => 1, |
190 |
); |
); |
191 |
|
|
192 |
|
# TODO: |
193 |
|
=pod |
194 |
|
$sync->configure( |
195 |
|
'source.storage.handle' => ..., |
196 |
|
'target.storage.handle' => ..., |
197 |
|
); |
198 |
|
=cut |
199 |
|
|
200 |
# trace |
# trace |
201 |
#print Dumper($sync); |
#print Dumper($sync); |