1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.ldap.server.prefs;
18
19
20 import javax.naming.Name;
21 import javax.naming.NamingException;
22
23 import org.apache.ldap.common.name.LdapName;
24
25
26 /***
27 * Document this class.
28 *
29 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
30 * @version $Rev: 264732 $
31 */
32 class PreferencesUtils
33 {
34 /*** the dn base of the system preference hierarchy */
35 static final String SYSPREF_BASE = "prefNodeName=sysPrefRoot,ou=system";
36
37
38 /***
39 * Translates an absolute system preferences node name into the distinguished
40 * name of the entry corresponding to the preferences node.
41 *
42 * @param absPrefPath the absolute path to the system preferences node
43 * @return the distinguished name of the entry representing the system preferences node
44 * @throws NamingException if there are namespace problems while translating the path
45 */
46 public static Name toSysDn( String absPrefPath ) throws NamingException
47 {
48 LdapName dn = new LdapName( SYSPREF_BASE );
49
50 String[] comps = absPrefPath.split( "/" );
51
52 for ( int ii = 0; ii < comps.length; ii++ )
53 {
54 if ( comps[ii] != null && ! comps[ii].trim().equals( "" ) )
55 {
56 dn.add( "prefNodeName=" + comps[ii] );
57 }
58 }
59
60 return dn;
61 }
62 }