/[cvs]/nfo/perl/scripts/outlook2ldap/libs/Torus/Core.pm
ViewVC logotype

Diff of /nfo/perl/scripts/outlook2ldap/libs/Torus/Core.pm

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

revision 1.2 by joko, Sat Jan 18 18:23:20 2003 UTC revision 1.3 by joko, Sun Jan 19 03:35:25 2003 UTC
# Line 1  Line 1 
1    ##    ------------------------------------------------------------------------
2    ##    $Id$
3    ##    ------------------------------------------------------------------------
4    ##    $Log$
5    ##    Revision 1.3  2003/01/19 03:35:25  joko
6    ##    + added cvs-header
7    ##
8    ##    ------------------------------------------------------------------------
9    
10    
11  package Torus::Core;  package Torus::Core;
12    
13  use base qw(  use base qw(
# Line 8  use base qw( Line 18  use base qw(
18  use strict;  use strict;
19  use warnings;  use warnings;
20    
21    use Data::Dumper;
22    
23  use loadConfig;  use loadConfig;
24  #use Torus::Driver::ldap;  use Data::Storage;
25    use Data::Storage::Locator;
26  use Data::Transfer::Sync;  use Data::Transfer::Sync;
27    
28  my $logger = Log::Dispatch::Config->instance;  my $logger = Log::Dispatch::Config->instance;
# Line 58  sub startSync { Line 71  sub startSync {
71    my $self = shift;    my $self = shift;
72    my $opts = shift;    my $opts = shift;
73    
74    #print Dumper($opts);
75    #exit;
76    
77      my $host = $config->get("ldapserver_host");
78      my $binddn = $config->get("ldapserver_binddn");
79      my $pass = $config->get("ldapserver_pass");
80      my $basedn = $config->get("ldapserver_basedn");
81      
82      my $dsn = "ldap:host=$host;binddn='$binddn';pass=$pass";
83      $logger->info(__PACKAGE__ . "->startSync: using dsn: $dsn");
84    
85    my $ldapLocator = Data::Storage::Locator->new(    my $ldapLocator = Data::Storage::Locator->new(
86      ldap => {      ldap => {
87        type => "NetLDAP",        type => "NetLDAP",
88  #      dsn => "ldap:host=192.168.1.56;binddn='cn=root, dc=labnet, dc=de';pass=Geheim",  #      dsn => "ldap:host=192.168.1.56;binddn='cn=root, dc=labnet, dc=de';pass=Geheim",
89        dsn => "ldap:host=192.168.10.150;binddn='cn=root, o=netfrag.org, c=de';pass=secret",  #      dsn => "ldap:host=192.168.10.150;binddn='cn=root, o=netfrag.org, c=de';pass=secret",
90          dsn => $dsn,
91    #      basedn => "o=netfrag.org, c=de",
92          basedn => $basedn,
93        #schema => 'BizWorks::BackendDbSchema',        #schema => 'BizWorks::BackendDbSchema',
94        #classnames => [qw( SystemEvent LangText )],        #classnames => [qw( SystemEvent LangText )],
95        #classnames => [qw( SystemEvent Person Address LangText )],        #classnames => [qw( SystemEvent Person Address LangText )],
# Line 84  sub startSync { Line 111  sub startSync {
111    # create a new synchronization object    # create a new synchronization object
112    my $sync = Data::Transfer::Sync->new();    my $sync = Data::Transfer::Sync->new();
113    
114      # read, mungle & check the options
115        $sync->prepareOptionsV2($opts);
116    
117    # resolve mapping metadata for syncing requested resource      if (!$sync->checkOptionsV2()) {
     # if now mapping is given explicitely, try to use mapping named like "target"  
     $opts->{mapping} ||= $opts->{target};  
     # was: ($nodemapping and $propmapping were package-globals)  
     # is: (both mappings are retrieved from mapping-module/package/object  
     # resolve mapping module  
     my $modulename = $self->{config}->{mappings}->{$opts->{mapping}};  
     $opts->{mapping_module} = $modulename;  
   
 #print Dumper($opts);  
   
   # mungle & check the options  
   # TODO: refactor this and the innards.....  
   
     #$opts = $sync->prepareSyncOptions($opts);  
     if (!$sync->prepareOptions($opts)) {  
       $logger->critical( __PACKAGE__ . "->startSync: 'Data::Transfer::Sync::prepareSyncOptions' failed.");  
     }  
   
 #print Dumper($opts);  
       
     if (!$sync->checkOptions($opts)) {  
118        $logger->critical( __PACKAGE__ . "->startSync: 'Data::Transfer::Sync::checkOptions' failed.");        $logger->critical( __PACKAGE__ . "->startSync: 'Data::Transfer::Sync::checkOptions' failed.");
119        return;        return;
120      }      }
121    
122    #print Dumper($opts);
123    
124    
125    =pod
126    # branch to execution path for special targets    # branch to execution path for special targets
127    # detect for option 'handler' which could be a CODEref    # detect for option 'handler' which could be a CODEref
128      if ($opts->{handler} && ref $opts->{handler} eq 'CODE') {      if ($opts->{handler} && ref $opts->{handler} eq 'CODE') {
# Line 118  sub startSync { Line 130  sub startSync {
130        $opts->{handler}->($self, $opts);        $opts->{handler}->($self, $opts);
131        return;        return;
132      }      }
133    =cut
   # determine write-protection(s) from options  
     my @write_protects;  
     push @write_protects, 'L' if $opts->{source_write_protect};  
     push @write_protects, 'R' if $opts->{target_write_protect};  
134        
135    # configure synchronization-object    # configure synchronization-object
136    $sync->configure(    $sync->configureV2(
     storages => {  
137        #L => $self->{bizWorks}->{$opts->{source}},        #L => $self->{bizWorks}->{$opts->{source}},
138        L => $mapiStorage,      source => {
139        #R => $self->{bizWorks}->{$opts->{target}},        storage => {
140        R => $ldapStorage,          handle => $mapiStorage,
141            writeProtected => 1,
142          },
143        },
144        #R => $self->{bizWorks}->{$opts->{target}},
145        target => {
146          storage => {
147            handle => $ldapStorage,
148            idAuthority => 1,
149            checksumAuthority => 1,
150            writeProtected => 0,
151          },
152      },      },
     id_authorities => [qw( L ) ],  
     checksum_authorities => [qw( L ) ],  
     write_protected => \@write_protects,  
153      verbose => 1,      verbose => 1,
154    );    );
155        

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

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