View Javadoc

1   /*
2    *   Copyright 2004 The Apache Software Foundation
3    *
4    *   Licensed under the Apache License, Version 2.0 (the "License");
5    *   you may not use this file except in compliance with the License.
6    *   You may obtain a copy of the License at
7    *
8    *       http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *   Unless required by applicable law or agreed to in writing, software
11   *   distributed under the License is distributed on an "AS IS" BASIS,
12   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *   See the License for the specific language governing permissions and
14   *   limitations under the License.
15   *
16   */
17  package org.apache.ldap.server.schema;
18  
19  
20  import java.util.Iterator;
21  
22  import javax.naming.NamingException;
23  
24  import org.apache.ldap.common.schema.Syntax;
25  
26  
27  /***
28   * Manages the lookup and registration of Syntaxes within the system by OID.
29   *
30   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
31   * @version $Rev: 264732 $
32   */
33  public interface SyntaxRegistry
34  {
35      /***
36       * Looks up a Syntax by its unique Object Identifier or by name.
37       * 
38       * @param id the object identifier or name
39       * @return the Syntax for the id
40       * @throws NamingException if there is a backing store failure or the Syntax
41       * does not exist.
42       */
43      Syntax lookup( String id ) throws NamingException;
44      
45      /***
46       * Registers a Syntax with this registry.  
47       * 
48       * @param schema the name of the schema the Syntax is associated with
49       * @param syntax the Syntax to register
50       * @throws NamingException if the syntax is already registered or the 
51       * registration operation is not supported
52       */
53      void register( String schema, Syntax syntax ) throws NamingException;
54  
55      /***
56       * Gets the name of the schema this schema object is associated with.
57       *
58       * @param id the object identifier or the name
59       * @return the schema name
60       * @throws NamingException if the schema object does not exist
61       */
62      String getSchemaName( String id ) throws NamingException;
63  
64      /***
65       * Checks to see if a Syntax exists.  Backing store failures simply return
66       * false.
67       * 
68       * @param id the object identifier or name
69       * @return true if a Syntax definition exists for the id, false otherwise
70       */
71      boolean hasSyntax( String id );
72  
73      /***
74       * Lists all the Syntaxes within this registry.
75       *
76       * @return an Iterator over all the Syntaxes within this registry
77       */
78      Iterator list();
79  }