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.client;
027
028
029
030import java.net.InetAddress;
031import java.util.Collection;
032import java.util.SortedSet;
033import org.forgerock.opendj.config.client.ConcurrentModificationException;
034import org.forgerock.opendj.config.client.ManagedObjectDecodingException;
035import org.forgerock.opendj.config.ConfigurationClient;
036import org.forgerock.opendj.config.DefinitionDecodingException;
037import org.forgerock.opendj.config.ManagedObjectDefinition;
038import org.forgerock.opendj.config.ManagedObjectNotFoundException;
039import org.forgerock.opendj.config.PropertyException;
040import org.forgerock.opendj.ldap.DN;
041import org.forgerock.opendj.ldap.LdapException;
042import org.forgerock.opendj.server.config.meta.ReplicationDomainCfgDefn.AssuredType;
043import org.forgerock.opendj.server.config.meta.ReplicationDomainCfgDefn.IsolationPolicy;
044import org.forgerock.opendj.server.config.server.ReplicationDomainCfg;
045
046
047
048/**
049 * A client-side interface for reading and modifying Replication
050 * Domain settings.
051 * <p>
052 * A Replication Domain comprises of several Directory Servers sharing
053 * the same synchronized set of data.
054 */
055public interface ReplicationDomainCfgClient extends ConfigurationClient {
056
057  /**
058   * Get the configuration definition associated with this Replication Domain.
059   *
060   * @return Returns the configuration definition associated with this Replication Domain.
061   */
062  ManagedObjectDefinition<? extends ReplicationDomainCfgClient, ? extends ReplicationDomainCfg> definition();
063
064
065
066  /**
067   * Gets the "assured-sd-level" property.
068   * <p>
069   * The level of acknowledgment for Safe Data assured sub mode.
070   * <p>
071   * When assured replication is configured in Safe Data mode, this
072   * value defines the number of replication servers (with the same
073   * group ID of the local server) that should acknowledge the sent
074   * update before the LDAP client call can return.
075   *
076   * @return Returns the value of the "assured-sd-level" property.
077   */
078  int getAssuredSdLevel();
079
080
081
082  /**
083   * Sets the "assured-sd-level" property.
084   * <p>
085   * The level of acknowledgment for Safe Data assured sub mode.
086   * <p>
087   * When assured replication is configured in Safe Data mode, this
088   * value defines the number of replication servers (with the same
089   * group ID of the local server) that should acknowledge the sent
090   * update before the LDAP client call can return.
091   *
092   * @param value The value of the "assured-sd-level" property.
093   * @throws PropertyException
094   *           If the new value is invalid.
095   */
096  void setAssuredSdLevel(Integer value) throws PropertyException;
097
098
099
100  /**
101   * Gets the "assured-timeout" property.
102   * <p>
103   * The timeout value when waiting for assured replication
104   * acknowledgments.
105   * <p>
106   * Defines the amount of milliseconds the server will wait for
107   * assured acknowledgments (in either Safe Data or Safe Read assured
108   * replication modes) before returning anyway the LDAP client call.
109   *
110   * @return Returns the value of the "assured-timeout" property.
111   */
112  long getAssuredTimeout();
113
114
115
116  /**
117   * Sets the "assured-timeout" property.
118   * <p>
119   * The timeout value when waiting for assured replication
120   * acknowledgments.
121   * <p>
122   * Defines the amount of milliseconds the server will wait for
123   * assured acknowledgments (in either Safe Data or Safe Read assured
124   * replication modes) before returning anyway the LDAP client call.
125   *
126   * @param value The value of the "assured-timeout" property.
127   * @throws PropertyException
128   *           If the new value is invalid.
129   */
130  void setAssuredTimeout(Long value) throws PropertyException;
131
132
133
134  /**
135   * Gets the "assured-type" property.
136   * <p>
137   * Defines the assured replication mode of the replicated domain.
138   * <p>
139   * The assured replication can be disabled or enabled. When enabled,
140   * two modes are available: Safe Data or Safe Read modes.
141   *
142   * @return Returns the value of the "assured-type" property.
143   */
144  AssuredType getAssuredType();
145
146
147
148  /**
149   * Sets the "assured-type" property.
150   * <p>
151   * Defines the assured replication mode of the replicated domain.
152   * <p>
153   * The assured replication can be disabled or enabled. When enabled,
154   * two modes are available: Safe Data or Safe Read modes.
155   *
156   * @param value The value of the "assured-type" property.
157   * @throws PropertyException
158   *           If the new value is invalid.
159   */
160  void setAssuredType(AssuredType value) throws PropertyException;
161
162
163
164  /**
165   * Gets the "base-dn" property.
166   * <p>
167   * Specifies the base DN of the replicated data.
168   *
169   * @return Returns the value of the "base-dn" property.
170   */
171  DN getBaseDN();
172
173
174
175  /**
176   * Sets the "base-dn" property.
177   * <p>
178   * Specifies the base DN of the replicated data.
179   * <p>
180   * This property is read-only and can only be modified during
181   * creation of a Replication Domain.
182   *
183   * @param value The value of the "base-dn" property.
184   * @throws PropertyException
185   *           If the new value is invalid.
186   * @throws PropertyException
187   *           If this Replication Domain is not being initialized.
188   */
189  void setBaseDN(DN value) throws PropertyException, PropertyException;
190
191
192
193  /**
194   * Gets the "changetime-heartbeat-interval" property.
195   * <p>
196   * Specifies the heart-beat interval that the directory server will
197   * use when sending its local change time to the Replication Server.
198   * <p>
199   * The directory server sends a regular heart-beat to the
200   * Replication within the specified interval. The heart-beat
201   * indicates the change time of the directory server to the
202   * Replication Server.
203   *
204   * @return Returns the value of the "changetime-heartbeat-interval" property.
205   */
206  long getChangetimeHeartbeatInterval();
207
208
209
210  /**
211   * Sets the "changetime-heartbeat-interval" property.
212   * <p>
213   * Specifies the heart-beat interval that the directory server will
214   * use when sending its local change time to the Replication Server.
215   * <p>
216   * The directory server sends a regular heart-beat to the
217   * Replication within the specified interval. The heart-beat
218   * indicates the change time of the directory server to the
219   * Replication Server.
220   *
221   * @param value The value of the "changetime-heartbeat-interval" property.
222   * @throws PropertyException
223   *           If the new value is invalid.
224   */
225  void setChangetimeHeartbeatInterval(Long value) throws PropertyException;
226
227
228
229  /**
230   * Gets the "conflicts-historical-purge-delay" property.
231   * <p>
232   * This delay indicates the time (in minutes) the domain keeps the
233   * historical information necessary to solve conflicts.When a change
234   * stored in the historical part of the user entry has a date (from
235   * its replication ChangeNumber) older than this delay, it is
236   * candidate to be purged. The purge is applied on 2 events: modify
237   * of the entry, dedicated purge task.
238   *
239   * @return Returns the value of the "conflicts-historical-purge-delay" property.
240   */
241  long getConflictsHistoricalPurgeDelay();
242
243
244
245  /**
246   * Sets the "conflicts-historical-purge-delay" property.
247   * <p>
248   * This delay indicates the time (in minutes) the domain keeps the
249   * historical information necessary to solve conflicts.When a change
250   * stored in the historical part of the user entry has a date (from
251   * its replication ChangeNumber) older than this delay, it is
252   * candidate to be purged. The purge is applied on 2 events: modify
253   * of the entry, dedicated purge task.
254   *
255   * @param value The value of the "conflicts-historical-purge-delay" property.
256   * @throws PropertyException
257   *           If the new value is invalid.
258   */
259  void setConflictsHistoricalPurgeDelay(Long value) throws PropertyException;
260
261
262
263  /**
264   * Gets the "fractional-exclude" property.
265   * <p>
266   * Allows to exclude some attributes to replicate to this server.
267   * <p>
268   * If fractional-exclude configuration attribute is used, attributes
269   * specified in this attribute will be ignored (not
270   * added/modified/deleted) when an operation performed from another
271   * directory server is being replayed in the local server. Note that
272   * the usage of this configuration attribute is mutually exclusive
273   * with the usage of the fractional-include attribute.
274   *
275   * @return Returns the values of the "fractional-exclude" property.
276   */
277  SortedSet<String> getFractionalExclude();
278
279
280
281  /**
282   * Sets the "fractional-exclude" property.
283   * <p>
284   * Allows to exclude some attributes to replicate to this server.
285   * <p>
286   * If fractional-exclude configuration attribute is used, attributes
287   * specified in this attribute will be ignored (not
288   * added/modified/deleted) when an operation performed from another
289   * directory server is being replayed in the local server. Note that
290   * the usage of this configuration attribute is mutually exclusive
291   * with the usage of the fractional-include attribute.
292   *
293   * @param values The values of the "fractional-exclude" property.
294   * @throws PropertyException
295   *           If one or more of the new values are invalid.
296   */
297  void setFractionalExclude(Collection<String> values) throws PropertyException;
298
299
300
301  /**
302   * Gets the "fractional-include" property.
303   * <p>
304   * Allows to include some attributes to replicate to this server.
305   * <p>
306   * If fractional-include configuration attribute is used, only
307   * attributes specified in this attribute will be
308   * added/modified/deleted when an operation performed from another
309   * directory server is being replayed in the local server. Note that
310   * the usage of this configuration attribute is mutually exclusive
311   * with the usage of the fractional-exclude attribute.
312   *
313   * @return Returns the values of the "fractional-include" property.
314   */
315  SortedSet<String> getFractionalInclude();
316
317
318
319  /**
320   * Sets the "fractional-include" property.
321   * <p>
322   * Allows to include some attributes to replicate to this server.
323   * <p>
324   * If fractional-include configuration attribute is used, only
325   * attributes specified in this attribute will be
326   * added/modified/deleted when an operation performed from another
327   * directory server is being replayed in the local server. Note that
328   * the usage of this configuration attribute is mutually exclusive
329   * with the usage of the fractional-exclude attribute.
330   *
331   * @param values The values of the "fractional-include" property.
332   * @throws PropertyException
333   *           If one or more of the new values are invalid.
334   */
335  void setFractionalInclude(Collection<String> values) throws PropertyException;
336
337
338
339  /**
340   * Gets the "group-id" property.
341   * <p>
342   * The group ID associated with this replicated domain.
343   * <p>
344   * This value defines the group ID of the replicated domain. The
345   * replication system will preferably connect and send updates to
346   * replicate to a replication server with the same group ID as its
347   * own one (the local server group ID).
348   *
349   * @return Returns the value of the "group-id" property.
350   */
351  int getGroupId();
352
353
354
355  /**
356   * Sets the "group-id" property.
357   * <p>
358   * The group ID associated with this replicated domain.
359   * <p>
360   * This value defines the group ID of the replicated domain. The
361   * replication system will preferably connect and send updates to
362   * replicate to a replication server with the same group ID as its
363   * own one (the local server group ID).
364   *
365   * @param value The value of the "group-id" property.
366   * @throws PropertyException
367   *           If the new value is invalid.
368   */
369  void setGroupId(Integer value) throws PropertyException;
370
371
372
373  /**
374   * Gets the "heartbeat-interval" property.
375   * <p>
376   * Specifies the heart-beat interval that the directory server will
377   * use when communicating with Replication Servers.
378   * <p>
379   * The directory server expects a regular heart-beat coming from the
380   * Replication Server within the specified interval. If a heartbeat
381   * is not received within the interval, the Directory Server closes
382   * its connection and connects to another Replication Server.
383   *
384   * @return Returns the value of the "heartbeat-interval" property.
385   */
386  long getHeartbeatInterval();
387
388
389
390  /**
391   * Sets the "heartbeat-interval" property.
392   * <p>
393   * Specifies the heart-beat interval that the directory server will
394   * use when communicating with Replication Servers.
395   * <p>
396   * The directory server expects a regular heart-beat coming from the
397   * Replication Server within the specified interval. If a heartbeat
398   * is not received within the interval, the Directory Server closes
399   * its connection and connects to another Replication Server.
400   *
401   * @param value The value of the "heartbeat-interval" property.
402   * @throws PropertyException
403   *           If the new value is invalid.
404   */
405  void setHeartbeatInterval(Long value) throws PropertyException;
406
407
408
409  /**
410   * Gets the "initialization-window-size" property.
411   * <p>
412   * Specifies the window size that this directory server may use when
413   * communicating with remote Directory Servers for initialization.
414   *
415   * @return Returns the value of the "initialization-window-size" property.
416   */
417  int getInitializationWindowSize();
418
419
420
421  /**
422   * Sets the "initialization-window-size" property.
423   * <p>
424   * Specifies the window size that this directory server may use when
425   * communicating with remote Directory Servers for initialization.
426   *
427   * @param value The value of the "initialization-window-size" property.
428   * @throws PropertyException
429   *           If the new value is invalid.
430   */
431  void setInitializationWindowSize(Integer value) throws PropertyException;
432
433
434
435  /**
436   * Gets the "isolation-policy" property.
437   * <p>
438   * Specifies the behavior of the directory server if a write
439   * operation is attempted on the data within the Replication Domain
440   * when none of the configured Replication Servers are available.
441   *
442   * @return Returns the value of the "isolation-policy" property.
443   */
444  IsolationPolicy getIsolationPolicy();
445
446
447
448  /**
449   * Sets the "isolation-policy" property.
450   * <p>
451   * Specifies the behavior of the directory server if a write
452   * operation is attempted on the data within the Replication Domain
453   * when none of the configured Replication Servers are available.
454   *
455   * @param value The value of the "isolation-policy" property.
456   * @throws PropertyException
457   *           If the new value is invalid.
458   */
459  void setIsolationPolicy(IsolationPolicy value) throws PropertyException;
460
461
462
463  /**
464   * Gets the "log-changenumber" property.
465   * <p>
466   * Indicates if this server logs the ChangeNumber in access log.
467   * <p>
468   * This boolean indicates if the domain should log the ChangeNumber
469   * of replicated operations in the access log.
470   *
471   * @return Returns the value of the "log-changenumber" property.
472   */
473  boolean isLogChangenumber();
474
475
476
477  /**
478   * Sets the "log-changenumber" property.
479   * <p>
480   * Indicates if this server logs the ChangeNumber in access log.
481   * <p>
482   * This boolean indicates if the domain should log the ChangeNumber
483   * of replicated operations in the access log.
484   *
485   * @param value The value of the "log-changenumber" property.
486   * @throws PropertyException
487   *           If the new value is invalid.
488   */
489  void setLogChangenumber(Boolean value) throws PropertyException;
490
491
492
493  /**
494   * Gets the "referrals-url" property.
495   * <p>
496   * The URLs other LDAP servers should use to refer to the local
497   * server.
498   * <p>
499   * URLs used by peer servers in the topology to refer to the local
500   * server through LDAP referrals. If this attribute is not defined,
501   * every URLs available to access this server will be used. If
502   * defined, only URLs specified here will be used.
503   *
504   * @return Returns the values of the "referrals-url" property.
505   */
506  SortedSet<String> getReferralsUrl();
507
508
509
510  /**
511   * Sets the "referrals-url" property.
512   * <p>
513   * The URLs other LDAP servers should use to refer to the local
514   * server.
515   * <p>
516   * URLs used by peer servers in the topology to refer to the local
517   * server through LDAP referrals. If this attribute is not defined,
518   * every URLs available to access this server will be used. If
519   * defined, only URLs specified here will be used.
520   *
521   * @param values The values of the "referrals-url" property.
522   * @throws PropertyException
523   *           If one or more of the new values are invalid.
524   */
525  void setReferralsUrl(Collection<String> values) throws PropertyException;
526
527
528
529  /**
530   * Gets the "replication-server" property.
531   * <p>
532   * Specifies the addresses of the Replication Servers within the
533   * Replication Domain to which the directory server should try to
534   * connect at startup time.
535   * <p>
536   * Addresses must be specified using the syntax: hostname:port
537   *
538   * @return Returns the values of the "replication-server" property.
539   */
540  SortedSet<String> getReplicationServer();
541
542
543
544  /**
545   * Sets the "replication-server" property.
546   * <p>
547   * Specifies the addresses of the Replication Servers within the
548   * Replication Domain to which the directory server should try to
549   * connect at startup time.
550   * <p>
551   * Addresses must be specified using the syntax: hostname:port
552   *
553   * @param values The values of the "replication-server" property.
554   * @throws PropertyException
555   *           If one or more of the new values are invalid.
556   */
557  void setReplicationServer(Collection<String> values) throws PropertyException;
558
559
560
561  /**
562   * Gets the "server-id" property.
563   * <p>
564   * Specifies a unique identifier for the directory server within the
565   * Replication Domain.
566   * <p>
567   * Each directory server within the same Replication Domain must
568   * have a different server ID. A directory server which is a member
569   * of multiple Replication Domains may use the same server ID for
570   * each of its Replication Domain configurations.
571   *
572   * @return Returns the value of the "server-id" property.
573   */
574  Integer getServerId();
575
576
577
578  /**
579   * Sets the "server-id" property.
580   * <p>
581   * Specifies a unique identifier for the directory server within the
582   * Replication Domain.
583   * <p>
584   * Each directory server within the same Replication Domain must
585   * have a different server ID. A directory server which is a member
586   * of multiple Replication Domains may use the same server ID for
587   * each of its Replication Domain configurations.
588   * <p>
589   * This property is read-only and can only be modified during
590   * creation of a Replication Domain.
591   *
592   * @param value The value of the "server-id" property.
593   * @throws PropertyException
594   *           If the new value is invalid.
595   * @throws PropertyException
596   *           If this Replication Domain is not being initialized.
597   */
598  void setServerId(int value) throws PropertyException, PropertyException;
599
600
601
602  /**
603   * Gets the "solve-conflicts" property.
604   * <p>
605   * Indicates if this server solves conflict.
606   * <p>
607   * This boolean indicates if this domain keeps the historical
608   * information necessary to solve conflicts. When set to false the
609   * server will not maintain historical information and will therefore
610   * not be able to solve conflict. This should therefore be done only
611   * if the replication is used in a single master type of deployment.
612   *
613   * @return Returns the value of the "solve-conflicts" property.
614   */
615  boolean isSolveConflicts();
616
617
618
619  /**
620   * Sets the "solve-conflicts" property.
621   * <p>
622   * Indicates if this server solves conflict.
623   * <p>
624   * This boolean indicates if this domain keeps the historical
625   * information necessary to solve conflicts. When set to false the
626   * server will not maintain historical information and will therefore
627   * not be able to solve conflict. This should therefore be done only
628   * if the replication is used in a single master type of deployment.
629   *
630   * @param value The value of the "solve-conflicts" property.
631   * @throws PropertyException
632   *           If the new value is invalid.
633   */
634  void setSolveConflicts(Boolean value) throws PropertyException;
635
636
637
638  /**
639   * Gets the "source-address" property.
640   * <p>
641   * If specified, the server will bind to the address before
642   * connecting to the remote server.
643   * <p>
644   * The address must be one assigned to an existing network
645   * interface.
646   *
647   * @return Returns the value of the "source-address" property.
648   */
649  InetAddress getSourceAddress();
650
651
652
653  /**
654   * Sets the "source-address" property.
655   * <p>
656   * If specified, the server will bind to the address before
657   * connecting to the remote server.
658   * <p>
659   * The address must be one assigned to an existing network
660   * interface.
661   *
662   * @param value The value of the "source-address" property.
663   * @throws PropertyException
664   *           If the new value is invalid.
665   */
666  void setSourceAddress(InetAddress value) throws PropertyException;
667
668
669
670  /**
671   * Gets the "window-size" property.
672   * <p>
673   * Specifies the window size that the directory server will use when
674   * communicating with Replication Servers.
675   * <p>
676   * This option may be deprecated and removed in future releases.
677   *
678   * @return Returns the value of the "window-size" property.
679   */
680  int getWindowSize();
681
682
683
684  /**
685   * Sets the "window-size" property.
686   * <p>
687   * Specifies the window size that the directory server will use when
688   * communicating with Replication Servers.
689   * <p>
690   * This option may be deprecated and removed in future releases.
691   *
692   * @param value The value of the "window-size" property.
693   * @throws PropertyException
694   *           If the new value is invalid.
695   */
696  void setWindowSize(Integer value) throws PropertyException;
697
698
699
700  /**
701   * Gets the External Changelog Domain.
702   *
703   * @return Returns the External Changelog Domain.
704   * @throws DefinitionDecodingException
705   *           If the External Changelog Domain was found but its type
706   *           could not be determined.
707   * @throws ManagedObjectDecodingException
708   *           If the External Changelog Domain was found but one or
709   *           more of its properties could not be decoded.
710   * @throws ManagedObjectNotFoundException
711   *           If the External Changelog Domain could not be found on
712   *           the server.
713   * @throws ConcurrentModificationException
714   *           If this Replication Domain has been removed from the
715   *           server by another client.
716   * @throws LdapException
717   *           If any other error occurs.
718   */
719  ExternalChangelogDomainCfgClient getExternalChangelogDomain()
720      throws DefinitionDecodingException, ManagedObjectDecodingException,
721      ManagedObjectNotFoundException, ConcurrentModificationException,
722      LdapException;
723
724}