From 4400f1735bfe509e5eab036bf9500202fa255e2a Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Fri, 04 Dec 2009 17:34:39 +0000
Subject: [PATCH] [Forgotten in previous commit] Remove ordinals from messages as they are not needed in SDK.
---
sdk/build-tools/com/sun/opends/sdk/build/tools/GenerateMessageFile.java | 29 +-------------
sdk/build-tools/com/sun/opends/sdk/build/tools/MessagePropertyKey.java | 79 ++-------------------------------------
2 files changed, 7 insertions(+), 101 deletions(-)
diff --git a/sdk/build-tools/com/sun/opends/sdk/build/tools/GenerateMessageFile.java b/sdk/build-tools/com/sun/opends/sdk/build/tools/GenerateMessageFile.java
index 4ad72fe..190e678 100644
--- a/sdk/build-tools/com/sun/opends/sdk/build/tools/GenerateMessageFile.java
+++ b/sdk/build-tools/com/sun/opends/sdk/build/tools/GenerateMessageFile.java
@@ -668,13 +668,6 @@
{
if (stubLine.contains("${MESSAGES}"))
{
- Integer globalOrdinal = null;
- String go = properties.getProperty(GLOBAL_ORDINAL);
- if (go != null)
- {
- globalOrdinal = new Integer(go);
- }
-
Map<MessagePropertyKey, String> keyMap = new TreeMap<MessagePropertyKey, String>();
for (Object propO : properties.keySet())
@@ -685,7 +678,7 @@
if (!DIRECTIVE_PROPERTIES.contains(propKey))
{
MessagePropertyKey key = MessagePropertyKey
- .parseString(propKey, globalOrdinal == null);
+ .parseString(propKey);
String formatString = properties.getProperty(propKey);
keyMap.put(key, formatString);
}
@@ -699,32 +692,14 @@
int usesOfGenericDescriptor = 0;
- Set<Integer> usedOrdinals = new HashSet<Integer>();
for (MessagePropertyKey key : keyMap.keySet())
{
String formatString = keyMap.get(key);
MessageDescriptorDeclaration message = new MessageDescriptorDeclaration(
key, formatString);
- if (globalOrdinal == null)
- {
- Integer ordinal = key.getOrdinal();
- if (usedOrdinals.contains(ordinal))
- {
- throw new BuildException("The ordinal value \'"
- + ordinal + "\' in key " + key
- + " has been previously defined in " + source
- + KEY_FORM_MSG);
- }
- else
- {
- usedOrdinals.add(ordinal);
- }
- }
-
message.setConstructorArguments("BASE", quote(key
- .toString()), globalOrdinal != null ? globalOrdinal
- .toString() : key.getOrdinal().toString());
+ .toString()));
destWriter.println(message.toString());
destWriter.println();
diff --git a/sdk/build-tools/com/sun/opends/sdk/build/tools/MessagePropertyKey.java b/sdk/build-tools/com/sun/opends/sdk/build/tools/MessagePropertyKey.java
index c0f841f..0ab5498 100644
--- a/sdk/build-tools/com/sun/opends/sdk/build/tools/MessagePropertyKey.java
+++ b/sdk/build-tools/com/sun/opends/sdk/build/tools/MessagePropertyKey.java
@@ -52,8 +52,6 @@
private String description;
- private Integer ordinal;
-
/**
@@ -61,49 +59,11 @@
*
* @param keyString
* from properties file
- * @param includesOrdinal
- * when true expects ordinals to be encoded in the keystring;
- * when false the mandate is relaxed
* @return MessagePropertyKey created from string
*/
- static public MessagePropertyKey parseString(String keyString,
- boolean includesOrdinal)
+ static public MessagePropertyKey parseString(String keyString)
{
-
- String description;
- Integer ordinal = null;
-
- String k = keyString;
-
- if (includesOrdinal)
- {
- int li = k.lastIndexOf("_");
- if (li != -1)
- {
- description = k.substring(0, li).toUpperCase();
- }
- else
- {
- throw new IllegalArgumentException("Incorrectly formatted key "
- + keyString);
- }
-
- try
- {
- String ordString = k.substring(li + 1);
- ordinal = Integer.parseInt(ordString);
- }
- catch (Exception nfe)
- {
- throw new IllegalArgumentException(
- "Error parsing ordinal for key " + keyString);
- }
- }
- else
- {
- description = k;
- }
- return new MessagePropertyKey(description, ordinal);
+ return new MessagePropertyKey(keyString);
}
@@ -113,13 +73,10 @@
*
* @param description
* of this key
- * @param ordinal
- * of this key
*/
- public MessagePropertyKey(String description, Integer ordinal)
+ public MessagePropertyKey(String description)
{
this.description = description;
- this.ordinal = ordinal;
}
@@ -137,18 +94,6 @@
/**
- * Gets the ordinal of this key.
- *
- * @return ordinal of this key
- */
- public Integer getOrdinal()
- {
- return this.ordinal;
- }
-
-
-
- /**
* Gets the name of the MessageDescriptor as it should appear in the
* messages file.
*
@@ -188,14 +133,7 @@
*/
public String getPropertyKeyName(boolean includeOrdinal)
{
- StringBuilder sb = new StringBuilder();
- sb.append(description);
- if (ordinal != null && includeOrdinal)
- {
- sb.append("_");
- sb.append(ordinal);
- }
- return sb.toString();
+ return description;
}
@@ -205,14 +143,7 @@
*/
public int compareTo(MessagePropertyKey k)
{
- if (ordinal == k.ordinal)
- {
- return description.compareTo(k.description);
- }
- else
- {
- return ordinal.compareTo(k.ordinal);
- }
+ return description.compareTo(k.description);
}
}
--
Gitblit v1.10.0