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 */
020package org.apache.directory.server.protocol.shared;
021
022
023import org.apache.directory.server.constants.ServerDNConstants;
024import org.apache.directory.server.core.api.DirectoryService;
025
026
027/**
028 * Base class shared by all protocol providers for configuration.
029 *
030 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
031 */
032public abstract class DirectoryBackedService extends AbstractProtocolService
033{
034    /**
035     * The single location where entries are stored.  If this service
036     * is catalog based the store will search the system partition
037     * configuration for catalog entries.  Otherwise it will use this
038     * search base as a single point of searching the DIT.
039     */
040    private String searchBaseDn = ServerDNConstants.USER_EXAMPLE_COM_DN;
041
042    /** determines if the search base is pointer to a catalog or a single entry point */
043    private boolean catelogBased;
044
045    /** directory service core where protocol data is backed */
046    private DirectoryService directoryService;
047
048
049    public DirectoryService getDirectoryService()
050    {
051        return directoryService;
052    }
053
054
055    /**
056     * Set the DirectoryService
057     * 
058     * @param directoryService The DirectoryService instance
059     */
060    public void setDirectoryService( DirectoryService directoryService )
061    {
062        this.directoryService = directoryService;
063    }
064
065
066    /**
067     * Returns the search base Dn.
068     *
069     * @return The search base Dn.
070     */
071    public String getSearchBaseDn()
072    {
073        return searchBaseDn;
074    }
075
076
077    /**
078     * @param searchBaseDn The searchBaseDn to set.
079     */
080    public void setSearchBaseDn( String searchBaseDn )
081    {
082        this.searchBaseDn = searchBaseDn;
083    }
084
085
086    /**
087     * Gets true if this service uses a catalog for searching different
088     * regions of the DIT for its data.
089     *
090     * @return true if the search base dn is for a catalog, false otherwise
091     */
092    public boolean isCatelogBased()
093    {
094        return catelogBased;
095    }
096
097
098    /**
099     * Set true if this service uses a catalog for searching different
100     * regions of the DIT for its data.
101     *
102     * @param  catelogBased if the search base dn is for a catalog, false otherwise
103     */
104    public void setCatelogBased( boolean catelogBased )
105    {
106        this.catelogBased = catelogBased;
107    }
108}