001 /* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 * 019 */ 020 package org.apache.directory.server.core.jndi; 021 022 023 import javax.naming.spi.DirStateFactory; 024 025 026 /** 027 * A specialized StateFactory that is optimized for our server-side JNDI 028 * provider. This factory reports the id of the objectClass that it 029 * is associated with. This makes it easier for the server side provider to 030 * find the required factory rather than attempt several others within the list 031 * of state factories. JNDI SPI methods are inefficient since they are designed 032 * to try all state factories to produce an object. Our provider looks up 033 * the most specific state factories based on additional information. This 034 * makes a huge difference when the number of StateFactories becomes large. 035 * <br/> 036 * Eventually, it is highly feasible for generated schemas, to also include 037 * state and object factories for various objectClasses. This means the number 038 * of factories will increase. By associating object and state factories with 039 * their respective objectClasses we can integrate this into the schema 040 * subsystem making factory lookups extremely fast and efficient without costing 041 * the user too much to create and store objects within the directory. 042 * 043 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 044 * @version $Rev: 679219 $ 045 */ 046 public interface ServerDirStateFactory extends DirStateFactory 047 { 048 /** 049 * Gets either the OID for the objectClass or the human readable name for 050 * the objectClass this DirStateFactory is associated with. Note 051 * that associating this factory with an objectClass automatically 052 * associates this DirStateFactory with all descendents of the objectClass. 053 * 054 * @return the OID or human readable name of the objectClass associated with this StateFactory 055 */ 056 String getObjectClassId(); 057 058 059 /** 060 * Gets the Class instance associated with this StateFactory. Objects to 061 * be persisted by this StateFactory must be of this type, a subclass of 062 * this type, or implement this type if it is an interface. 063 * 064 * @return the class associated with this factory. 065 */ 066 Class<?> getAssociatedClass(); 067 }