001/* 002 * CDDL HEADER START 003 * 004 * The contents of this file are subject to the terms of the 005 * Common Development and Distribution License, Version 1.0 only 006 * (the "License"). You may not use this file except in compliance 007 * with the License. 008 * 009 * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt 010 * or http://forgerock.org/license/CDDLv1.0.html. 011 * See the License for the specific language governing permissions 012 * and limitations under the License. 013 * 014 * When distributing Covered Code, include this CDDL HEADER in each 015 * file and include the License file at legal-notices/CDDLv1_0.txt. 016 * If applicable, add the following below this CDDL HEADER, with the 017 * fields enclosed by brackets "[]" replaced with your own identifying 018 * information: 019 * Portions Copyright [yyyy] [name of copyright owner] 020 * 021 * CDDL HEADER END 022 * 023 * 024 * Copyright 2008 Sun Microsystems, Inc. 025 */ 026package org.opends.server.admin.std.meta; 027 028 029 030import org.opends.server.admin.AbstractManagedObjectDefinition; 031import org.opends.server.admin.AdministratorAction; 032import org.opends.server.admin.BooleanPropertyDefinition; 033import org.opends.server.admin.ClassPropertyDefinition; 034import org.opends.server.admin.DefaultBehaviorProvider; 035import org.opends.server.admin.DefaultManagedObject; 036import org.opends.server.admin.DefinedDefaultBehaviorProvider; 037import org.opends.server.admin.DNPropertyDefinition; 038import org.opends.server.admin.DurationPropertyDefinition; 039import org.opends.server.admin.EnumPropertyDefinition; 040import org.opends.server.admin.InstantiableRelationDefinition; 041import org.opends.server.admin.IntegerPropertyDefinition; 042import org.opends.server.admin.PropertyOption; 043import org.opends.server.admin.std.client.BackendIndexCfgClient; 044import org.opends.server.admin.std.client.BackendVLVIndexCfgClient; 045import org.opends.server.admin.std.client.PluggableBackendCfgClient; 046import org.opends.server.admin.std.meta.BackendCfgDefn.WritabilityMode; 047import org.opends.server.admin.std.meta.BackendIndexCfgDefn; 048import org.opends.server.admin.std.server.BackendIndexCfg; 049import org.opends.server.admin.std.server.BackendVLVIndexCfg; 050import org.opends.server.admin.std.server.PluggableBackendCfg; 051import org.opends.server.admin.StringPropertyDefinition; 052import org.opends.server.admin.Tag; 053import org.opends.server.types.DN; 054 055 056 057/** 058 * An interface for querying the Pluggable Backend managed object 059 * definition meta information. 060 * <p> 061 * A Pluggable Backend stores application data in a pluggable 062 * database. 063 */ 064public final class PluggableBackendCfgDefn extends AbstractManagedObjectDefinition<PluggableBackendCfgClient, PluggableBackendCfg> { 065 066 // The singleton configuration definition instance. 067 private static final PluggableBackendCfgDefn INSTANCE = new PluggableBackendCfgDefn(); 068 069 070 071 // The "compact-encoding" property definition. 072 private static final BooleanPropertyDefinition PD_COMPACT_ENCODING; 073 074 075 076 // The "entries-compressed" property definition. 077 private static final BooleanPropertyDefinition PD_ENTRIES_COMPRESSED; 078 079 080 081 // The "index-entry-limit" property definition. 082 private static final IntegerPropertyDefinition PD_INDEX_ENTRY_LIMIT; 083 084 085 086 // The "index-filter-analyzer-enabled" property definition. 087 private static final BooleanPropertyDefinition PD_INDEX_FILTER_ANALYZER_ENABLED; 088 089 090 091 // The "index-filter-analyzer-max-filters" property definition. 092 private static final IntegerPropertyDefinition PD_INDEX_FILTER_ANALYZER_MAX_FILTERS; 093 094 095 096 // The "preload-time-limit" property definition. 097 private static final DurationPropertyDefinition PD_PRELOAD_TIME_LIMIT; 098 099 100 101 // The "writability-mode" property definition. 102 private static final EnumPropertyDefinition<WritabilityMode> PD_WRITABILITY_MODE; 103 104 105 106 // The "backend-indexes" relation definition. 107 private static final InstantiableRelationDefinition<BackendIndexCfgClient, BackendIndexCfg> RD_BACKEND_INDEXES; 108 109 110 111 // The "backend-vlv-indexes" relation definition. 112 private static final InstantiableRelationDefinition<BackendVLVIndexCfgClient, BackendVLVIndexCfg> RD_BACKEND_VLV_INDEXES; 113 114 115 116 // Build the "compact-encoding" property definition. 117 static { 118 BooleanPropertyDefinition.Builder builder = BooleanPropertyDefinition.createBuilder(INSTANCE, "compact-encoding"); 119 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "compact-encoding")); 120 DefaultBehaviorProvider<Boolean> provider = new DefinedDefaultBehaviorProvider<Boolean>("true"); 121 builder.setDefaultBehaviorProvider(provider); 122 PD_COMPACT_ENCODING = builder.getInstance(); 123 INSTANCE.registerPropertyDefinition(PD_COMPACT_ENCODING); 124 } 125 126 127 128 // Build the "entries-compressed" property definition. 129 static { 130 BooleanPropertyDefinition.Builder builder = BooleanPropertyDefinition.createBuilder(INSTANCE, "entries-compressed"); 131 builder.setOption(PropertyOption.ADVANCED); 132 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "entries-compressed")); 133 DefaultBehaviorProvider<Boolean> provider = new DefinedDefaultBehaviorProvider<Boolean>("false"); 134 builder.setDefaultBehaviorProvider(provider); 135 PD_ENTRIES_COMPRESSED = builder.getInstance(); 136 INSTANCE.registerPropertyDefinition(PD_ENTRIES_COMPRESSED); 137 } 138 139 140 141 // Build the "index-entry-limit" property definition. 142 static { 143 IntegerPropertyDefinition.Builder builder = IntegerPropertyDefinition.createBuilder(INSTANCE, "index-entry-limit"); 144 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "index-entry-limit")); 145 DefaultBehaviorProvider<Integer> provider = new DefinedDefaultBehaviorProvider<Integer>("4000"); 146 builder.setDefaultBehaviorProvider(provider); 147 builder.setUpperLimit(2147483647); 148 builder.setLowerLimit(0); 149 PD_INDEX_ENTRY_LIMIT = builder.getInstance(); 150 INSTANCE.registerPropertyDefinition(PD_INDEX_ENTRY_LIMIT); 151 } 152 153 154 155 // Build the "index-filter-analyzer-enabled" property definition. 156 static { 157 BooleanPropertyDefinition.Builder builder = BooleanPropertyDefinition.createBuilder(INSTANCE, "index-filter-analyzer-enabled"); 158 builder.setOption(PropertyOption.ADVANCED); 159 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "index-filter-analyzer-enabled")); 160 DefaultBehaviorProvider<Boolean> provider = new DefinedDefaultBehaviorProvider<Boolean>("false"); 161 builder.setDefaultBehaviorProvider(provider); 162 PD_INDEX_FILTER_ANALYZER_ENABLED = builder.getInstance(); 163 INSTANCE.registerPropertyDefinition(PD_INDEX_FILTER_ANALYZER_ENABLED); 164 } 165 166 167 168 // Build the "index-filter-analyzer-max-filters" property definition. 169 static { 170 IntegerPropertyDefinition.Builder builder = IntegerPropertyDefinition.createBuilder(INSTANCE, "index-filter-analyzer-max-filters"); 171 builder.setOption(PropertyOption.ADVANCED); 172 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "index-filter-analyzer-max-filters")); 173 DefaultBehaviorProvider<Integer> provider = new DefinedDefaultBehaviorProvider<Integer>("25"); 174 builder.setDefaultBehaviorProvider(provider); 175 builder.setLowerLimit(1); 176 PD_INDEX_FILTER_ANALYZER_MAX_FILTERS = builder.getInstance(); 177 INSTANCE.registerPropertyDefinition(PD_INDEX_FILTER_ANALYZER_MAX_FILTERS); 178 } 179 180 181 182 // Build the "preload-time-limit" property definition. 183 static { 184 DurationPropertyDefinition.Builder builder = DurationPropertyDefinition.createBuilder(INSTANCE, "preload-time-limit"); 185 builder.setOption(PropertyOption.ADVANCED); 186 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "preload-time-limit")); 187 DefaultBehaviorProvider<Long> provider = new DefinedDefaultBehaviorProvider<Long>("0s"); 188 builder.setDefaultBehaviorProvider(provider); 189 builder.setBaseUnit("ms"); 190 builder.setUpperLimit("2147483647"); 191 builder.setLowerLimit("0"); 192 PD_PRELOAD_TIME_LIMIT = builder.getInstance(); 193 INSTANCE.registerPropertyDefinition(PD_PRELOAD_TIME_LIMIT); 194 } 195 196 197 198 // Build the "writability-mode" property definition. 199 static { 200 EnumPropertyDefinition.Builder<WritabilityMode> builder = EnumPropertyDefinition.createBuilder(INSTANCE, "writability-mode"); 201 builder.setOption(PropertyOption.MANDATORY); 202 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "writability-mode")); 203 DefaultBehaviorProvider<WritabilityMode> provider = new DefinedDefaultBehaviorProvider<WritabilityMode>("enabled"); 204 builder.setDefaultBehaviorProvider(provider); 205 builder.setEnumClass(WritabilityMode.class); 206 PD_WRITABILITY_MODE = builder.getInstance(); 207 INSTANCE.registerPropertyDefinition(PD_WRITABILITY_MODE); 208 } 209 210 211 212 // Build the "backend-indexes" relation definition. 213 static { 214 InstantiableRelationDefinition.Builder<BackendIndexCfgClient, BackendIndexCfg> builder = 215 new InstantiableRelationDefinition.Builder<BackendIndexCfgClient, BackendIndexCfg>(INSTANCE, "backend-index", "backend-indexes", BackendIndexCfgDefn.getInstance()); 216 builder.setNamingProperty(BackendIndexCfgDefn.getInstance().getAttributePropertyDefinition()); 217 { 218 DefaultManagedObject.Builder<BackendIndexCfgClient, BackendIndexCfg> dmoBuilder = new DefaultManagedObject.Builder<BackendIndexCfgClient, BackendIndexCfg>(BackendIndexCfgDefn.getInstance()); 219 dmoBuilder.setPropertyValues("index-type", "presence"); 220 dmoBuilder.setPropertyValues("attribute", "aci"); 221 builder.setDefaultManagedObject("aci", dmoBuilder.getInstance()); 222 } 223 { 224 DefaultManagedObject.Builder<BackendIndexCfgClient, BackendIndexCfg> dmoBuilder = new DefaultManagedObject.Builder<BackendIndexCfgClient, BackendIndexCfg>(BackendIndexCfgDefn.getInstance()); 225 dmoBuilder.setPropertyValues("index-type", "equality"); 226 dmoBuilder.setPropertyValues("attribute", "entryUUID"); 227 builder.setDefaultManagedObject("entryUUID", dmoBuilder.getInstance()); 228 } 229 { 230 DefaultManagedObject.Builder<BackendIndexCfgClient, BackendIndexCfg> dmoBuilder = new DefaultManagedObject.Builder<BackendIndexCfgClient, BackendIndexCfg>(BackendIndexCfgDefn.getInstance()); 231 dmoBuilder.setPropertyValues("index-type", "equality"); 232 dmoBuilder.setPropertyValues("attribute", "objectClass"); 233 builder.setDefaultManagedObject("objectClass", dmoBuilder.getInstance()); 234 } 235 { 236 DefaultManagedObject.Builder<BackendIndexCfgClient, BackendIndexCfg> dmoBuilder = new DefaultManagedObject.Builder<BackendIndexCfgClient, BackendIndexCfg>(BackendIndexCfgDefn.getInstance()); 237 dmoBuilder.setPropertyValues("index-type", "ordering"); 238 dmoBuilder.setPropertyValues("attribute", "ds-sync-hist"); 239 builder.setDefaultManagedObject("ds-sync-hist", dmoBuilder.getInstance()); 240 } 241 { 242 DefaultManagedObject.Builder<BackendIndexCfgClient, BackendIndexCfg> dmoBuilder = new DefaultManagedObject.Builder<BackendIndexCfgClient, BackendIndexCfg>(BackendIndexCfgDefn.getInstance()); 243 dmoBuilder.setPropertyValues("index-type", "equality"); 244 dmoBuilder.setPropertyValues("attribute", "ds-sync-conflict"); 245 builder.setDefaultManagedObject("ds-sync-conflict", dmoBuilder.getInstance()); 246 } 247 RD_BACKEND_INDEXES = builder.getInstance(); 248 INSTANCE.registerRelationDefinition(RD_BACKEND_INDEXES); 249 } 250 251 252 253 // Build the "backend-vlv-indexes" relation definition. 254 static { 255 InstantiableRelationDefinition.Builder<BackendVLVIndexCfgClient, BackendVLVIndexCfg> builder = 256 new InstantiableRelationDefinition.Builder<BackendVLVIndexCfgClient, BackendVLVIndexCfg>(INSTANCE, "backend-vlv-index", "backend-vlv-indexes", BackendVLVIndexCfgDefn.getInstance()); 257 builder.setNamingProperty(BackendVLVIndexCfgDefn.getInstance().getNamePropertyDefinition()); 258 RD_BACKEND_VLV_INDEXES = builder.getInstance(); 259 INSTANCE.registerRelationDefinition(RD_BACKEND_VLV_INDEXES); 260 } 261 262 263 264 // Register the tags associated with this managed object definition. 265 static { 266 INSTANCE.registerTag(Tag.valueOf("database")); 267 } 268 269 270 271 /** 272 * Get the Pluggable Backend configuration definition singleton. 273 * 274 * @return Returns the Pluggable Backend configuration definition 275 * singleton. 276 */ 277 public static PluggableBackendCfgDefn getInstance() { 278 return INSTANCE; 279 } 280 281 282 283 /** 284 * Private constructor. 285 */ 286 private PluggableBackendCfgDefn() { 287 super("pluggable-backend", BackendCfgDefn.getInstance()); 288 } 289 290 291 292 /** 293 * Get the "backend-id" property definition. 294 * <p> 295 * Specifies a name to identify the associated backend. 296 * <p> 297 * The name must be unique among all backends in the server. The 298 * backend ID may not be altered after the backend is created in the 299 * server. 300 * 301 * @return Returns the "backend-id" property definition. 302 */ 303 public StringPropertyDefinition getBackendIdPropertyDefinition() { 304 return BackendCfgDefn.getInstance().getBackendIdPropertyDefinition(); 305 } 306 307 308 309 /** 310 * Get the "base-dn" property definition. 311 * <p> 312 * Specifies the base DN(s) for the data that the backend handles. 313 * <p> 314 * A single backend may be responsible for one or more base DNs. 315 * Note that no two backends may have the same base DN although one 316 * backend may have a base DN that is below a base DN provided by 317 * another backend (similar to the use of sub-suffixes in the Sun 318 * Java System Directory Server). If any of the base DNs is 319 * subordinate to a base DN for another backend, then all base DNs 320 * for that backend must be subordinate to that same base DN. 321 * 322 * @return Returns the "base-dn" property definition. 323 */ 324 public DNPropertyDefinition getBaseDNPropertyDefinition() { 325 return BackendCfgDefn.getInstance().getBaseDNPropertyDefinition(); 326 } 327 328 329 330 /** 331 * Get the "compact-encoding" property definition. 332 * <p> 333 * Indicates whether the backend should use a compact form when 334 * encoding entries by compressing the attribute descriptions and 335 * object class sets. 336 * <p> 337 * Note that this property applies only to the entries themselves 338 * and does not impact the index data. 339 * 340 * @return Returns the "compact-encoding" property definition. 341 */ 342 public BooleanPropertyDefinition getCompactEncodingPropertyDefinition() { 343 return PD_COMPACT_ENCODING; 344 } 345 346 347 348 /** 349 * Get the "enabled" property definition. 350 * <p> 351 * Indicates whether the backend is enabled in the server. 352 * <p> 353 * If a backend is not enabled, then its contents are not accessible 354 * when processing operations. 355 * 356 * @return Returns the "enabled" property definition. 357 */ 358 public BooleanPropertyDefinition getEnabledPropertyDefinition() { 359 return BackendCfgDefn.getInstance().getEnabledPropertyDefinition(); 360 } 361 362 363 364 /** 365 * Get the "entries-compressed" property definition. 366 * <p> 367 * Indicates whether the backend should attempt to compress entries 368 * before storing them in the database. 369 * <p> 370 * Note that this property applies only to the entries themselves 371 * and does not impact the index data. Further, the effectiveness of 372 * the compression is based on the type of data contained in the 373 * entry. 374 * 375 * @return Returns the "entries-compressed" property definition. 376 */ 377 public BooleanPropertyDefinition getEntriesCompressedPropertyDefinition() { 378 return PD_ENTRIES_COMPRESSED; 379 } 380 381 382 383 /** 384 * Get the "index-entry-limit" property definition. 385 * <p> 386 * Specifies the maximum number of entries that is allowed to match 387 * a given index key before that particular index key is no longer 388 * maintained. 389 * <p> 390 * This property is analogous to the ALL IDs threshold in the Sun 391 * Java System Directory Server. Note that this is the default limit 392 * for the backend, and it may be overridden on a per-attribute 393 * basis.A value of 0 means there is no limit. 394 * 395 * @return Returns the "index-entry-limit" property definition. 396 */ 397 public IntegerPropertyDefinition getIndexEntryLimitPropertyDefinition() { 398 return PD_INDEX_ENTRY_LIMIT; 399 } 400 401 402 403 /** 404 * Get the "index-filter-analyzer-enabled" property definition. 405 * <p> 406 * Indicates whether to gather statistical information about the 407 * search filters processed by the directory server while evaluating 408 * the usage of indexes. 409 * <p> 410 * Analyzing indexes requires gathering search filter usage patterns 411 * from user requests, especially for values as specified in the 412 * filters and subsequently looking the status of those values into 413 * the index files. When a search requests is processed, internal or 414 * user generated, a first phase uses indexes to find potential 415 * entries to be returned. Depending on the search filter, if the 416 * index of one of the specified attributes matches too many entries 417 * (exceeds the index entry limit), the search becomes non-indexed. 418 * In any case, all entries thus gathered (or the entire DIT) are 419 * matched against the filter for actually returning the search 420 * result. 421 * 422 * @return Returns the "index-filter-analyzer-enabled" property definition. 423 */ 424 public BooleanPropertyDefinition getIndexFilterAnalyzerEnabledPropertyDefinition() { 425 return PD_INDEX_FILTER_ANALYZER_ENABLED; 426 } 427 428 429 430 /** 431 * Get the "index-filter-analyzer-max-filters" property definition. 432 * <p> 433 * The maximum number of search filter statistics to keep. 434 * <p> 435 * When the maximum number of search filter is reached, the least 436 * used one will be deleted. 437 * 438 * @return Returns the "index-filter-analyzer-max-filters" property definition. 439 */ 440 public IntegerPropertyDefinition getIndexFilterAnalyzerMaxFiltersPropertyDefinition() { 441 return PD_INDEX_FILTER_ANALYZER_MAX_FILTERS; 442 } 443 444 445 446 /** 447 * Get the "java-class" property definition. 448 * <p> 449 * Specifies the fully-qualified name of the Java class that 450 * provides the backend implementation. 451 * 452 * @return Returns the "java-class" property definition. 453 */ 454 public ClassPropertyDefinition getJavaClassPropertyDefinition() { 455 return BackendCfgDefn.getInstance().getJavaClassPropertyDefinition(); 456 } 457 458 459 460 /** 461 * Get the "preload-time-limit" property definition. 462 * <p> 463 * Specifies the length of time that the backend is allowed to spend 464 * "pre-loading" data when it is initialized. 465 * <p> 466 * The pre-load process is used to pre-populate the database cache, 467 * so that it can be more quickly available when the server is 468 * processing requests. A duration of zero means there is no 469 * pre-load. 470 * 471 * @return Returns the "preload-time-limit" property definition. 472 */ 473 public DurationPropertyDefinition getPreloadTimeLimitPropertyDefinition() { 474 return PD_PRELOAD_TIME_LIMIT; 475 } 476 477 478 479 /** 480 * Get the "writability-mode" property definition. 481 * <p> 482 * Specifies the behavior that the backend should use when 483 * processing write operations. 484 * 485 * @return Returns the "writability-mode" property definition. 486 */ 487 public EnumPropertyDefinition<WritabilityMode> getWritabilityModePropertyDefinition() { 488 return PD_WRITABILITY_MODE; 489 } 490 491 492 493 /** 494 * Get the "backend-indexes" relation definition. 495 * 496 * @return Returns the "backend-indexes" relation definition. 497 */ 498 public InstantiableRelationDefinition<BackendIndexCfgClient,BackendIndexCfg> getBackendIndexesRelationDefinition() { 499 return RD_BACKEND_INDEXES; 500 } 501 502 503 504 /** 505 * Get the "backend-vlv-indexes" relation definition. 506 * 507 * @return Returns the "backend-vlv-indexes" relation definition. 508 */ 509 public InstantiableRelationDefinition<BackendVLVIndexCfgClient,BackendVLVIndexCfg> getBackendVLVIndexesRelationDefinition() { 510 return RD_BACKEND_VLV_INDEXES; 511 } 512}