| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2012 ForgeRock AS |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | */ |
| | | package org.opends.quicksetup.installer; |
| | | |
| | |
| | | import org.opends.quicksetup.UserDataException; |
| | | import org.opends.quicksetup.WizardStep; |
| | | import org.opends.quicksetup.ui.*; |
| | | import org.opends.quicksetup.util.FileManager; |
| | | import org.opends.quicksetup.util.IncompatibleVersionException; |
| | | import org.opends.quicksetup.util.Utils; |
| | | |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean canQuit(WizardStep step) { |
| | | return step != PROGRESS && |
| | | step != FINISHED; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isSubStep(WizardStep step) |
| | | { |
| | | return SUBSTEPS.contains(step); |
| | |
| | | protected void configureServer() throws ApplicationException { |
| | | notifyListeners(getFormattedWithPoints(INFO_PROGRESS_CONFIGURING.get())); |
| | | |
| | | writeOpenDSJavaHome(); |
| | | |
| | | writeHostName(); |
| | | |
| | | if (Utils.isWebStart()) |
| | | { |
| | | String installDir = getUserData().getServerLocation(); |
| | | setInstallation(new Installation(installDir, installDir)); |
| | | } |
| | | |
| | | copyTemplateInstance(); |
| | | |
| | | writeOpenDSJavaHome(); |
| | | |
| | | writeHostName(); |
| | | |
| | | checkAbort(); |
| | | |
| | | ArrayList<String> argList = new ArrayList<String>(); |
| | |
| | | @Override |
| | | public void run() |
| | | { |
| | | int result = -1; |
| | | try |
| | | { |
| | | result = helper.invokeConfigureServer(args); |
| | | if (result != 0) |
| | | if (helper.invokeConfigureServer(args) != 0) |
| | | { |
| | | ae = new ApplicationException( |
| | | ReturnCode.CONFIGURATION_ERROR, |
| | |
| | | { |
| | | throw ace; |
| | | } |
| | | else |
| | | { |
| | | // Nothing to do: this may occur if the new server has been |
| | | // unregistered on another server and the modification has |
| | | // been already propagated by replication. |
| | | } |
| | | // Else, nothing to do: this may occur if the new server has been |
| | | // unregistered on another server and the modification has been |
| | | // already propagated by replication. |
| | | } |
| | | } |
| | | if (createdAdministrator) |
| | |
| | | ctx.close(); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | { /* do nothing */ |
| | | } |
| | | } |
| | | } |
| | |
| | | ctx.close(); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | { /* do nothing */ |
| | | } |
| | | } |
| | | notifyListeners(getFormattedDoneWithLineBreak()); |
| | |
| | | } |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | { /* do nothing */ |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | { /* do nothing */ |
| | | } |
| | | } |
| | | notifyListeners(getFormattedDoneWithLineBreak()); |
| | |
| | | ctx.close(); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | { /* do nothing */ |
| | | } |
| | | notifyListeners(getFormattedDoneWithLineBreak()); |
| | | checkAbort(); |
| | |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | { /* do nothing */ |
| | | } |
| | | } |
| | | } |
| | |
| | | */ |
| | | private String getHostNameFile() |
| | | { |
| | | String file = Utils.getPath( |
| | | return Utils.getPath( |
| | | getInstallation().getRootDirectory().getAbsolutePath(), |
| | | SetupUtils.HOST_NAME_FILE); |
| | | return file; |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | catch (Throwable t1) |
| | | { |
| | | { /* do nothing */ |
| | | } |
| | | throw new ApplicationException( |
| | | ReturnCode.CONFIGURATION_ERROR, failedMsg, t); |
| | |
| | | finally |
| | | { |
| | | try{ rCtx.close(); } |
| | | catch (Throwable t){} |
| | | catch (Throwable t){ /* do nothing */ } |
| | | } |
| | | } |
| | | |
| | |
| | | rCtx.close(); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | { /* do nothing */ |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | Thread.sleep(3000); |
| | | } |
| | | catch (Throwable t) {} |
| | | catch (Throwable t) { /* do nothing */ } |
| | | int nTries = 5; |
| | | boolean initDone = false; |
| | | while (!initDone) |
| | |
| | | Thread.sleep((5 - nTries) * 3000); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | { /* do nothing */ |
| | | } |
| | | } |
| | | nTries--; |
| | |
| | | } |
| | | } |
| | | catch (Throwable t1) |
| | | { |
| | | { /* do nothing */ |
| | | } |
| | | throw ae; |
| | | } |
| | |
| | | InitialLdapContext localCtx = null; // Bound to local server. |
| | | ADSContext adsContext = null; // Bound to ADS host (via one of above). |
| | | |
| | | /* Outer try-catch-finally to convert occurences of NamingException and |
| | | /* Outer try-catch-finally to convert occurrences of NamingException and |
| | | ADSContextException to ApplicationException and clean up JNDI contexts.*/ |
| | | try |
| | | { |
| | |
| | | finally |
| | | { |
| | | if (null != remoteCtx) |
| | | try { remoteCtx.close(); } catch (NamingException x){ } |
| | | try { remoteCtx.close(); } |
| | | catch (NamingException x){ /* do nothing */ } |
| | | if (null != localCtx) |
| | | try { localCtx.close(); } catch (NamingException x){ } |
| | | try { localCtx.close(); } |
| | | catch (NamingException x){ /* do nothing */ } |
| | | } |
| | | } |
| | | |
| | |
| | | serverLocation, String.valueOf(requiredInMb))); |
| | | qs.displayFieldInvalid(FieldName.SERVER_LOCATION, true); |
| | | |
| | | } else if (isWindows() && (serverLocation.indexOf("%") != -1)) |
| | | } else if (isWindows() && (serverLocation.contains("%"))) |
| | | { |
| | | errorMsgs.add(INFO_INVALID_CHAR_IN_PATH.get("%")); |
| | | qs.displayFieldInvalid(FieldName.SERVER_LOCATION, true); |
| | |
| | | { |
| | | /* Check if there are already global administrators */ |
| | | Set<?> administrators = adsContext.readAdministratorRegistry(); |
| | | if (administrators.size() > 0) |
| | | { |
| | | hasGlobalAdministrators[0] = true; |
| | | } |
| | | else |
| | | { |
| | | hasGlobalAdministrators[0] = false; |
| | | } |
| | | hasGlobalAdministrators[0] = administrators.size() > 0; |
| | | Set<TopologyCacheException> exceptions = |
| | | updateUserDataWithSuffixesInADS(adsContext, trustManager); |
| | | Set<Message> exceptionMsgs = new LinkedHashSet<Message>(); |
| | |
| | | ctx.close(); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | { /* do nothing */ |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | nEntriesValid = n >= MIN_NUMBER_ENTRIES && n <= MAX_NUMBER_ENTRIES; |
| | | } catch (NumberFormatException nfe) |
| | | { |
| | | { /* do nothing */ |
| | | } |
| | | |
| | | if (!nEntriesValid) |
| | |
| | | * @param server the object describing the server. |
| | | * @param trustManager the trust manager to be used to establish the |
| | | * connection. |
| | | * @param preferredURLs the list of preferred LDAP URLs to be used to connect |
| | | * @param cnx the list of preferred LDAP URLs to be used to connect |
| | | * to the server. |
| | | * @return the InitialLdapContext to the remote server. |
| | | * @throws ApplicationException if something goes wrong. |
| | |
| | | Thread.sleep(500); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | { /* do nothing */ |
| | | } |
| | | if (canceled) |
| | | { |
| | |
| | | */ |
| | | private String getConfigurationFile() |
| | | { |
| | | String file = getUserData().getConfigurationFile(); |
| | | if (file == null) |
| | | { |
| | | file = getPath(getInstallation().getCurrentConfigurationFile()); |
| | | } |
| | | return file; |
| | | return getPath(getInstallation().getCurrentConfigurationFile()); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | private String getConfigurationClassName() |
| | | { |
| | | String className = getUserData().getConfigurationClassName(); |
| | | if (className == null) |
| | | { |
| | | className = DEFAULT_CONFIG_CLASS_NAME; |
| | | } |
| | | return className; |
| | | return DEFAULT_CONFIG_CLASS_NAME; |
| | | } |
| | | |
| | | private String getLocalReplicationServer() |
| | |
| | | dirCtx.close(); |
| | | } |
| | | catch (NameAlreadyBoundException x) |
| | | { |
| | | { /* do nothing */ |
| | | } |
| | | catch (NamingException ne) |
| | | { |
| | |
| | | Thread.sleep(500); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | { /* do nothing */ |
| | | } |
| | | try |
| | | { |
| | |
| | | helper.isStoppedByError(state)) |
| | | { |
| | | LOG.log(Level.WARNING, "Error: "+errorMsg); |
| | | ApplicationException ae = new ApplicationException( |
| | | throw new ApplicationException( |
| | | ReturnCode.APPLICATION_ERROR, errorMsg, |
| | | null); |
| | | throw ae; |
| | | } |
| | | } |
| | | } |
| | |
| | | Thread.sleep(100); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | { /* do nothing */ |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | return getUserData().getConnectTimeout(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Copies the template instance files into the instance directory. |
| | | * |
| | | * @throws ApplicationException |
| | | * If an IO error occurred. |
| | | */ |
| | | private void copyTemplateInstance() throws ApplicationException |
| | | { |
| | | FileManager fileManager = new FileManager(); |
| | | fileManager.synchronize(getInstallation().getTemplateDirectory(), |
| | | getInstallation().getInstanceDirectory()); |
| | | } |
| | | } |
| | | |
| | | /** |