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 org.apache.ldap.server.jndi.ServerDirStateFactory;
21  
22  import javax.naming.NamingException;
23  
24  
25  /***
26   * A registry used for looking up JNDI state factories based on meta data
27   * regarding the objectClass and Class associations with the factory. Unlike
28   * other registries which often throw exceptions when they cannot find an
29   * object, this one does not.  It returns null if an 'optional' state factory
30   * cannot be found.
31   *
32   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
33   * @version $Rev$
34   */
35  public interface StateFactoryRegistry
36  {
37      /***
38       * Gets the list of StateFactories associated with a class.  Several state
39       * factories may be associated with a class or interface depending on its
40       * ancestry.  Also more specific factories may be registered for subclasses
41       * of the class.  So a request for a general class may result in several
42       * factories which could persist the state of an object although more
43       * specifically.
44       *
45       * @param obj the object to be persisted by the factories
46       * @return the set of state factories which persist objects of the specified class
47       */
48      ServerDirStateFactory getStateFactories( Object obj ) throws NamingException;
49  
50      /***
51       * Registers a server-side state factory with this registry.
52       *
53       * @param factory the factory to register.
54       */
55      void register( ServerDirStateFactory factory );
56  }