| | |
| | | import java.net.URI; |
| | | import java.security.cert.X509Certificate; |
| | | import java.util.*; |
| | | import java.util.logging.Level; |
| | | import java.util.logging.Logger; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import java.awt.event.WindowEvent; |
| | | |
| | | import javax.naming.Context; |
| | |
| | | |
| | | private UninstallCliHelper cliHelper = new UninstallCliHelper(); |
| | | |
| | | private static final Logger LOG = |
| | | Logger.getLogger(Uninstaller.class.getName()); |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | private LoginDialog loginDialog; |
| | | private ProgressDialog startProgressDlg; |
| | |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | LOG.log(Level.WARNING, "Error enabling admin framework class loader: "+t, |
| | | t); |
| | | logger.warn(LocalizableMessage.raw("Error enabling admin framework class loader: "+t, |
| | | t)); |
| | | } |
| | | |
| | | // Switch off class name validation in client. |
| | |
| | | // Switch off attribute type name validation in client. |
| | | AttributeTypePropertyDefinition.setCheckSchema(false); |
| | | |
| | | LOG.log(Level.INFO, "Uninstaller is created."); |
| | | logger.debug(LocalizableMessage.raw("Uninstaller is created.")); |
| | | } |
| | | /** |
| | | * {@inheritDoc} |
| | |
| | | catch (UserDataException uude) { |
| | | throw uude; |
| | | } catch (Throwable t) { |
| | | LOG.log(Level.WARNING, "Error processing task: "+t, t); |
| | | logger.warn(LocalizableMessage.raw("Error processing task: "+t, t)); |
| | | throw new UserDataException(Step.CONFIRM_UNINSTALL, |
| | | getThrowableMsg(INFO_BUG_MSG.get(), t)); |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | LOG.log(Level.WARNING, "Error processing task: "+throwable, |
| | | throwable); |
| | | logger.warn(LocalizableMessage.raw("Error processing task: "+throwable, |
| | | throwable)); |
| | | qs.displayError(LocalizableMessage.raw(throwable.toString()), |
| | | INFO_ERROR_TITLE.get()); |
| | | } |
| | |
| | | */ |
| | | public void run() { |
| | | runStarted = true; |
| | | LOG.log(Level.INFO, "run of the Uninstaller started"); |
| | | logger.debug(LocalizableMessage.raw("run of the Uninstaller started")); |
| | | |
| | | initMaps(); |
| | | PrintStream origErr = System.err; |
| | |
| | | |
| | | boolean displaySeparator = false; |
| | | |
| | | LOG.log(Level.INFO, "Update remote replication? "+ |
| | | getUninstallUserData().getUpdateRemoteReplication()); |
| | | logger.debug(LocalizableMessage.raw("Update remote replication? "+ |
| | | getUninstallUserData().getUpdateRemoteReplication())); |
| | | if (getUninstallUserData().getUpdateRemoteReplication()) |
| | | { |
| | | status = UninstallProgressStep.UNCONFIGURING_REPLICATION; |
| | |
| | | displaySeparator = true; |
| | | } |
| | | |
| | | LOG.log(Level.INFO, "Stop server? "+getUserData().getStopServer()); |
| | | logger.debug(LocalizableMessage.raw("Stop server? "+getUserData().getStopServer())); |
| | | if (getUserData().getStopServer()) { |
| | | status = UninstallProgressStep.STOPPING_SERVER; |
| | | if (displaySeparator && isVerbose()) { |
| | |
| | | } |
| | | displaySeparator = true; |
| | | } |
| | | LOG.log(Level.INFO, "Is Windows Service Enabled? "+ |
| | | isWindowsServiceEnabled()); |
| | | logger.debug(LocalizableMessage.raw("Is Windows Service Enabled? "+ |
| | | isWindowsServiceEnabled())); |
| | | if (isWindowsServiceEnabled()) { |
| | | status = UninstallProgressStep.DISABLING_WINDOWS_SERVICE; |
| | | if (displaySeparator && isVerbose()) { |
| | |
| | | } |
| | | |
| | | } catch (ApplicationException ex) { |
| | | LOG.log(Level.SEVERE, "Error: "+ex, ex); |
| | | logger.error(LocalizableMessage.raw("Error: "+ex, ex)); |
| | | ue = ex; |
| | | status = UninstallProgressStep.FINISHED_WITH_ERROR; |
| | | LocalizableMessage msg = getFormattedError(ex, true); |
| | | notifyListeners(msg); |
| | | } |
| | | catch (Throwable t) { |
| | | LOG.log(Level.SEVERE, "Error: "+t, t); |
| | | logger.error(LocalizableMessage.raw("Error: "+t, t)); |
| | | ue = new ApplicationException( |
| | | ReturnCode.BUG, |
| | | getThrowableMsg(INFO_BUG_MSG.get(), t), t); |
| | |
| | | !equalsOrDescendant(file, parent); |
| | | } |
| | | |
| | | LOG.log(Level.INFO, "accept for :"+file+" is: "+accept); |
| | | logger.debug(LocalizableMessage.raw("accept for :"+file+" is: "+accept)); |
| | | return accept; |
| | | } |
| | | } |
| | |
| | | } |
| | | catch (NamingException ne) |
| | | { |
| | | LOG.log(Level.WARNING, "Could not find local server: "+ne, ne); |
| | | logger.warn(LocalizableMessage.raw("Could not find local server: "+ne, ne)); |
| | | getUninstallUserData().setLocalServerUrl("ldap://localhost:389"); |
| | | } |
| | | getUninstallUserData().setReplicationServer( |
| | |
| | | { |
| | | public TopologyCache processBackgroundTask() throws Throwable |
| | | { |
| | | LOG.log(Level.INFO, "Loading Topology Cache in askForAuthentication"); |
| | | logger.debug(LocalizableMessage.raw("Loading Topology Cache in askForAuthentication")); |
| | | ADSContext adsContext = new ADSContext(ctx); |
| | | TopologyCache cache = new TopologyCache(adsContext, |
| | | getTrustManager(), getConnectTimeout()); |
| | |
| | | qs.getDialog().workerFinished(); |
| | | if (throwable != null) |
| | | { |
| | | LOG.log(Level.WARNING, "Throwable: "+throwable, throwable); |
| | | logger.warn(LocalizableMessage.raw("Throwable: "+throwable, throwable)); |
| | | if (throwable instanceof TopologyCacheException) |
| | | { |
| | | qs.displayError( |
| | |
| | | getThrowableMsg(INFO_BUG_MSG.get(), throwable), |
| | | INFO_ERROR_TITLE.get()); |
| | | } |
| | | LOG.log(Level.INFO, "Error was displayed"); |
| | | logger.debug(LocalizableMessage.raw("Error was displayed")); |
| | | } |
| | | else |
| | | { |
| | |
| | | */ |
| | | private void handleTopologyCache(QuickSetup qs, TopologyCache cache) |
| | | { |
| | | LOG.log(Level.INFO, "Handling TopologyCache"); |
| | | logger.debug(LocalizableMessage.raw("Handling TopologyCache")); |
| | | boolean stopProcessing = false; |
| | | Set<TopologyCacheException> exceptions = |
| | | new HashSet<TopologyCacheException>(); |
| | |
| | | /* Check the exceptions and see if we throw them or not. */ |
| | | for (TopologyCacheException e : exceptions) |
| | | { |
| | | LOG.log(Level.INFO, "Analyzing exception: "+e, e); |
| | | logger.debug(LocalizableMessage.raw("Analyzing exception: "+e, e)); |
| | | if (stopProcessing) |
| | | { |
| | | break; |
| | |
| | | { |
| | | cause = e.getTrustManager().getLastRefusedCause(); |
| | | } |
| | | LOG.log(Level.INFO, "Certificate exception cause: "+cause); |
| | | logger.debug(LocalizableMessage.raw("Certificate exception cause: "+cause)); |
| | | if (cause == ApplicationTrustManager.Cause.NOT_TRUSTED) |
| | | { |
| | | excType = UserDataCertificateException.Type.NOT_TRUSTED; |
| | |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | LOG.log(Level.WARNING, |
| | | "Error parsing ldap url of TopologyCacheException.", t); |
| | | logger.warn(LocalizableMessage.raw( |
| | | "Error parsing ldap url of TopologyCacheException.", t)); |
| | | h = INFO_NOT_AVAILABLE_LABEL.get().toString(); |
| | | p = -1; |
| | | } |
| | |
| | | |
| | | if ((chain != null) && (authType != null) && (host != null)) |
| | | { |
| | | LOG.log(Level.INFO, "Accepting certificate presented by host "+host); |
| | | logger.debug(LocalizableMessage.raw("Accepting certificate presented by host "+host)); |
| | | getTrustManager().acceptCertificate(chain, authType, host); |
| | | BackgroundTask<TopologyCache> worker = |
| | | new BackgroundTask<TopologyCache>() |
| | | { |
| | | public TopologyCache processBackgroundTask() throws Throwable |
| | | { |
| | | LOG.log(Level.INFO, "Reloading topology"); |
| | | logger.debug(LocalizableMessage.raw("Reloading topology")); |
| | | cache.getFilter().setSearchMonitoringInformation(false); |
| | | cache.reloadTopology(); |
| | | return cache; |
| | |
| | | { |
| | | if (chain == null) |
| | | { |
| | | LOG.log(Level.WARNING, |
| | | "The chain is null for the UserDataCertificateException"); |
| | | logger.warn(LocalizableMessage.raw( |
| | | "The chain is null for the UserDataCertificateException")); |
| | | } |
| | | if (authType == null) |
| | | { |
| | | LOG.log(Level.WARNING, |
| | | "The auth type is null for the UserDataCertificateException"); |
| | | logger.warn(LocalizableMessage.raw( |
| | | "The auth type is null for the UserDataCertificateException")); |
| | | } |
| | | if (host == null) |
| | | { |
| | | LOG.log(Level.WARNING, |
| | | "The host is null for the UserDataCertificateException"); |
| | | logger.warn(LocalizableMessage.raw( |
| | | "The host is null for the UserDataCertificateException")); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | LOG.log(Level.WARNING, "Error accepting certificate: "+t, t); |
| | | logger.warn(LocalizableMessage.raw("Error accepting certificate: "+t, t)); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | if (serverADSProperties == null) |
| | | { |
| | | LOG.log(Level.WARNING, "The server ADS properties for the server to "+ |
| | | "uninstall could not be found."); |
| | | logger.warn(LocalizableMessage.raw("The server ADS properties for the server to "+ |
| | | "uninstall could not be found.")); |
| | | } |
| | | |
| | | for (ServerDescriptor server : servers) |
| | |
| | | |
| | | if (!hasReferences) |
| | | { |
| | | LOG.log(Level.INFO, "No references in: "+ server.getHostPort(true)); |
| | | logger.debug(LocalizableMessage.raw("No references in: "+ server.getHostPort(true))); |
| | | } |
| | | if (hasReferences) |
| | | { |
| | | LOG.log(Level.INFO, "Updating references in: "+ server.getHostPort(true)); |
| | | logger.debug(LocalizableMessage.raw("Updating references in: "+ server.getHostPort(true))); |
| | | notifyListeners(getFormattedWithPoints( |
| | | INFO_PROGRESS_REMOVING_REFERENCES.get(server.getHostPort(true)))); |
| | | InitialLdapContext ctx = null; |
| | |
| | | catch (ApplicationException ae) |
| | | { |
| | | errorOnRemoteOccurred = true; |
| | | LOG.log(Level.INFO, "Error updating replication references in: "+ |
| | | server.getHostPort(true), ae); |
| | | logger.debug(LocalizableMessage.raw("Error updating replication references in: "+ |
| | | server.getHostPort(true), ae)); |
| | | |
| | | if (!getUninstallUserData().isForceOnError()) |
| | | { |
| | |
| | | } |
| | | if (replServer != null) |
| | | { |
| | | LOG.log(Level.INFO, "Updating references in replication server on "+ |
| | | serverDisplay+"."); |
| | | logger.debug(LocalizableMessage.raw("Updating references in replication server on "+ |
| | | serverDisplay+".")); |
| | | replServers.remove(replServer); |
| | | if (replServers.size() > 0) |
| | | { |
| | |
| | | } |
| | | if (replServer != null) |
| | | { |
| | | LOG.log(Level.INFO, "Updating references in domain " + |
| | | domain.getBaseDN()+" on " + serverDisplay + "."); |
| | | logger.debug(LocalizableMessage.raw("Updating references in domain " + |
| | | domain.getBaseDN()+" on " + serverDisplay + ".")); |
| | | replServers.remove(replServer); |
| | | if (replServers.size() > 0) |
| | | { |
| | |
| | | catch (ManagedObjectNotFoundException monfe) |
| | | { |
| | | // It does not exist. |
| | | LOG.log(Level.INFO, "No synchronization found on "+ serverDisplay+".", |
| | | monfe); |
| | | logger.debug(LocalizableMessage.raw("No synchronization found on "+ serverDisplay+".", |
| | | monfe)); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | LOG.log(Level.WARNING, |
| | | logger.warn(LocalizableMessage.raw( |
| | | "Error removing references in replication server on "+ |
| | | serverDisplay+": "+t, t); |
| | | serverDisplay+": "+t, t)); |
| | | LocalizableMessage errorMessage = INFO_ERROR_CONFIGURING_REMOTE_GENERIC.get( |
| | | serverDisplay, t.toString()); |
| | | throw new ApplicationException( |
| | |
| | | { |
| | | if (adsContext.hasAdminData() && (serverADSProperties != null)) |
| | | { |
| | | LOG.log(Level.INFO, "Unregistering server on ADS of server "+ |
| | | logger.debug(LocalizableMessage.raw("Unregistering server on ADS of server "+ |
| | | ConnectionUtils.getHostPort(ctx)+". Properties: "+ |
| | | serverADSProperties); |
| | | serverADSProperties)); |
| | | adsContext.unregisterServer(serverADSProperties); |
| | | } |
| | | } |
| | |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | LOG.log(Level.WARNING, "Failing checking the port: "+t, t); |
| | | logger.warn(LocalizableMessage.raw("Failing checking the port: "+t, t)); |
| | | } |
| | | } |
| | | else |
| | |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | LOG.log(Level.WARNING, "Failing checking host names: "+t, t); |
| | | logger.warn(LocalizableMessage.raw("Failing checking host names: "+t, t)); |
| | | } |
| | | isServerToUninstall = hostNameEquals; |
| | | } |