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 2006-2008 Sun Microsystems, Inc.
015 * Portions Copyright 2015 ForgeRock AS.
016 */
017
018package org.opends.guitools.uninstaller;
019
020import org.opends.admin.ads.ServerDescriptor;
021import org.opends.admin.ads.util.ApplicationTrustManager;
022import org.opends.quicksetup.UserData;
023
024import java.util.Set;
025import java.util.HashSet;
026
027/**
028 * UserData with specific properties for Uninstall.
029 */
030public class UninstallUserData extends UserData {
031
032  private Set<String> externalDbsToRemove = new HashSet<>();
033  private Set<String> externalLogsToRemove = new HashSet<>();
034  private boolean removeDatabases;
035  private boolean removeLogs;
036  private boolean removeLibrariesAndTools;
037  private boolean removeBackups;
038  private boolean removeLDIFs;
039  private boolean removeConfigurationAndSchema;
040  private boolean updateRemoteReplication;
041  private ApplicationTrustManager trustManager = new ApplicationTrustManager(null);
042  private String adminUID;
043  private String adminPwd;
044  private String localServerUrl;
045  private HashSet<ServerDescriptor> remoteServers = new HashSet<>();
046  private String replicationServer;
047  private String referencedHostName;
048
049  /**
050   * Sets the database directories located outside the installation which must
051   * be removed.
052   * @param dbPaths the directories of the database files.
053   */
054  public void setExternalDbsToRemove(Set<String> dbPaths)
055  {
056    externalDbsToRemove.clear();
057    externalDbsToRemove.addAll(dbPaths);
058  }
059
060  /**
061   * Returns the list of databases located outside the installation that must
062   * be removed.
063   * @return the list of databases located outside the installation that must
064   * be removed.
065   */
066  public Set<String> getExternalDbsToRemove()
067  {
068    return new HashSet<>(externalDbsToRemove);
069  }
070
071  /**
072   * Sets the log files located outside the installation which must
073   * be removed.
074   * @param logFiles the log files.
075   */
076  public void setExternalLogsToRemove(Set<String> logFiles)
077  {
078    externalLogsToRemove.clear();
079    externalLogsToRemove.addAll(logFiles);
080  }
081
082  /**
083   * Returns the list of log files located outside the installation that must
084   * be removed.
085   * @return the list of log files located outside the installation that must
086   * be removed.
087   */
088  public Set<String> getExternalLogsToRemove()
089  {
090    return new HashSet<>(externalLogsToRemove);
091  }
092
093  /**
094   * Returns whether the user wants to remove libraries and tools or not.
095   * @return <CODE>true</CODE> if the user wants to remove the libraries and
096   * tools and <CODE>false</CODE> otherwise.
097   */
098  public boolean getRemoveLibrariesAndTools()
099  {
100    return removeLibrariesAndTools;
101  }
102
103  /**
104   * Sets whether to remove libraries and tools or not.
105   * @param removeLibrariesAndTools remove libraries and tools or not.
106   */
107  public void setRemoveLibrariesAndTools(boolean removeLibrariesAndTools)
108  {
109    this.removeLibrariesAndTools = removeLibrariesAndTools;
110  }
111
112  /**
113   * Sets whether to remove databases or not.
114   * @param removeDatabases remove databases or not.
115   */
116  public void setRemoveDatabases(boolean removeDatabases)
117  {
118    this.removeDatabases = removeDatabases;
119  }
120
121  /**
122   * Returns whether the user wants to remove databases or not.
123   * @return <CODE>true</CODE> if the user wants to remove the databases and
124   * <CODE>false</CODE> otherwise.
125   */
126  public boolean getRemoveDatabases()
127  {
128    return removeDatabases;
129  }
130
131  /**
132   * Sets whether to remove backups or not.
133   * @param removeBackups remove backups or not.
134   */
135  public void setRemoveBackups(boolean removeBackups)
136  {
137    this.removeBackups = removeBackups;
138  }
139
140  /**
141   * Returns whether the user wants to remove backups or not.
142   * @return <CODE>true</CODE> if the user wants to remove the backups and
143   * <CODE>false</CODE> otherwise.
144   */
145  public boolean getRemoveBackups()
146  {
147    return removeBackups;
148  }
149
150  /**
151   * Sets whether to remove log files or not.
152   * @param removeLogs remove log files or not.
153   */
154  public void setRemoveLogs(boolean removeLogs)
155  {
156    this.removeLogs = removeLogs;
157  }
158
159  /**
160   * Returns whether the user wants to remove logs or not.
161   * @return <CODE>true</CODE> if the user wants to remove the log files and
162   * <CODE>false</CODE> otherwise.
163   */
164  public boolean getRemoveLogs()
165  {
166    return removeLogs;
167  }
168
169  /**
170   * Sets whether to remove LDIF files or not.
171   * @param removeLDIFs remove LDIF files or not.
172   */
173  public void setRemoveLDIFs(boolean removeLDIFs)
174  {
175    this.removeLDIFs = removeLDIFs;
176  }
177
178  /**
179   * Returns whether the user wants to remove LDIF files or not.
180   * @return <CODE>true</CODE> if the user wants to remove the LDIF files and
181   * <CODE>false</CODE> otherwise.
182   */
183  public boolean getRemoveLDIFs()
184  {
185    return removeLDIFs;
186  }
187
188  /**
189   * Sets whether to remove configuration and schema files or not.
190   * @param removeConfigurationAndSchema remove configuration and schema files
191   * or not.
192   */
193  public void setRemoveConfigurationAndSchema(
194      boolean removeConfigurationAndSchema)
195  {
196    this.removeConfigurationAndSchema = removeConfigurationAndSchema;
197  }
198
199  /**
200   * Returns whether the user wants to remove configuration and schema files or
201   * not.
202   * @return <CODE>true</CODE> if the user wants to remove the configuration
203   * and schema files and <CODE>false</CODE> otherwise.
204   */
205  public boolean getRemoveConfigurationAndSchema()
206  {
207    return removeConfigurationAndSchema;
208  }
209
210  /**
211   * Sets whether to update remote replication configuration or not.
212   * @param updateRemoteReplication update remote replication configuration
213   * or not.
214   */
215  public void setUpdateRemoteReplication(boolean updateRemoteReplication)
216  {
217    this.updateRemoteReplication = updateRemoteReplication;
218  }
219
220  /**
221   * Returns whether the user wants to update remote replication configuration
222   * or not.
223   * @return <CODE>true</CODE> if the user wants to update remote replication
224   * configuration and <CODE>false</CODE> otherwise.
225   */
226  public boolean getUpdateRemoteReplication()
227  {
228    return updateRemoteReplication;
229  }
230
231  /**
232   * Returns the trust manager that can be used to establish secure connections.
233   * @return the trust manager that can be used to establish secure connections.
234   */
235  public ApplicationTrustManager getTrustManager() {
236    return trustManager;
237  }
238
239  /**
240   * Sets the trust manager that can be used to establish secure connections.
241   * @param trustManager the trust manager that can be used to establish secure
242   * connections.
243   */
244  public void setTrustManager(ApplicationTrustManager trustManager) {
245    this.trustManager = trustManager;
246  }
247
248  /**
249   * Returns the administrator password provided by the user.
250   * @return the administrator password provided by the user.
251   */
252  public String getAdminPwd() {
253    return adminPwd;
254  }
255
256  /**
257   * Sets the administrator password provided by the user.
258   * @param adminPwd the administrator password provided by the user.
259   */
260  public void setAdminPwd(String adminPwd) {
261    this.adminPwd = adminPwd;
262  }
263
264  /**
265   * Returns the administrator UID provided by the user.
266   * @return the administrator UID provided by the user.
267   */
268  public String getAdminUID() {
269    return adminUID;
270  }
271
272  /**
273   * Sets the administrator UID provided by the user.
274   * @param adminUID the administrator UID provided by the user.
275   */
276  public void setAdminUID(String adminUID) {
277    this.adminUID = adminUID;
278  }
279
280  /**
281   * Returns the replication server as referenced in other servers.
282   * @return the replication server as referenced in other servers.
283   */
284  public String getReplicationServer() {
285    return replicationServer;
286  }
287
288  /**
289   * Sets the replication server as referenced in other servers.
290   * @param replicationServer the replication server as referenced in other
291   * servers.
292   */
293  public void setReplicationServer(String replicationServer) {
294    this.replicationServer = replicationServer;
295  }
296
297  /**
298   * Returns the server host name as referenced in other servers.
299   * @return the server host name as referenced in other servers.
300   */
301  public String getReferencedHostName() {
302    return referencedHostName;
303  }
304
305  /**
306   * Sets the server host name as referenced in other servers.
307   * @param referencedHostName server host name as referenced in other
308   * servers.
309   */
310  public void setReferencedHostName(String referencedHostName) {
311    this.referencedHostName = referencedHostName;
312  }
313
314  /**
315   * Returns the LDAP URL that we used to connect to the local server.
316   * @return the LDAP URL that we used to connect to the local server.
317   */
318  public String getLocalServerUrl() {
319    return localServerUrl;
320  }
321
322  /**
323   * Sets the LDAP URL that we used to connect to the local server.
324   * @param localServerUrl the LDAP URL that we used to connect to the local
325   * server.
326   */
327  public void setLocalServerUrl(String localServerUrl) {
328    this.localServerUrl = localServerUrl;
329  }
330
331  /**
332   * Returns a Set containing the ServerDescriptors discovered in the
333   * TopologyCache.
334   * @return a Set containing the ServerDescriptors discovered in the
335   * TopologyCache.
336   */
337  public Set<ServerDescriptor> getRemoteServers()
338  {
339    return new HashSet<>(remoteServers);
340  }
341
342  /**
343   * Sets the ServerDescriptors discovered in the TopologyCache.
344   * @param remoteServers the Set containing the ServerDescriptors discovered in
345   * the TopologyCache.
346   */
347  public void setRemoteServers(Set<ServerDescriptor> remoteServers)
348  {
349    this.remoteServers.clear();
350    this.remoteServers.addAll(remoteServers);
351  }
352
353}