/[cvs]/nfo/perl/libs/OEF/Script/AbstractFeeder.pm
ViewVC logotype

Diff of /nfo/perl/libs/OEF/Script/AbstractFeeder.pm

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

revision 1.1 by joko, Sun Feb 9 16:27:06 2003 UTC revision 1.3 by joko, Fri Feb 14 14:18:36 2003 UTC
# Line 4  Line 4 
4  ##    $Id$  ##    $Id$
5  ##    --------------------------------------------------------------------------------  ##    --------------------------------------------------------------------------------
6  ##    $Log$  ##    $Log$
7    ##    Revision 1.3  2003/02/14 14:18:36  joko
8    ##    + new get-/setter-methods
9    ##
10    ##    Revision 1.2  2003/02/11 09:48:57  joko
11    ##    - moved notice output out of this module
12    ##    + some fixes
13    ##
14  ##    Revision 1.1  2003/02/09 16:27:06  joko  ##    Revision 1.1  2003/02/09 16:27:06  joko
15  ##    + initial commit  ##    + initial commit
16  ##  ##
# Line 24  use base qw( Line 31  use base qw(
31    
32  use Data::Dumper;  use Data::Dumper;
33  use Getopt::Long;  use Getopt::Long;
34    use Data::Transfer::Sync;
35    
36    
37  # get logger instance  # get logger instance
# Line 48  EOU Line 56  EOU
56    exit;    exit;
57  }  }
58    
59  sub getoptions {  sub readoptions {
60    my $self = shift;    my $self = shift;
61    
62    GetOptions(    GetOptions(
# Line 67  sub getoptions { Line 75  sub getoptions {
75    );    );
76  }    }  
77    
78    sub getoptions {
79      my $self = shift;
80      return $self->{opt};
81    }
82    
83    sub setoptions {
84      my $self = shift;
85      my $options = shift;
86      # FIXME: is this really true?
87      $self->{opt} = $options;
88    }
89    
90  sub getoptions_old {  sub getoptions_old {
91    my $self = shift;    my $self = shift;
92    GetOptions(    GetOptions(
# Line 105  sub run { Line 125  sub run {
125    my $self = shift;    my $self = shift;
126    $self->_before_run();    $self->_before_run();
127    $self->prepare();    $self->prepare();
128    $self->tellWhatIAmDoing();    #$self->tellWhatIAmDoing();
129    $self->sync();    $self->sync();
130  }  }
131    
 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" );  
     
 }  
   
132  sub prepare {  sub prepare {
133    my $self = shift;    my $self = shift;
134    
# Line 196  sub sync { Line 174  sub sync {
174      $sync_version ||= 'V1';      $sync_version ||= 'V1';
175    
176    # create a new synchronization object    # create a new synchronization object
177      my $sync = Data::Transfer::Sync->new( 'sync_version' => $sync_version );      my $sync = Data::Transfer::Sync->new( 'sync_version' => $sync_version, __parent => $self );
178    
179    # trace    # trace
180      #print Dumper($self);      #print Dumper($self);
181        #print Dumper($self);
182        #exit;
183        
184    
185    # configure the synchronization-object    # configure the synchronization-object
186      $sync->configure(      $sync->configure(
# Line 207  sub sync { Line 188  sub sync {
188          storage => {          storage => {
189            #handle => $mapiStorage,            #handle => $mapiStorage,
190            handle => $self->{app}->{$self->{opt}->{source}},            handle => $self->{app}->{$self->{opt}->{source}},
191            writeProtected => 1,            #isIdentAuthority => $self->{app}->{config}->{{$self->{opt}->{source}},
192              #isChecksumAuthority => 1,
193              #writeProtected => 1,
194          },          },
195        },        },
196        target => {        target => {
197          storage => {          storage => {
198            #handle => $ldapStorage,            #handle => $ldapStorage,
199            handle => $self->{app}->{$self->{opt}->{target}},            handle => $self->{app}->{$self->{opt}->{target}},
200            idAuthority => 1,            #idAuthority => 1,
201            isChecksumAuthority => 1,            #isChecksumAuthority => 1,
202            writeProtected => 0,            #isWriteProtected => 0,
203          },          },
204        },        },
205        verbose => 1,        verbose => 1,
206      );      );
207        
208      # TODO:
209    =pod
210      $sync->configure(
211        'source.storage.handle' => ...,
212        'target.storage.handle' => ...,
213      );
214    =cut
215    
216    # trace    # trace
217      #print Dumper($sync);      #print Dumper($sync);

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.3

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