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.jndi;
18  
19  
20  import javax.naming.spi.DirStateFactory;
21  
22  
23  /***
24   * A specialized StateFactory that is optimized for our server-side JNDI
25   * provider.  This factory reports the id of the objectClass that it
26   * is associated with.  This makes it easier for the server side provider to
27   * find the required factory rather than attempt several others within the list
28   * of state factories.  JNDI SPI methods are inefficient since they are designed
29   * to try all state factories to produce an object.  Our provider looks up
30   * the most specific state factories based on additional information.  This
31   * makes a huge difference when the number of StateFactories becomes large.
32   * <br/>
33   * Eventually, it is highly feasible for generated schemas, to also include
34   * state and object factories for various objectClasses.  This means the number
35   * of factories will increase.  By associating object and state factories with
36   * their respective objectClasses we can integrate this into the schema
37   * subsystem making factory lookups extremely fast and efficient without costing
38   * the user too much to create and store objects within the directory.
39   *
40   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
41   * @version $Rev: 264732 $
42   */
43  public interface ServerDirStateFactory extends DirStateFactory
44  {
45      /***
46       * Gets either the OID for the objectClass or the human readable name for
47       * the objectClass this DirStateFactory is associated with.  Note
48       * that associating this factory with an objectClass automatically
49       * associates this DirStateFactory with all descendents of the objectClass.
50       *
51       * @return the OID or human readable name of the objectClass associated with this StateFactory
52       */
53      String getObjectClassId();
54  
55      /***
56       * Gets the Class instance associated with this StateFactory.  Objects to
57       * be persisted by this StateFactory must be of this type, a subclass of
58       * this type, or implement this type if it is an interface.
59       *
60       * @return the class associated with this factory.
61       */
62      Class getAssociatedClass();
63  }