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.util.Collection;
031import org.forgerock.opendj.config.client.ConcurrentModificationException;
032import org.forgerock.opendj.config.client.IllegalManagedObjectNameException;
033import org.forgerock.opendj.config.client.ManagedObjectDecodingException;
034import org.forgerock.opendj.config.client.OperationRejectedException;
035import org.forgerock.opendj.config.DefinitionDecodingException;
036import org.forgerock.opendj.config.ManagedObjectDefinition;
037import org.forgerock.opendj.config.ManagedObjectNotFoundException;
038import org.forgerock.opendj.config.PropertyException;
039import org.forgerock.opendj.ldap.LdapException;
040import org.forgerock.opendj.server.config.server.ReplicationDomainCfg;
041import org.forgerock.opendj.server.config.server.ReplicationServerCfg;
042import org.forgerock.opendj.server.config.server.ReplicationSynchronizationProviderCfg;
043
044
045
046/**
047 * A client-side interface for reading and modifying Replication
048 * Synchronization Provider settings.
049 * <p>
050 * The Replication Synchronization Provider provides multi-master
051 * replication of data across multiple directory server instances.
052 */
053public interface ReplicationSynchronizationProviderCfgClient extends SynchronizationProviderCfgClient {
054
055  /**
056   * Get the configuration definition associated with this Replication Synchronization Provider.
057   *
058   * @return Returns the configuration definition associated with this Replication Synchronization Provider.
059   */
060  ManagedObjectDefinition<? extends ReplicationSynchronizationProviderCfgClient, ? extends ReplicationSynchronizationProviderCfg> definition();
061
062
063
064  /**
065   * Gets the "connection-timeout" property.
066   * <p>
067   * Specifies the timeout used when connecting to peers and when
068   * performing SSL negotiation.
069   *
070   * @return Returns the value of the "connection-timeout" property.
071   */
072  long getConnectionTimeout();
073
074
075
076  /**
077   * Sets the "connection-timeout" property.
078   * <p>
079   * Specifies the timeout used when connecting to peers and when
080   * performing SSL negotiation.
081   *
082   * @param value The value of the "connection-timeout" property.
083   * @throws PropertyException
084   *           If the new value is invalid.
085   */
086  void setConnectionTimeout(Long value) throws PropertyException;
087
088
089
090  /**
091   * Gets the "java-class" property.
092   * <p>
093   * Specifies the fully-qualified name of the Java class that
094   * provides the Replication Synchronization Provider implementation.
095   *
096   * @return Returns the value of the "java-class" property.
097   */
098  String getJavaClass();
099
100
101
102  /**
103   * Sets the "java-class" property.
104   * <p>
105   * Specifies the fully-qualified name of the Java class that
106   * provides the Replication Synchronization Provider implementation.
107   *
108   * @param value The value of the "java-class" property.
109   * @throws PropertyException
110   *           If the new value is invalid.
111   */
112  void setJavaClass(String value) throws PropertyException;
113
114
115
116  /**
117   * Gets the "num-update-replay-threads" property.
118   * <p>
119   * Specifies the number of update replay threads.
120   * <p>
121   * This value is the number of threads created for replaying every
122   * updates received for all the replication domains.
123   *
124   * @return Returns the value of the "num-update-replay-threads" property.
125   */
126  int getNumUpdateReplayThreads();
127
128
129
130  /**
131   * Sets the "num-update-replay-threads" property.
132   * <p>
133   * Specifies the number of update replay threads.
134   * <p>
135   * This value is the number of threads created for replaying every
136   * updates received for all the replication domains.
137   *
138   * @param value The value of the "num-update-replay-threads" property.
139   * @throws PropertyException
140   *           If the new value is invalid.
141   */
142  void setNumUpdateReplayThreads(Integer value) throws PropertyException;
143
144
145
146  /**
147   * Lists the Replication Domains.
148   *
149   * @return Returns an array containing the names of the Replication
150   *         Domains.
151   * @throws ConcurrentModificationException
152   *           If this Replication Synchronization Provider has been
153   *           removed from the server by another client.
154   * @throws LdapException
155   *           If any other error occurs.
156   */
157  String[] listReplicationDomains() throws ConcurrentModificationException,
158      LdapException;
159
160
161
162  /**
163   * Gets the named Replication Domain.
164   *
165   * @param name
166   *           The name of the Replication Domain to retrieve.
167   * @return Returns the named Replication Domain.
168   * @throws DefinitionDecodingException
169   *           If the named Replication Domain was found but its type
170   *           could not be determined.
171   * @throws ManagedObjectDecodingException
172   *           If the named Replication Domain was found but one or
173   *           more of its properties could not be decoded.
174   * @throws ManagedObjectNotFoundException
175   *           If the named Replication Domain was not found on the
176   *           server.
177   * @throws ConcurrentModificationException
178   *           If this Replication Synchronization Provider has been
179   *           removed from the server by another client.
180   * @throws LdapException
181   *           If any other error occurs.
182   */
183  ReplicationDomainCfgClient getReplicationDomain(String name)
184      throws DefinitionDecodingException, ManagedObjectDecodingException,
185      ManagedObjectNotFoundException, ConcurrentModificationException,
186      LdapException;
187
188
189
190  /**
191   * Creates a new Replication Domain. The new Replication Domain will
192   * initially not contain any property values (including mandatory
193   * properties). Once the Replication Domain has been configured it
194   * can be added to the server using the {@link #commit()} method.
195   *
196   * @param <C>
197   *          The type of the Replication Domain being created.
198   * @param d
199   *          The definition of the Replication Domain to be created.
200   * @param name
201   *          The name of the new Replication Domain.
202   * @param exceptions
203   *          An optional collection in which to place any {@link
204   *          PropertyException}s that occurred whilst attempting to
205   *          determine the default values of the Replication Domain.
206   *          This argument can be <code>null<code>.
207   * @return Returns a new Replication Domain configuration instance.
208   * @throws IllegalManagedObjectNameException
209   *          If the name of the new Replication Domain is invalid.
210   */
211  <C extends ReplicationDomainCfgClient> C createReplicationDomain(
212      ManagedObjectDefinition<C, ? extends ReplicationDomainCfg> d, String name, Collection<PropertyException> exceptions) throws IllegalManagedObjectNameException;
213
214
215
216  /**
217   * Removes the named Replication Domain.
218   *
219   * @param name
220   *          The name of the Replication Domain to remove.
221   * @throws ManagedObjectNotFoundException
222   *           If the Replication Domain does not exist.
223   * @throws OperationRejectedException
224   *           If the server refuses to remove the Replication Domain
225   *           due to some server-side constraint which cannot be
226   *           satisfied (for example, if it is referenced by another
227   *           managed object).
228   * @throws ConcurrentModificationException
229   *           If this Replication Synchronization Provider has been
230   *           removed from the server by another client.
231   * @throws LdapException
232   *           If any other error occurs.
233   */
234  void removeReplicationDomain(String name)
235      throws ManagedObjectNotFoundException, OperationRejectedException,
236      ConcurrentModificationException, LdapException;
237
238
239
240  /**
241   * Determines whether or not the Replication Server exists.
242   *
243   * @return Returns <true> if the Replication Server exists.
244   * @throws ConcurrentModificationException
245   *           If this Replication Synchronization Provider has been
246   *           removed from the server by another client.
247   * @throws LdapException
248   *           If any other error occurs.
249   */
250  boolean hasReplicationServer() throws ConcurrentModificationException,
251      LdapException;
252
253
254
255  /**
256   * Gets the Replication Server if it is present.
257   *
258   * @return Returns the Replication Server if it is present.
259   * @throws DefinitionDecodingException
260   *           If the Replication Server was found but its type could
261   *           not be determined.
262   * @throws ManagedObjectDecodingException
263   *           If the Replication Server was found but one or more of
264   *           its properties could not be decoded.
265   * @throws ManagedObjectNotFoundException
266   *           If the Replication Server is not present.
267   * @throws ConcurrentModificationException
268   *           If this Replication Synchronization Provider has been
269   *           removed from the server by another client.
270   * @throws LdapException
271   *           If any other error occurs.
272   */
273  ReplicationServerCfgClient getReplicationServer()
274      throws DefinitionDecodingException, ManagedObjectDecodingException,
275      ManagedObjectNotFoundException, ConcurrentModificationException,
276      LdapException;
277
278
279
280  /**
281   * Creates a new Replication Server. The new Replication Server will
282   * initially not contain any property values (including mandatory
283   * properties). Once the Replication Server has been configured it
284   * can be added to the server using the {@link #commit()} method.
285   *
286   * @param <C>
287   *          The type of the Replication Server being created.
288   * @param d
289   *          The definition of the Replication Server to be created.
290   * @param exceptions
291   *          An optional collection in which to place any {@link
292   *          PropertyException}s that occurred whilst attempting to
293   *          determine the default values of the Replication Server.
294   *          This argument can be <code>null<code>.
295   * @return Returns a new Replication Server configuration instance.
296   */
297  <C extends ReplicationServerCfgClient> C createReplicationServer(
298      ManagedObjectDefinition<C, ? extends ReplicationServerCfg> d, Collection<PropertyException> exceptions);
299
300
301
302  /**
303   * Removes the Replication Server if it exists.
304   *
305   * @throws ManagedObjectNotFoundException
306   *           If the Replication Server does not exist.
307   * @throws OperationRejectedException
308   *           If the server refuses to remove the Replication Server
309   *           due to some server-side constraint which cannot be
310   *           satisfied (for example, if it is referenced by another
311   *           managed object).
312   * @throws ConcurrentModificationException
313   *           If this Replication Synchronization Provider has been
314   *           removed from the server by another client.
315   * @throws LdapException
316   *           If any other error occurs.
317   */
318  void removeReplicationServer()
319      throws ManagedObjectNotFoundException, OperationRejectedException,
320      ConcurrentModificationException, LdapException;
321
322}