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

Contents of /nfo/perl/scripts/outlook2ldap/libs/Torus/Reflection/schema.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations)
Sun Jan 19 06:42:59 2003 UTC (21 years, 5 months ago) by joko
Branch: MAIN
CVS Tags: v009, HEAD
+ initial check-in

1 package Torus::Reflection::schema;
2
3 use strict;
4 use warnings;
5
6 # config
7
8 my $ldapAttributeIdPrefix="1.3.6.1.4.1.13040.1.2.66";
9 my $ldapAttributetypeSUP="name";
10 my %ldapObjectClassArguments = (
11 "objectclassid" => $ldapAttributeIdPrefix . ".1001",
12 "NAME" => "'msMapi'",
13 "DESC" => "'msMapi Schema'",
14 "SUP" => "person",
15 );
16
17
18 sub genSchema {
19
20 my $sourceFileName=shift;
21 open (FH,"<".$sourceFileName) or die "could not open \"$sourceFileName\" for reading, exit!\n";
22 # main
23
24 my %buffer;
25 my $counter = 0;
26 my $counter_attributesUsed = 0;
27 while (my $line = <FH>) {
28 $counter++;
29 chomp ($line);
30 my @entry=split(";",$line);
31 my $mapiAttributeName=$entry[0];
32 my $ldapAttributeName=$entry[1];
33 my $ldapObjectClassName=$entry[2];
34
35
36 #print "line: $line\n";
37
38 # go on?
39 # no ldap-attribute?
40 next if (!$ldapAttributeName);
41 # no ldap-objectclass?
42 next if (!$ldapObjectClassName);
43 # just certain objectclasses?
44 next if ($ldapObjectClassName ne "msMapi");
45
46 #print "line: $line\n";
47
48 # preparing fill
49 my $prefix_ldapAttr = ' ';
50 $prefix_ldapAttr = ' $ ' if ($counter_attributesUsed);
51
52 # fill buffers
53 $counter_attributesUsed++;
54 $buffer{attributes} .= "attributetype ( $ldapAttributeIdPrefix.$counter_attributesUsed NAME '$ldapAttributeName' SUP $ldapAttributetypeSUP )\n";
55 $buffer{objectClassMay} .= $prefix_ldapAttr . $ldapAttributeName . "\n";
56
57 }
58
59 close (FH);
60
61 return if !$counter;
62
63 my $masterbuffer;
64
65 $masterbuffer .= $buffer{attributes} . "\n";
66
67 $masterbuffer .= "objectclass ( $ldapObjectClassArguments{objectclassid}
68 NAME $ldapObjectClassArguments{NAME}
69 DESC $ldapObjectClassArguments{DESC}
70 SUP $ldapObjectClassArguments{SUP}
71 MAY ( \n";
72 $masterbuffer .= $buffer{objectClassMay} if ($buffer{objectClassMay});
73 $masterbuffer .= " ) )" . "\n";
74 return $masterbuffer;
75
76 }
77
78 1;

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