1: # -*- perl -*-
2#*************************************************************************
3#
4# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5#
6# Copyright 2000, 2010 Oracle and/or its affiliates.
7#
8# OpenOffice.org - a multi-platform office productivity suite
9#
10# This file is part of OpenOffice.org.
11#
12# OpenOffice.org is free software: you can redistribute it and/or modify
13# it under the terms of the GNU Lesser General Public License version 3
14# only, as published by the Free Software Foundation.
15#
16# OpenOffice.org is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19# GNU Lesser General Public License version 3 for more details
20# (a copy is included in the LICENSE file that accompanied this code).
21#
22# You should have received a copy of the GNU Lesser General Public License
23# version 3 along with OpenOffice.org.  If not, see
24# <http://www.openoffice.org/license.html>
25# for a copy of the LGPLv3 License.
26#
27#*************************************************************************
28
29
30# generates of the component schema list mapping file, which
31# describes the mapping between OOR and LDAP
32
33eval 'exec perl -wS $0 ${1+"$@"}'
34	if 0;
35
36#creating the output file
37open(OUTFILE, ">$ARGV[0]") or die "can't open >$ARGV[0]";
38
39#open the makefile
40open(INFILE, "makefile.mk") or die "can't open makefile.mk";
41
42$inxcs=0;
43
44#search all schemas in the makefile except userprofile and format them as e.g org.openoffice.Inet
45while(<INFILE>) {
46	tr/\r\n//d;
47
48	if (/^\s*XCSFILES/) {
49		$inxcs++;
50	}
51	next unless $inxcs;
52
53	if ($inxcs) {
54
55		$inxcs=0 unless /\\$/;
56
57		next if (/^\s*XCSFILES/);
58		next if (/UserProfile/);
59
60		s/^\s+//;
61		s/\s*\\$//;
62		s/\.xcs.*$//;
63		s#\$/#.#g;
64
65		push(@comp_names, $_);
66	}
67}
68close(INFILE);
69
70# create the properites file
71
72print OUTFILE "# location of the component schema \n";
73print OUTFILE "component-schema=schema\n\n";
74
75print OUTFILE "# location of the component data \n";
76print OUTFILE "component-data=data\n\n";
77
78$comps=join (';',@comp_names);
79print OUTFILE "# installed components \n";
80print OUTFILE "components=$comps\n\n";
81
82print OUTFILE "# component mapping \n";
83foreach (@comp_names) {
84	$myCompName=$_;
85
86	s#org.openoffice.#oo-#g;
87	s#\.#-#g;
88
89	$myLdapName=lc $_;
90
91	print OUTFILE "component/$myCompName/attribute=$myLdapName-attr\n";
92	print OUTFILE "component/$myCompName/objectclass=$myLdapName-class\n\n";
93}
94
95close(OUTFILE);
96
97exit 0;
98