1: # -*- perl -*-
2#**************************************************************
3#
4#  Licensed to the Apache Software Foundation (ASF) under one
5#  or more contributor license agreements.  See the NOTICE file
6#  distributed with this work for additional information
7#  regarding copyright ownership.  The ASF licenses this file
8#  to you under the Apache License, Version 2.0 (the
9#  "License"); you may not use this file except in compliance
10#  with the License.  You may obtain a copy of the License at
11#
12#    http://www.apache.org/licenses/LICENSE-2.0
13#
14#  Unless required by applicable law or agreed to in writing,
15#  software distributed under the License is distributed on an
16#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17#  KIND, either express or implied.  See the License for the
18#  specific language governing permissions and limitations
19#  under the License.
20#
21#**************************************************************
22
23
24# generates of the component schema list mapping file, which
25# describes the mapping between OOR and LDAP
26
27eval 'exec perl -wS $0 ${1+"$@"}'
28	if 0;
29
30#creating the output file
31open(OUTFILE, ">$ARGV[0]") or die "can't open >$ARGV[0]";
32
33#open the makefile
34open(INFILE, "makefile.mk") or die "can't open makefile.mk";
35
36$inxcs=0;
37
38#search all schemas in the makefile except userprofile and format them as e.g org.openoffice.Inet
39while(<INFILE>) {
40	tr/\r\n//d;
41
42	if (/^\s*XCSFILES/) {
43		$inxcs++;
44	}
45	next unless $inxcs;
46
47	if ($inxcs) {
48
49		$inxcs=0 unless /\\$/;
50
51		next if (/^\s*XCSFILES/);
52		next if (/UserProfile/);
53
54		s/^\s+//;
55		s/\s*\\$//;
56		s/\.xcs.*$//;
57		s#\$/#.#g;
58
59		push(@comp_names, $_);
60	}
61}
62close(INFILE);
63
64# create the properites file
65
66print OUTFILE "# location of the component schema \n";
67print OUTFILE "component-schema=schema\n\n";
68
69print OUTFILE "# location of the component data \n";
70print OUTFILE "component-data=data\n\n";
71
72$comps=join (';',@comp_names);
73print OUTFILE "# installed components \n";
74print OUTFILE "components=$comps\n\n";
75
76print OUTFILE "# component mapping \n";
77foreach (@comp_names) {
78	$myCompName=$_;
79
80	s#org.openoffice.#oo-#g;
81	s#\.#-#g;
82
83	$myLdapName=lc $_;
84
85	print OUTFILE "component/$myCompName/attribute=$myLdapName-attr\n";
86	print OUTFILE "component/$myCompName/objectclass=$myLdapName-class\n\n";
87}
88
89close(OUTFILE);
90
91exit 0;
92