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.DirObjectFactory;
024    
025    
026    /**
027     * A specialized ObjectFactory that is optimized for our server-side JNDI
028     * provider.  This factory reports the Class of objects that it is creates as
029     * well as the objectClass corresponding to that Class.  This makes it easier
030     * for the server side provider to lookup the respective factory rather than
031     * attempt several others within the list of object factories in the order of
032     * greatest specificity.  JNDI SPI methods are inefficient since they are
033     * designed to try all object factories to produce the object.  Our provider
034     * looks up the most specific object factory based on this additional
035     * information.  This makes a huge difference when the number of ObjectFactory
036     * instances is large.
037     * <p/>
038     * Eventually, it is highly feasible for generated schemas, to also include
039     * state and object factories for various objectClasses, or domain objects.
040     * This means the number of factories will increase.  By associating object and
041     * state factories with their respective objectClasses and Classes we can
042     * integrate these DAOs into the schema subsystem making factory lookups
043     * extremely fast and efficient without costing the user too much to create and
044     * store objects within the directory.  At the end of the day the directory
045     * becomes a hierarchical object store where lookup, bind and rebind are the
046     * only operations besides search to access and store objects.  That's pretty
047     * PHAT!
048     *
049     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
050     * @version $Rev: 679219 $
051     */
052    public interface ServerDirObjectFactory extends DirObjectFactory
053    {
054        /**
055         * Gets either the OID for the objectClass or the human readable name for
056         * the objectClass this DirStateFactory is associated with.  Note
057         * that associating this factory with an objectClass automatically
058         * associates this DirObjectFactory with all descendents of the objectClass.
059         *
060         * @return the OID or human readable name of the objectClass associated with this ObjectFactory
061         */
062        String getObjectClassId();
063    
064    
065        /**
066         * Gets the Class instance associated with this ObjectFactory.  Objects to
067         * be created by this ObjectFactory will be of this type, a subclass of
068         * this type, or implement this type if it is an interface.
069         *
070         * @return the Class associated with this factory.
071         */
072        Class<?> getAssociatedClass();
073    }