1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 *
19 */
20 package org.apache.directory.server.core.jndi;
21
22
23 import javax.naming.spi.DirStateFactory;
24
25
26 /**
27 * A specialized StateFactory that is optimized for our server-side JNDI
28 * provider. This factory reports the id of the objectClass that it
29 * is associated with. This makes it easier for the server side provider to
30 * find the required factory rather than attempt several others within the list
31 * of state factories. JNDI SPI methods are inefficient since they are designed
32 * to try all state factories to produce an object. Our provider looks up
33 * the most specific state factories based on additional information. This
34 * makes a huge difference when the number of StateFactories becomes large.
35 * <br/>
36 * Eventually, it is highly feasible for generated schemas, to also include
37 * state and object factories for various objectClasses. This means the number
38 * of factories will increase. By associating object and state factories with
39 * their respective objectClasses we can integrate this into the schema
40 * subsystem making factory lookups extremely fast and efficient without costing
41 * the user too much to create and store objects within the directory.
42 *
43 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
44 * @version $Rev: 679219 $
45 */
46 public interface ServerDirStateFactory extends DirStateFactory
47 {
48 /**
49 * Gets either the OID for the objectClass or the human readable name for
50 * the objectClass this DirStateFactory is associated with. Note
51 * that associating this factory with an objectClass automatically
52 * associates this DirStateFactory with all descendents of the objectClass.
53 *
54 * @return the OID or human readable name of the objectClass associated with this StateFactory
55 */
56 String getObjectClassId();
57
58
59 /**
60 * Gets the Class instance associated with this StateFactory. Objects to
61 * be persisted by this StateFactory must be of this type, a subclass of
62 * this type, or implement this type if it is an interface.
63 *
64 * @return the class associated with this factory.
65 */
66 Class<?> getAssociatedClass();
67 }