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.DirObjectFactory;
21  
22  
23  /***
24   * A specialized ObjectFactory that is optimized for our server-side JNDI
25   * provider.  This factory reports the Class of objects that it is creates as
26   * well as the objectClass corresponding to that Class.  This makes it easier
27   * for the server side provider to lookup the respective factory rather than
28   * attempt several others within the list of object factories in the order of
29   * greatest specificity.  JNDI SPI methods are inefficient since they are
30   * designed to try all object factories to produce the object.  Our provider
31   * looks up the most specific object factory based on this additional
32   * information.  This makes a huge difference when the number of ObjectFactory
33   * instances is large.
34   * <br/>
35   * Eventually, it is highly feasible for generated schemas, to also include
36   * state and object factories for various objectClasses, or domain objects.
37   * This means the number of factories will increase.  By associating object and
38   * state factories with their respective objectClasses and Classes we can
39   * integrate these DAOs into the schema subsystem making factory lookups
40   * extremely fast and efficient without costing the user too much to create and
41   * store objects within the directory.  At the end of the day the directory
42   * becomes a hierarchical object store where lookup, bind and rebind are the
43   * only operations besides search to access and store objects.  That's pretty
44   * PHAT!
45   *
46   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
47   * @version $Rev$
48   */
49  public interface ServerDirObjectFactory extends DirObjectFactory
50  {
51      /***
52       * Gets either the OID for the objectClass or the human readable name for
53       * the objectClass this DirStateFactory is associated with.  Note
54       * that associating this factory with an objectClass automatically
55       * associates this DirObjectFactory with all descendents of the objectClass.
56       *
57       * @return the OID or human readable name of the objectClass associated with this ObjectFactory
58       */
59      String getObjectClassId();
60  
61      /***
62       * Gets the Class instance associated with this ObjectFactory.  Objects to
63       * be created by this ObjectFactory will be of this type, a subclass of
64       * this type, or implement this type if it is an interface.
65       *
66       * @return the Class associated with this factory.
67       */
68      Class getAssociatedClass();
69  }