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.forgerock.opendj.server.config.meta;
027
028
029
030import java.net.InetAddress;
031import java.util.Collection;
032import java.util.SortedSet;
033import org.forgerock.opendj.config.AdministratorAction;
034import org.forgerock.opendj.config.AliasDefaultBehaviorProvider;
035import org.forgerock.opendj.config.BooleanPropertyDefinition;
036import org.forgerock.opendj.config.client.ConcurrentModificationException;
037import org.forgerock.opendj.config.client.ManagedObject;
038import org.forgerock.opendj.config.client.MissingMandatoryPropertiesException;
039import org.forgerock.opendj.config.client.OperationRejectedException;
040import org.forgerock.opendj.config.DefaultBehaviorProvider;
041import org.forgerock.opendj.config.DefinedDefaultBehaviorProvider;
042import org.forgerock.opendj.config.DurationPropertyDefinition;
043import org.forgerock.opendj.config.EnumPropertyDefinition;
044import org.forgerock.opendj.config.IntegerPropertyDefinition;
045import org.forgerock.opendj.config.IPAddressPropertyDefinition;
046import org.forgerock.opendj.config.ManagedObjectAlreadyExistsException;
047import org.forgerock.opendj.config.ManagedObjectDefinition;
048import org.forgerock.opendj.config.PropertyException;
049import org.forgerock.opendj.config.PropertyOption;
050import org.forgerock.opendj.config.PropertyProvider;
051import org.forgerock.opendj.config.server.ConfigurationChangeListener;
052import org.forgerock.opendj.config.server.ServerManagedObject;
053import org.forgerock.opendj.config.StringPropertyDefinition;
054import org.forgerock.opendj.config.Tag;
055import org.forgerock.opendj.config.TopCfgDefn;
056import org.forgerock.opendj.config.UndefinedDefaultBehaviorProvider;
057import org.forgerock.opendj.ldap.DN;
058import org.forgerock.opendj.ldap.LdapException;
059import org.forgerock.opendj.server.config.client.ReplicationServerCfgClient;
060import org.forgerock.opendj.server.config.server.ReplicationServerCfg;
061
062
063
064/**
065 * An interface for querying the Replication Server managed object
066 * definition meta information.
067 * <p>
068 * Replication Servers publish updates to Directory Servers within a
069 * Replication Domain.
070 */
071public final class ReplicationServerCfgDefn extends ManagedObjectDefinition<ReplicationServerCfgClient, ReplicationServerCfg> {
072
073  // The singleton configuration definition instance.
074  private static final ReplicationServerCfgDefn INSTANCE = new ReplicationServerCfgDefn();
075
076
077
078  /**
079   * Defines the set of permissable values for the "replication-db-implementation" property.
080   * <p>
081   * The Replication Server database implementation that stores all
082   * persistent information.
083   */
084  public static enum ReplicationDBImplementation {
085
086    /**
087     * Implementation based on Berkeley DB JE database.
088     */
089    JE("je"),
090
091
092
093    /**
094     * Implementation based on log file.
095     */
096    LOG("log");
097
098
099
100    // String representation of the value.
101    private final String name;
102
103
104
105    // Private constructor.
106    private ReplicationDBImplementation(String name) { this.name = name; }
107
108
109
110    /**
111     * {@inheritDoc}
112     */
113    public String toString() { return name; }
114
115  }
116
117
118
119  // The "assured-timeout" property definition.
120  private static final DurationPropertyDefinition PD_ASSURED_TIMEOUT;
121
122
123
124  // The "compute-change-number" property definition.
125  private static final BooleanPropertyDefinition PD_COMPUTE_CHANGE_NUMBER;
126
127
128
129  // The "degraded-status-threshold" property definition.
130  private static final IntegerPropertyDefinition PD_DEGRADED_STATUS_THRESHOLD;
131
132
133
134  // The "group-id" property definition.
135  private static final IntegerPropertyDefinition PD_GROUP_ID;
136
137
138
139  // The "monitoring-period" property definition.
140  private static final DurationPropertyDefinition PD_MONITORING_PERIOD;
141
142
143
144  // The "queue-size" property definition.
145  private static final IntegerPropertyDefinition PD_QUEUE_SIZE;
146
147
148
149  // The "replication-db-directory" property definition.
150  private static final StringPropertyDefinition PD_REPLICATION_DB_DIRECTORY;
151
152
153
154  // The "replication-db-implementation" property definition.
155  private static final EnumPropertyDefinition<ReplicationDBImplementation> PD_REPLICATION_DB_IMPLEMENTATION;
156
157
158
159  // The "replication-port" property definition.
160  private static final IntegerPropertyDefinition PD_REPLICATION_PORT;
161
162
163
164  // The "replication-purge-delay" property definition.
165  private static final DurationPropertyDefinition PD_REPLICATION_PURGE_DELAY;
166
167
168
169  // The "replication-server" property definition.
170  private static final StringPropertyDefinition PD_REPLICATION_SERVER;
171
172
173
174  // The "replication-server-id" property definition.
175  private static final IntegerPropertyDefinition PD_REPLICATION_SERVER_ID;
176
177
178
179  // The "source-address" property definition.
180  private static final IPAddressPropertyDefinition PD_SOURCE_ADDRESS;
181
182
183
184  // The "weight" property definition.
185  private static final IntegerPropertyDefinition PD_WEIGHT;
186
187
188
189  // The "window-size" property definition.
190  private static final IntegerPropertyDefinition PD_WINDOW_SIZE;
191
192
193
194  // Build the "assured-timeout" property definition.
195  static {
196      DurationPropertyDefinition.Builder builder = DurationPropertyDefinition.createBuilder(INSTANCE, "assured-timeout");
197      builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "assured-timeout"));
198      DefaultBehaviorProvider<Long> provider = new DefinedDefaultBehaviorProvider<Long>("1000ms");
199      builder.setDefaultBehaviorProvider(provider);
200      builder.setBaseUnit("ms");
201      builder.setLowerLimit("1");
202      PD_ASSURED_TIMEOUT = builder.getInstance();
203      INSTANCE.registerPropertyDefinition(PD_ASSURED_TIMEOUT);
204  }
205
206
207
208  // Build the "compute-change-number" property definition.
209  static {
210      BooleanPropertyDefinition.Builder builder = BooleanPropertyDefinition.createBuilder(INSTANCE, "compute-change-number");
211      builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "compute-change-number"));
212      DefaultBehaviorProvider<Boolean> provider = new DefinedDefaultBehaviorProvider<Boolean>("true");
213      builder.setDefaultBehaviorProvider(provider);
214      PD_COMPUTE_CHANGE_NUMBER = builder.getInstance();
215      INSTANCE.registerPropertyDefinition(PD_COMPUTE_CHANGE_NUMBER);
216  }
217
218
219
220  // Build the "degraded-status-threshold" property definition.
221  static {
222      IntegerPropertyDefinition.Builder builder = IntegerPropertyDefinition.createBuilder(INSTANCE, "degraded-status-threshold");
223      builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "degraded-status-threshold"));
224      DefaultBehaviorProvider<Integer> provider = new DefinedDefaultBehaviorProvider<Integer>("5000");
225      builder.setDefaultBehaviorProvider(provider);
226      builder.setLowerLimit(0);
227      PD_DEGRADED_STATUS_THRESHOLD = builder.getInstance();
228      INSTANCE.registerPropertyDefinition(PD_DEGRADED_STATUS_THRESHOLD);
229  }
230
231
232
233  // Build the "group-id" property definition.
234  static {
235      IntegerPropertyDefinition.Builder builder = IntegerPropertyDefinition.createBuilder(INSTANCE, "group-id");
236      builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "group-id"));
237      DefaultBehaviorProvider<Integer> provider = new DefinedDefaultBehaviorProvider<Integer>("1");
238      builder.setDefaultBehaviorProvider(provider);
239      builder.setUpperLimit(127);
240      builder.setLowerLimit(1);
241      PD_GROUP_ID = builder.getInstance();
242      INSTANCE.registerPropertyDefinition(PD_GROUP_ID);
243  }
244
245
246
247  // Build the "monitoring-period" property definition.
248  static {
249      DurationPropertyDefinition.Builder builder = DurationPropertyDefinition.createBuilder(INSTANCE, "monitoring-period");
250      builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "monitoring-period"));
251      DefaultBehaviorProvider<Long> provider = new DefinedDefaultBehaviorProvider<Long>("60s");
252      builder.setDefaultBehaviorProvider(provider);
253      builder.setBaseUnit("ms");
254      builder.setLowerLimit("0");
255      PD_MONITORING_PERIOD = builder.getInstance();
256      INSTANCE.registerPropertyDefinition(PD_MONITORING_PERIOD);
257  }
258
259
260
261  // Build the "queue-size" property definition.
262  static {
263      IntegerPropertyDefinition.Builder builder = IntegerPropertyDefinition.createBuilder(INSTANCE, "queue-size");
264      builder.setOption(PropertyOption.ADVANCED);
265      builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "queue-size"));
266      DefaultBehaviorProvider<Integer> provider = new DefinedDefaultBehaviorProvider<Integer>("10000");
267      builder.setDefaultBehaviorProvider(provider);
268      PD_QUEUE_SIZE = builder.getInstance();
269      INSTANCE.registerPropertyDefinition(PD_QUEUE_SIZE);
270  }
271
272
273
274  // Build the "replication-db-directory" property definition.
275  static {
276      StringPropertyDefinition.Builder builder = StringPropertyDefinition.createBuilder(INSTANCE, "replication-db-directory");
277      builder.setOption(PropertyOption.READ_ONLY);
278      builder.setOption(PropertyOption.MANDATORY);
279      builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "replication-db-directory"));
280      DefaultBehaviorProvider<String> provider = new DefinedDefaultBehaviorProvider<String>("changelogDb");
281      builder.setDefaultBehaviorProvider(provider);
282      PD_REPLICATION_DB_DIRECTORY = builder.getInstance();
283      INSTANCE.registerPropertyDefinition(PD_REPLICATION_DB_DIRECTORY);
284  }
285
286
287
288  // Build the "replication-db-implementation" property definition.
289  static {
290      EnumPropertyDefinition.Builder<ReplicationDBImplementation> builder = EnumPropertyDefinition.createBuilder(INSTANCE, "replication-db-implementation");
291      builder.setOption(PropertyOption.ADVANCED);
292      builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "replication-db-implementation"));
293      DefaultBehaviorProvider<ReplicationDBImplementation> provider = new DefinedDefaultBehaviorProvider<ReplicationDBImplementation>("log");
294      builder.setDefaultBehaviorProvider(provider);
295      builder.setEnumClass(ReplicationDBImplementation.class);
296      PD_REPLICATION_DB_IMPLEMENTATION = builder.getInstance();
297      INSTANCE.registerPropertyDefinition(PD_REPLICATION_DB_IMPLEMENTATION);
298  }
299
300
301
302  // Build the "replication-port" property definition.
303  static {
304      IntegerPropertyDefinition.Builder builder = IntegerPropertyDefinition.createBuilder(INSTANCE, "replication-port");
305      builder.setOption(PropertyOption.MANDATORY);
306      builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "replication-port"));
307      builder.setDefaultBehaviorProvider(new UndefinedDefaultBehaviorProvider<Integer>());
308      builder.setUpperLimit(65535);
309      builder.setLowerLimit(1);
310      PD_REPLICATION_PORT = builder.getInstance();
311      INSTANCE.registerPropertyDefinition(PD_REPLICATION_PORT);
312  }
313
314
315
316  // Build the "replication-purge-delay" property definition.
317  static {
318      DurationPropertyDefinition.Builder builder = DurationPropertyDefinition.createBuilder(INSTANCE, "replication-purge-delay");
319      builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "replication-purge-delay"));
320      DefaultBehaviorProvider<Long> provider = new DefinedDefaultBehaviorProvider<Long>("3 days");
321      builder.setDefaultBehaviorProvider(provider);
322      builder.setAllowUnlimited(false);
323      builder.setBaseUnit("s");
324      PD_REPLICATION_PURGE_DELAY = builder.getInstance();
325      INSTANCE.registerPropertyDefinition(PD_REPLICATION_PURGE_DELAY);
326  }
327
328
329
330  // Build the "replication-server" property definition.
331  static {
332      StringPropertyDefinition.Builder builder = StringPropertyDefinition.createBuilder(INSTANCE, "replication-server");
333      builder.setOption(PropertyOption.MULTI_VALUED);
334      builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "replication-server"));
335      builder.setDefaultBehaviorProvider(new UndefinedDefaultBehaviorProvider<String>());
336      builder.setPattern("^.+:[0-9]+$", "HOST:PORT");
337      PD_REPLICATION_SERVER = builder.getInstance();
338      INSTANCE.registerPropertyDefinition(PD_REPLICATION_SERVER);
339  }
340
341
342
343  // Build the "replication-server-id" property definition.
344  static {
345      IntegerPropertyDefinition.Builder builder = IntegerPropertyDefinition.createBuilder(INSTANCE, "replication-server-id");
346      builder.setOption(PropertyOption.READ_ONLY);
347      builder.setOption(PropertyOption.MANDATORY);
348      builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "replication-server-id"));
349      builder.setDefaultBehaviorProvider(new UndefinedDefaultBehaviorProvider<Integer>());
350      builder.setUpperLimit(65535);
351      builder.setLowerLimit(1);
352      PD_REPLICATION_SERVER_ID = builder.getInstance();
353      INSTANCE.registerPropertyDefinition(PD_REPLICATION_SERVER_ID);
354  }
355
356
357
358  // Build the "source-address" property definition.
359  static {
360      IPAddressPropertyDefinition.Builder builder = IPAddressPropertyDefinition.createBuilder(INSTANCE, "source-address");
361      builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "source-address"));
362      builder.setDefaultBehaviorProvider(new AliasDefaultBehaviorProvider<InetAddress>(INSTANCE, "source-address"));
363      PD_SOURCE_ADDRESS = builder.getInstance();
364      INSTANCE.registerPropertyDefinition(PD_SOURCE_ADDRESS);
365  }
366
367
368
369  // Build the "weight" property definition.
370  static {
371      IntegerPropertyDefinition.Builder builder = IntegerPropertyDefinition.createBuilder(INSTANCE, "weight");
372      builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "weight"));
373      DefaultBehaviorProvider<Integer> provider = new DefinedDefaultBehaviorProvider<Integer>("1");
374      builder.setDefaultBehaviorProvider(provider);
375      builder.setLowerLimit(1);
376      PD_WEIGHT = builder.getInstance();
377      INSTANCE.registerPropertyDefinition(PD_WEIGHT);
378  }
379
380
381
382  // Build the "window-size" property definition.
383  static {
384      IntegerPropertyDefinition.Builder builder = IntegerPropertyDefinition.createBuilder(INSTANCE, "window-size");
385      builder.setOption(PropertyOption.ADVANCED);
386      builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "window-size"));
387      DefaultBehaviorProvider<Integer> provider = new DefinedDefaultBehaviorProvider<Integer>("100000");
388      builder.setDefaultBehaviorProvider(provider);
389      PD_WINDOW_SIZE = builder.getInstance();
390      INSTANCE.registerPropertyDefinition(PD_WINDOW_SIZE);
391  }
392
393
394
395  // Register the tags associated with this managed object definition.
396  static {
397    INSTANCE.registerTag(Tag.valueOf("replication"));
398  }
399
400
401
402  /**
403   * Get the Replication Server configuration definition singleton.
404   *
405   * @return Returns the Replication Server configuration definition
406   *         singleton.
407   */
408  public static ReplicationServerCfgDefn getInstance() {
409    return INSTANCE;
410  }
411
412
413
414  /**
415   * Private constructor.
416   */
417  private ReplicationServerCfgDefn() {
418    super("replication-server", TopCfgDefn.getInstance());
419  }
420
421
422
423  /**
424   * {@inheritDoc}
425   */
426  public ReplicationServerCfgClient createClientConfiguration(
427      ManagedObject<? extends ReplicationServerCfgClient> impl) {
428    return new ReplicationServerCfgClientImpl(impl);
429  }
430
431
432
433  /**
434   * {@inheritDoc}
435   */
436  public ReplicationServerCfg createServerConfiguration(
437      ServerManagedObject<? extends ReplicationServerCfg> impl) {
438    return new ReplicationServerCfgServerImpl(impl);
439  }
440
441
442
443  /**
444   * {@inheritDoc}
445   */
446  public Class<ReplicationServerCfg> getServerConfigurationClass() {
447    return ReplicationServerCfg.class;
448  }
449
450
451
452  /**
453   * Get the "assured-timeout" property definition.
454   * <p>
455   * The timeout value when waiting for assured mode acknowledgments.
456   * <p>
457   * Defines the number of milliseconds that the replication server
458   * will wait for assured acknowledgments (in either Safe Data or Safe
459   * Read assured sub modes) before forgetting them and answer to the
460   * entity that sent an update and is waiting for acknowledgment.
461   *
462   * @return Returns the "assured-timeout" property definition.
463   */
464  public DurationPropertyDefinition getAssuredTimeoutPropertyDefinition() {
465    return PD_ASSURED_TIMEOUT;
466  }
467
468
469
470  /**
471   * Get the "compute-change-number" property definition.
472   * <p>
473   * Whether the replication server will compute change numbers.
474   * <p>
475   * This boolean tells the replication server to compute change
476   * numbers for each replicated change by maintaining a change number
477   * index database. Changenumbers are computed according to
478   * http://tools.ietf.org/html/draft-good-ldap-changelog-04. Note this
479   * functionality has an impact on CPU, disk accesses and storage. If
480   * changenumbers are not required, it is advisable to set this value
481   * to false.
482   *
483   * @return Returns the "compute-change-number" property definition.
484   */
485  public BooleanPropertyDefinition getComputeChangeNumberPropertyDefinition() {
486    return PD_COMPUTE_CHANGE_NUMBER;
487  }
488
489
490
491  /**
492   * Get the "degraded-status-threshold" property definition.
493   * <p>
494   * The number of pending changes as threshold value for putting a
495   * directory server in degraded status.
496   * <p>
497   * This value represents a number of pending changes a replication
498   * server has in queue for sending to a directory server. Once this
499   * value is crossed, the matching directory server goes in degraded
500   * status. When number of pending changes goes back under this value,
501   * the directory server is put back in normal status. 0 means status
502   * analyzer is disabled and directory servers are never put in
503   * degraded status.
504   *
505   * @return Returns the "degraded-status-threshold" property definition.
506   */
507  public IntegerPropertyDefinition getDegradedStatusThresholdPropertyDefinition() {
508    return PD_DEGRADED_STATUS_THRESHOLD;
509  }
510
511
512
513  /**
514   * Get the "group-id" property definition.
515   * <p>
516   * The group id for the replication server.
517   * <p>
518   * This value defines the group id of the replication server. The
519   * replication system of a LDAP server uses the group id of the
520   * replicated domain and tries to connect, if possible, to a
521   * replication with the same group id.
522   *
523   * @return Returns the "group-id" property definition.
524   */
525  public IntegerPropertyDefinition getGroupIdPropertyDefinition() {
526    return PD_GROUP_ID;
527  }
528
529
530
531  /**
532   * Get the "monitoring-period" property definition.
533   * <p>
534   * The period between sending of monitoring messages.
535   * <p>
536   * Defines the duration that the replication server will wait before
537   * sending new monitoring messages to its peers (replication servers
538   * and directory servers). Larger values increase the length of time
539   * it takes for a directory server to detect and switch to a more
540   * suitable replication server, whereas smaller values increase the
541   * amount of background network traffic.
542   *
543   * @return Returns the "monitoring-period" property definition.
544   */
545  public DurationPropertyDefinition getMonitoringPeriodPropertyDefinition() {
546    return PD_MONITORING_PERIOD;
547  }
548
549
550
551  /**
552   * Get the "queue-size" property definition.
553   * <p>
554   * Specifies the number of changes that are kept in memory for each
555   * directory server in the Replication Domain.
556   *
557   * @return Returns the "queue-size" property definition.
558   */
559  public IntegerPropertyDefinition getQueueSizePropertyDefinition() {
560    return PD_QUEUE_SIZE;
561  }
562
563
564
565  /**
566   * Get the "replication-db-directory" property definition.
567   * <p>
568   * The path where the Replication Server stores all persistent
569   * information.
570   *
571   * @return Returns the "replication-db-directory" property definition.
572   */
573  public StringPropertyDefinition getReplicationDBDirectoryPropertyDefinition() {
574    return PD_REPLICATION_DB_DIRECTORY;
575  }
576
577
578
579  /**
580   * Get the "replication-db-implementation" property definition.
581   * <p>
582   * The Replication Server database implementation that stores all
583   * persistent information.
584   *
585   * @return Returns the "replication-db-implementation" property definition.
586   */
587  public EnumPropertyDefinition<ReplicationDBImplementation> getReplicationDBImplementationPropertyDefinition() {
588    return PD_REPLICATION_DB_IMPLEMENTATION;
589  }
590
591
592
593  /**
594   * Get the "replication-port" property definition.
595   * <p>
596   * The port on which this Replication Server waits for connections
597   * from other Replication Servers or Directory Servers.
598   *
599   * @return Returns the "replication-port" property definition.
600   */
601  public IntegerPropertyDefinition getReplicationPortPropertyDefinition() {
602    return PD_REPLICATION_PORT;
603  }
604
605
606
607  /**
608   * Get the "replication-purge-delay" property definition.
609   * <p>
610   * The time (in seconds) after which the Replication Server erases
611   * all persistent information.
612   *
613   * @return Returns the "replication-purge-delay" property definition.
614   */
615  public DurationPropertyDefinition getReplicationPurgeDelayPropertyDefinition() {
616    return PD_REPLICATION_PURGE_DELAY;
617  }
618
619
620
621  /**
622   * Get the "replication-server" property definition.
623   * <p>
624   * Specifies the addresses of other Replication Servers to which
625   * this Replication Server tries to connect at startup time.
626   * <p>
627   * Addresses must be specified using the syntax: "hostname:port". If
628   * IPv6 addresses are used as the hostname, they must be specified
629   * using the syntax "[IPv6Address]:port".
630   *
631   * @return Returns the "replication-server" property definition.
632   */
633  public StringPropertyDefinition getReplicationServerPropertyDefinition() {
634    return PD_REPLICATION_SERVER;
635  }
636
637
638
639  /**
640   * Get the "replication-server-id" property definition.
641   * <p>
642   * Specifies a unique identifier for the Replication Server.
643   * <p>
644   * Each Replication Server must have a different server ID.
645   *
646   * @return Returns the "replication-server-id" property definition.
647   */
648  public IntegerPropertyDefinition getReplicationServerIdPropertyDefinition() {
649    return PD_REPLICATION_SERVER_ID;
650  }
651
652
653
654  /**
655   * Get the "source-address" property definition.
656   * <p>
657   * If specified, the server will bind to the address before
658   * connecting to the remote server.
659   * <p>
660   * The address must be one assigned to an existing network
661   * interface.
662   *
663   * @return Returns the "source-address" property definition.
664   */
665  public IPAddressPropertyDefinition getSourceAddressPropertyDefinition() {
666    return PD_SOURCE_ADDRESS;
667  }
668
669
670
671  /**
672   * Get the "weight" property definition.
673   * <p>
674   * The weight of the replication server.
675   * <p>
676   * The weight affected to the replication server. Each replication
677   * server of the topology has a weight. When combined together, the
678   * weights of the replication servers of a same group can be
679   * translated to a percentage that determines the quantity of
680   * directory servers of the topology that should be connected to a
681   * replication server. For instance imagine a topology with 3
682   * replication servers (with the same group id) with the following
683   * weights: RS1=1, RS2=1, RS3=2. This means that RS1 should have 25%
684   * of the directory servers connected in the topology, RS2 25%, and
685   * RS3 50%. This may be useful if the replication servers of the
686   * topology have a different power and one wants to spread the load
687   * between the replication servers according to their power.
688   *
689   * @return Returns the "weight" property definition.
690   */
691  public IntegerPropertyDefinition getWeightPropertyDefinition() {
692    return PD_WEIGHT;
693  }
694
695
696
697  /**
698   * Get the "window-size" property definition.
699   * <p>
700   * Specifies the window size that the Replication Server uses when
701   * communicating with other Replication Servers.
702   * <p>
703   * This option may be deprecated and removed in future releases.
704   *
705   * @return Returns the "window-size" property definition.
706   */
707  public IntegerPropertyDefinition getWindowSizePropertyDefinition() {
708    return PD_WINDOW_SIZE;
709  }
710
711
712
713  /**
714   * Managed object client implementation.
715   */
716  private static class ReplicationServerCfgClientImpl implements
717    ReplicationServerCfgClient {
718
719    // Private implementation.
720    private ManagedObject<? extends ReplicationServerCfgClient> impl;
721
722
723
724    // Private constructor.
725    private ReplicationServerCfgClientImpl(
726        ManagedObject<? extends ReplicationServerCfgClient> impl) {
727      this.impl = impl;
728    }
729
730
731
732    /**
733     * {@inheritDoc}
734     */
735    public long getAssuredTimeout() {
736      return impl.getPropertyValue(INSTANCE.getAssuredTimeoutPropertyDefinition());
737    }
738
739
740
741    /**
742     * {@inheritDoc}
743     */
744    public void setAssuredTimeout(Long value) {
745      impl.setPropertyValue(INSTANCE.getAssuredTimeoutPropertyDefinition(), value);
746    }
747
748
749
750    /**
751     * {@inheritDoc}
752     */
753    public boolean isComputeChangeNumber() {
754      return impl.getPropertyValue(INSTANCE.getComputeChangeNumberPropertyDefinition());
755    }
756
757
758
759    /**
760     * {@inheritDoc}
761     */
762    public void setComputeChangeNumber(Boolean value) {
763      impl.setPropertyValue(INSTANCE.getComputeChangeNumberPropertyDefinition(), value);
764    }
765
766
767
768    /**
769     * {@inheritDoc}
770     */
771    public int getDegradedStatusThreshold() {
772      return impl.getPropertyValue(INSTANCE.getDegradedStatusThresholdPropertyDefinition());
773    }
774
775
776
777    /**
778     * {@inheritDoc}
779     */
780    public void setDegradedStatusThreshold(Integer value) {
781      impl.setPropertyValue(INSTANCE.getDegradedStatusThresholdPropertyDefinition(), value);
782    }
783
784
785
786    /**
787     * {@inheritDoc}
788     */
789    public int getGroupId() {
790      return impl.getPropertyValue(INSTANCE.getGroupIdPropertyDefinition());
791    }
792
793
794
795    /**
796     * {@inheritDoc}
797     */
798    public void setGroupId(Integer value) {
799      impl.setPropertyValue(INSTANCE.getGroupIdPropertyDefinition(), value);
800    }
801
802
803
804    /**
805     * {@inheritDoc}
806     */
807    public long getMonitoringPeriod() {
808      return impl.getPropertyValue(INSTANCE.getMonitoringPeriodPropertyDefinition());
809    }
810
811
812
813    /**
814     * {@inheritDoc}
815     */
816    public void setMonitoringPeriod(Long value) {
817      impl.setPropertyValue(INSTANCE.getMonitoringPeriodPropertyDefinition(), value);
818    }
819
820
821
822    /**
823     * {@inheritDoc}
824     */
825    public int getQueueSize() {
826      return impl.getPropertyValue(INSTANCE.getQueueSizePropertyDefinition());
827    }
828
829
830
831    /**
832     * {@inheritDoc}
833     */
834    public void setQueueSize(Integer value) {
835      impl.setPropertyValue(INSTANCE.getQueueSizePropertyDefinition(), value);
836    }
837
838
839
840    /**
841     * {@inheritDoc}
842     */
843    public String getReplicationDBDirectory() {
844      return impl.getPropertyValue(INSTANCE.getReplicationDBDirectoryPropertyDefinition());
845    }
846
847
848
849    /**
850     * {@inheritDoc}
851     */
852    public void setReplicationDBDirectory(String value) throws PropertyException {
853      impl.setPropertyValue(INSTANCE.getReplicationDBDirectoryPropertyDefinition(), value);
854    }
855
856
857
858    /**
859     * {@inheritDoc}
860     */
861    public ReplicationDBImplementation getReplicationDBImplementation() {
862      return impl.getPropertyValue(INSTANCE.getReplicationDBImplementationPropertyDefinition());
863    }
864
865
866
867    /**
868     * {@inheritDoc}
869     */
870    public void setReplicationDBImplementation(ReplicationDBImplementation value) {
871      impl.setPropertyValue(INSTANCE.getReplicationDBImplementationPropertyDefinition(), value);
872    }
873
874
875
876    /**
877     * {@inheritDoc}
878     */
879    public Integer getReplicationPort() {
880      return impl.getPropertyValue(INSTANCE.getReplicationPortPropertyDefinition());
881    }
882
883
884
885    /**
886     * {@inheritDoc}
887     */
888    public void setReplicationPort(int value) {
889      impl.setPropertyValue(INSTANCE.getReplicationPortPropertyDefinition(), value);
890    }
891
892
893
894    /**
895     * {@inheritDoc}
896     */
897    public long getReplicationPurgeDelay() {
898      return impl.getPropertyValue(INSTANCE.getReplicationPurgeDelayPropertyDefinition());
899    }
900
901
902
903    /**
904     * {@inheritDoc}
905     */
906    public void setReplicationPurgeDelay(Long value) {
907      impl.setPropertyValue(INSTANCE.getReplicationPurgeDelayPropertyDefinition(), value);
908    }
909
910
911
912    /**
913     * {@inheritDoc}
914     */
915    public SortedSet<String> getReplicationServer() {
916      return impl.getPropertyValues(INSTANCE.getReplicationServerPropertyDefinition());
917    }
918
919
920
921    /**
922     * {@inheritDoc}
923     */
924    public void setReplicationServer(Collection<String> values) {
925      impl.setPropertyValues(INSTANCE.getReplicationServerPropertyDefinition(), values);
926    }
927
928
929
930    /**
931     * {@inheritDoc}
932     */
933    public Integer getReplicationServerId() {
934      return impl.getPropertyValue(INSTANCE.getReplicationServerIdPropertyDefinition());
935    }
936
937
938
939    /**
940     * {@inheritDoc}
941     */
942    public void setReplicationServerId(int value) throws PropertyException {
943      impl.setPropertyValue(INSTANCE.getReplicationServerIdPropertyDefinition(), value);
944    }
945
946
947
948    /**
949     * {@inheritDoc}
950     */
951    public InetAddress getSourceAddress() {
952      return impl.getPropertyValue(INSTANCE.getSourceAddressPropertyDefinition());
953    }
954
955
956
957    /**
958     * {@inheritDoc}
959     */
960    public void setSourceAddress(InetAddress value) {
961      impl.setPropertyValue(INSTANCE.getSourceAddressPropertyDefinition(), value);
962    }
963
964
965
966    /**
967     * {@inheritDoc}
968     */
969    public int getWeight() {
970      return impl.getPropertyValue(INSTANCE.getWeightPropertyDefinition());
971    }
972
973
974
975    /**
976     * {@inheritDoc}
977     */
978    public void setWeight(Integer value) {
979      impl.setPropertyValue(INSTANCE.getWeightPropertyDefinition(), value);
980    }
981
982
983
984    /**
985     * {@inheritDoc}
986     */
987    public int getWindowSize() {
988      return impl.getPropertyValue(INSTANCE.getWindowSizePropertyDefinition());
989    }
990
991
992
993    /**
994     * {@inheritDoc}
995     */
996    public void setWindowSize(Integer value) {
997      impl.setPropertyValue(INSTANCE.getWindowSizePropertyDefinition(), value);
998    }
999
1000
1001
1002    /**
1003     * {@inheritDoc}
1004     */
1005    public ManagedObjectDefinition<? extends ReplicationServerCfgClient, ? extends ReplicationServerCfg> definition() {
1006      return INSTANCE;
1007    }
1008
1009
1010
1011    /**
1012     * {@inheritDoc}
1013     */
1014    public PropertyProvider properties() {
1015      return impl;
1016    }
1017
1018
1019
1020    /**
1021     * {@inheritDoc}
1022     */
1023    public void commit() throws ManagedObjectAlreadyExistsException,
1024        MissingMandatoryPropertiesException, ConcurrentModificationException,
1025        OperationRejectedException, LdapException {
1026      impl.commit();
1027    }
1028
1029  }
1030
1031
1032
1033  /**
1034   * Managed object server implementation.
1035   */
1036  private static class ReplicationServerCfgServerImpl implements
1037    ReplicationServerCfg {
1038
1039    // Private implementation.
1040    private ServerManagedObject<? extends ReplicationServerCfg> impl;
1041
1042    // The value of the "assured-timeout" property.
1043    private final long pAssuredTimeout;
1044
1045    // The value of the "compute-change-number" property.
1046    private final boolean pComputeChangeNumber;
1047
1048    // The value of the "degraded-status-threshold" property.
1049    private final int pDegradedStatusThreshold;
1050
1051    // The value of the "group-id" property.
1052    private final int pGroupId;
1053
1054    // The value of the "monitoring-period" property.
1055    private final long pMonitoringPeriod;
1056
1057    // The value of the "queue-size" property.
1058    private final int pQueueSize;
1059
1060    // The value of the "replication-db-directory" property.
1061    private final String pReplicationDBDirectory;
1062
1063    // The value of the "replication-db-implementation" property.
1064    private final ReplicationDBImplementation pReplicationDBImplementation;
1065
1066    // The value of the "replication-port" property.
1067    private final int pReplicationPort;
1068
1069    // The value of the "replication-purge-delay" property.
1070    private final long pReplicationPurgeDelay;
1071
1072    // The value of the "replication-server" property.
1073    private final SortedSet<String> pReplicationServer;
1074
1075    // The value of the "replication-server-id" property.
1076    private final int pReplicationServerId;
1077
1078    // The value of the "source-address" property.
1079    private final InetAddress pSourceAddress;
1080
1081    // The value of the "weight" property.
1082    private final int pWeight;
1083
1084    // The value of the "window-size" property.
1085    private final int pWindowSize;
1086
1087
1088
1089    // Private constructor.
1090    private ReplicationServerCfgServerImpl(ServerManagedObject<? extends ReplicationServerCfg> impl) {
1091      this.impl = impl;
1092      this.pAssuredTimeout = impl.getPropertyValue(INSTANCE.getAssuredTimeoutPropertyDefinition());
1093      this.pComputeChangeNumber = impl.getPropertyValue(INSTANCE.getComputeChangeNumberPropertyDefinition());
1094      this.pDegradedStatusThreshold = impl.getPropertyValue(INSTANCE.getDegradedStatusThresholdPropertyDefinition());
1095      this.pGroupId = impl.getPropertyValue(INSTANCE.getGroupIdPropertyDefinition());
1096      this.pMonitoringPeriod = impl.getPropertyValue(INSTANCE.getMonitoringPeriodPropertyDefinition());
1097      this.pQueueSize = impl.getPropertyValue(INSTANCE.getQueueSizePropertyDefinition());
1098      this.pReplicationDBDirectory = impl.getPropertyValue(INSTANCE.getReplicationDBDirectoryPropertyDefinition());
1099      this.pReplicationDBImplementation = impl.getPropertyValue(INSTANCE.getReplicationDBImplementationPropertyDefinition());
1100      this.pReplicationPort = impl.getPropertyValue(INSTANCE.getReplicationPortPropertyDefinition());
1101      this.pReplicationPurgeDelay = impl.getPropertyValue(INSTANCE.getReplicationPurgeDelayPropertyDefinition());
1102      this.pReplicationServer = impl.getPropertyValues(INSTANCE.getReplicationServerPropertyDefinition());
1103      this.pReplicationServerId = impl.getPropertyValue(INSTANCE.getReplicationServerIdPropertyDefinition());
1104      this.pSourceAddress = impl.getPropertyValue(INSTANCE.getSourceAddressPropertyDefinition());
1105      this.pWeight = impl.getPropertyValue(INSTANCE.getWeightPropertyDefinition());
1106      this.pWindowSize = impl.getPropertyValue(INSTANCE.getWindowSizePropertyDefinition());
1107    }
1108
1109
1110
1111    /**
1112     * {@inheritDoc}
1113     */
1114    public void addChangeListener(
1115        ConfigurationChangeListener<ReplicationServerCfg> listener) {
1116      impl.registerChangeListener(listener);
1117    }
1118
1119
1120
1121    /**
1122     * {@inheritDoc}
1123     */
1124    public void removeChangeListener(
1125        ConfigurationChangeListener<ReplicationServerCfg> listener) {
1126      impl.deregisterChangeListener(listener);
1127    }
1128
1129
1130
1131    /**
1132     * {@inheritDoc}
1133     */
1134    public long getAssuredTimeout() {
1135      return pAssuredTimeout;
1136    }
1137
1138
1139
1140    /**
1141     * {@inheritDoc}
1142     */
1143    public boolean isComputeChangeNumber() {
1144      return pComputeChangeNumber;
1145    }
1146
1147
1148
1149    /**
1150     * {@inheritDoc}
1151     */
1152    public int getDegradedStatusThreshold() {
1153      return pDegradedStatusThreshold;
1154    }
1155
1156
1157
1158    /**
1159     * {@inheritDoc}
1160     */
1161    public int getGroupId() {
1162      return pGroupId;
1163    }
1164
1165
1166
1167    /**
1168     * {@inheritDoc}
1169     */
1170    public long getMonitoringPeriod() {
1171      return pMonitoringPeriod;
1172    }
1173
1174
1175
1176    /**
1177     * {@inheritDoc}
1178     */
1179    public int getQueueSize() {
1180      return pQueueSize;
1181    }
1182
1183
1184
1185    /**
1186     * {@inheritDoc}
1187     */
1188    public String getReplicationDBDirectory() {
1189      return pReplicationDBDirectory;
1190    }
1191
1192
1193
1194    /**
1195     * {@inheritDoc}
1196     */
1197    public ReplicationDBImplementation getReplicationDBImplementation() {
1198      return pReplicationDBImplementation;
1199    }
1200
1201
1202
1203    /**
1204     * {@inheritDoc}
1205     */
1206    public int getReplicationPort() {
1207      return pReplicationPort;
1208    }
1209
1210
1211
1212    /**
1213     * {@inheritDoc}
1214     */
1215    public long getReplicationPurgeDelay() {
1216      return pReplicationPurgeDelay;
1217    }
1218
1219
1220
1221    /**
1222     * {@inheritDoc}
1223     */
1224    public SortedSet<String> getReplicationServer() {
1225      return pReplicationServer;
1226    }
1227
1228
1229
1230    /**
1231     * {@inheritDoc}
1232     */
1233    public int getReplicationServerId() {
1234      return pReplicationServerId;
1235    }
1236
1237
1238
1239    /**
1240     * {@inheritDoc}
1241     */
1242    public InetAddress getSourceAddress() {
1243      return pSourceAddress;
1244    }
1245
1246
1247
1248    /**
1249     * {@inheritDoc}
1250     */
1251    public int getWeight() {
1252      return pWeight;
1253    }
1254
1255
1256
1257    /**
1258     * {@inheritDoc}
1259     */
1260    public int getWindowSize() {
1261      return pWindowSize;
1262    }
1263
1264
1265
1266    /**
1267     * {@inheritDoc}
1268     */
1269    public Class<? extends ReplicationServerCfg> configurationClass() {
1270      return ReplicationServerCfg.class;
1271    }
1272
1273
1274
1275    /**
1276     * {@inheritDoc}
1277     */
1278    public DN dn() {
1279      return impl.getDN();
1280    }
1281
1282  }
1283}