001/*
002 * The contents of this file are subject to the terms of the Common Development and
003 * Distribution License (the License). You may not use this file except in compliance with the
004 * License.
005 *
006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
007 * specific language governing permission and limitations under the License.
008 *
009 * When distributing Covered Software, include this CDDL Header Notice in each file and include
010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
011 * Header, with the fields enclosed by brackets [] replaced by your own identifying
012 * information: "Portions Copyright [year] [name of copyright owner]".
013 *
014 * Copyright 2008 Sun Microsystems, Inc.
015 */
016package org.opends.server.admin.std.client;
017
018
019
020import java.util.Collection;
021import org.opends.server.admin.client.AuthorizationException;
022import org.opends.server.admin.client.CommunicationException;
023import org.opends.server.admin.client.ConcurrentModificationException;
024import org.opends.server.admin.client.IllegalManagedObjectNameException;
025import org.opends.server.admin.client.ManagedObjectDecodingException;
026import org.opends.server.admin.client.OperationRejectedException;
027import org.opends.server.admin.DefinitionDecodingException;
028import org.opends.server.admin.ManagedObjectDefinition;
029import org.opends.server.admin.ManagedObjectNotFoundException;
030import org.opends.server.admin.PropertyException;
031import org.opends.server.admin.std.server.ReplicationDomainCfg;
032import org.opends.server.admin.std.server.ReplicationServerCfg;
033import org.opends.server.admin.std.server.ReplicationSynchronizationProviderCfg;
034
035
036
037/**
038 * A client-side interface for reading and modifying Replication
039 * Synchronization Provider settings.
040 * <p>
041 * The Replication Synchronization Provider provides multi-master
042 * replication of data across multiple directory server instances.
043 */
044public interface ReplicationSynchronizationProviderCfgClient extends SynchronizationProviderCfgClient {
045
046  /**
047   * Get the configuration definition associated with this Replication Synchronization Provider.
048   *
049   * @return Returns the configuration definition associated with this Replication Synchronization Provider.
050   */
051  ManagedObjectDefinition<? extends ReplicationSynchronizationProviderCfgClient, ? extends ReplicationSynchronizationProviderCfg> definition();
052
053
054
055  /**
056   * Gets the "connection-timeout" property.
057   * <p>
058   * Specifies the timeout used when connecting to peers and when
059   * performing SSL negotiation.
060   *
061   * @return Returns the value of the "connection-timeout" property.
062   */
063  long getConnectionTimeout();
064
065
066
067  /**
068   * Sets the "connection-timeout" property.
069   * <p>
070   * Specifies the timeout used when connecting to peers and when
071   * performing SSL negotiation.
072   *
073   * @param value The value of the "connection-timeout" property.
074   * @throws PropertyException
075   *           If the new value is invalid.
076   */
077  void setConnectionTimeout(Long value) throws PropertyException;
078
079
080
081  /**
082   * Gets the "java-class" property.
083   * <p>
084   * Specifies the fully-qualified name of the Java class that
085   * provides the Replication Synchronization Provider implementation.
086   *
087   * @return Returns the value of the "java-class" property.
088   */
089  String getJavaClass();
090
091
092
093  /**
094   * Sets the "java-class" property.
095   * <p>
096   * Specifies the fully-qualified name of the Java class that
097   * provides the Replication Synchronization Provider implementation.
098   *
099   * @param value The value of the "java-class" property.
100   * @throws PropertyException
101   *           If the new value is invalid.
102   */
103  void setJavaClass(String value) throws PropertyException;
104
105
106
107  /**
108   * Gets the "num-update-replay-threads" property.
109   * <p>
110   * Specifies the number of update replay threads.
111   * <p>
112   * This value is the number of threads created for replaying every
113   * updates received for all the replication domains.
114   *
115   * @return Returns the value of the "num-update-replay-threads" property.
116   */
117  Integer getNumUpdateReplayThreads();
118
119
120
121  /**
122   * Sets the "num-update-replay-threads" property.
123   * <p>
124   * Specifies the number of update replay threads.
125   * <p>
126   * This value is the number of threads created for replaying every
127   * updates received for all the replication domains.
128   *
129   * @param value The value of the "num-update-replay-threads" property.
130   * @throws PropertyException
131   *           If the new value is invalid.
132   */
133  void setNumUpdateReplayThreads(Integer value) throws PropertyException;
134
135
136
137  /**
138   * Lists the Replication Domains.
139   *
140   * @return Returns an array containing the names of the Replication
141   *         Domains.
142   * @throws ConcurrentModificationException
143   *           If this Replication Synchronization Provider has been
144   *           removed from the server by another client.
145   * @throws AuthorizationException
146   *           If the server refuses to list the Replication Domains
147   *           because the client does not have the correct privileges.
148   * @throws CommunicationException
149   *           If the client cannot contact the server due to an
150   *           underlying communication problem.
151   */
152  String[] listReplicationDomains() throws ConcurrentModificationException,
153      AuthorizationException, CommunicationException;
154
155
156
157  /**
158   * Gets the named Replication Domain.
159   *
160   * @param name
161   *           The name of the Replication Domain to retrieve.
162   * @return Returns the named Replication Domain.
163   * @throws DefinitionDecodingException
164   *           If the named Replication Domain was found but its type
165   *           could not be determined.
166   * @throws ManagedObjectDecodingException
167   *           If the named Replication Domain was found but one or
168   *           more of its properties could not be decoded.
169   * @throws ManagedObjectNotFoundException
170   *           If the named Replication Domain was not found on the
171   *           server.
172   * @throws ConcurrentModificationException
173   *           If this Replication Synchronization Provider has been
174   *           removed from the server by another client.
175   * @throws AuthorizationException
176   *           If the server refuses to retrieve the named Replication
177   *           Domain because the client does not have the correct
178   *           privileges.
179   * @throws CommunicationException
180   *           If the client cannot contact the server due to an
181   *           underlying communication problem.
182   */
183  ReplicationDomainCfgClient getReplicationDomain(String name)
184      throws DefinitionDecodingException, ManagedObjectDecodingException,
185      ManagedObjectNotFoundException, ConcurrentModificationException,
186      AuthorizationException, CommunicationException;
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 AuthorizationException
232   *           If the server refuses to remove the Replication Domain
233   *           because the client does not have the correct privileges.
234   * @throws CommunicationException
235   *           If the client cannot contact the server due to an
236   *           underlying communication problem.
237   */
238  void removeReplicationDomain(String name)
239      throws ManagedObjectNotFoundException, OperationRejectedException,
240      ConcurrentModificationException, AuthorizationException,
241      CommunicationException;
242
243
244
245  /**
246   * Determines whether or not the Replication Server exists.
247   *
248   * @return Returns <true> if the Replication Server exists.
249   * @throws ConcurrentModificationException
250   *           If this Replication Synchronization Provider has been
251   *           removed from the server by another client.
252   * @throws AuthorizationException
253   *           If the server refuses to make the determination because
254   *           the client does not have the correct privileges.
255   * @throws CommunicationException
256   *           If the client cannot contact the server due to an
257   *           underlying communication problem.
258   */
259  boolean hasReplicationServer() throws ConcurrentModificationException,
260      AuthorizationException, CommunicationException;
261
262
263
264  /**
265   * Gets the Replication Server if it is present.
266   *
267   * @return Returns the Replication Server if it is present.
268   * @throws DefinitionDecodingException
269   *           If the Replication Server was found but its type could
270   *           not be determined.
271   * @throws ManagedObjectDecodingException
272   *           If the Replication Server was found but one or more of
273   *           its properties could not be decoded.
274   * @throws ManagedObjectNotFoundException
275   *           If the Replication Server is not present.
276   * @throws ConcurrentModificationException
277   *           If this Replication Synchronization Provider has been
278   *           removed from the server by another client.
279   * @throws AuthorizationException
280   *           If the server refuses to retrieve the Replication
281   *           Server because the client does not have the correct
282   *           privileges.
283   * @throws CommunicationException
284   *           If the client cannot contact the server due to an
285   *           underlying communication problem.
286   */
287  ReplicationServerCfgClient getReplicationServer()
288      throws DefinitionDecodingException, ManagedObjectDecodingException,
289      ManagedObjectNotFoundException, ConcurrentModificationException,
290      AuthorizationException, CommunicationException;
291
292
293
294  /**
295   * Creates a new Replication Server. The new Replication Server will
296   * initially not contain any property values (including mandatory
297   * properties). Once the Replication Server has been configured it
298   * can be added to the server using the {@link #commit()} method.
299   *
300   * @param <C>
301   *          The type of the Replication Server being created.
302   * @param d
303   *          The definition of the Replication Server to be created.
304   * @param exceptions
305   *          An optional collection in which to place any {@link
306   *          PropertyException}s that occurred whilst attempting to
307   *          determine the default values of the Replication Server.
308   *          This argument can be <code>null<code>.
309   * @return Returns a new Replication Server configuration instance.
310   */
311  <C extends ReplicationServerCfgClient> C createReplicationServer(
312      ManagedObjectDefinition<C, ? extends ReplicationServerCfg> d, Collection<PropertyException> exceptions);
313
314
315
316  /**
317   * Removes the Replication Server if it exists.
318   *
319   * @throws ManagedObjectNotFoundException
320   *           If the Replication Server does not exist.
321   * @throws OperationRejectedException
322   *           If the server refuses to remove the Replication Server
323   *           due to some server-side constraint which cannot be
324   *           satisfied (for example, if it is referenced by another
325   *           managed object).
326   * @throws ConcurrentModificationException
327   *           If this Replication Synchronization Provider has been
328   *           removed from the server by another client.
329   * @throws AuthorizationException
330   *           If the server refuses to remove the Replication Server
331   *           because the client does not have the correct privileges.
332   * @throws CommunicationException
333   *           If the client cannot contact the server due to an
334   *           underlying communication problem.
335   */
336  void removeReplicationServer()
337      throws ManagedObjectNotFoundException, OperationRejectedException,
338      ConcurrentModificationException, AuthorizationException,
339      CommunicationException;
340
341}