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