001/*
002 * The contents of this file are subject to the terms of the Common Development and
003 * Distribution License (the License). You may not use this file except in compliance with the
004 * License.
005 *
006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
007 * specific language governing permission and limitations under the License.
008 *
009 * When distributing Covered Software, include this CDDL Header Notice in each file and include
010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
011 * Header, with the fields enclosed by brackets [] replaced by your own identifying
012 * information: "Portions Copyright [year] [name of copyright owner]".
013 *
014 * Copyright 2008 Sun Microsystems, Inc.
015 */
016package org.forgerock.opendj.server.config.client;
017
018
019
020import java.util.Collection;
021import org.forgerock.opendj.config.client.ConcurrentModificationException;
022import org.forgerock.opendj.config.client.IllegalManagedObjectNameException;
023import org.forgerock.opendj.config.client.ManagedObjectDecodingException;
024import org.forgerock.opendj.config.client.OperationRejectedException;
025import org.forgerock.opendj.config.DefinitionDecodingException;
026import org.forgerock.opendj.config.ManagedObjectDefinition;
027import org.forgerock.opendj.config.ManagedObjectNotFoundException;
028import org.forgerock.opendj.config.PropertyException;
029import org.forgerock.opendj.ldap.LdapException;
030import org.forgerock.opendj.server.config.meta.BackendCfgDefn.WritabilityMode;
031import org.forgerock.opendj.server.config.server.BackendIndexCfg;
032import org.forgerock.opendj.server.config.server.BackendVLVIndexCfg;
033import org.forgerock.opendj.server.config.server.PluggableBackendCfg;
034
035
036
037/**
038 * A client-side interface for reading and modifying Pluggable Backend
039 * settings.
040 * <p>
041 * A Pluggable Backend stores application data in a pluggable
042 * database.
043 */
044public interface PluggableBackendCfgClient extends BackendCfgClient {
045
046  /**
047   * Get the configuration definition associated with this Pluggable Backend.
048   *
049   * @return Returns the configuration definition associated with this Pluggable Backend.
050   */
051  ManagedObjectDefinition<? extends PluggableBackendCfgClient, ? extends PluggableBackendCfg> definition();
052
053
054
055  /**
056   * Gets the "compact-encoding" property.
057   * <p>
058   * Indicates whether the backend should use a compact form when
059   * encoding entries by compressing the attribute descriptions and
060   * object class sets.
061   * <p>
062   * Note that this property applies only to the entries themselves
063   * and does not impact the index data.
064   *
065   * @return Returns the value of the "compact-encoding" property.
066   */
067  boolean isCompactEncoding();
068
069
070
071  /**
072   * Sets the "compact-encoding" property.
073   * <p>
074   * Indicates whether the backend should use a compact form when
075   * encoding entries by compressing the attribute descriptions and
076   * object class sets.
077   * <p>
078   * Note that this property applies only to the entries themselves
079   * and does not impact the index data.
080   *
081   * @param value The value of the "compact-encoding" property.
082   * @throws PropertyException
083   *           If the new value is invalid.
084   */
085  void setCompactEncoding(Boolean value) throws PropertyException;
086
087
088
089  /**
090   * Gets the "entries-compressed" property.
091   * <p>
092   * Indicates whether the backend should attempt to compress entries
093   * before storing them in the database.
094   * <p>
095   * Note that this property applies only to the entries themselves
096   * and does not impact the index data. Further, the effectiveness of
097   * the compression is based on the type of data contained in the
098   * entry.
099   *
100   * @return Returns the value of the "entries-compressed" property.
101   */
102  boolean isEntriesCompressed();
103
104
105
106  /**
107   * Sets the "entries-compressed" property.
108   * <p>
109   * Indicates whether the backend should attempt to compress entries
110   * before storing them in the database.
111   * <p>
112   * Note that this property applies only to the entries themselves
113   * and does not impact the index data. Further, the effectiveness of
114   * the compression is based on the type of data contained in the
115   * entry.
116   *
117   * @param value The value of the "entries-compressed" property.
118   * @throws PropertyException
119   *           If the new value is invalid.
120   */
121  void setEntriesCompressed(Boolean value) throws PropertyException;
122
123
124
125  /**
126   * Gets the "index-entry-limit" property.
127   * <p>
128   * Specifies the maximum number of entries that is allowed to match
129   * a given index key before that particular index key is no longer
130   * maintained.
131   * <p>
132   * This property is analogous to the ALL IDs threshold in the Sun
133   * Java System Directory Server. Note that this is the default limit
134   * for the backend, and it may be overridden on a per-attribute
135   * basis.A value of 0 means there is no limit.
136   *
137   * @return Returns the value of the "index-entry-limit" property.
138   */
139  int getIndexEntryLimit();
140
141
142
143  /**
144   * Sets the "index-entry-limit" property.
145   * <p>
146   * Specifies the maximum number of entries that is allowed to match
147   * a given index key before that particular index key is no longer
148   * maintained.
149   * <p>
150   * This property is analogous to the ALL IDs threshold in the Sun
151   * Java System Directory Server. Note that this is the default limit
152   * for the backend, and it may be overridden on a per-attribute
153   * basis.A value of 0 means there is no limit.
154   *
155   * @param value The value of the "index-entry-limit" property.
156   * @throws PropertyException
157   *           If the new value is invalid.
158   */
159  void setIndexEntryLimit(Integer value) throws PropertyException;
160
161
162
163  /**
164   * Gets the "index-filter-analyzer-enabled" property.
165   * <p>
166   * Indicates whether to gather statistical information about the
167   * search filters processed by the directory server while evaluating
168   * the usage of indexes.
169   * <p>
170   * Analyzing indexes requires gathering search filter usage patterns
171   * from user requests, especially for values as specified in the
172   * filters and subsequently looking the status of those values into
173   * the index files. When a search requests is processed, internal or
174   * user generated, a first phase uses indexes to find potential
175   * entries to be returned. Depending on the search filter, if the
176   * index of one of the specified attributes matches too many entries
177   * (exceeds the index entry limit), the search becomes non-indexed.
178   * In any case, all entries thus gathered (or the entire DIT) are
179   * matched against the filter for actually returning the search
180   * result.
181   *
182   * @return Returns the value of the "index-filter-analyzer-enabled" property.
183   */
184  boolean isIndexFilterAnalyzerEnabled();
185
186
187
188  /**
189   * Sets the "index-filter-analyzer-enabled" property.
190   * <p>
191   * Indicates whether to gather statistical information about the
192   * search filters processed by the directory server while evaluating
193   * the usage of indexes.
194   * <p>
195   * Analyzing indexes requires gathering search filter usage patterns
196   * from user requests, especially for values as specified in the
197   * filters and subsequently looking the status of those values into
198   * the index files. When a search requests is processed, internal or
199   * user generated, a first phase uses indexes to find potential
200   * entries to be returned. Depending on the search filter, if the
201   * index of one of the specified attributes matches too many entries
202   * (exceeds the index entry limit), the search becomes non-indexed.
203   * In any case, all entries thus gathered (or the entire DIT) are
204   * matched against the filter for actually returning the search
205   * result.
206   *
207   * @param value The value of the "index-filter-analyzer-enabled" property.
208   * @throws PropertyException
209   *           If the new value is invalid.
210   */
211  void setIndexFilterAnalyzerEnabled(Boolean value) throws PropertyException;
212
213
214
215  /**
216   * Gets the "index-filter-analyzer-max-filters" property.
217   * <p>
218   * The maximum number of search filter statistics to keep.
219   * <p>
220   * When the maximum number of search filter is reached, the least
221   * used one will be deleted.
222   *
223   * @return Returns the value of the "index-filter-analyzer-max-filters" property.
224   */
225  int getIndexFilterAnalyzerMaxFilters();
226
227
228
229  /**
230   * Sets the "index-filter-analyzer-max-filters" property.
231   * <p>
232   * The maximum number of search filter statistics to keep.
233   * <p>
234   * When the maximum number of search filter is reached, the least
235   * used one will be deleted.
236   *
237   * @param value The value of the "index-filter-analyzer-max-filters" property.
238   * @throws PropertyException
239   *           If the new value is invalid.
240   */
241  void setIndexFilterAnalyzerMaxFilters(Integer value) throws PropertyException;
242
243
244
245  /**
246   * Gets the "preload-time-limit" property.
247   * <p>
248   * Specifies the length of time that the backend is allowed to spend
249   * "pre-loading" data when it is initialized.
250   * <p>
251   * The pre-load process is used to pre-populate the database cache,
252   * so that it can be more quickly available when the server is
253   * processing requests. A duration of zero means there is no
254   * pre-load.
255   *
256   * @return Returns the value of the "preload-time-limit" property.
257   */
258  long getPreloadTimeLimit();
259
260
261
262  /**
263   * Sets the "preload-time-limit" property.
264   * <p>
265   * Specifies the length of time that the backend is allowed to spend
266   * "pre-loading" data when it is initialized.
267   * <p>
268   * The pre-load process is used to pre-populate the database cache,
269   * so that it can be more quickly available when the server is
270   * processing requests. A duration of zero means there is no
271   * pre-load.
272   *
273   * @param value The value of the "preload-time-limit" property.
274   * @throws PropertyException
275   *           If the new value is invalid.
276   */
277  void setPreloadTimeLimit(Long value) throws PropertyException;
278
279
280
281  /**
282   * Gets the "writability-mode" property.
283   * <p>
284   * Specifies the behavior that the backend should use when
285   * processing write operations.
286   *
287   * @return Returns the value of the "writability-mode" property.
288   */
289  WritabilityMode getWritabilityMode();
290
291
292
293  /**
294   * Sets the "writability-mode" property.
295   * <p>
296   * Specifies the behavior that the backend should use when
297   * processing write operations.
298   *
299   * @param value The value of the "writability-mode" property.
300   * @throws PropertyException
301   *           If the new value is invalid.
302   */
303  void setWritabilityMode(WritabilityMode value) throws PropertyException;
304
305
306
307  /**
308   * Lists the Backend Indexes.
309   *
310   * @return Returns an array containing the names of the Backend
311   *         Indexes.
312   * @throws ConcurrentModificationException
313   *           If this Pluggable Backend has been removed from the
314   *           server by another client.
315   * @throws LdapException
316   *           If any other error occurs.
317   */
318  String[] listBackendIndexes() throws ConcurrentModificationException,
319      LdapException;
320
321
322
323  /**
324   * Gets the named Backend Index.
325   *
326   * @param name
327   *           The name of the Backend Index to retrieve.
328   * @return Returns the named Backend Index.
329   * @throws DefinitionDecodingException
330   *           If the named Backend Index was found but its type could
331   *           not be determined.
332   * @throws ManagedObjectDecodingException
333   *           If the named Backend Index was found but one or more of
334   *           its properties could not be decoded.
335   * @throws ManagedObjectNotFoundException
336   *           If the named Backend Index was not found on the server.
337   * @throws ConcurrentModificationException
338   *           If this Pluggable Backend has been removed from the
339   *           server by another client.
340   * @throws LdapException
341   *           If any other error occurs.
342   */
343  BackendIndexCfgClient getBackendIndex(String name)
344      throws DefinitionDecodingException, ManagedObjectDecodingException,
345      ManagedObjectNotFoundException, ConcurrentModificationException,
346      LdapException;
347
348
349
350  /**
351   * Creates a new Backend Index. The new Backend Index will initially
352   * not contain any property values (including mandatory properties).
353   * Once the Backend Index has been configured it can be added to the
354   * server using the {@link #commit()} method.
355   *
356   * @param <C>
357   *          The type of the Backend Index being created.
358   * @param d
359   *          The definition of the Backend Index to be created.
360   * @param name
361   *          The name of the new Backend Index.
362   * @param exceptions
363   *          An optional collection in which to place any {@link
364   *          PropertyException}s that occurred whilst attempting to
365   *          determine the default values of the Backend Index. This
366   *          argument can be <code>null<code>.
367   * @return Returns a new Backend Index configuration instance.
368   * @throws IllegalManagedObjectNameException
369   *          If the name of the new Backend Index is invalid.
370   */
371  <C extends BackendIndexCfgClient> C createBackendIndex(
372      ManagedObjectDefinition<C, ? extends BackendIndexCfg> d, String name, Collection<PropertyException> exceptions) throws IllegalManagedObjectNameException;
373
374
375
376  /**
377   * Removes the named Backend Index.
378   *
379   * @param name
380   *          The name of the Backend Index to remove.
381   * @throws ManagedObjectNotFoundException
382   *           If the Backend Index does not exist.
383   * @throws OperationRejectedException
384   *           If the server refuses to remove the Backend Index due
385   *           to some server-side constraint which cannot be satisfied
386   *           (for example, if it is referenced by another managed
387   *           object).
388   * @throws ConcurrentModificationException
389   *           If this Pluggable Backend has been removed from the
390   *           server by another client.
391   * @throws LdapException
392   *           If any other error occurs.
393   */
394  void removeBackendIndex(String name)
395      throws ManagedObjectNotFoundException, OperationRejectedException,
396      ConcurrentModificationException, LdapException;
397
398
399
400  /**
401   * Lists the Backend VLV Indexes.
402   *
403   * @return Returns an array containing the names of the Backend VLV
404   *         Indexes.
405   * @throws ConcurrentModificationException
406   *           If this Pluggable Backend has been removed from the
407   *           server by another client.
408   * @throws LdapException
409   *           If any other error occurs.
410   */
411  String[] listBackendVLVIndexes() throws ConcurrentModificationException,
412      LdapException;
413
414
415
416  /**
417   * Gets the named Backend VLV Index.
418   *
419   * @param name
420   *           The name of the Backend VLV Index to retrieve.
421   * @return Returns the named Backend VLV Index.
422   * @throws DefinitionDecodingException
423   *           If the named Backend VLV Index was found but its type
424   *           could not be determined.
425   * @throws ManagedObjectDecodingException
426   *           If the named Backend VLV Index was found but one or
427   *           more of its properties could not be decoded.
428   * @throws ManagedObjectNotFoundException
429   *           If the named Backend VLV Index was not found on the
430   *           server.
431   * @throws ConcurrentModificationException
432   *           If this Pluggable Backend has been removed from the
433   *           server by another client.
434   * @throws LdapException
435   *           If any other error occurs.
436   */
437  BackendVLVIndexCfgClient getBackendVLVIndex(String name)
438      throws DefinitionDecodingException, ManagedObjectDecodingException,
439      ManagedObjectNotFoundException, ConcurrentModificationException,
440      LdapException;
441
442
443
444  /**
445   * Creates a new Backend VLV Index. The new Backend VLV Index will
446   * initially not contain any property values (including mandatory
447   * properties). Once the Backend VLV Index has been configured it can
448   * be added to the server using the {@link #commit()} method.
449   *
450   * @param <C>
451   *          The type of the Backend VLV Index being created.
452   * @param d
453   *          The definition of the Backend VLV Index to be created.
454   * @param name
455   *          The name of the new Backend VLV Index.
456   * @param exceptions
457   *          An optional collection in which to place any {@link
458   *          PropertyException}s that occurred whilst attempting to
459   *          determine the default values of the Backend VLV Index.
460   *          This argument can be <code>null<code>.
461   * @return Returns a new Backend VLV Index configuration instance.
462   * @throws IllegalManagedObjectNameException
463   *          If the name of the new Backend VLV Index is invalid.
464   */
465  <C extends BackendVLVIndexCfgClient> C createBackendVLVIndex(
466      ManagedObjectDefinition<C, ? extends BackendVLVIndexCfg> d, String name, Collection<PropertyException> exceptions) throws IllegalManagedObjectNameException;
467
468
469
470  /**
471   * Removes the named Backend VLV Index.
472   *
473   * @param name
474   *          The name of the Backend VLV Index to remove.
475   * @throws ManagedObjectNotFoundException
476   *           If the Backend VLV Index does not exist.
477   * @throws OperationRejectedException
478   *           If the server refuses to remove the Backend VLV Index
479   *           due to some server-side constraint which cannot be
480   *           satisfied (for example, if it is referenced by another
481   *           managed object).
482   * @throws ConcurrentModificationException
483   *           If this Pluggable Backend has been removed from the
484   *           server by another client.
485   * @throws LdapException
486   *           If any other error occurs.
487   */
488  void removeBackendVLVIndex(String name)
489      throws ManagedObjectNotFoundException, OperationRejectedException,
490      ConcurrentModificationException, LdapException;
491
492}