View Javadoc
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.protocol.shared;
21  
22  
23  import org.apache.directory.server.constants.ServerDNConstants;
24  import org.apache.directory.server.core.api.DirectoryService;
25  
26  
27  /**
28   * Base class shared by all protocol providers for configuration.
29   *
30   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
31   */
32  public abstract class DirectoryBackedService extends AbstractProtocolService
33  {
34      /**
35       * The single location where entries are stored.  If this service
36       * is catalog based the store will search the system partition
37       * configuration for catalog entries.  Otherwise it will use this
38       * search base as a single point of searching the DIT.
39       */
40      private String searchBaseDn = ServerDNConstants.USER_EXAMPLE_COM_DN;
41  
42      /** determines if the search base is pointer to a catalog or a single entry point */
43      private boolean catelogBased;
44  
45      /** directory service core where protocol data is backed */
46      private DirectoryService directoryService;
47  
48  
49      public DirectoryService getDirectoryService()
50      {
51          return directoryService;
52      }
53  
54  
55      /**
56       * Set the DirectoryService
57       * 
58       * @param directoryService The DirectoryService instance
59       */
60      public void setDirectoryService( DirectoryService directoryService )
61      {
62          this.directoryService = directoryService;
63      }
64  
65  
66      /**
67       * Returns the search base Dn.
68       *
69       * @return The search base Dn.
70       */
71      public String getSearchBaseDn()
72      {
73          return searchBaseDn;
74      }
75  
76  
77      /**
78       * @param searchBaseDn The searchBaseDn to set.
79       */
80      public void setSearchBaseDn( String searchBaseDn )
81      {
82          this.searchBaseDn = searchBaseDn;
83      }
84  
85  
86      /**
87       * Gets true if this service uses a catalog for searching different
88       * regions of the DIT for its data.
89       *
90       * @return true if the search base dn is for a catalog, false otherwise
91       */
92      public boolean isCatelogBased()
93      {
94          return catelogBased;
95      }
96  
97  
98      /**
99       * 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 }