OPENDJ-1303 "opendj-cli"
- Removed && replaced StaticUtils.filterExitCode by com.forgerock.opendj.cli.Utils.filterExitCode;
- Removed SetupUtils.getDefaultJMXPort and replaced it by CliConstants.DEFAULT_JMX_PORT.
- Removed && replaced Utilities.OBFUSCATED_VALUE by com.forgerock.opendj.cli.Utils.OBFUSCATED_VALUE;
- Removed && replaced Utils.getThrowableMsg by com.forgerock.opendj.cli.Utils.getThrowableMsg;
** SetupUtils.java
Removed close() and replaced it by org.forgerock.util.Utils.closeSilently;
| | |
| | | |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | import static com.forgerock.opendj.util.OperatingSystem.isWindows; |
| | | import static com.forgerock.opendj.cli.Utils.OBFUSCATED_VALUE; |
| | | |
| | | import java.io.File; |
| | | import java.util.ArrayList; |
| | |
| | | if (Utilities.mustObfuscate(attrName, |
| | | getInfo().getServerDescriptor().getSchema())) |
| | | { |
| | | return Utilities.OBFUSCATED_VALUE; |
| | | return OBFUSCATED_VALUE; |
| | | } |
| | | else |
| | | { |
| | |
| | | if (Utilities.mustObfuscate(attrName, |
| | | getInfo().getServerDescriptor().getSchema())) |
| | | { |
| | | returnValue = attrName + ": " +Utilities.OBFUSCATED_VALUE; |
| | | returnValue = attrName + ": " + OBFUSCATED_VALUE; |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | if (args.get(i-1).equalsIgnoreCase(argName)) |
| | | { |
| | | args.set(i, Utilities.OBFUSCATED_VALUE); |
| | | args.set(i, OBFUSCATED_VALUE); |
| | | break; |
| | | } |
| | | } |
| | |
| | | |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | import static org.opends.messages.QuickSetupMessages.*; |
| | | import static com.forgerock.opendj.cli.Utils.OBFUSCATED_VALUE; |
| | | |
| | | import java.awt.Component; |
| | | import java.awt.GridBagConstraints; |
| | |
| | | args.add("--adminUID"); |
| | | args.add("admin"); |
| | | args.add("--adminPassword"); |
| | | args.add(Utilities.OBFUSCATED_VALUE); |
| | | args.add(OBFUSCATED_VALUE); |
| | | args.add("--trustAll"); |
| | | args.add("--no-prompt"); |
| | | |
| | |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | import static org.opends.messages.QuickSetupMessages.*; |
| | | import static com.forgerock.opendj.cli.Utils.isDN; |
| | | import static com.forgerock.opendj.cli.Utils.getThrowableMsg; |
| | | |
| | | import java.awt.Component; |
| | | import java.awt.GridBagConstraints; |
| | |
| | | } |
| | | else |
| | | { |
| | | LocalizableMessage msg = Utils.getThrowableMsg( |
| | | LocalizableMessage msg = getThrowableMsg( |
| | | INFO_ERROR_CONNECTING_TO_LOCAL.get(), throwable); |
| | | errors.add(msg); |
| | | } |
| | |
| | | // This is a bug |
| | | logger.error(LocalizableMessage.raw( |
| | | "Unexpected error: "+throwable, throwable)); |
| | | errors.add(Utils.getThrowableMsg(INFO_BUG_MSG.get(), throwable)); |
| | | errors.add(getThrowableMsg(INFO_BUG_MSG.get(), throwable)); |
| | | } |
| | | } |
| | | displayMainPanel(); |
| | |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | import static org.opends.messages.QuickSetupMessages.*; |
| | | import static com.forgerock.opendj.cli.Utils.isDN; |
| | | import static com.forgerock.opendj.cli.Utils.getThrowableMsg; |
| | | |
| | | import java.awt.Component; |
| | | import java.awt.GridBagConstraints; |
| | |
| | | } |
| | | else |
| | | { |
| | | LocalizableMessage msg = Utils.getThrowableMsg( |
| | | LocalizableMessage msg = getThrowableMsg( |
| | | INFO_ERROR_CONNECTING_TO_LOCAL.get(), throwable); |
| | | errors.add(msg); |
| | | } |
| | |
| | | { |
| | | // This is a bug |
| | | throwable.printStackTrace(); |
| | | errors.add(Utils.getThrowableMsg(INFO_BUG_MSG.get(), throwable)); |
| | | errors.add(getThrowableMsg(INFO_BUG_MSG.get(), throwable)); |
| | | } |
| | | } |
| | | displayMainPanel(); |
| | |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | import static com.forgerock.opendj.cli.Utils.OBFUSCATED_VALUE; |
| | | |
| | | import java.awt.Component; |
| | | import java.awt.GridBagConstraints; |
| | |
| | | { |
| | | panel.add( |
| | | Utilities.createDefaultLabel( |
| | | LocalizableMessage.raw(Utilities.OBFUSCATED_VALUE)), gbc); |
| | | LocalizableMessage.raw(OBFUSCATED_VALUE)), gbc); |
| | | } |
| | | else if (!isBinary) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.renderer; |
| | | |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | import static com.forgerock.opendj.cli.Utils.OBFUSCATED_VALUE; |
| | | |
| | | import java.awt.Component; |
| | | import java.awt.GridBagConstraints; |
| | |
| | | } |
| | | if (isPassword(table, row, column)) |
| | | { |
| | | return getStringValue(table, Utilities.OBFUSCATED_VALUE, isSelected, |
| | | return getStringValue(table, OBFUSCATED_VALUE, isSelected, |
| | | hasFocus, row, column); |
| | | } |
| | | else if (value instanceof ObjectClassValue) |
| | |
| | | private static File rootDirectory; |
| | | private static File instanceRootDirectory; |
| | | |
| | | /** |
| | | * The string to be used to display an obfuscated value (for instance password |
| | | * value). |
| | | */ |
| | | public final static String OBFUSCATED_VALUE = "********"; |
| | | |
| | | private static String[] attrsToObfuscate = |
| | | {ServerConstants.ATTR_USER_PASSWORD}; |
| | | |
| | |
| | | import static com.forgerock.opendj.cli.ArgumentConstants.OPTION_LONG_BINDPWD; |
| | | import static com.forgerock.opendj.cli.ArgumentConstants.OPTION_LONG_BINDPWD_FILE; |
| | | import static com.forgerock.opendj.cli.Utils.CONFIRMATION_MAX_TRIES; |
| | | import static com.forgerock.opendj.cli.Utils.getThrowableMsg; |
| | | import static org.forgerock.util.Utils.joinAsString; |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | import static org.opends.messages.QuickSetupMessages.*; |
| | |
| | | { |
| | | logger.warn(LocalizableMessage.raw("Error processing task: "+t, t)); |
| | | throw new UserDataException(Step.CONFIRM_UNINSTALL, |
| | | Utils.getThrowableMsg(INFO_BUG_MSG.get(), t)); |
| | | getThrowableMsg(INFO_BUG_MSG.get(), t)); |
| | | } |
| | | logger.info(LocalizableMessage.raw("interactive: "+interactive)); |
| | | logger.info(LocalizableMessage.raw("forceOnError: "+forceOnError)); |
| | |
| | | } |
| | | else |
| | | { |
| | | exceptionMsg = Utils.getThrowableMsg( |
| | | exceptionMsg = getThrowableMsg( |
| | | INFO_ERROR_CONNECTING_TO_LOCAL.get(), ne); |
| | | } |
| | | } catch (TopologyCacheException te) |
| | |
| | | } catch (Throwable t) |
| | | { |
| | | logger.warn(LocalizableMessage.raw("Error connecting to server: "+t, t)); |
| | | exceptionMsg = Utils.getThrowableMsg(INFO_BUG_MSG.get(), t); |
| | | exceptionMsg = getThrowableMsg(INFO_BUG_MSG.get(), t); |
| | | } |
| | | finally |
| | | { |
| | |
| | | import static org.opends.quicksetup.util.Utils.*; |
| | | import static com.forgerock.opendj.cli.ArgumentConstants.*; |
| | | import static com.forgerock.opendj.util.OperatingSystem.isWindows; |
| | | import static com.forgerock.opendj.cli.Utils.getThrowableMsg; |
| | | |
| | | import java.io.*; |
| | | import java.net.InetAddress; |
| | |
| | | |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | import static org.opends.messages.QuickSetupMessages.*; |
| | | import static com.forgerock.opendj.cli.Utils.getThrowableMsg; |
| | | |
| | | /** |
| | | * This class is a dialog that appears when the user must provide authentication |
| | |
| | | } |
| | | else |
| | | { |
| | | LocalizableMessage msg = Utils.getThrowableMsg( |
| | | LocalizableMessage msg = getThrowableMsg( |
| | | INFO_ERROR_CONNECTING_TO_LOCAL.get(), throwable); |
| | | displayError(msg, INFO_ERROR_TITLE.get()); |
| | | } |
| | |
| | | logger.error(LocalizableMessage.raw("Unexpected throwable: "+throwable, |
| | | throwable)); |
| | | displayError( |
| | | Utils.getThrowableMsg(INFO_BUG_MSG.get(), throwable), |
| | | getThrowableMsg(INFO_BUG_MSG.get(), throwable), |
| | | INFO_ERROR_TITLE.get()); |
| | | } |
| | | cancelButton.setEnabled(true); |
| | |
| | | |
| | | for (int i=0;i<65000 && (defaultJMXPort == -1);i+=1000) |
| | | { |
| | | int port = i + org.opends.server.util.SetupUtils.getDefaultJMXPort(); |
| | | int port = i + CliConstants.DEFAULT_JMX_PORT; |
| | | boolean isForbidden = false; |
| | | if (forbiddenPorts != null) |
| | | { |
| | |
| | | import static com.forgerock.opendj.cli.Utils.canWrite; |
| | | import static com.forgerock.opendj.cli.Utils.isDN; |
| | | import static com.forgerock.opendj.cli.Utils.getHostNameForLdapUrl; |
| | | import static com.forgerock.opendj.cli.Utils.getThrowableMsg; |
| | | |
| | | /** |
| | | * This is an abstract class that is in charge of actually performing the |
| | |
| | | { |
| | | logger.error(LocalizableMessage.raw("Error: "+t, t)); |
| | | throw new ApplicationException(ReturnCode.BUG, |
| | | Utils.getThrowableMsg(INFO_BUG_MSG.get(), t), t); |
| | | getThrowableMsg(INFO_BUG_MSG.get(), t), t); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | import static org.opends.messages.QuickSetupMessages.*; |
| | | import static com.forgerock.opendj.util.OperatingSystem.isWindows; |
| | | import static com.forgerock.opendj.cli.Utils.getThrowableMsg; |
| | | |
| | | import org.opends.server.tools.ConfigureDS; |
| | | import org.opends.server.tools.ConfigureWindowsService; |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import static org.opends.messages.QuickSetupMessages.*; |
| | | import static com.forgerock.opendj.util.OperatingSystem.isWindows; |
| | | import static com.forgerock.opendj.cli.Utils.getThrowableMsg; |
| | | |
| | | |
| | | import java.io.PrintStream; |
| | |
| | | setCurrentProgressStep(InstallProgressStep.FINISHED_WITH_ERROR); |
| | | ApplicationException ex = new ApplicationException( |
| | | ReturnCode.BUG, |
| | | Utils.getThrowableMsg(INFO_BUG_MSG.get(), t), t); |
| | | getThrowableMsg(INFO_BUG_MSG.get(), t), t); |
| | | LocalizableMessage msg = getFormattedError(ex, true); |
| | | notifyListeners(msg); |
| | | logger.error(LocalizableMessage.raw("Error installing.", t)); |
| | |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | |
| | | import static org.opends.messages.QuickSetupMessages.*; |
| | | import static com.forgerock.opendj.cli.Utils.getThrowableMsg; |
| | | |
| | | /** |
| | | * This class is a dialog that appears when the user wants to configure |
| | |
| | | // Bug |
| | | throwable.printStackTrace(); |
| | | displayError( |
| | | Utils.getThrowableMsg(INFO_BUG_MSG.get(), throwable), |
| | | getThrowableMsg(INFO_BUG_MSG.get(), throwable), |
| | | INFO_ERROR_TITLE.get()); |
| | | cancelButton.setEnabled(true); |
| | | okButton.setEnabled(true); |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | import static org.opends.messages.QuickSetupMessages.*; |
| | | import static com.forgerock.opendj.cli.Utils.getThrowableMsg; |
| | | |
| | | /** |
| | | * This class is a dialog that appears when the user wants to configure |
| | |
| | | // Bug |
| | | throwable.printStackTrace(); |
| | | displayError( |
| | | Utils.getThrowableMsg(INFO_BUG_MSG.get(), throwable), |
| | | getThrowableMsg(INFO_BUG_MSG.get(), throwable), |
| | | INFO_ERROR_TITLE.get()); |
| | | cancelButton.setEnabled(true); |
| | | okButton.setEnabled(true); |
| | |
| | | |
| | | import static org.opends.messages.QuickSetupMessages.*; |
| | | import static com.forgerock.opendj.util.OperatingSystem.isWindows; |
| | | import static com.forgerock.opendj.cli.Utils.getThrowableMsg; |
| | | |
| | | /** |
| | | * This is an implementation of the Installer class that is used to install |
| | |
| | | setCurrentProgressStep(InstallProgressStep.FINISHED_WITH_ERROR); |
| | | ApplicationException ex = new ApplicationException( |
| | | ReturnCode.BUG, |
| | | Utils.getThrowableMsg(INFO_BUG_MSG.get(), t), t); |
| | | getThrowableMsg(INFO_BUG_MSG.get(), t), t); |
| | | LocalizableMessage msg = getFormattedError(ex, true); |
| | | notifyListeners(msg); |
| | | logger.error(LocalizableMessage.raw("Error installing.", t)); |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import static org.opends.messages.QuickSetupMessages.*; |
| | | import static com.forgerock.opendj.util.OperatingSystem.isMacOS; |
| | | import static com.forgerock.opendj.cli.Utils.getThrowableMsg; |
| | | |
| | | import javax.swing.*; |
| | | |
| | |
| | | import static org.opends.quicksetup.util.Utils.*; |
| | | import static com.forgerock.opendj.cli.ArgumentConstants.*; |
| | | import static com.forgerock.opendj.util.OperatingSystem.isWindows; |
| | | import static com.forgerock.opendj.cli.Utils.getThrowableMsg; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | |
| | | import static org.opends.server.util.DynamicConstants.*; |
| | | import static com.forgerock.opendj.util.OperatingSystem.isWindows; |
| | | import static com.forgerock.opendj.util.OperatingSystem.isUnix; |
| | | import static com.forgerock.opendj.cli.Utils.OBFUSCATED_VALUE; |
| | | import static com.forgerock.opendj.cli.Utils.getThrowableMsg; |
| | | |
| | | import java.io.*; |
| | | import java.net.InetAddress; |
| | |
| | | import org.opends.admin.ads.util.ConnectionUtils; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import org.forgerock.i18n.LocalizableMessageDescriptor; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.quicksetup.*; |
| | | import org.opends.quicksetup.installer.AuthenticationData; |
| | |
| | | } |
| | | |
| | | /** |
| | | * Returns a localized message for a given properties key an throwable. |
| | | * @param message prefix |
| | | * @param t the throwable for which we want to get a message. |
| | | * |
| | | * @return a localized message for a given properties key and throwable. |
| | | */ |
| | | public static LocalizableMessage getThrowableMsg(LocalizableMessage message, Throwable t) |
| | | { |
| | | LocalizableMessageBuilder mb = new LocalizableMessageBuilder(message); |
| | | LocalizableMessageDescriptor.Arg1<Object> tag; |
| | | if (isOutOfMemory(t)) |
| | | { |
| | | tag = INFO_EXCEPTION_OUT_OF_MEMORY_DETAILS; |
| | | } |
| | | else |
| | | { |
| | | tag = INFO_EXCEPTION_DETAILS; |
| | | } |
| | | String detail = t.toString(); |
| | | if (detail != null) |
| | | { |
| | | mb.append(" ").append(tag.get(detail)); |
| | | } |
| | | return mb.toMessage(); |
| | | } |
| | | |
| | | /** |
| | | * Gets a localized representation of the provide TopologyCacheException. |
| | | * @param te the exception. |
| | | * @return a localized representation of the provide TopologyCacheException. |
| | |
| | | } |
| | | |
| | | /** |
| | | * Tells whether this throwable has been generated for an out of memory |
| | | * error or not. |
| | | * @param t the throwable to analyze. |
| | | * @return <CODE>true</CODE> if the throwable was generated by an out of |
| | | * memory error and false otherwise. |
| | | */ |
| | | private static boolean isOutOfMemory(Throwable t) |
| | | { |
| | | boolean isOutOfMemory = false; |
| | | while (!isOutOfMemory && (t != null)) |
| | | { |
| | | if (t instanceof OutOfMemoryError) |
| | | { |
| | | isOutOfMemory = true; |
| | | } |
| | | else if (t instanceof IOException) |
| | | { |
| | | String msg = t.toString(); |
| | | if (msg != null) |
| | | { |
| | | isOutOfMemory = msg.contains("Not enough space"); |
| | | } |
| | | } |
| | | t = t.getCause(); |
| | | } |
| | | return isOutOfMemory; |
| | | } |
| | | |
| | | /** |
| | | * Returns the number of entries contained in the zip file. This is used to |
| | | * update properly the progress bar ratio. |
| | | * @return the number of entries contained in the zip file. |
| | |
| | | //Chars that require special treatment when passing them to command-line. |
| | | private final static char[] charsToEscape = {' ', '\t', '\n', '|', ';', '<', |
| | | '>', '(', ')', '$', '`', '\\', '"', '\''}; |
| | | private static final String OBFUSCATED_VALUE = "******"; |
| | | |
| | | /** |
| | | * This method simply takes a value and tries to transform it (with escape or |
| | |
| | | |
| | | package org.opends.quicksetup.util; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import static org.opends.messages.QuickSetupMessages.*; |
| | | import static com.forgerock.opendj.util.OperatingSystem.isUnix; |
| | | import static com.forgerock.opendj.cli.Utils.getThrowableMsg; |
| | | |
| | | import org.opends.quicksetup.ApplicationException; |
| | | import org.opends.quicksetup.Application; |
| | | import org.opends.quicksetup.ReturnCode; |
| | | |
| | | import java.io.*; |
| | | import java.util.zip.ZipInputStream; |
| | | import java.util.zip.ZipEntry; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.FileNotFoundException; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.util.ArrayList; |
| | | import java.util.Map; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.zip.ZipEntry; |
| | | import java.util.zip.ZipInputStream; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.quicksetup.Application; |
| | | import org.opends.quicksetup.ApplicationException; |
| | | import org.opends.quicksetup.ReturnCode; |
| | | |
| | | /** |
| | | * Class for extracting the contents of a zip file and managing |
| | |
| | | |
| | | } catch (IOException ioe) { |
| | | LocalizableMessage errorMsg = |
| | | Utils.getThrowableMsg( |
| | | getThrowableMsg( |
| | | INFO_ERROR_COPYING.get(entry.getName()), ioe); |
| | | |
| | | throw new ApplicationException( |
| | |
| | | |
| | | } catch (IOException ioe) { |
| | | LocalizableMessage errorMsg = |
| | | Utils.getThrowableMsg( |
| | | getThrowableMsg( |
| | | INFO_ERROR_ZIP_STREAM.get(zipFileName), ioe); |
| | | throw new ApplicationException( |
| | | ReturnCode.FILE_SYSTEM_ACCESS_ERROR, |
| | |
| | | import static org.opends.quicksetup.util.Utils.*; |
| | | import static org.opends.messages.QuickSetupMessages.*; |
| | | import static com.forgerock.opendj.util.OperatingSystem.isWindows; |
| | | import static com.forgerock.opendj.cli.Utils.getThrowableMsg; |
| | | |
| | | /** |
| | | * This class is used to download the files that have been marked as lazy |
| | |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static com.forgerock.opendj.cli.Utils.wrapText; |
| | | import static com.forgerock.opendj.cli.Utils.filterExitCode; |
| | | |
| | | /** |
| | | * This program provides a utility that may be used to back up a Directory |
| | |
| | | import org.opends.server.types.LDIFImportConfig; |
| | | import org.opends.server.types.NullOutputStream; |
| | | import org.opends.server.util.LDIFReader; |
| | | import org.opends.server.util.SetupUtils; |
| | | |
| | | import com.forgerock.opendj.cli.ArgumentException; |
| | | import com.forgerock.opendj.cli.ArgumentParser; |
| | | import com.forgerock.opendj.cli.BooleanArgument; |
| | | import com.forgerock.opendj.cli.CliConstants; |
| | | import com.forgerock.opendj.cli.CommonArguments; |
| | | import com.forgerock.opendj.cli.FileBasedArgument; |
| | | import com.forgerock.opendj.cli.IntegerArgument; |
| | |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static com.forgerock.opendj.cli.ArgumentConstants.*; |
| | | import static com.forgerock.opendj.cli.Utils.wrapText; |
| | | import static com.forgerock.opendj.cli.Utils.filterExitCode; |
| | | |
| | | /** |
| | | * This class provides a very basic tool that can be used to configure some of |
| | |
| | | argParser.addArgument(enableStartTLS); |
| | | |
| | | jmxPort = new IntegerArgument("jmxport", 'x', "jmxPort", false, false, |
| | | true, INFO_JMXPORT_PLACEHOLDER.get(), SetupUtils.getDefaultJMXPort(), |
| | | true, INFO_JMXPORT_PLACEHOLDER.get(), CliConstants.DEFAULT_JMX_PORT, |
| | | null, true, 1, |
| | | true, 65535, |
| | | INFO_CONFIGDS_DESCRIPTION_JMX_PORT.get()); |
| | |
| | | |
| | | import static org.opends.messages.ToolMessages.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static com.forgerock.opendj.util.OperatingSystem.hasUAC; |
| | | import static com.forgerock.opendj.cli.Utils.wrapText; |
| | | import static com.forgerock.opendj.cli.Utils.filterExitCode; |
| | | |
| | | /** |
| | | * This class is used to configure the Windows service for this instance on |
| | |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static com.forgerock.opendj.cli.Utils.wrapText; |
| | | import static com.forgerock.opendj.cli.Utils.filterExitCode; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.server.admin.std.server.BackendCfg; |
| | |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static com.forgerock.opendj.cli.Utils.wrapText; |
| | | import static com.forgerock.opendj.cli.Utils.filterExitCode; |
| | | |
| | | /** |
| | | * This program provides a utility that may be used to interact with the |
| | |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static com.forgerock.opendj.cli.Utils.filterExitCode; |
| | | |
| | | import org.opends.server.core.CoreConfigManager; |
| | | import org.opends.server.core.DirectoryServer; |
| | |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static com.forgerock.opendj.cli.Utils.wrapText; |
| | | import static com.forgerock.opendj.cli.Utils.filterExitCode; |
| | | |
| | | import java.io.File; |
| | | import java.io.OutputStream; |
| | |
| | | import org.opends.quicksetup.UserData; |
| | | import org.opends.quicksetup.util.Utils; |
| | | import org.opends.server.admin.AdministrationConnector; |
| | | import org.opends.server.util.SetupUtils; |
| | | |
| | | import com.forgerock.opendj.cli.Argument; |
| | | import com.forgerock.opendj.cli.ArgumentException; |
| | | import com.forgerock.opendj.cli.ArgumentParser; |
| | | import com.forgerock.opendj.cli.BooleanArgument; |
| | | import com.forgerock.opendj.cli.CliConstants; |
| | | import com.forgerock.opendj.cli.CommonArguments; |
| | | import com.forgerock.opendj.cli.FileBasedArgument; |
| | | import com.forgerock.opendj.cli.IntegerArgument; |
| | |
| | | jmxPortArg = new IntegerArgument( |
| | | "jmxPort".toLowerCase(), 'x', "jmxPort", false, false, |
| | | true, INFO_JMXPORT_PLACEHOLDER.get(), |
| | | SetupUtils.getDefaultJMXPort(), "jmxPort", true, |
| | | CliConstants.DEFAULT_JMX_PORT, "jmxPort", true, |
| | | 1, true, 65535, |
| | | INFO_INSTALLDS_DESCRIPTION_JMXPORT.get()); |
| | | addArgument(jmxPortArg); |
| | |
| | | |
| | | package org.opends.server.tools; |
| | | |
| | | import java.io.*; |
| | | import static com.forgerock.opendj.cli.Utils.getThrowableMsg; |
| | | import static com.forgerock.opendj.util.OperatingSystem.isWindows; |
| | | import static org.opends.server.util.ServerConstants.EOL; |
| | | import static org.opends.messages.ToolMessages.*; |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.BufferedWriter; |
| | | import java.io.File; |
| | | import java.io.FileNotFoundException; |
| | | import java.io.FileReader; |
| | | import java.io.FileWriter; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.io.PrintStream; |
| | | import java.util.Enumeration; |
| | | import java.util.Properties; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.messages.ToolMessages; |
| | | import org.opends.quicksetup.Constants; |
| | | import org.opends.quicksetup.util.Utils; |
| | | import org.opends.server.loggers.JDKLogging; |
| | | import org.opends.server.types.NullOutputStream; |
| | | import com.forgerock.opendj.cli.ConsoleApplication; |
| | | |
| | | import com.forgerock.opendj.cli.ArgumentException; |
| | | |
| | | import static org.opends.messages.ToolMessages.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static com.forgerock.opendj.util.OperatingSystem.isWindows; |
| | | |
| | | /** |
| | | * This class is used to update the scripts that are used to launch the command |
| | |
| | | } |
| | | catch (IOException ioe) |
| | | { |
| | | println(Utils.getThrowableMsg( |
| | | println(getThrowableMsg( |
| | | ERR_JAVAPROPERTIES_WRITING_DESTINATION_FILE.get(destinationFile), |
| | | ioe)); |
| | | return ErrorReturnCode.ERROR_WRITING_FILE.getReturnCode(); |
| | |
| | | import static org.opends.server.protocols.ldap.LDAPResultCode.*; |
| | | import static com.forgerock.opendj.cli.ArgumentConstants.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static org.opends.server.util.args.LDAPConnectionArgumentParser.*; |
| | | import static com.forgerock.opendj.cli.Utils.wrapText; |
| | | import static com.forgerock.opendj.cli.Utils.filterExitCode; |
| | | |
| | | /** |
| | | * This class provides a tool that can be used to issue compare requests to the |
| | |
| | | import static org.opends.messages.ToolMessages.*; |
| | | import static org.opends.server.protocols.ldap.LDAPResultCode.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static com.forgerock.opendj.cli.ArgumentConstants.*; |
| | | import static org.opends.server.util.args.LDAPConnectionArgumentParser.*; |
| | | import static com.forgerock.opendj.cli.Utils.wrapText; |
| | | import static com.forgerock.opendj.cli.Utils.filterExitCode; |
| | | |
| | | /** |
| | | * This class provides a tool that can be used to issue delete requests to the |
| | |
| | | import static org.opends.server.protocols.ldap.LDAPResultCode.*; |
| | | import static com.forgerock.opendj.cli.ArgumentConstants.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static org.opends.server.util.args.LDAPConnectionArgumentParser.*; |
| | | import static com.forgerock.opendj.cli.Utils.wrapText; |
| | | import static com.forgerock.opendj.cli.Utils.filterExitCode; |
| | | |
| | | /** |
| | | * This class provides a tool that can be used to issue modify requests to the |
| | |
| | | import static com.forgerock.opendj.cli.ArgumentConstants.*; |
| | | import static org.opends.server.protocols.ldap.LDAPResultCode.*; |
| | | import static com.forgerock.opendj.cli.Utils.wrapText; |
| | | import static com.forgerock.opendj.cli.Utils.filterExitCode; |
| | | |
| | | /** |
| | | * This program provides a utility that uses the LDAP password modify extended |
| | |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static org.opends.server.util.args.LDAPConnectionArgumentParser.*; |
| | | import static com.forgerock.opendj.cli.Utils.wrapText; |
| | | import static com.forgerock.opendj.cli.Utils.filterExitCode; |
| | | |
| | | /** |
| | | * This class provides a tool that can be used to issue search requests to the |
| | |
| | | import static org.opends.server.protocols.ldap.LDAPResultCode.*; |
| | | import static com.forgerock.opendj.cli.ArgumentConstants.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static com.forgerock.opendj.cli.Utils.filterExitCode; |
| | | |
| | | |
| | | |
| | |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static com.forgerock.opendj.cli.Utils.wrapText; |
| | | import static com.forgerock.opendj.cli.Utils.filterExitCode; |
| | | |
| | | /** |
| | | * This class provides a program that may be used to apply a set of changes (in |
| | |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static com.forgerock.opendj.cli.Utils.wrapText; |
| | | import static com.forgerock.opendj.cli.Utils.filterExitCode; |
| | | |
| | | /** |
| | | * This class provides a program that may be used to search LDIF files. It is |
| | |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static com.forgerock.opendj.cli.ArgumentConstants.*; |
| | | import static com.forgerock.opendj.cli.Utils.wrapText; |
| | | import static com.forgerock.opendj.cli.Utils.filterExitCode; |
| | | |
| | | |
| | | |
| | |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static com.forgerock.opendj.cli.Utils.wrapText; |
| | | import static com.forgerock.opendj.cli.Utils.filterExitCode; |
| | | |
| | | |
| | | |
| | |
| | | import java.util.TreeMap; |
| | | |
| | | import static org.opends.messages.ToolMessages.*; |
| | | import static org.opends.server.util.StaticUtils.filterExitCode; |
| | | import static com.forgerock.opendj.cli.ArgumentConstants.*; |
| | | import static com.forgerock.opendj.cli.Utils.filterExitCode; |
| | | |
| | | /** |
| | | * Tool for getting information and managing tasks in the Directory Server. |
| | |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static com.forgerock.opendj.cli.Utils.wrapText; |
| | | import static com.forgerock.opendj.cli.Utils.filterExitCode; |
| | | |
| | | import org.opends.server.util.BuildVersion; |
| | | import org.opends.server.util.StaticUtils; |
| | |
| | | import static com.forgerock.opendj.cli.ArgumentConstants.*; |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static com.forgerock.opendj.cli.Utils.wrapText; |
| | | import static com.forgerock.opendj.cli.Utils.filterExitCode; |
| | | |
| | | import org.opends.server.tools.tasks.TaskTool; |
| | | import org.opends.server.admin.std.server.BackendCfg; |
| | |
| | | import org.opends.server.types.NullOutputStream; |
| | | |
| | | import static org.opends.messages.ToolMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static com.forgerock.opendj.util.OperatingSystem.hasUAC; |
| | | import static com.forgerock.opendj.cli.Utils.filterExitCode; |
| | | |
| | | /** |
| | | * This class is used to start the Windows service associated with this |
| | |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static com.forgerock.opendj.cli.ArgumentConstants.*; |
| | | import static com.forgerock.opendj.cli.Utils.wrapText; |
| | | import static com.forgerock.opendj.cli.Utils.filterExitCode; |
| | | |
| | | /** |
| | | * This class provides a tool that can send a request to the Directory Server |
| | |
| | | import org.opends.server.types.NullOutputStream; |
| | | |
| | | import static org.opends.messages.ToolMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static com.forgerock.opendj.util.OperatingSystem.hasUAC; |
| | | import static com.forgerock.opendj.cli.Utils.filterExitCode; |
| | | |
| | | |
| | | /** |
| | |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static com.forgerock.opendj.cli.Utils.wrapText; |
| | | import static com.forgerock.opendj.cli.Utils.filterExitCode; |
| | | |
| | | import java.io.OutputStream; |
| | | import java.io.PrintStream; |
| | |
| | | import static org.opends.messages.CoreMessages.*; |
| | | import static org.opends.messages.ToolMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static com.forgerock.opendj.cli.Utils.filterExitCode; |
| | | |
| | | /** |
| | | * This program provides a simple tool that will wait for a specified file to be |
| | |
| | | import static org.opends.messages.ToolMessages.INFO_TASK_TOOL_TASK_SCHEDULED_FUTURE; |
| | | import static org.opends.messages.ToolMessages.INFO_TASK_TOOL_RECURRING_TASK_SCHEDULED; |
| | | import static org.opends.quicksetup.util.Utils.getFirstValue; |
| | | import static org.opends.quicksetup.util.Utils.getThrowableMsg; |
| | | import static com.forgerock.opendj.cli.Utils.getThrowableMsg; |
| | | import static org.opends.server.tools.dsreplication.ReplicationCliReturnCode.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static com.forgerock.opendj.cli.Utils.wrapText; |
| | | import static com.forgerock.opendj.cli.Utils.filterExitCode; |
| | | |
| | | /** |
| | | * This class defines a program that can be used to generate LDIF content based |
| | |
| | | package org.opends.server.tools.upgrade; |
| | | |
| | | import static org.opends.messages.ToolMessages.*; |
| | | import static org.opends.server.util.StaticUtils.filterExitCode; |
| | | import static com.forgerock.opendj.cli.Utils.filterExitCode; |
| | | import static org.opends.server.tools.upgrade.FormattedNotificationCallback.*; |
| | | import static org.opends.server.tools.upgrade.Upgrade.EXIT_CODE_ERROR; |
| | | import static org.opends.server.tools.upgrade.Upgrade.EXIT_CODE_SUCCESS; |
| | |
| | | */ |
| | | package org.opends.server.util; |
| | | |
| | | import static org.forgerock.util.Utils.closeSilently; |
| | | |
| | | import java.io.*; |
| | | import java.net.InetSocketAddress; |
| | | import java.net.ServerSocket; |
| | |
| | | } |
| | | |
| | | /** |
| | | * Returns the default value for the JMX Port. |
| | | * @return the default value for the JMX Port. |
| | | */ |
| | | public static int getDefaultJMXPort() |
| | | { |
| | | return 1689; |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether we are in a web start installation or not. |
| | | * |
| | | * @return <CODE>true</CODE> if we are in a web start installation and |
| | |
| | | } |
| | | finally |
| | | { |
| | | close(outputStream); |
| | | closeSilently(outputStream); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | finally |
| | | { |
| | | close(outputStream); |
| | | closeSilently(outputStream); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | finally |
| | | { |
| | | close(br); |
| | | closeSilently(br); |
| | | } |
| | | if (hostName == null) |
| | | { |
| | |
| | | } |
| | | return hostName; |
| | | } |
| | | |
| | | private static void close(Closeable toClose) |
| | | { |
| | | if (toClose != null) |
| | | { |
| | | try |
| | | { |
| | | toClose.close(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | // ignore |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * Filters the provided value to ensure that it is appropriate for use as an |
| | | * exit code. Exit code values are generally only allowed to be between 0 and |
| | | * 255, so any value outside of this range will be converted to 255, which is |
| | | * the typical exit code used to indicate an overflow value. |
| | | * |
| | | * @param exitCode The exit code value to be processed. |
| | | * |
| | | * @return An integer value between 0 and 255, inclusive. If the provided |
| | | * exit code was already between 0 and 255, then the original value |
| | | * will be returned. If the provided value was out of this range, |
| | | * then 255 will be returned. |
| | | */ |
| | | public static int filterExitCode(int exitCode) |
| | | { |
| | | if (exitCode < 0) |
| | | { |
| | | return 255; |
| | | } |
| | | else if (exitCode > 255) |
| | | { |
| | | return 255; |
| | | } |
| | | else |
| | | { |
| | | return exitCode; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Checks that no more that one of a set of arguments is present. This |
| | | * utility should be used after argument parser has parsed a set of |
| | | * arguments. |