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