| 4 |
## $Id$ |
## $Id$ |
| 5 |
## -------------------------------------------------------------------------------- |
## -------------------------------------------------------------------------------- |
| 6 |
## $Log$ |
## $Log$ |
| 7 |
|
## Revision 1.6 2004/06/19 01:49:07 joko |
| 8 |
|
## enabled verbosing with Data::Transfer::Sync |
| 9 |
|
## minor patch to option processing |
| 10 |
|
## |
| 11 |
|
## Revision 1.5 2003/02/22 16:53:42 joko |
| 12 |
|
## minor update: debugging |
| 13 |
|
## |
| 14 |
|
## Revision 1.4 2003/02/20 21:11:15 joko |
| 15 |
|
## renamed module |
| 16 |
|
## modified runtime namespace hierarchy |
| 17 |
|
## |
| 18 |
|
## Revision 1.3 2003/02/14 14:18:36 joko |
| 19 |
|
## + new get-/setter-methods |
| 20 |
|
## |
| 21 |
## Revision 1.2 2003/02/11 09:48:57 joko |
## Revision 1.2 2003/02/11 09:48:57 joko |
| 22 |
## - moved notice output out of this module |
## - moved notice output out of this module |
| 23 |
## + some fixes |
## + some fixes |
| 36 |
#use base 'OEF::Component::Task'; |
#use base 'OEF::Component::Task'; |
| 37 |
use base qw( |
use base qw( |
| 38 |
DesignPattern::Object |
DesignPattern::Object |
| 39 |
DesignPattern::Object::Logger |
DesignPattern::Logger |
| 40 |
); |
); |
| 41 |
|
|
| 42 |
|
|
| 43 |
use Data::Dumper; |
use Data::Dumper; |
| 44 |
use Getopt::Long; |
use Getopt::Long; |
| 45 |
|
use Data::Transfer::Sync; |
| 46 |
|
|
| 47 |
|
|
| 48 |
# get logger instance |
# get logger instance |
| 67 |
exit; |
exit; |
| 68 |
} |
} |
| 69 |
|
|
| 70 |
sub getoptions { |
sub readoptions { |
| 71 |
my $self = shift; |
my $self = shift; |
| 72 |
|
|
| 73 |
GetOptions( |
GetOptions( |
| 86 |
); |
); |
| 87 |
} |
} |
| 88 |
|
|
| 89 |
|
sub getoptions { |
| 90 |
|
my $self = shift; |
| 91 |
|
return $self->{opt}; |
| 92 |
|
} |
| 93 |
|
|
| 94 |
|
sub setoptions { |
| 95 |
|
my $self = shift; |
| 96 |
|
my $options = shift; |
| 97 |
|
# FIXME: is this really true? |
| 98 |
|
$self->{opt} = $options; |
| 99 |
|
} |
| 100 |
|
|
| 101 |
sub getoptions_old { |
sub getoptions_old { |
| 102 |
my $self = shift; |
my $self = shift; |
| 103 |
GetOptions( |
GetOptions( |
| 137 |
$self->_before_run(); |
$self->_before_run(); |
| 138 |
$self->prepare(); |
$self->prepare(); |
| 139 |
#$self->tellWhatIAmDoing(); |
#$self->tellWhatIAmDoing(); |
| 140 |
|
#$self->_tellWhatIWillDo(); |
| 141 |
$self->sync(); |
$self->sync(); |
| 142 |
} |
} |
| 143 |
|
|
| 144 |
sub prepare { |
sub prepare { |
| 145 |
my $self = shift; |
my $self = shift; |
| 146 |
|
|
| 147 |
|
#print Dumper($self->{opt}); |
| 148 |
|
#exit; |
| 149 |
|
|
| 150 |
# TODO: |
# TODO: |
| 151 |
# - move this to Data::Transfer::Sync::checkOptions!!! |
# - move this to Data::Transfer::Sync::checkOptions!!! |
| 152 |
# - use 'syncable'??? |
# - use 'syncable'??? |
| 153 |
|
|
| 154 |
#if ($self->{app}->{config}->{databases}->{$self->{opt}->{target}}->{syncable}) { |
#if ($self->{app}->{config}->{databases}->{$self->{opt}->{target}}->{syncable}) { |
| 155 |
|
$self->{opt}->{action} ||= ''; |
| 156 |
|
|
| 157 |
my $mode = ''; |
my $mode = ''; |
| 158 |
my $erase = 0; |
my $erase = 0; |
| 188 |
# is api-version specified? |
# is api-version specified? |
| 189 |
my $sync_version = $self->{opt}->{sv}; |
my $sync_version = $self->{opt}->{sv}; |
| 190 |
$sync_version ||= 'V1'; |
$sync_version ||= 'V1'; |
| 191 |
|
#$sync_version = 'V2'; |
| 192 |
|
|
| 193 |
|
#print "version: $sync_version", "\n"; |
| 194 |
|
|
| 195 |
# create a new synchronization object |
# create a new synchronization object |
| 196 |
my $sync = Data::Transfer::Sync->new( 'sync_version' => $sync_version, __parent => $self ); |
my $sync = Data::Transfer::Sync->new( 'sync_version' => $sync_version, __parent => $self, verbose => 1 ); |
| 197 |
|
|
| 198 |
# trace |
# trace |
| 199 |
#print Dumper($self); |
#print Dumper($self); |
| 200 |
#print Dumper($self); |
#print Dumper($self); |
| 201 |
#exit; |
#exit; |
| 202 |
|
|
| 203 |
|
# checks |
| 204 |
|
if (!$self->{app}->{storage}->{$self->{opt}->{source}}) { |
| 205 |
|
$logger->critical("Sync source storage handle undefined!"); |
| 206 |
|
} |
| 207 |
|
if (!$self->{app}->{storage}->{$self->{opt}->{target}}) { |
| 208 |
|
$logger->critical("Sync target storage handle undefined!"); |
| 209 |
|
} |
| 210 |
|
|
| 211 |
# configure the synchronization-object |
# configure the synchronization-object |
| 212 |
$sync->configure( |
$sync->configure( |
| 213 |
source => { |
source => { |
| 214 |
storage => { |
storage => { |
| 215 |
#handle => $mapiStorage, |
#handle => $mapiStorage, |
| 216 |
handle => $self->{app}->{$self->{opt}->{source}}, |
handle => $self->{app}->{storage}->{$self->{opt}->{source}}, |
| 217 |
#isIdentAuthority => $self->{app}->{config}->{{$self->{opt}->{source}}, |
#isIdentAuthority => $self->{app}->{config}->{{$self->{opt}->{source}}, |
| 218 |
#isChecksumAuthority => 1, |
#isChecksumAuthority => 1, |
| 219 |
#writeProtected => 1, |
#writeProtected => 1, |
| 222 |
target => { |
target => { |
| 223 |
storage => { |
storage => { |
| 224 |
#handle => $ldapStorage, |
#handle => $ldapStorage, |
| 225 |
handle => $self->{app}->{$self->{opt}->{target}}, |
handle => $self->{app}->{storage}->{$self->{opt}->{target}}, |
| 226 |
#idAuthority => 1, |
#idAuthority => 1, |
| 227 |
#isChecksumAuthority => 1, |
#isChecksumAuthority => 1, |
| 228 |
#isWriteProtected => 0, |
#isWriteProtected => 0, |