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 java.util.Collection;
031import java.util.SortedSet;
032import org.opends.server.admin.AdministratorAction;
033import org.opends.server.admin.AliasDefaultBehaviorProvider;
034import org.opends.server.admin.AttributeTypePropertyDefinition;
035import org.opends.server.admin.BooleanPropertyDefinition;
036import org.opends.server.admin.ClassPropertyDefinition;
037import org.opends.server.admin.client.AuthorizationException;
038import org.opends.server.admin.client.CommunicationException;
039import org.opends.server.admin.client.ConcurrentModificationException;
040import org.opends.server.admin.client.ManagedObject;
041import org.opends.server.admin.client.MissingMandatoryPropertiesException;
042import org.opends.server.admin.client.OperationRejectedException;
043import org.opends.server.admin.DefaultBehaviorProvider;
044import org.opends.server.admin.DefinedDefaultBehaviorProvider;
045import org.opends.server.admin.DNPropertyDefinition;
046import org.opends.server.admin.DurationPropertyDefinition;
047import org.opends.server.admin.EnumPropertyDefinition;
048import org.opends.server.admin.ManagedObjectAlreadyExistsException;
049import org.opends.server.admin.ManagedObjectDefinition;
050import org.opends.server.admin.PropertyOption;
051import org.opends.server.admin.PropertyProvider;
052import org.opends.server.admin.server.ConfigurationChangeListener;
053import org.opends.server.admin.server.ServerManagedObject;
054import org.opends.server.admin.std.client.ReferentialIntegrityPluginCfgClient;
055import org.opends.server.admin.std.meta.PluginCfgDefn.PluginType;
056import org.opends.server.admin.std.server.PluginCfg;
057import org.opends.server.admin.std.server.ReferentialIntegrityPluginCfg;
058import org.opends.server.admin.StringPropertyDefinition;
059import org.opends.server.admin.Tag;
060import org.opends.server.admin.UndefinedDefaultBehaviorProvider;
061import org.opends.server.types.AttributeType;
062import org.opends.server.types.DN;
063
064
065
066/**
067 * An interface for querying the Referential Integrity Plugin managed
068 * object definition meta information.
069 * <p>
070 * The Referential Integrity Plugin maintains referential integrity
071 * for DN valued attributes.
072 */
073public final class ReferentialIntegrityPluginCfgDefn extends ManagedObjectDefinition<ReferentialIntegrityPluginCfgClient, ReferentialIntegrityPluginCfg> {
074
075  // The singleton configuration definition instance.
076  private static final ReferentialIntegrityPluginCfgDefn INSTANCE = new ReferentialIntegrityPluginCfgDefn();
077
078
079
080  /**
081   * Defines the set of permissable values for the "check-references-scope-criteria" property.
082   * <p>
083   * Specifies whether or not referenced entries must reside within
084   * the same naming context as the entry containing the reference.
085   * <p>
086   * The reference scope will only be enforced when reference checking
087   * is enabled.
088   */
089  public static enum CheckReferencesScopeCriteria {
090
091    /**
092     * References may refer to existing entries located anywhere in
093     * the Directory.
094     */
095    GLOBAL("global"),
096
097
098
099    /**
100     * References must refer to existing entries located within the
101     * same naming context.
102     */
103    NAMING_CONTEXT("naming-context");
104
105
106
107    // String representation of the value.
108    private final String name;
109
110
111
112    // Private constructor.
113    private CheckReferencesScopeCriteria(String name) { this.name = name; }
114
115
116
117    /**
118     * {@inheritDoc}
119     */
120    public String toString() { return name; }
121
122  }
123
124
125
126  // The "attribute-type" property definition.
127  private static final AttributeTypePropertyDefinition PD_ATTRIBUTE_TYPE;
128
129
130
131  // The "base-dn" property definition.
132  private static final DNPropertyDefinition PD_BASE_DN;
133
134
135
136  // The "check-references" property definition.
137  private static final BooleanPropertyDefinition PD_CHECK_REFERENCES;
138
139
140
141  // The "check-references-filter-criteria" property definition.
142  private static final StringPropertyDefinition PD_CHECK_REFERENCES_FILTER_CRITERIA;
143
144
145
146  // The "check-references-scope-criteria" property definition.
147  private static final EnumPropertyDefinition<CheckReferencesScopeCriteria> PD_CHECK_REFERENCES_SCOPE_CRITERIA;
148
149
150
151  // The "java-class" property definition.
152  private static final ClassPropertyDefinition PD_JAVA_CLASS;
153
154
155
156  // The "log-file" property definition.
157  private static final StringPropertyDefinition PD_LOG_FILE;
158
159
160
161  // The "plugin-type" property definition.
162  private static final EnumPropertyDefinition<PluginType> PD_PLUGIN_TYPE;
163
164
165
166  // The "update-interval" property definition.
167  private static final DurationPropertyDefinition PD_UPDATE_INTERVAL;
168
169
170
171  // Build the "attribute-type" property definition.
172  static {
173      AttributeTypePropertyDefinition.Builder builder = AttributeTypePropertyDefinition.createBuilder(INSTANCE, "attribute-type");
174      builder.setOption(PropertyOption.MULTI_VALUED);
175      builder.setOption(PropertyOption.MANDATORY);
176      builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "attribute-type"));
177      builder.setDefaultBehaviorProvider(new UndefinedDefaultBehaviorProvider<AttributeType>());
178      PD_ATTRIBUTE_TYPE = builder.getInstance();
179      INSTANCE.registerPropertyDefinition(PD_ATTRIBUTE_TYPE);
180  }
181
182
183
184  // Build the "base-dn" property definition.
185  static {
186      DNPropertyDefinition.Builder builder = DNPropertyDefinition.createBuilder(INSTANCE, "base-dn");
187      builder.setOption(PropertyOption.MULTI_VALUED);
188      builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "base-dn"));
189      builder.setDefaultBehaviorProvider(new AliasDefaultBehaviorProvider<DN>(INSTANCE, "base-dn"));
190      PD_BASE_DN = builder.getInstance();
191      INSTANCE.registerPropertyDefinition(PD_BASE_DN);
192  }
193
194
195
196  // Build the "check-references" property definition.
197  static {
198      BooleanPropertyDefinition.Builder builder = BooleanPropertyDefinition.createBuilder(INSTANCE, "check-references");
199      builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "check-references"));
200      DefaultBehaviorProvider<Boolean> provider = new DefinedDefaultBehaviorProvider<Boolean>("false");
201      builder.setDefaultBehaviorProvider(provider);
202      PD_CHECK_REFERENCES = builder.getInstance();
203      INSTANCE.registerPropertyDefinition(PD_CHECK_REFERENCES);
204  }
205
206
207
208  // Build the "check-references-filter-criteria" property definition.
209  static {
210      StringPropertyDefinition.Builder builder = StringPropertyDefinition.createBuilder(INSTANCE, "check-references-filter-criteria");
211      builder.setOption(PropertyOption.MULTI_VALUED);
212      builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "check-references-filter-criteria"));
213      builder.setDefaultBehaviorProvider(new UndefinedDefaultBehaviorProvider<String>());
214      builder.setPattern("^[^:]+:\\(.+\\)$", "ATTRIBUTE:FILTER");
215      PD_CHECK_REFERENCES_FILTER_CRITERIA = builder.getInstance();
216      INSTANCE.registerPropertyDefinition(PD_CHECK_REFERENCES_FILTER_CRITERIA);
217  }
218
219
220
221  // Build the "check-references-scope-criteria" property definition.
222  static {
223      EnumPropertyDefinition.Builder<CheckReferencesScopeCriteria> builder = EnumPropertyDefinition.createBuilder(INSTANCE, "check-references-scope-criteria");
224      builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "check-references-scope-criteria"));
225      DefaultBehaviorProvider<CheckReferencesScopeCriteria> provider = new DefinedDefaultBehaviorProvider<CheckReferencesScopeCriteria>("global");
226      builder.setDefaultBehaviorProvider(provider);
227      builder.setEnumClass(CheckReferencesScopeCriteria.class);
228      PD_CHECK_REFERENCES_SCOPE_CRITERIA = builder.getInstance();
229      INSTANCE.registerPropertyDefinition(PD_CHECK_REFERENCES_SCOPE_CRITERIA);
230  }
231
232
233
234  // Build the "java-class" property definition.
235  static {
236      ClassPropertyDefinition.Builder builder = ClassPropertyDefinition.createBuilder(INSTANCE, "java-class");
237      builder.setOption(PropertyOption.MANDATORY);
238      builder.setOption(PropertyOption.ADVANCED);
239      builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "java-class"));
240      DefaultBehaviorProvider<String> provider = new DefinedDefaultBehaviorProvider<String>("org.opends.server.plugins.ReferentialIntegrityPlugin");
241      builder.setDefaultBehaviorProvider(provider);
242      builder.addInstanceOf("org.opends.server.api.plugin.DirectoryServerPlugin");
243      PD_JAVA_CLASS = builder.getInstance();
244      INSTANCE.registerPropertyDefinition(PD_JAVA_CLASS);
245  }
246
247
248
249  // Build the "log-file" property definition.
250  static {
251      StringPropertyDefinition.Builder builder = StringPropertyDefinition.createBuilder(INSTANCE, "log-file");
252      builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "log-file"));
253      DefaultBehaviorProvider<String> provider = new DefinedDefaultBehaviorProvider<String>("logs/referint");
254      builder.setDefaultBehaviorProvider(provider);
255      builder.setPattern(".*", "FILE");
256      PD_LOG_FILE = builder.getInstance();
257      INSTANCE.registerPropertyDefinition(PD_LOG_FILE);
258  }
259
260
261
262  // Build the "plugin-type" property definition.
263  static {
264      EnumPropertyDefinition.Builder<PluginType> builder = EnumPropertyDefinition.createBuilder(INSTANCE, "plugin-type");
265      builder.setOption(PropertyOption.MULTI_VALUED);
266      builder.setOption(PropertyOption.MANDATORY);
267      builder.setOption(PropertyOption.ADVANCED);
268      builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.COMPONENT_RESTART, INSTANCE, "plugin-type"));
269      DefaultBehaviorProvider<PluginType> provider = new DefinedDefaultBehaviorProvider<PluginType>("postoperationdelete", "postoperationmodifydn", "subordinatemodifydn", "subordinatedelete", "preoperationadd", "preoperationmodify");
270      builder.setDefaultBehaviorProvider(provider);
271      builder.setEnumClass(PluginType.class);
272      PD_PLUGIN_TYPE = builder.getInstance();
273      INSTANCE.registerPropertyDefinition(PD_PLUGIN_TYPE);
274  }
275
276
277
278  // Build the "update-interval" property definition.
279  static {
280      DurationPropertyDefinition.Builder builder = DurationPropertyDefinition.createBuilder(INSTANCE, "update-interval");
281      builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "update-interval"));
282      DefaultBehaviorProvider<Long> provider = new DefinedDefaultBehaviorProvider<Long>("0 seconds");
283      builder.setDefaultBehaviorProvider(provider);
284      builder.setAllowUnlimited(false);
285      builder.setBaseUnit("s");
286      PD_UPDATE_INTERVAL = builder.getInstance();
287      INSTANCE.registerPropertyDefinition(PD_UPDATE_INTERVAL);
288  }
289
290
291
292  // Register the tags associated with this managed object definition.
293  static {
294    INSTANCE.registerTag(Tag.valueOf("core-server"));
295  }
296
297
298
299  /**
300   * Get the Referential Integrity Plugin configuration definition
301   * singleton.
302   *
303   * @return Returns the Referential Integrity Plugin configuration
304   *         definition singleton.
305   */
306  public static ReferentialIntegrityPluginCfgDefn getInstance() {
307    return INSTANCE;
308  }
309
310
311
312  /**
313   * Private constructor.
314   */
315  private ReferentialIntegrityPluginCfgDefn() {
316    super("referential-integrity-plugin", PluginCfgDefn.getInstance());
317  }
318
319
320
321  /**
322   * {@inheritDoc}
323   */
324  public ReferentialIntegrityPluginCfgClient createClientConfiguration(
325      ManagedObject<? extends ReferentialIntegrityPluginCfgClient> impl) {
326    return new ReferentialIntegrityPluginCfgClientImpl(impl);
327  }
328
329
330
331  /**
332   * {@inheritDoc}
333   */
334  public ReferentialIntegrityPluginCfg createServerConfiguration(
335      ServerManagedObject<? extends ReferentialIntegrityPluginCfg> impl) {
336    return new ReferentialIntegrityPluginCfgServerImpl(impl);
337  }
338
339
340
341  /**
342   * {@inheritDoc}
343   */
344  public Class<ReferentialIntegrityPluginCfg> getServerConfigurationClass() {
345    return ReferentialIntegrityPluginCfg.class;
346  }
347
348
349
350  /**
351   * Get the "attribute-type" property definition.
352   * <p>
353   * Specifies the attribute types for which referential integrity is
354   * to be maintained.
355   * <p>
356   * At least one attribute type must be specified, and the syntax of
357   * any attributes must be either a distinguished name
358   * (1.3.6.1.4.1.1466.115.121.1.12) or name and optional UID
359   * (1.3.6.1.4.1.1466.115.121.1.34).
360   *
361   * @return Returns the "attribute-type" property definition.
362   */
363  public AttributeTypePropertyDefinition getAttributeTypePropertyDefinition() {
364    return PD_ATTRIBUTE_TYPE;
365  }
366
367
368
369  /**
370   * Get the "base-dn" property definition.
371   * <p>
372   * Specifies the base DN that limits the scope within which
373   * referential integrity is maintained.
374   *
375   * @return Returns the "base-dn" property definition.
376   */
377  public DNPropertyDefinition getBaseDNPropertyDefinition() {
378    return PD_BASE_DN;
379  }
380
381
382
383  /**
384   * Get the "check-references" property definition.
385   * <p>
386   * Specifies whether or not reference attributes must refer to
387   * existing entries.
388   * <p>
389   * When this property is set to true, this plugin will ensure that
390   * any new references added as part of an add or modify operation
391   * point to existing entries, and that the referenced entries match
392   * the filter criteria for the referencing attribute, if specified.
393   *
394   * @return Returns the "check-references" property definition.
395   */
396  public BooleanPropertyDefinition getCheckReferencesPropertyDefinition() {
397    return PD_CHECK_REFERENCES;
398  }
399
400
401
402  /**
403   * Get the "check-references-filter-criteria" property definition.
404   * <p>
405   * Specifies additional filter criteria which will be enforced when
406   * checking references.
407   * <p>
408   * If a reference attribute has filter criteria defined then this
409   * plugin will ensure that any new references added as part of an add
410   * or modify operation refer to an existing entry which matches the
411   * specified filter.
412   *
413   * @return Returns the "check-references-filter-criteria" property definition.
414   */
415  public StringPropertyDefinition getCheckReferencesFilterCriteriaPropertyDefinition() {
416    return PD_CHECK_REFERENCES_FILTER_CRITERIA;
417  }
418
419
420
421  /**
422   * Get the "check-references-scope-criteria" property definition.
423   * <p>
424   * Specifies whether or not referenced entries must reside within
425   * the same naming context as the entry containing the reference.
426   * <p>
427   * The reference scope will only be enforced when reference checking
428   * is enabled.
429   *
430   * @return Returns the "check-references-scope-criteria" property definition.
431   */
432  public EnumPropertyDefinition<CheckReferencesScopeCriteria> getCheckReferencesScopeCriteriaPropertyDefinition() {
433    return PD_CHECK_REFERENCES_SCOPE_CRITERIA;
434  }
435
436
437
438  /**
439   * Get the "enabled" property definition.
440   * <p>
441   * Indicates whether the plug-in is enabled for use.
442   *
443   * @return Returns the "enabled" property definition.
444   */
445  public BooleanPropertyDefinition getEnabledPropertyDefinition() {
446    return PluginCfgDefn.getInstance().getEnabledPropertyDefinition();
447  }
448
449
450
451  /**
452   * Get the "invoke-for-internal-operations" property definition.
453   * <p>
454   * Indicates whether the plug-in should be invoked for internal
455   * operations.
456   * <p>
457   * Any plug-in that can be invoked for internal operations must
458   * ensure that it does not create any new internal operatons that can
459   * cause the same plug-in to be re-invoked.
460   *
461   * @return Returns the "invoke-for-internal-operations" property definition.
462   */
463  public BooleanPropertyDefinition getInvokeForInternalOperationsPropertyDefinition() {
464    return PluginCfgDefn.getInstance().getInvokeForInternalOperationsPropertyDefinition();
465  }
466
467
468
469  /**
470   * Get the "java-class" property definition.
471   * <p>
472   * Specifies the fully-qualified name of the Java class that
473   * provides the plug-in implementation.
474   *
475   * @return Returns the "java-class" property definition.
476   */
477  public ClassPropertyDefinition getJavaClassPropertyDefinition() {
478    return PD_JAVA_CLASS;
479  }
480
481
482
483  /**
484   * Get the "log-file" property definition.
485   * <p>
486   * Specifies the log file location where the update records are
487   * written when the plug-in is in background-mode processing.
488   * <p>
489   * The default location is the logs directory of the server
490   * instance, using the file name "referint".
491   *
492   * @return Returns the "log-file" property definition.
493   */
494  public StringPropertyDefinition getLogFilePropertyDefinition() {
495    return PD_LOG_FILE;
496  }
497
498
499
500  /**
501   * Get the "plugin-type" property definition.
502   * <p>
503   * Specifies the set of plug-in types for the plug-in, which
504   * specifies the times at which the plug-in is invoked.
505   *
506   * @return Returns the "plugin-type" property definition.
507   */
508  public EnumPropertyDefinition<PluginType> getPluginTypePropertyDefinition() {
509    return PD_PLUGIN_TYPE;
510  }
511
512
513
514  /**
515   * Get the "update-interval" property definition.
516   * <p>
517   * Specifies the interval in seconds when referential integrity
518   * updates are made.
519   * <p>
520   * If this value is 0, then the updates are made synchronously in
521   * the foreground.
522   *
523   * @return Returns the "update-interval" property definition.
524   */
525  public DurationPropertyDefinition getUpdateIntervalPropertyDefinition() {
526    return PD_UPDATE_INTERVAL;
527  }
528
529
530
531  /**
532   * Managed object client implementation.
533   */
534  private static class ReferentialIntegrityPluginCfgClientImpl implements
535    ReferentialIntegrityPluginCfgClient {
536
537    // Private implementation.
538    private ManagedObject<? extends ReferentialIntegrityPluginCfgClient> impl;
539
540
541
542    // Private constructor.
543    private ReferentialIntegrityPluginCfgClientImpl(
544        ManagedObject<? extends ReferentialIntegrityPluginCfgClient> impl) {
545      this.impl = impl;
546    }
547
548
549
550    /**
551     * {@inheritDoc}
552     */
553    public SortedSet<AttributeType> getAttributeType() {
554      return impl.getPropertyValues(INSTANCE.getAttributeTypePropertyDefinition());
555    }
556
557
558
559    /**
560     * {@inheritDoc}
561     */
562    public void setAttributeType(Collection<AttributeType> values) {
563      impl.setPropertyValues(INSTANCE.getAttributeTypePropertyDefinition(), values);
564    }
565
566
567
568    /**
569     * {@inheritDoc}
570     */
571    public SortedSet<DN> getBaseDN() {
572      return impl.getPropertyValues(INSTANCE.getBaseDNPropertyDefinition());
573    }
574
575
576
577    /**
578     * {@inheritDoc}
579     */
580    public void setBaseDN(Collection<DN> values) {
581      impl.setPropertyValues(INSTANCE.getBaseDNPropertyDefinition(), values);
582    }
583
584
585
586    /**
587     * {@inheritDoc}
588     */
589    public boolean isCheckReferences() {
590      return impl.getPropertyValue(INSTANCE.getCheckReferencesPropertyDefinition());
591    }
592
593
594
595    /**
596     * {@inheritDoc}
597     */
598    public void setCheckReferences(Boolean value) {
599      impl.setPropertyValue(INSTANCE.getCheckReferencesPropertyDefinition(), value);
600    }
601
602
603
604    /**
605     * {@inheritDoc}
606     */
607    public SortedSet<String> getCheckReferencesFilterCriteria() {
608      return impl.getPropertyValues(INSTANCE.getCheckReferencesFilterCriteriaPropertyDefinition());
609    }
610
611
612
613    /**
614     * {@inheritDoc}
615     */
616    public void setCheckReferencesFilterCriteria(Collection<String> values) {
617      impl.setPropertyValues(INSTANCE.getCheckReferencesFilterCriteriaPropertyDefinition(), values);
618    }
619
620
621
622    /**
623     * {@inheritDoc}
624     */
625    public CheckReferencesScopeCriteria getCheckReferencesScopeCriteria() {
626      return impl.getPropertyValue(INSTANCE.getCheckReferencesScopeCriteriaPropertyDefinition());
627    }
628
629
630
631    /**
632     * {@inheritDoc}
633     */
634    public void setCheckReferencesScopeCriteria(CheckReferencesScopeCriteria value) {
635      impl.setPropertyValue(INSTANCE.getCheckReferencesScopeCriteriaPropertyDefinition(), value);
636    }
637
638
639
640    /**
641     * {@inheritDoc}
642     */
643    public Boolean isEnabled() {
644      return impl.getPropertyValue(INSTANCE.getEnabledPropertyDefinition());
645    }
646
647
648
649    /**
650     * {@inheritDoc}
651     */
652    public void setEnabled(boolean value) {
653      impl.setPropertyValue(INSTANCE.getEnabledPropertyDefinition(), value);
654    }
655
656
657
658    /**
659     * {@inheritDoc}
660     */
661    public boolean isInvokeForInternalOperations() {
662      return impl.getPropertyValue(INSTANCE.getInvokeForInternalOperationsPropertyDefinition());
663    }
664
665
666
667    /**
668     * {@inheritDoc}
669     */
670    public void setInvokeForInternalOperations(Boolean value) {
671      impl.setPropertyValue(INSTANCE.getInvokeForInternalOperationsPropertyDefinition(), value);
672    }
673
674
675
676    /**
677     * {@inheritDoc}
678     */
679    public String getJavaClass() {
680      return impl.getPropertyValue(INSTANCE.getJavaClassPropertyDefinition());
681    }
682
683
684
685    /**
686     * {@inheritDoc}
687     */
688    public void setJavaClass(String value) {
689      impl.setPropertyValue(INSTANCE.getJavaClassPropertyDefinition(), value);
690    }
691
692
693
694    /**
695     * {@inheritDoc}
696     */
697    public String getLogFile() {
698      return impl.getPropertyValue(INSTANCE.getLogFilePropertyDefinition());
699    }
700
701
702
703    /**
704     * {@inheritDoc}
705     */
706    public void setLogFile(String value) {
707      impl.setPropertyValue(INSTANCE.getLogFilePropertyDefinition(), value);
708    }
709
710
711
712    /**
713     * {@inheritDoc}
714     */
715    public SortedSet<PluginType> getPluginType() {
716      return impl.getPropertyValues(INSTANCE.getPluginTypePropertyDefinition());
717    }
718
719
720
721    /**
722     * {@inheritDoc}
723     */
724    public void setPluginType(Collection<PluginType> values) {
725      impl.setPropertyValues(INSTANCE.getPluginTypePropertyDefinition(), values);
726    }
727
728
729
730    /**
731     * {@inheritDoc}
732     */
733    public long getUpdateInterval() {
734      return impl.getPropertyValue(INSTANCE.getUpdateIntervalPropertyDefinition());
735    }
736
737
738
739    /**
740     * {@inheritDoc}
741     */
742    public void setUpdateInterval(Long value) {
743      impl.setPropertyValue(INSTANCE.getUpdateIntervalPropertyDefinition(), value);
744    }
745
746
747
748    /**
749     * {@inheritDoc}
750     */
751    public ManagedObjectDefinition<? extends ReferentialIntegrityPluginCfgClient, ? extends ReferentialIntegrityPluginCfg> definition() {
752      return INSTANCE;
753    }
754
755
756
757    /**
758     * {@inheritDoc}
759     */
760    public PropertyProvider properties() {
761      return impl;
762    }
763
764
765
766    /**
767     * {@inheritDoc}
768     */
769    public void commit() throws ManagedObjectAlreadyExistsException,
770        MissingMandatoryPropertiesException, ConcurrentModificationException,
771        OperationRejectedException, AuthorizationException,
772        CommunicationException {
773      impl.commit();
774    }
775
776  }
777
778
779
780  /**
781   * Managed object server implementation.
782   */
783  private static class ReferentialIntegrityPluginCfgServerImpl implements
784    ReferentialIntegrityPluginCfg {
785
786    // Private implementation.
787    private ServerManagedObject<? extends ReferentialIntegrityPluginCfg> impl;
788
789    // The value of the "attribute-type" property.
790    private final SortedSet<AttributeType> pAttributeType;
791
792    // The value of the "base-dn" property.
793    private final SortedSet<DN> pBaseDN;
794
795    // The value of the "check-references" property.
796    private final boolean pCheckReferences;
797
798    // The value of the "check-references-filter-criteria" property.
799    private final SortedSet<String> pCheckReferencesFilterCriteria;
800
801    // The value of the "check-references-scope-criteria" property.
802    private final CheckReferencesScopeCriteria pCheckReferencesScopeCriteria;
803
804    // The value of the "enabled" property.
805    private final boolean pEnabled;
806
807    // The value of the "invoke-for-internal-operations" property.
808    private final boolean pInvokeForInternalOperations;
809
810    // The value of the "java-class" property.
811    private final String pJavaClass;
812
813    // The value of the "log-file" property.
814    private final String pLogFile;
815
816    // The value of the "plugin-type" property.
817    private final SortedSet<PluginType> pPluginType;
818
819    // The value of the "update-interval" property.
820    private final long pUpdateInterval;
821
822
823
824    // Private constructor.
825    private ReferentialIntegrityPluginCfgServerImpl(ServerManagedObject<? extends ReferentialIntegrityPluginCfg> impl) {
826      this.impl = impl;
827      this.pAttributeType = impl.getPropertyValues(INSTANCE.getAttributeTypePropertyDefinition());
828      this.pBaseDN = impl.getPropertyValues(INSTANCE.getBaseDNPropertyDefinition());
829      this.pCheckReferences = impl.getPropertyValue(INSTANCE.getCheckReferencesPropertyDefinition());
830      this.pCheckReferencesFilterCriteria = impl.getPropertyValues(INSTANCE.getCheckReferencesFilterCriteriaPropertyDefinition());
831      this.pCheckReferencesScopeCriteria = impl.getPropertyValue(INSTANCE.getCheckReferencesScopeCriteriaPropertyDefinition());
832      this.pEnabled = impl.getPropertyValue(INSTANCE.getEnabledPropertyDefinition());
833      this.pInvokeForInternalOperations = impl.getPropertyValue(INSTANCE.getInvokeForInternalOperationsPropertyDefinition());
834      this.pJavaClass = impl.getPropertyValue(INSTANCE.getJavaClassPropertyDefinition());
835      this.pLogFile = impl.getPropertyValue(INSTANCE.getLogFilePropertyDefinition());
836      this.pPluginType = impl.getPropertyValues(INSTANCE.getPluginTypePropertyDefinition());
837      this.pUpdateInterval = impl.getPropertyValue(INSTANCE.getUpdateIntervalPropertyDefinition());
838    }
839
840
841
842    /**
843     * {@inheritDoc}
844     */
845    public void addReferentialIntegrityChangeListener(
846        ConfigurationChangeListener<ReferentialIntegrityPluginCfg> listener) {
847      impl.registerChangeListener(listener);
848    }
849
850
851
852    /**
853     * {@inheritDoc}
854     */
855    public void removeReferentialIntegrityChangeListener(
856        ConfigurationChangeListener<ReferentialIntegrityPluginCfg> listener) {
857      impl.deregisterChangeListener(listener);
858    }
859    /**
860     * {@inheritDoc}
861     */
862    public void addChangeListener(
863        ConfigurationChangeListener<PluginCfg> listener) {
864      impl.registerChangeListener(listener);
865    }
866
867
868
869    /**
870     * {@inheritDoc}
871     */
872    public void removeChangeListener(
873        ConfigurationChangeListener<PluginCfg> listener) {
874      impl.deregisterChangeListener(listener);
875    }
876
877
878
879    /**
880     * {@inheritDoc}
881     */
882    public SortedSet<AttributeType> getAttributeType() {
883      return pAttributeType;
884    }
885
886
887
888    /**
889     * {@inheritDoc}
890     */
891    public SortedSet<DN> getBaseDN() {
892      return pBaseDN;
893    }
894
895
896
897    /**
898     * {@inheritDoc}
899     */
900    public boolean isCheckReferences() {
901      return pCheckReferences;
902    }
903
904
905
906    /**
907     * {@inheritDoc}
908     */
909    public SortedSet<String> getCheckReferencesFilterCriteria() {
910      return pCheckReferencesFilterCriteria;
911    }
912
913
914
915    /**
916     * {@inheritDoc}
917     */
918    public CheckReferencesScopeCriteria getCheckReferencesScopeCriteria() {
919      return pCheckReferencesScopeCriteria;
920    }
921
922
923
924    /**
925     * {@inheritDoc}
926     */
927    public boolean isEnabled() {
928      return pEnabled;
929    }
930
931
932
933    /**
934     * {@inheritDoc}
935     */
936    public boolean isInvokeForInternalOperations() {
937      return pInvokeForInternalOperations;
938    }
939
940
941
942    /**
943     * {@inheritDoc}
944     */
945    public String getJavaClass() {
946      return pJavaClass;
947    }
948
949
950
951    /**
952     * {@inheritDoc}
953     */
954    public String getLogFile() {
955      return pLogFile;
956    }
957
958
959
960    /**
961     * {@inheritDoc}
962     */
963    public SortedSet<PluginType> getPluginType() {
964      return pPluginType;
965    }
966
967
968
969    /**
970     * {@inheritDoc}
971     */
972    public long getUpdateInterval() {
973      return pUpdateInterval;
974    }
975
976
977
978    /**
979     * {@inheritDoc}
980     */
981    public Class<? extends ReferentialIntegrityPluginCfg> configurationClass() {
982      return ReferentialIntegrityPluginCfg.class;
983    }
984
985
986
987    /**
988     * {@inheritDoc}
989     */
990    public DN dn() {
991      return impl.getDN();
992    }
993
994  }
995}