1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.ldap.server.schema;
18
19
20 import javax.naming.NamingException;
21 import java.util.Iterator;
22 import java.util.List;
23
24
25 /***
26 * Object identifier registry.
27 *
28 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
29 * @version $Rev: 159259 $
30 */
31 public interface OidRegistry
32 {
33 /***
34 * Gets the object identifier for a common name or returns the argument
35 * as-is if it is an object identifier.
36 *
37 * @param name the name to lookup an OID for
38 * @return the OID string associated with a name
39 * @throws NamingException if name does not map to an OID
40 */
41 String getOid( String name ) throws NamingException;
42
43 /***
44 * Checks to see if an identifier, oid or name exists within this registry.
45 *
46 * @param id the oid or name to look for
47 * @return true if the id exists false otherwise
48 */
49 boolean hasOid( String id );
50
51 /***
52 * Gets the primary name associated with an OID. The primary name is the
53 * first name specified for the OID.
54 *
55 * @param oid the object identifier
56 * @return the primary name
57 * @throws NamingException if oid does not exist
58 */
59 String getPrimaryName( String oid ) throws NamingException;
60
61 /***
62 * Gets the names associated with an OID. An OID is unique however it may
63 * have many names used to refer to it. A good example is the cn and
64 * commonName attribute names for OID 2.5.4.3. Within a server one name
65 * within the set must be chosen as the primary name. This is used to
66 * name certain things within the server internally. If there is more than
67 * one name then the first name is taken to be the primary.
68 *
69 * @param oid the OID for which we return the set of common names
70 * @return a sorted set of names
71 * @throws NamingException if oid does not exist
72 */
73 List getNameSet( String oid ) throws NamingException;
74
75 /***
76 * Lists all the OIDs within the registry. This may be a really big list.
77 *
78 * @return all the OIDs registered
79 */
80 Iterator list();
81
82 /***
83 * Adds an OID name pair to the registry.
84 *
85 * @param name the name to associate with the OID
86 * @param oid the OID to add or associate a new name with
87 */
88 void register( String name, String oid );
89 }