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