From 180b7d839228b6d3a48cd84dbe60daaca2f8e35f Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Mon, 30 Jul 2007 13:41:25 +0000
Subject: [PATCH] Move dsconfig messages out of a properties file and into the ToolMessages.java message file in anticipation of forthcoming i18n improvements.
---
opends/src/server/org/opends/server/tools/dsconfig/HelpSubCommandHandler.java | 168 +++++-------------
/dev/null | 36 ----
opends/src/server/org/opends/server/messages/ToolMessages.java | 293 ++++++++++++++++++++++++++++++++
opends/src/server/org/opends/server/admin/client/cli/DsFrameworkCliServer.java | 23 +-
opends/src/server/org/opends/server/tools/dsconfig/SetPropSubCommandHandler.java | 6
opends/src/server/org/opends/server/tools/dsconfig/CreateSubCommandHandler.java | 6
opends/src/server/org/opends/server/tools/dsconfig/DeleteSubCommandHandler.java | 8
7 files changed, 360 insertions(+), 180 deletions(-)
diff --git a/opends/src/server/org/opends/server/admin/client/cli/DsFrameworkCliServer.java b/opends/src/server/org/opends/server/admin/client/cli/DsFrameworkCliServer.java
index e937cd1..948b6b9 100644
--- a/opends/src/server/org/opends/server/admin/client/cli/DsFrameworkCliServer.java
+++ b/opends/src/server/org/opends/server/admin/client/cli/DsFrameworkCliServer.java
@@ -51,7 +51,6 @@
import org.opends.server.admin.PropertyOption;
import org.opends.server.admin.client.cli.DsFrameworkCliReturnCode.ReturnCode;
import org.opends.server.tools.dsconfig.ArgumentExceptionFactory;
-import org.opends.server.tools.dsconfig.Messages;
import org.opends.server.util.args.Argument;
import org.opends.server.util.args.ArgumentException;
import org.opends.server.util.args.BooleanArgument;
@@ -67,22 +66,20 @@
public class DsFrameworkCliServer implements DsFrameworkCliSubCommandGroup
{
// Strings used in property help.
- private static final String KEY_PREFIX = "help-properties.";
+ private final static String DESCRIPTION_OPTIONS_TITLE =
+ getMessage(MSGID_DSCFG_HELP_DESCRIPTION_OPTION);
- private final static String DESCRIPTION_OPTIONS_TITLE = Messages
- .getString(KEY_PREFIX + "description.options"); //$NON-NLS-1$
+ private final static String DESCRIPTION_OPTIONS_READ =
+ getMessage(MSGID_DSCFG_HELP_DESCRIPTION_READ);
- private final static String DESCRIPTION_OPTIONS_READ = Messages
- .getString(KEY_PREFIX + "description.read"); //$NON-NLS-1$
+ private final static String DESCRIPTION_OPTIONS_WRITE =
+ getMessage(MSGID_DSCFG_HELP_DESCRIPTION_WRITE);
- private final static String DESCRIPTION_OPTIONS_WRITE = Messages
- .getString(KEY_PREFIX + "description.write"); //$NON-NLS-1$
+ private final static String DESCRIPTION_OPTIONS_MANDATORY =
+ getMessage(MSGID_DSCFG_HELP_DESCRIPTION_MANDATORY);
- private final static String DESCRIPTION_OPTIONS_MANDATORY = Messages
- .getString(KEY_PREFIX + "description.mandatory"); //$NON-NLS-1$
-
- private final static String DESCRIPTION_OPTIONS_SINGLE = Messages
- .getString(KEY_PREFIX + "description.single-valued"); //$NON-NLS-1$
+ private final static String DESCRIPTION_OPTIONS_SINGLE =
+ getMessage(MSGID_DSCFG_HELP_DESCRIPTION_SINGLE_VALUED);
/**
* The subcommand Parser.
diff --git a/opends/src/server/org/opends/server/messages/ToolMessages.java b/opends/src/server/org/opends/server/messages/ToolMessages.java
index eb08e12..c0ddc83 100644
--- a/opends/src/server/org/opends/server/messages/ToolMessages.java
+++ b/opends/src/server/org/opends/server/messages/ToolMessages.java
@@ -9482,6 +9482,232 @@
CATEGORY_MASK_TOOLS | SEVERITY_MASK_SEVERE_ERROR | 1253;
/**
+ * The message ID for the message which will be used in dsconfig
+ * help for enumerations.
+ */
+ public static final int MSGID_DSCFG_HELP_FIELD_ENUM =
+ CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 1254;
+
+ /**
+ * The message ID for the message which will be used in dsconfig
+ * help for undefined default behavior.
+ */
+ public static final int MSGID_DSCFG_HELP_FIELD_UNDEFINED =
+ CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 1255;
+
+ /**
+ * The message ID for the message which will be used in dsconfig
+ * help for absolute inherited default behavior.
+ */
+ public static final int MSGID_DSCFG_HELP_FIELD_INHERITED_ABS =
+ CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 1256;
+
+ /**
+ * The message ID for the message which will be used in dsconfig
+ * help for offset > 0 inherited default behavior.
+ */
+ public static final int MSGID_DSCFG_HELP_FIELD_INHERITED_PARENT =
+ CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 1257;
+
+ /**
+ * The message ID for the message which will be used in dsconfig
+ * help for offset 0 inherited default behavior.
+ */
+ public static final int MSGID_DSCFG_HELP_FIELD_INHERITED_THIS =
+ CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 1258;
+
+ /**
+ * The message ID for the message which will be used in dsconfig
+ * help for server restart.
+ */
+ public static final int MSGID_DSCFG_HELP_FIELD_SERVER_RESTART =
+ CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 1259;
+
+ /**
+ * The message ID for the message which will be used in dsconfig
+ * help for component restart.
+ */
+ public static final int MSGID_DSCFG_HELP_FIELD_COMPONENT_RESTART =
+ CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 1260;
+
+ /**
+ * The message ID for the message which will be used in dsconfig
+ * help for read-only.
+ */
+ public static final int MSGID_DSCFG_HELP_FIELD_READ_ONLY =
+ CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 1261;
+
+ /**
+ * The message ID for the message which will be used in dsconfig
+ * help for monitoring.
+ */
+ public static final int MSGID_DSCFG_HELP_FIELD_MONITORING =
+ CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 1262;
+
+ /**
+ * The message ID for the message which will be used in dsconfig
+ * help for the property heading.
+ */
+ public static final int MSGID_DSCFG_HELP_HEADING_PROPERTY =
+ CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 1263;
+
+ /**
+ * The message ID for the message which will be used in dsconfig
+ * help for the component heading.
+ */
+ public static final int MSGID_DSCFG_HELP_HEADING_COMPONENT =
+ CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 1264;
+
+ /**
+ * The message ID for the message which will be used in dsconfig
+ * help for the default heading.
+ */
+ public static final int MSGID_DSCFG_HELP_HEADING_DEFAULT =
+ CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 1265;
+
+ /**
+ * The message ID for the message which will be used in dsconfig
+ * help for the mandatory heading.
+ */
+ public static final int MSGID_DSCFG_HELP_HEADING_MANDATORY =
+ CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 1266;
+
+ /**
+ * The message ID for the message which will be used in dsconfig
+ * help for the advanced heading.
+ */
+ public static final int MSGID_DSCFG_HELP_HEADING_ADVANCED =
+ CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 1267;
+
+ /**
+ * The message ID for the message which will be used in dsconfig
+ * help for the multi-valued heading.
+ */
+ public static final int MSGID_DSCFG_HELP_HEADING_MULTI_VALUED =
+ CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 1268;
+
+ /**
+ * The message ID for the message which will be used in dsconfig
+ * help for the read-only heading.
+ */
+ public static final int MSGID_DSCFG_HELP_HEADING_READ_ONLY =
+ CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 1269;
+
+ /**
+ * The message ID for the message which will be used in dsconfig
+ * help for the syntax heading.
+ */
+ public static final int MSGID_DSCFG_HELP_HEADING_SYNTAX =
+ CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 1270;
+
+ /**
+ * The message ID for the message which will be used in dsconfig
+ * help for the options description.
+ */
+ public static final int MSGID_DSCFG_HELP_DESCRIPTION_OPTION =
+ CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 1271;
+
+ /**
+ * The message ID for the message which will be used in dsconfig
+ * help for the readable description.
+ */
+ public static final int MSGID_DSCFG_HELP_DESCRIPTION_READ =
+ CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 1272;
+
+ /**
+ * The message ID for the message which will be used in dsconfig
+ * help for the writable description.
+ */
+ public static final int MSGID_DSCFG_HELP_DESCRIPTION_WRITE =
+ CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 1273;
+
+ /**
+ * The message ID for the message which will be used in dsconfig
+ * help for the mandatory description.
+ */
+ public static final int MSGID_DSCFG_HELP_DESCRIPTION_MANDATORY =
+ CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 1274;
+
+ /**
+ * The message ID for the message which will be used in dsconfig
+ * help for the single-valued description.
+ */
+ public static final int MSGID_DSCFG_HELP_DESCRIPTION_SINGLE_VALUED =
+ CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 1275;
+
+ /**
+ * The message ID for the message which will be used in dsconfig
+ * help for the admin-action description.
+ */
+ public static final int MSGID_DSCFG_HELP_DESCRIPTION_ADMIN_ACTION =
+ CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 1276;
+
+ /**
+ * The message ID for the message which will be used in dsconfig
+ * help for the creation confirmation question.
+ */
+ public static final int MSGID_DSCFG_CONFIRM_CREATE =
+ CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 1277;
+
+ /**
+ * The message ID for the message which will be used in dsconfig
+ * help for the deletion confirmation question.
+ */
+ public static final int MSGID_DSCFG_CONFIRM_DELETE =
+ CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 1278;
+
+ /**
+ * The message ID for the message which will be used in dsconfig
+ * help for the modify confirmation question.
+ */
+ public static final int MSGID_DSCFG_CONFIRM_MODIFY =
+ CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 1279;
+
+ /**
+ * The message ID for the message which will be used in dsconfig
+ * help for the creation successful confirmation message.
+ */
+ public static final int MSGID_DSCFG_CONFIRM_CREATE_SUCCESS =
+ CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 1280;
+
+ /**
+ * The message ID for the message which will be used in dsconfig
+ * help for the deletion successful confirmation message.
+ */
+ public static final int MSGID_DSCFG_CONFIRM_DELETE_SUCCESS =
+ CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 1281;
+
+ /**
+ * The message ID for the message which will be used in dsconfig
+ * help for the modify successful confirmation message.
+ */
+ public static final int MSGID_DSCFG_CONFIRM_MODIFY_SUCCESS =
+ CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 1282;
+
+ /**
+ * The message ID for the message which will be used in dsconfig
+ * help for the creation failure confirmation message.
+ */
+ public static final int MSGID_DSCFG_CONFIRM_CREATE_FAIL =
+ CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 1283;
+
+ /**
+ * The message ID for the message which will be used in dsconfig
+ * help for the deletion failure confirmation message.
+ */
+ public static final int MSGID_DSCFG_CONFIRM_DELETE_FAIL =
+ CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 1284;
+
+ /**
+ * The message ID for the message which will be used in dsconfig
+ * help for the modify failure confirmation message.
+ */
+ public static final int MSGID_DSCFG_CONFIRM_MODIFY_FAIL =
+ CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 1285;
+
+
+
+ /**
* Associates a set of generic messages with the message IDs defined in this
* class.
*/
@@ -12539,6 +12765,73 @@
"remove all entries for all base DNs (%s) in the " +
"backend. The %s argument must be given to continue with " +
"import");
+ registerMessage(MSGID_DSCFG_HELP_FIELD_ENUM,
+ "one of the following values:");
+ registerMessage(MSGID_DSCFG_HELP_FIELD_UNDEFINED,
+ "undefined");
+ registerMessage(MSGID_DSCFG_HELP_FIELD_INHERITED_ABS,
+ "inherits from the property \"%s\" in the %s");
+ registerMessage(MSGID_DSCFG_HELP_FIELD_INHERITED_PARENT,
+ "inherits from the property \"%s\" in the parent %s");
+ registerMessage(MSGID_DSCFG_HELP_FIELD_INHERITED_THIS,
+ "inherits from the property \"%s\" in this %s");
+ registerMessage(MSGID_DSCFG_HELP_FIELD_SERVER_RESTART,
+ "The server must be restarted in order for changes to this property " +
+ "to take effect");
+ registerMessage(MSGID_DSCFG_HELP_FIELD_COMPONENT_RESTART,
+ "The %s must be restarted in order for changes to this property to " +
+ "take effect");
+ registerMessage(MSGID_DSCFG_HELP_FIELD_READ_ONLY,
+ "read-only - this property can only be specified when the %s " +
+ "is created");
+ registerMessage(MSGID_DSCFG_HELP_FIELD_MONITORING,
+ "monitoring - this property is automatically generated by the server");
+ registerMessage(MSGID_DSCFG_HELP_HEADING_PROPERTY,
+ "Property: %s");
+ registerMessage(MSGID_DSCFG_HELP_HEADING_COMPONENT,
+ "Component: %s");
+ registerMessage(MSGID_DSCFG_HELP_HEADING_DEFAULT,
+ "Default behavior");
+ registerMessage(MSGID_DSCFG_HELP_HEADING_MANDATORY,
+ "Mandatory");
+ registerMessage(MSGID_DSCFG_HELP_HEADING_ADVANCED,
+ "Advanced");
+ registerMessage(MSGID_DSCFG_HELP_HEADING_MULTI_VALUED,
+ "Multi-valued");
+ registerMessage(MSGID_DSCFG_HELP_HEADING_READ_ONLY,
+ "Read-only");
+ registerMessage(MSGID_DSCFG_HELP_HEADING_SYNTAX,
+ "Syntax");
+ registerMessage(MSGID_DSCFG_HELP_DESCRIPTION_OPTION,
+ "Option Types:");
+ registerMessage(MSGID_DSCFG_HELP_DESCRIPTION_READ,
+ "Property value(s) are readable");
+ registerMessage(MSGID_DSCFG_HELP_DESCRIPTION_WRITE,
+ "Property value(s) are writable");
+ registerMessage(MSGID_DSCFG_HELP_DESCRIPTION_MANDATORY,
+ "The property is mandatory");
+ registerMessage(MSGID_DSCFG_HELP_DESCRIPTION_SINGLE_VALUED,
+ "The property is single-valued");
+ registerMessage(MSGID_DSCFG_HELP_DESCRIPTION_ADMIN_ACTION,
+ "Administrative action is required for changes to take effect");
+ registerMessage(MSGID_DSCFG_CONFIRM_CREATE,
+ "Are you sure that you want to create the %s?");
+ registerMessage(MSGID_DSCFG_CONFIRM_DELETE,
+ "Are you sure that you want to delete the %s?");
+ registerMessage(MSGID_DSCFG_CONFIRM_MODIFY,
+ "Are you sure that you want to modify the %s?");
+ registerMessage(MSGID_DSCFG_CONFIRM_CREATE_SUCCESS,
+ "The %s was created successfully");
+ registerMessage(MSGID_DSCFG_CONFIRM_DELETE_SUCCESS,
+ "The %s was deleted successfully");
+ registerMessage(MSGID_DSCFG_CONFIRM_MODIFY_SUCCESS,
+ "The %s was modified successfully");
+ registerMessage(MSGID_DSCFG_CONFIRM_CREATE_FAIL,
+ "The %s was not created");
+ registerMessage(MSGID_DSCFG_CONFIRM_DELETE_FAIL,
+ "The %s was not deleted");
+ registerMessage(MSGID_DSCFG_CONFIRM_MODIFY_FAIL,
+ "The %s was not modified");
}
}
diff --git a/opends/src/server/org/opends/server/tools/dsconfig/CreateSubCommandHandler.java b/opends/src/server/org/opends/server/tools/dsconfig/CreateSubCommandHandler.java
index 489d4fc..3c1bda1 100644
--- a/opends/src/server/org/opends/server/tools/dsconfig/CreateSubCommandHandler.java
+++ b/opends/src/server/org/opends/server/tools/dsconfig/CreateSubCommandHandler.java
@@ -621,11 +621,11 @@
}
// Confirm commit.
- String prompt = String.format(Messages.getString("create.confirm"), d
+ String prompt = getMessage(MSGID_DSCFG_CONFIRM_CREATE, d
.getUserFriendlyName());
if (!getConsoleApplication().confirmAction(prompt)) {
// Output failure message.
- String msg = String.format(Messages.getString("create.failed"), d
+ String msg = getMessage(MSGID_DSCFG_CONFIRM_CREATE_FAIL, d
.getUserFriendlyName());
getConsoleApplication().printVerboseMessage(msg);
return 1;
@@ -635,7 +635,7 @@
child.commit();
// Output success message.
- String msg = String.format(Messages.getString("create.done"), d
+ String msg = getMessage(MSGID_DSCFG_CONFIRM_CREATE_SUCCESS, d
.getUserFriendlyName());
getConsoleApplication().printVerboseMessage(msg);
} catch (MissingMandatoryPropertiesException e) {
diff --git a/opends/src/server/org/opends/server/tools/dsconfig/DeleteSubCommandHandler.java b/opends/src/server/org/opends/server/tools/dsconfig/DeleteSubCommandHandler.java
index c833566..be09a8a 100644
--- a/opends/src/server/org/opends/server/tools/dsconfig/DeleteSubCommandHandler.java
+++ b/opends/src/server/org/opends/server/tools/dsconfig/DeleteSubCommandHandler.java
@@ -286,7 +286,7 @@
}
// Output success message.
- String msg = String.format(Messages.getString("delete.done"), relation
+ String msg = getMessage(MSGID_DSCFG_CONFIRM_DELETE_SUCCESS, relation
.getUserFriendlyName());
getConsoleApplication().printVerboseMessage(msg);
@@ -297,11 +297,11 @@
// Confirm deletion.
private boolean confirmDeletion() throws ArgumentException {
- String prompt = String.format(Messages.getString("delete.confirm"),
- relation.getUserFriendlyName());
+ String prompt = getMessage(MSGID_DSCFG_CONFIRM_DELETE, relation
+ .getUserFriendlyName());
if (!getConsoleApplication().confirmAction(prompt)) {
// Output failure message.
- String msg = String.format(Messages.getString("delete.failed"), relation
+ String msg = getMessage(MSGID_DSCFG_CONFIRM_DELETE_FAIL, relation
.getUserFriendlyName());
getConsoleApplication().printVerboseMessage(msg);
return false;
diff --git a/opends/src/server/org/opends/server/tools/dsconfig/HelpSubCommandHandler.java b/opends/src/server/org/opends/server/tools/dsconfig/HelpSubCommandHandler.java
index 3c9f906..7cee8cc 100644
--- a/opends/src/server/org/opends/server/tools/dsconfig/HelpSubCommandHandler.java
+++ b/opends/src/server/org/opends/server/tools/dsconfig/HelpSubCommandHandler.java
@@ -97,9 +97,9 @@
public String visitAbsoluteInherited(
AbsoluteInheritedDefaultBehaviorProvider<T> d,
PropertyDefinition<T> p) {
- return String.format(FIELD_INHERITS_ABSOLUTE, d.getPropertyName(), d
- .getManagedObjectPath().getRelationDefinition()
- .getUserFriendlyName());
+ return getMessage(MSGID_DSCFG_HELP_FIELD_INHERITED_ABS, d
+ .getPropertyName(), d.getManagedObjectPath()
+ .getRelationDefinition().getUserFriendlyName());
}
@@ -125,7 +125,7 @@
boolean isFirst = true;
for (String s : d.getDefaultValues()) {
if (!isFirst) {
- builder.append(", "); //$NON-NLS-1$
+ builder.append(", ");
}
T value = p.decodeValue(s);
@@ -144,11 +144,11 @@
RelativeInheritedDefaultBehaviorProvider<T> d,
PropertyDefinition<T> p) {
if (d.getRelativeOffset() == 0) {
- return String.format(FIELD_INHERITS_RELATIVE_THIS, d
+ return getMessage(MSGID_DSCFG_HELP_FIELD_INHERITED_THIS, d
.getPropertyName(), d.getManagedObjectDefinition()
.getUserFriendlyName());
} else {
- return String.format(FIELD_INHERITS_RELATIVE_PARENT, d
+ return getMessage(MSGID_DSCFG_HELP_FIELD_INHERITED_PARENT, d
.getPropertyName(), d.getManagedObjectDefinition()
.getUserFriendlyName());
}
@@ -161,7 +161,7 @@
*/
public String visitUndefined(UndefinedDefaultBehaviorProvider<T> d,
PropertyDefinition<T> p) {
- return FIELD_UNDEFINED;
+ return getMessage(MSGID_DSCFG_HELP_FIELD_UNDEFINED);
}
}
@@ -221,7 +221,7 @@
@Override
public <E extends Enum<E>> Void visitEnum(EnumPropertyDefinition<E> d,
PrintStream p) {
- displayUsage(p, FIELD_ENUM);
+ displayUsage(p, getMessage(MSGID_DSCFG_HELP_FIELD_ENUM));
p.println();
TableBuilder builder = new TableBuilder();
@@ -265,7 +265,7 @@
TableBuilder builder = new TableBuilder();
builder.startRow();
- builder.appendCell(HEADING_SYNTAX);
+ builder.appendCell(getMessage(MSGID_DSCFG_HELP_HEADING_SYNTAX));
builder.appendCell(HEADING_SEPARATOR);
builder.appendCell(usageBuilder.getUsage(d));
@@ -309,7 +309,7 @@
private void displayUsage(PrintStream p, String usage) {
TableBuilder builder = new TableBuilder();
builder.startRow();
- builder.appendCell(HEADING_SYNTAX);
+ builder.appendCell(getMessage(MSGID_DSCFG_HELP_HEADING_SYNTAX));
builder.appendCell(HEADING_SEPARATOR);
builder.appendCell(usage);
@@ -352,84 +352,7 @@
}
// Strings used in property help.
- private static final String KEY_PREFIX = "help-properties.";
-
- private static final String FIELD_COMPONENT_RESTART = Messages
- .getString(KEY_PREFIX + "field.component.restart"); //$NON-NLS-1$
-
- private static final String FIELD_ENUM = Messages.getString(KEY_PREFIX
- + "field.enum"); //$NON-NLS-1$
-
- private static final String FIELD_INHERITS_ABSOLUTE = Messages
- .getString(KEY_PREFIX + "field.inherits.abs"); //$NON-NLS-1$
-
- private static final String FIELD_INHERITS_RELATIVE_PARENT = Messages
- .getString(KEY_PREFIX + "field.inherits.parent"); //$NON-NLS-1$
-
- private static final String FIELD_INHERITS_RELATIVE_THIS = Messages
- .getString(KEY_PREFIX + "field.inherits.this"); //$NON-NLS-1$
-
- private static final String FIELD_MONITORING = Messages.getString(KEY_PREFIX
- + "field.monitoring"); //$NON-NLS-1$
-
- private static final String FIELD_NO =
- getMessage(MSGID_DSCFG_GENERAL_CONFIRM_NO);
-
- private static final String FIELD_READ_ONLY = Messages.getString(KEY_PREFIX
- + "field.read-only"); //$NON-NLS-1$
-
- private static final String FIELD_SERVER_RESTART = Messages
- .getString(KEY_PREFIX + "field.server.restart"); //$NON-NLS-1$
-
- private static final String FIELD_UNDEFINED = Messages.getString(KEY_PREFIX
- + "field.undefined"); //$NON-NLS-1$
-
- private static final String FIELD_YES =
- getMessage(MSGID_DSCFG_GENERAL_CONFIRM_YES);
-
- private final static String HEADING_ADVANCED = Messages
- .getString(KEY_PREFIX + "heading.advanced"); //$NON-NLS-1$
-
- private final static String HEADING_DEFAULT = Messages.getString(KEY_PREFIX
- + "heading.default"); //$NON-NLS-1$
-
- private static final String HEADING_MANAGED_OBJECT = Messages
- .getString(KEY_PREFIX + "heading.managed-object"); //$NON-NLS-1$
-
- private final static String HEADING_MANDATORY = Messages.getString(KEY_PREFIX
- + "heading.mandatory"); //$NON-NLS-1$
-
- private final static String HEADING_MULTI_VALUED = Messages
- .getString(KEY_PREFIX + "heading.multi-valued"); //$NON-NLS-1$
-
- private static final String HEADING_PROPERTY = Messages.getString(KEY_PREFIX
- + "heading.property"); //$NON-NLS-1$
-
- private final static String HEADING_READ_ONLY = Messages.getString(KEY_PREFIX
- + "heading.read-only"); //$NON-NLS-1$
-
- private final static String HEADING_SEPARATOR = " : "; //$NON-NLS-1$
-
- private final static String HEADING_SYNTAX = Messages.getString(KEY_PREFIX
- + "heading.syntax"); //$NON-NLS-1$
-
- private final static String DESCRIPTION_OPTIONS_TITLE = Messages
- .getString(KEY_PREFIX + "description.options"); //$NON-NLS-1$
-
- private final static String DESCRIPTION_OPTIONS_READ = Messages
- .getString(KEY_PREFIX + "description.read"); //$NON-NLS-1$
-
- private final static String DESCRIPTION_OPTIONS_WRITE = Messages
- .getString(KEY_PREFIX + "description.write"); //$NON-NLS-1$
-
- private final static String DESCRIPTION_OPTIONS_MANDATORY = Messages
- .getString(KEY_PREFIX + "description.mandatory"); //$NON-NLS-1$
-
- private final static String DESCRIPTION_OPTIONS_SINGLE = Messages
- .getString(KEY_PREFIX + "description.single-valued"); //$NON-NLS-1$
-
- private final static String DESCRIPTION_OPTIONS_ADMIN = Messages
- .getString(KEY_PREFIX + "description.admin-action"); //$NON-NLS-1$
+ private final static String HEADING_SEPARATOR = " : ";
// Width of biggest heading (need to be careful of I18N).
private final static int HEADING_WIDTH;
@@ -447,11 +370,14 @@
private static final Character OPTION_DSCFG_SHORT_TYPE = 't';
static {
- int tmp = HEADING_SYNTAX.length();
- tmp = Math.max(tmp, HEADING_DEFAULT.length());
- tmp = Math.max(tmp, HEADING_MULTI_VALUED.length());
- tmp = Math.max(tmp, HEADING_MANDATORY.length());
- tmp = Math.max(tmp, HEADING_READ_ONLY.length());
+ int tmp = getMessage(MSGID_DSCFG_HELP_HEADING_SYNTAX).length();
+ tmp = Math.max(tmp, getMessage(MSGID_DSCFG_HELP_HEADING_DEFAULT).length());
+ tmp = Math.max(tmp, getMessage(MSGID_DSCFG_HELP_HEADING_MULTI_VALUED)
+ .length());
+ tmp = Math
+ .max(tmp, getMessage(MSGID_DSCFG_HELP_HEADING_MANDATORY).length());
+ tmp = Math
+ .max(tmp, getMessage(MSGID_DSCFG_HELP_HEADING_READ_ONLY).length());
HEADING_WIDTH = tmp;
}
@@ -547,7 +473,7 @@
PropertyDefinition<?> pd = d.getPropertyDefinition(name);
// Display the title.
- out.println(String.format(HEADING_PROPERTY, name));
+ out.println(getMessage(MSGID_DSCFG_HELP_HEADING_PROPERTY, name));
// Display the property synopsis and description.
out.println();
@@ -570,48 +496,48 @@
DefaultBehaviorPrinter defaultPrinter = new DefaultBehaviorPrinter();
builder.startRow();
- builder.appendCell(HEADING_DEFAULT);
+ builder.appendCell(getMessage(MSGID_DSCFG_HELP_HEADING_DEFAULT));
builder.appendCell(HEADING_SEPARATOR);
builder.appendCell(defaultPrinter.print(pd));
// Display options.
builder.startRow();
- builder.appendCell(HEADING_ADVANCED);
+ builder.appendCell(getMessage(MSGID_DSCFG_HELP_HEADING_ADVANCED));
builder.appendCell(HEADING_SEPARATOR);
if (pd.hasOption(PropertyOption.ADVANCED)) {
- builder.appendCell(FIELD_YES);
+ builder.appendCell(getMessage(MSGID_DSCFG_GENERAL_CONFIRM_YES));
} else {
- builder.appendCell(FIELD_NO);
+ builder.appendCell(getMessage(MSGID_DSCFG_GENERAL_CONFIRM_NO));
}
builder.startRow();
- builder.appendCell(HEADING_MULTI_VALUED);
+ builder.appendCell(getMessage(MSGID_DSCFG_HELP_HEADING_MULTI_VALUED));
builder.appendCell(HEADING_SEPARATOR);
if (pd.hasOption(PropertyOption.MULTI_VALUED)) {
- builder.appendCell(FIELD_YES);
+ builder.appendCell(getMessage(MSGID_DSCFG_GENERAL_CONFIRM_YES));
} else {
- builder.appendCell(FIELD_NO);
+ builder.appendCell(getMessage(MSGID_DSCFG_GENERAL_CONFIRM_NO));
}
builder.startRow();
- builder.appendCell(HEADING_MANDATORY);
+ builder.appendCell(getMessage(MSGID_DSCFG_HELP_HEADING_MANDATORY));
builder.appendCell(HEADING_SEPARATOR);
if (pd.hasOption(PropertyOption.MANDATORY)) {
- builder.appendCell(FIELD_YES);
+ builder.appendCell(getMessage(MSGID_DSCFG_GENERAL_CONFIRM_YES));
} else {
- builder.appendCell(FIELD_NO);
+ builder.appendCell(getMessage(MSGID_DSCFG_GENERAL_CONFIRM_NO));
}
builder.startRow();
- builder.appendCell(HEADING_READ_ONLY);
+ builder.appendCell(getMessage(MSGID_DSCFG_HELP_HEADING_READ_ONLY));
builder.appendCell(HEADING_SEPARATOR);
if (pd.hasOption(PropertyOption.MONITORING)) {
- builder.appendCell(FIELD_MONITORING);
+ builder.appendCell(getMessage(MSGID_DSCFG_HELP_FIELD_MONITORING));
} else if (pd.hasOption(PropertyOption.READ_ONLY)) {
- builder.appendCell(String
- .format(FIELD_READ_ONLY, d.getUserFriendlyName()));
+ builder.appendCell(getMessage(MSGID_DSCFG_HELP_FIELD_READ_ONLY, d
+ .getUserFriendlyName()));
} else {
- builder.appendCell(FIELD_NO);
+ builder.appendCell(getMessage(MSGID_DSCFG_GENERAL_CONFIRM_NO));
}
TextTablePrinter factory = new TextTablePrinter(out);
@@ -627,11 +553,11 @@
if (synopsis == null) {
switch (action.getType()) {
case COMPONENT_RESTART:
- synopsis = String.format(FIELD_COMPONENT_RESTART, d
+ synopsis = getMessage(MSGID_DSCFG_HELP_FIELD_COMPONENT_RESTART, d
.getUserFriendlyName());
break;
case SERVER_RESTART:
- synopsis = FIELD_SERVER_RESTART;
+ synopsis = getMessage(MSGID_DSCFG_HELP_FIELD_SERVER_RESTART);
break;
default:
// Do nothing.
@@ -724,18 +650,18 @@
Set<String> propertyNames) {
PrintStream out = getConsoleApplication().getOutputStream();
if (!getConsoleApplication().isScriptFriendly()) {
- out.println(DESCRIPTION_OPTIONS_TITLE);
+ out.println(getMessage(MSGID_DSCFG_HELP_DESCRIPTION_OPTION));
out.println();
out.print(" r -- ");
- out.println(DESCRIPTION_OPTIONS_READ);
+ out.println(getMessage(MSGID_DSCFG_HELP_DESCRIPTION_READ));
out.print(" w -- ");
- out.println(DESCRIPTION_OPTIONS_WRITE);
+ out.println(getMessage(MSGID_DSCFG_HELP_DESCRIPTION_WRITE));
out.print(" m -- ");
- out.println(DESCRIPTION_OPTIONS_MANDATORY);
+ out.println(getMessage(MSGID_DSCFG_HELP_DESCRIPTION_MANDATORY));
out.print(" s -- ");
- out.println(DESCRIPTION_OPTIONS_SINGLE);
+ out.println(getMessage(MSGID_DSCFG_HELP_DESCRIPTION_SINGLE_VALUED));
out.print(" a -- ");
- out.println(DESCRIPTION_OPTIONS_ADMIN);
+ out.println(getMessage(MSGID_DSCFG_HELP_DESCRIPTION_ADMIN_ACTION));
out.println();
out.println();
}
@@ -849,8 +775,8 @@
}
// Display the title.
- out.println(wrapText(String.format(HEADING_MANAGED_OBJECT, mod
- .getUserFriendlyName()), MAX_LINE_WIDTH));
+ out.println(wrapText(getMessage(MSGID_DSCFG_HELP_HEADING_COMPONENT,
+ mod.getUserFriendlyName()), MAX_LINE_WIDTH));
out.println();
out.println(wrapText(mod.getSynopsis(), MAX_LINE_WIDTH));
@@ -878,9 +804,9 @@
if (pd.hasOption(PropertyOption.MONITORING)
|| pd.hasOption(PropertyOption.READ_ONLY)) {
- b.append("r-"); //$NON-NLS-1$
+ b.append("r-");
} else {
- b.append("rw"); //$NON-NLS-1$
+ b.append("rw");
}
if (pd.hasOption(PropertyOption.MANDATORY)) {
diff --git a/opends/src/server/org/opends/server/tools/dsconfig/Messages.java b/opends/src/server/org/opends/server/tools/dsconfig/Messages.java
deleted file mode 100644
index 71ae99f..0000000
--- a/opends/src/server/org/opends/server/tools/dsconfig/Messages.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Portions Copyright 2007 Sun Microsystems, Inc.
- */
-package org.opends.server.tools.dsconfig;
-
-
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-
-
-/**
- * Message resource bundle for dsconfig.
- */
-public class Messages {
-
- // The name of the bundle.
- private static final String BUNDLE_NAME =
- "org.opends.server.tools.dsconfig.messages"; //$NON-NLS-1$
-
- // The single resource bundle.
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
- .getBundle(BUNDLE_NAME);
-
-
-
- // Prevent instantiation.
- private Messages() {
- // No implementation required.
- }
-
-
-
- /**
- * Get the named property.
- *
- * @param key
- * The name of the property.
- * @return Returns the named property.
- */
- public static String getString(String key) {
- try {
- return RESOURCE_BUNDLE.getString(key);
- } catch (MissingResourceException e) {
- return '!' + key + '!';
- }
- }
-}
diff --git a/opends/src/server/org/opends/server/tools/dsconfig/SetPropSubCommandHandler.java b/opends/src/server/org/opends/server/tools/dsconfig/SetPropSubCommandHandler.java
index 46ceafa..529d602 100644
--- a/opends/src/server/org/opends/server/tools/dsconfig/SetPropSubCommandHandler.java
+++ b/opends/src/server/org/opends/server/tools/dsconfig/SetPropSubCommandHandler.java
@@ -531,11 +531,11 @@
try {
// Confirm commit.
- String prompt = String.format(Messages.getString("modify.confirm"), d
+ String prompt = getMessage(MSGID_DSCFG_CONFIRM_MODIFY, d
.getUserFriendlyName());
if (!getConsoleApplication().confirmAction(prompt)) {
// Output failure message.
- String msg = String.format(Messages.getString("modify.failed"), d
+ String msg = getMessage(MSGID_DSCFG_CONFIRM_MODIFY_FAIL, d
.getUserFriendlyName());
getConsoleApplication().printVerboseMessage(msg);
return 1;
@@ -544,7 +544,7 @@
child.commit();
// Output success message.
- String msg = String.format(Messages.getString("modify.done"), d
+ String msg = getMessage(MSGID_DSCFG_CONFIRM_MODIFY_SUCCESS, d
.getUserFriendlyName());
getConsoleApplication().printVerboseMessage(msg);
} catch (MissingMandatoryPropertiesException e) {
diff --git a/opends/src/server/org/opends/server/tools/dsconfig/messages.properties b/opends/src/server/org/opends/server/tools/dsconfig/messages.properties
deleted file mode 100644
index 1d7d440..0000000
--- a/opends/src/server/org/opends/server/tools/dsconfig/messages.properties
+++ /dev/null
@@ -1,36 +0,0 @@
-help-properties.field.enum=one of the following values:
-help-properties.field.undefined=undefined
-help-properties.field.inherits.abs=inherits from the property "%s" in the %s.
-help-properties.field.inherits.parent=inherits from the property "%s" in the parent %s
-help-properties.field.inherits.this=inherits from the property "%s" in this %s
-help-properties.field.server.restart=The server must be restarted in order for changes to this property to take effect.
-help-properties.field.component.restart=The %s must be restarted in order for changes to this property to take effect.
-help-properties.field.read-only=read-only - this property can only be specified when the %s is created
-help-properties.field.monitoring=monitoring - this property is automatically generated by the server
-help-properties.heading.property=Property: %s
-help-properties.heading.managed-object=Managed Object: %s
-help-properties.heading.default=Default behavior
-help-properties.heading.mandatory=Mandatory
-help-properties.heading.advanced=Advanced
-help-properties.heading.multi-valued=Multi-valued
-help-properties.heading.read-only=Read-only
-help-properties.heading.syntax=Syntax
-help-properties.description.options=Option Types:
-help-properties.description.read=Property value(s) are readable
-help-properties.description.write=Property value(s) are writable
-help-properties.description.mandatory=The property is mandatory
-help-properties.description.single-valued=The property is single-valued
-help-properties.description.admin-action=Administrative action is required for changes to take effect
-create.confirm=Are you sure that you want to create the %s?
-delete.confirm=Are you sure that you want to delete the %s?
-modify.confirm=Are you sure that you want to modify the %s?
-create.done=The %s was created successfully.
-delete.done=The %s was deleted successfully.
-modify.done=The %s was modified successfully.
-create.failed=The %s was not created.
-delete.failed=The %s was not deleted.
-modify.failed=The %s was not modified.
-property-reader.prompt1.singular=Specify a value for "%s" whose current value is %s
-property-reader.prompt1.plural=Specify values for "%s" whose current values are %s
-property-reader.prompt2=New value (press RETURN to accept, or ? for help):
-property-reader.mandatory=The property "%s" is mandatory and must be specified.
--
Gitblit v1.10.0