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