issue 1430 fix (all utilities should provide as standard option -V/--version)
to specify the LDAP protocol version number, we should use now
-V/--ldapVersion
to get the 'product' version
--version
In all other tools/CLIs
-V/--version will print the version info
| | |
| | | |
| | | import java.io.File; |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.OutputStream; |
| | | import java.io.PrintStream; |
| | | import java.net.InetAddress; |
| | | import java.util.Collections; |
| | |
| | | return buffer.toString(); |
| | | } |
| | | |
| | | /** |
| | | * Prints out the version string for the Directory Server. |
| | | * |
| | | * |
| | | * @param outputStream The output stream to which the version information |
| | | * should be written. |
| | | * |
| | | * @throws IOException If a problem occurs while attempting to write the |
| | | * version information to the provided output stream. |
| | | */ |
| | | public static void printVersion(OutputStream outputStream) |
| | | throws IOException |
| | | { |
| | | StringBuilder buffer = new StringBuilder(); |
| | | buffer.append(getVersionString()); |
| | | buffer.append(EOL); |
| | | buffer.append("Build " + BUILD_ID); |
| | | buffer.append(EOL); |
| | | |
| | | if ((FIX_IDS != null) && (FIX_IDS.length() > 0)) |
| | | { |
| | | buffer.append("Fix IDs: " + FIX_IDS); |
| | | buffer.append(EOL); |
| | | } |
| | | outputStream.write(getBytes(buffer.toString())); |
| | | return; |
| | | } |
| | | |
| | | |
| | | /** |
| | |
| | | BooleanArgument fullVersion = null; |
| | | BooleanArgument noDetach = null; |
| | | BooleanArgument systemInfo = null; |
| | | BooleanArgument version = null; |
| | | StringArgument configClass = null; |
| | | StringArgument configFile = null; |
| | | |
| | |
| | | argParser.addArgument(windowsNetStart); |
| | | |
| | | |
| | | version = new BooleanArgument("version", 'V', "version", |
| | | MSGID_DSCORE_DESCRIPTION_VERSION); |
| | | argParser.addArgument(version); |
| | | |
| | | |
| | | fullVersion = new BooleanArgument("fullversion", 'F', "fullVersion", |
| | | MSGID_DSCORE_DESCRIPTION_FULLVERSION); |
| | | fullVersion.setHidden(true); |
| | |
| | | // that is something other than NOTHING_TO_DO, SERVER_ALREADY_STARTED, |
| | | // START_AS_DETACH, START_AS_NON_DETACH, START_AS_WINDOWS_SERVICE to |
| | | // indicate that a problem occurred. |
| | | if (argParser.usageDisplayed()) |
| | | if (argParser.usageOrVersionDisplayed()) |
| | | { |
| | | // We're just trying to display usage, and that's already been done so |
| | | // exit with a code of zero. |
| | | System.exit(NOTHING_TO_DO); |
| | | } |
| | | else if (fullVersion.isPresent() || version.isPresent() || |
| | | else if (fullVersion.isPresent() || |
| | | systemInfo.isPresent() || dumpMessages.isPresent()) |
| | | { |
| | | // We're not really trying to start, so rebuild the argument list |
| | |
| | | System.exit(checkStartability(argParser)); |
| | | } |
| | | } |
| | | else if (argParser.usageDisplayed()) |
| | | else if (argParser.usageOrVersionDisplayed()) |
| | | { |
| | | System.exit(0); |
| | | } |
| | |
| | | |
| | | return; |
| | | } |
| | | else if (version.isPresent()) |
| | | { |
| | | System.out.println(getVersionString()); |
| | | System.out.println("Build " + BUILD_ID); |
| | | |
| | | if ((FIX_IDS != null) && (FIX_IDS.length() > 0)) |
| | | { |
| | | System.out.println("Fix IDs: " + FIX_IDS); |
| | | } |
| | | |
| | | return; |
| | | } |
| | | else if (systemInfo.isPresent()) |
| | | { |
| | | System.out.println(getVersionString()); |
| | |
| | | public static final int MSGID_EFFECTIVERIGHTS_INVALID_AUTHZID = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_MILD_ERROR | 890; |
| | | |
| | | /** |
| | | * The message ID for the message that will be used as the description of the |
| | | * version argument. This does not take any arguments. |
| | | */ |
| | | public static final int MSGID_DESCRIPTION_PRODUCT_VERSION = |
| | | CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 891; |
| | | |
| | | |
| | | /** |
| | | * Associates a set of generic messages with the message IDs defined in this |
| | |
| | | "The authorization ID \"%s\" contained in the " + |
| | | "geteffectiverights control is invalid because it does" + |
| | | " not start with \"dn:\" to indicate a user DN"); |
| | | |
| | | registerMessage(MSGID_DESCRIPTION_PRODUCT_VERSION, |
| | | "Display Directory Server version information"); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | // If we should just display usage information, then print it and exit. |
| | | if (argParser.usageDisplayed()) |
| | | // If we should just display usage or versionn information, |
| | | // then print it and exit. |
| | | if (argParser.usageOrVersionDisplayed()) |
| | | { |
| | | System.exit(0); |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | // If we should just display usage information, then print it and exit. |
| | | if (argParser.usageDisplayed()) |
| | | // If we should just display usage or version information, |
| | | // then print it and exit. |
| | | if (argParser.usageOrVersionDisplayed()) |
| | | { |
| | | return 0; |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | // If we should just display usage information, then print it and exit. |
| | | if (argParser.usageDisplayed()) |
| | | // If we should just display usage or version information, |
| | | // then print it and exit. |
| | | if (argParser.usageOrVersionDisplayed()) |
| | | { |
| | | return 0; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | // If we should just display usage information, then it is already done |
| | | if ((returnValue == 0) && !argParser.usageDisplayed()) |
| | | // If we should just display usage or version information, |
| | | // then it is already done |
| | | if ((returnValue == 0) && !argParser.usageOrVersionDisplayed()) |
| | | { |
| | | /* Check that the user only asked for one argument */ |
| | | int nArgs = 0; |
| | |
| | | } |
| | | } |
| | | |
| | | if ((returnValue == 0) && !argParser.usageDisplayed()) |
| | | if ((returnValue == 0) && !argParser.usageOrVersionDisplayed()) |
| | | { |
| | | if (enableService.isPresent()) |
| | | { |
| | |
| | | } |
| | | |
| | | |
| | | // If we should just display usage information, then we've already done it |
| | | // so just return without doing anything else. |
| | | if (argParser.usageDisplayed()) |
| | | // If we should just display usage or version information, |
| | | // then we've already done it so just return without doing anything else. |
| | | if (argParser.usageOrVersionDisplayed()) |
| | | { |
| | | return 0; |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | // If we should just display usage information, then print it and exit. |
| | | if (argParser.usageDisplayed()) |
| | | // If we should just display usage or version information, |
| | | // then print it and exit. |
| | | if (argParser.usageOrVersionDisplayed()) |
| | | { |
| | | return 0; |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | // If we should just display usage information, then print it and exit. |
| | | if (argParser.usageDisplayed()) |
| | | // If we should just display usage or version information, |
| | | // then print it and exit. |
| | | if (argParser.usageOrVersionDisplayed()) |
| | | { |
| | | return 0; |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | // If either the showUsage or testOnly arguments were provided, then we're |
| | | // done. |
| | | if (argParser.usageDisplayed() || testOnly.isPresent()) |
| | | // If either the showUsage or testOnly or version arguments were provided, |
| | | // then we're done. |
| | | if (argParser.usageOrVersionDisplayed() || testOnly.isPresent()) |
| | | { |
| | | return 0; |
| | | } |
| | |
| | | null, null, MSGID_DESCRIPTION_CONTROLS); |
| | | argParser.addArgument(controlStr); |
| | | |
| | | version = new IntegerArgument("version", 'V', "version", |
| | | false, false, true, "{version}", 3, null, |
| | | MSGID_DESCRIPTION_VERSION); |
| | | version = new IntegerArgument("version", OPTION_SHORT_PROTOCOL_VERSION, |
| | | OPTION_LONG_PROTOCOL_VERSION, |
| | | false, false, true, |
| | | OPTION_VALUE_PROTOCOL_VERSION, |
| | | 3, null, MSGID_DESCRIPTION_VERSION); |
| | | argParser.addArgument(version); |
| | | |
| | | encodingStr = new StringArgument("encoding", 'i', "encoding", |
| | |
| | | return 1; |
| | | } |
| | | |
| | | // If we should just display usage information, then print it and exit. |
| | | if (argParser.usageDisplayed()) |
| | | // If we should just display usage or version information, |
| | | // then print it and exit. |
| | | if (argParser.usageOrVersionDisplayed()) |
| | | { |
| | | return 0; |
| | | } |
| | |
| | | null, null, MSGID_DESCRIPTION_CONTROLS); |
| | | argParser.addArgument(controlStr); |
| | | |
| | | version = new IntegerArgument("version", 'V', "version", false, false, |
| | | true, "{version}", 3, null, |
| | | MSGID_DESCRIPTION_VERSION); |
| | | version = new IntegerArgument("version", OPTION_SHORT_PROTOCOL_VERSION, |
| | | OPTION_LONG_PROTOCOL_VERSION, false, false, |
| | | true, OPTION_VALUE_PROTOCOL_VERSION, 3, |
| | | null, MSGID_DESCRIPTION_VERSION); |
| | | argParser.addArgument(version); |
| | | |
| | | encodingStr = new StringArgument("encoding", 'i', "encoding", false, |
| | |
| | | return 1; |
| | | } |
| | | |
| | | // If we should just display usage information, then it has already been |
| | | // done so just exit. |
| | | if (argParser.usageDisplayed()) |
| | | // If we should just display usage or version information, |
| | | // then it has already been done so just exit. |
| | | if (argParser.usageOrVersionDisplayed()) |
| | | { |
| | | return 0; |
| | | } |
| | |
| | | null, null, MSGID_DESCRIPTION_CONTROLS); |
| | | argParser.addArgument(controlStr); |
| | | |
| | | version = new IntegerArgument("version", 'V', "version", |
| | | false, false, true, "{version}", 3, null, |
| | | version = new IntegerArgument("version", OPTION_SHORT_PROTOCOL_VERSION, |
| | | OPTION_LONG_PROTOCOL_VERSION, |
| | | false, false, true, |
| | | OPTION_VALUE_PROTOCOL_VERSION, 3, null, |
| | | MSGID_DESCRIPTION_VERSION); |
| | | argParser.addArgument(version); |
| | | |
| | |
| | | return 1; |
| | | } |
| | | |
| | | // If we should just display usage information, then print it and exit. |
| | | if (argParser.usageDisplayed()) |
| | | // If we should just display usage or version information, |
| | | // then print it and exit. |
| | | if (argParser.usageOrVersionDisplayed()) |
| | | { |
| | | return 0; |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | // If the usage argument was provided, then we don't need to do anything |
| | | // else. |
| | | if (argParser.usageDisplayed()) |
| | | // If the usage or version argument was provided, |
| | | // then we don't need to do anything else. |
| | | if (argParser.usageOrVersionDisplayed()) |
| | | { |
| | | return 0; |
| | | } |
| | |
| | | MSGID_DESCRIPTION_EFFECTIVERIGHTS_ATTR ); |
| | | argParser.addArgument(effectiveRightsAttrs); |
| | | |
| | | version = new IntegerArgument("version", 'V', "version", false, false, |
| | | true, "{version}", 3, null, |
| | | MSGID_DESCRIPTION_VERSION); |
| | | version = new IntegerArgument("version", OPTION_SHORT_PROTOCOL_VERSION, |
| | | OPTION_LONG_PROTOCOL_VERSION, false, false, |
| | | true, OPTION_VALUE_PROTOCOL_VERSION, 3, |
| | | null, MSGID_DESCRIPTION_VERSION); |
| | | argParser.addArgument(version); |
| | | |
| | | encodingStr = new StringArgument("encoding", 'i', "encoding", false, |
| | |
| | | return 1; |
| | | } |
| | | |
| | | // If we should just display usage information, then print it and exit. |
| | | if (argParser.usageDisplayed()) |
| | | // If we should just display usage or version information, |
| | | // then print it and exit. |
| | | if (argParser.usageOrVersionDisplayed()) |
| | | { |
| | | return 0; |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | // If we should just display usage information, then print it and exit. |
| | | if (argParser.usageDisplayed()) |
| | | // If we should just display usage or version information, |
| | | // then print it and exit. |
| | | if (argParser.usageOrVersionDisplayed()) |
| | | { |
| | | return 0; |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | // If we should just display usage information, then print it and exit. |
| | | if (argParser.usageDisplayed()) |
| | | // If we should just display usage or version information, |
| | | // then print it and exit. |
| | | if (argParser.usageOrVersionDisplayed()) |
| | | { |
| | | return 0; |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | // If we should just display usage information, then print it and exit. |
| | | if (argParser.usageDisplayed()) |
| | | // If we should just display usage or version information, |
| | | // then print it and exit. |
| | | if (argParser.usageOrVersionDisplayed()) |
| | | { |
| | | return 0; |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | // If we should just display usage information, then it's already been done |
| | | // so just return. |
| | | if (argParser.usageDisplayed()) |
| | | // If we should just display usage or version information, |
| | | // then it's already been done so just return. |
| | | if (argParser.usageOrVersionDisplayed()) |
| | | { |
| | | return 0; |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | // If we should just display usage information, then print it and exit. |
| | | if (argParser.usageDisplayed()) |
| | | // If we should just display usage or version information, |
| | | // then print it and exit. |
| | | if (argParser.usageOrVersionDisplayed()) |
| | | { |
| | | return 0; |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | // If we should just display usage information, then print it and exit. |
| | | if (argParser.usageDisplayed()) |
| | | // If we should just display usage or version information, |
| | | // then print it and exit. |
| | | if (argParser.usageOrVersionDisplayed()) |
| | | { |
| | | return 0; |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | // If we should just display usage information, then exit because it will |
| | | // have already been done. |
| | | if (argParser.usageDisplayed()) |
| | | // If we should just display usage or version information, |
| | | // then exit because it will have already been done. |
| | | if (argParser.usageOrVersionDisplayed()) |
| | | { |
| | | return LDAPResultCode.SUCCESS; |
| | | } |
| | |
| | | */ |
| | | public static final String OPTION_LONG_EFFECTIVERIGHTSATTR = |
| | | "getEffectiveRightsAttribute"; |
| | | |
| | | /** |
| | | * The value for the short option protocol version attributes. |
| | | */ |
| | | public static final char OPTION_SHORT_PROTOCOL_VERSION = 'V'; |
| | | |
| | | /** |
| | | * The value for the long option protocol version |
| | | * attribute. |
| | | */ |
| | | public static final String OPTION_LONG_PROTOCOL_VERSION = |
| | | "ldapVersion"; |
| | | |
| | | /** |
| | | * The placeholder value of protocol version that will be |
| | | * displayed in usage information. |
| | | */ |
| | | public static final String OPTION_VALUE_PROTOCOL_VERSION = "{version}"; |
| | | |
| | | /** |
| | | * The value for the long option version. |
| | | */ |
| | | public static final char OPTION_SHORT_PRODUCT_VERSION = 'V'; |
| | | |
| | | /** |
| | | * The value for the long option version. |
| | | */ |
| | | public static final String OPTION_LONG_PRODUCT_VERSION = "version"; |
| | | |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | // If we should just display usage information, then print it and exit. |
| | | if (argParser.usageDisplayed()) |
| | | // If we should just display usage or version information, |
| | | // then print it and exit. |
| | | if (argParser.usageOrVersionDisplayed()) |
| | | { |
| | | return 0; |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | // If we should just display usage information, then print it and exit. |
| | | if (argParser.usageDisplayed()) |
| | | // If we should just display usage or version information, |
| | | // then print it and exit. |
| | | if (argParser.usageOrVersionDisplayed()) |
| | | { |
| | | return EXIT_CODE_SUCCESS; |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | // If we should just display usage information, then print it and exit. |
| | | if (argParser.usageDisplayed()) |
| | | // If we should just display usage or version information, |
| | | // then print it and exit. |
| | | if (argParser.usageOrVersionDisplayed()) |
| | | { |
| | | return 0; |
| | | } |
| | |
| | | import java.util.LinkedList; |
| | | import java.util.Properties; |
| | | |
| | | import org.opends.server.core.DirectoryServer; |
| | | |
| | | import static org.opends.server.messages.MessageHandler.*; |
| | | import static org.opends.server.messages.UtilityMessages.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import static org.opends.server.tools.ToolConstants.*; |
| | | import static org.opends.server.messages.ToolMessages.*; |
| | | |
| | | |
| | | /** |
| | |
| | | // manner. |
| | | private boolean longArgumentsCaseSensitive; |
| | | |
| | | // Indicates whether the usage information has been displayed. |
| | | private boolean usageDisplayed; |
| | | // Indicates whether the usage or version information has been displayed. |
| | | private boolean usageOrVersionDisplayed; |
| | | |
| | | // The set of arguments defined for this parser, referenced by short ID. |
| | | private HashMap<Character,Argument> shortIDMap; |
| | |
| | | shortIDMap = new HashMap<Character,Argument>(); |
| | | longIDMap = new HashMap<String,Argument>(); |
| | | allowsTrailingArguments = false; |
| | | usageDisplayed = false; |
| | | usageOrVersionDisplayed = false; |
| | | trailingArgsDisplayName = null; |
| | | maxTrailingArguments = 0; |
| | | minTrailingArguments = 0; |
| | |
| | | shortIDMap = new HashMap<Character,Argument>(); |
| | | longIDMap = new HashMap<String,Argument>(); |
| | | trailingArguments = new ArrayList<String>(); |
| | | usageDisplayed = false; |
| | | usageOrVersionDisplayed = false; |
| | | rawArguments = null; |
| | | usageArgument = null; |
| | | usageOutputStream = System.out; |
| | |
| | | return; |
| | | } |
| | | else |
| | | if (argName.equals(OPTION_LONG_PRODUCT_VERSION)) |
| | | { |
| | | // "--version" will always be interpreted as requesting version |
| | | // information. |
| | | usageOrVersionDisplayed = true; |
| | | try |
| | | { |
| | | DirectoryServer.printVersion(usageOutputStream); |
| | | } catch (Exception e) {} |
| | | |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | // There is no such argument registered. |
| | | int msgID = MSGID_ARGPARSER_NO_ARGUMENT_WITH_LONG_ID; |
| | |
| | | return; |
| | | } |
| | | else |
| | | if ( (argCharacter == OPTION_SHORT_PRODUCT_VERSION) |
| | | && |
| | | ( ! shortIDMap.containsKey(OPTION_SHORT_PRODUCT_VERSION))) |
| | | { |
| | | // "-V" will always be interpreted as requesting |
| | | // version information except if it's already defined (e.g in |
| | | // lpda tools). |
| | | usageOrVersionDisplayed = true ; |
| | | try |
| | | { |
| | | DirectoryServer.printVersion(usageOutputStream); |
| | | } catch (Exception e) {} |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | // There is no such argument registered. |
| | | int msgID = MSGID_ARGPARSER_NO_ARGUMENT_WITH_SHORT_ID; |
| | |
| | | */ |
| | | public void getUsage(StringBuilder buffer) |
| | | { |
| | | usageDisplayed = true; |
| | | usageOrVersionDisplayed = true; |
| | | if ((toolDescription != null) && (toolDescription.length() > 0)) |
| | | { |
| | | buffer.append(wrapText(toolDescription, 79)); |
| | |
| | | buffer.append(" where {options} include:"); |
| | | buffer.append(EOL); |
| | | |
| | | // --version is a builtin option |
| | | if (! shortIDMap.containsKey(OPTION_SHORT_PRODUCT_VERSION)) |
| | | { |
| | | buffer.append("-" + OPTION_SHORT_PRODUCT_VERSION + ", "); |
| | | } |
| | | buffer.append("--" + OPTION_LONG_PRODUCT_VERSION); |
| | | buffer.append(EOL); |
| | | buffer.append(" "); |
| | | buffer.append( getMessage(MSGID_DESCRIPTION_PRODUCT_VERSION)); |
| | | buffer.append(EOL); |
| | | |
| | | for (Argument a : argumentList) |
| | | { |
| | | // If this argument is hidden, then skip it. |
| | |
| | | |
| | | |
| | | /** |
| | | * Indicates whether the usage information has been displayed to the end user |
| | | * either by an explicit argument like "-H" or "--help", or by a built-in |
| | | * argument like "-?". |
| | | * Indicates whether the version or the usage information has been |
| | | * displayed to the end user either by an explicit argument like |
| | | * "-H" or "--help", or by a built-in argument like "-?". |
| | | * |
| | | * @return {@code true} if the usage information has been displayed, or |
| | | * {@code false} if not. |
| | | * @return {@code true} if the usage information has been displayed, |
| | | * or {@code false} if not. |
| | | */ |
| | | public boolean usageDisplayed() |
| | | public boolean usageOrVersionDisplayed() |
| | | { |
| | | return usageDisplayed; |
| | | return usageOrVersionDisplayed; |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | import java.util.LinkedList; |
| | | import java.util.Properties; |
| | | |
| | | import org.opends.server.core.DirectoryServer; |
| | | |
| | | import static org.opends.server.messages.MessageHandler.*; |
| | | import static org.opends.server.messages.UtilityMessages.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static org.opends.server.tools.ToolConstants.*; |
| | | |
| | | |
| | | |
| | |
| | | return; |
| | | } |
| | | else |
| | | if (argName.equals(OPTION_LONG_PRODUCT_VERSION)) |
| | | { |
| | | // "--version" will always be interpreted as requesting usage |
| | | // information. |
| | | try |
| | | { |
| | | DirectoryServer.printVersion(usageOutputStream); |
| | | } catch (Exception e) {} |
| | | |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | // There is no such global argument. |
| | | int msgID = MSGID_SUBCMDPARSER_NO_GLOBAL_ARGUMENT_FOR_LONG_ID; |
| | |
| | | return; |
| | | } |
| | | else |
| | | if (argName.equals(OPTION_LONG_PRODUCT_VERSION)) |
| | | { |
| | | // "--version" will always be interpreted as requesting usage |
| | | // information. |
| | | try |
| | | { |
| | | DirectoryServer.printVersion(usageOutputStream); |
| | | } catch (Exception e) {} |
| | | |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | // There is no such global or subcommand argument. |
| | | int msgID = MSGID_SUBCMDPARSER_NO_ARGUMENT_FOR_LONG_ID; |
| | |
| | | return; |
| | | } |
| | | else |
| | | if (argCharacter == OPTION_SHORT_PRODUCT_VERSION) |
| | | { |
| | | // "-V" will always be interpreted as requesting |
| | | // version information. |
| | | try |
| | | { |
| | | getUsage(usageOutputStream); |
| | | } catch (Exception e) {} |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | // There is no such argument registered. |
| | | int msgID = MSGID_SUBCMDPARSER_NO_GLOBAL_ARGUMENT_FOR_SHORT_ID; |
| | |
| | | return; |
| | | } |
| | | else |
| | | if (argCharacter == OPTION_SHORT_PRODUCT_VERSION) |
| | | { |
| | | // "-V" will always be interpreted as requesting |
| | | // version information. |
| | | try |
| | | { |
| | | getUsage(usageOutputStream); |
| | | } catch (Exception e) {} |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | // There is no such argument registered. |
| | | int msgID = MSGID_SUBCMDPARSER_NO_ARGUMENT_FOR_SHORT_ID; |
| | |
| | | import java.io.BufferedReader; |
| | | import java.io.File; |
| | | import java.io.FileReader; |
| | | import java.io.IOException; |
| | | import java.io.PrintStream; |
| | | import java.util.ArrayList; |
| | | import java.util.HashSet; |
| | |
| | | ArrayList<String> errors = new ArrayList<String>(); |
| | | |
| | | boolean printUsage = false; |
| | | boolean printVersion = false; |
| | | |
| | | String directoryManagerPwd = null; |
| | | String directoryManagerPwdFile = null; |
| | |
| | | { |
| | | printUsage = true; |
| | | } |
| | | else |
| | | if (args[i].equalsIgnoreCase("-" + OPTION_SHORT_PRODUCT_VERSION) || |
| | | args[i].equalsIgnoreCase("--" + OPTION_LONG_PRODUCT_VERSION)) |
| | | { |
| | | printVersion = true; |
| | | } |
| | | else if (args[i].equalsIgnoreCase("-D") || |
| | | args[i].equalsIgnoreCase("--bindDN")) |
| | | { |
| | |
| | | { |
| | | printUsage(System.out); |
| | | } |
| | | else if(printVersion) |
| | | { |
| | | try |
| | | { |
| | | DirectoryServer.printVersion(System.out); |
| | | } |
| | | catch (IOException e) |
| | | { |
| | | // TODO Auto-generated catch block |
| | | } |
| | | } |
| | | else if (errors.size() > 0) |
| | | { |
| | | System.err.println(Utils.getStringFromCollection(errors, |
| | |
| | | |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.io.PrintStream; |
| | | import java.util.logging.Level; |
| | | import java.util.logging.Logger; |
| | | |
| | | import org.opends.quicksetup.util.Utils; |
| | | import org.opends.quicksetup.Installation; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.statuspanel.i18n.ResourceProvider; |
| | | import static org.opends.server.tools.ToolConstants.*; |
| | | |
| | | /** |
| | | * This class is called by the control panel command lines to launch the |
| | |
| | | t.printStackTrace(); |
| | | } |
| | | boolean printUsage = false; |
| | | boolean printVersion = false; |
| | | if ((args != null) && (args.length > 4)) |
| | | { |
| | | printUsage = true; |
| | |
| | | { |
| | | printUsage = true; |
| | | } |
| | | else |
| | | if (args[i].equalsIgnoreCase("-" + OPTION_SHORT_PRODUCT_VERSION) || |
| | | args[i].equalsIgnoreCase("--" + OPTION_LONG_PRODUCT_VERSION)) |
| | | { |
| | | printVersion = true; |
| | | } |
| | | } |
| | | // We first check if we have to pribt the version |
| | | if(printVersion) |
| | | { |
| | | try |
| | | { |
| | | DirectoryServer.printVersion(System.out); |
| | | } |
| | | catch (IOException e) |
| | | { |
| | | // TODO Auto-generated catch block |
| | | } |
| | | System.exit(1); |
| | | } |
| | | else |
| | | if (printUsage) |
| | | { |
| | | printUsage(System.out); |
| | |
| | | Panel window which displays basic server information and allows to \ |
| | | start, stop and restart the server.\n\ |
| | | Usage: {0} {options}\n where {options} include:\n\ |
| | | -V, --version\n Display Directory Server version information.\n\ |
| | | -?, -H, --help\n Display this usage information. |
| | | status-panel-launcher-gui-launch-failed=Could not launch Status Panel. Check \ |
| | | that you have access to the display. |
| | |
| | | status-cli-usage=This utility may be used to display basic server \ |
| | | information\n\n\ |
| | | Usage: {0} {options}\n where {options} include:\n\ |
| | | -V, --version\n Display Directory Server version information\n\ |
| | | -D {bindDN}, --bindDN {bindDN}\n Bind DN\n\ |
| | | -w {bindPassword}, --bindPassword {bindPassword}\n Bind password\n\ |
| | | -j {bindPasswordFile}, --bindPasswordFile {bindPasswordFile}\n Bind \ |