From 514d7625b55f486147fb3a52aeefa6095fe5b402 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 29 Jan 2016 15:00:46 +0000
Subject: [PATCH] DirectoryServer.java: getAttributeTypeOrDefault(String lowerName, String upperName, Syntax) => getAttributeType(String nameOrOid, Syntax)
---
opendj-server-legacy/src/test/java/org/opends/server/types/TestDN.java | 2 +-
opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java | 24 +++++++++++-------------
opendj-server-legacy/src/main/java/org/opends/server/monitors/TraditionalWorkQueueMonitor.java | 2 +-
opendj-server-legacy/src/main/java/org/opends/server/extensions/DiskSpaceMonitor.java | 2 +-
opendj-server-legacy/src/main/java/org/opends/server/monitors/ParallelWorkQueueMonitor.java | 2 +-
opendj-server-legacy/src/test/java/org/opends/server/types/TestRDN.java | 2 +-
opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/JEMonitor.java | 2 +-
opendj-server-legacy/src/main/java/org/opends/server/config/ConfigEntry.java | 3 +--
8 files changed, 18 insertions(+), 21 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/JEMonitor.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/JEMonitor.java
index 4a95595..a8779b4 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/JEMonitor.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/JEMonitor.java
@@ -111,7 +111,7 @@
// Remove the 'get' from the method name and add the prefix.
String attrName = attrPrefix + method.getName().substring(3);
- AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attrName, attrName, integerSyntax);
+ AttributeType attrType = DirectoryServer.getAttributeType(attrName, integerSyntax);
monitorAttrs.add(Attributes.create(attrType, String.valueOf(method.invoke(stats))));
}
catch (Exception e)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/config/ConfigEntry.java b/opendj-server-legacy/src/main/java/org/opends/server/config/ConfigEntry.java
index 035dd67..7fbaa9b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/config/ConfigEntry.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/config/ConfigEntry.java
@@ -214,8 +214,7 @@
public void putConfigAttribute(ConfigAttribute attribute)
{
String name = attribute.getName();
- AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(
- name.toLowerCase(), name, attribute.getSyntax());
+ AttributeType attrType = DirectoryServer.getAttributeType(name, attribute.getSyntax());
List<Attribute> attrs = new ArrayList<>(2);
AttributeBuilder builder = new AttributeBuilder(attrType, name);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java b/opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
index ea9520a..fd6dcdd 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
@@ -2538,7 +2538,7 @@
*/
public static AttributeType getAttributeTypeOrDefault(String lowerName)
{
- return getAttributeTypeOrDefault(lowerName, lowerName, getDefaultAttributeSyntax());
+ return getAttributeType(lowerName, getDefaultAttributeSyntax());
}
/**
@@ -2555,26 +2555,24 @@
*/
public static AttributeType getAttributeTypeOrDefault(String lowerName, String upperName)
{
- return getAttributeTypeOrDefault(lowerName, upperName, getDefaultAttributeSyntax());
+ return getAttributeType(upperName, getDefaultAttributeSyntax());
}
/**
- * Retrieves the attribute type for the provided lowercase name or OID. It will return a generated
- * "default" version with the uppercase name or OID if the requested attribute type is not defined
- * in the schema.
+ * Retrieves the attribute type for the provided name or OID. It will return a generated
+ * placeholder version with the name or OID if the requested attribute type is not defined in the
+ * schema.
*
- * @param lowerName
- * The lowercase name or OID for the attribute type to retrieve.
- * @param upperName
- * The uppercase name or OID for the attribute type to generate.
+ * @param nameOrOid
+ * The name or OID for the attribute type to look for.
* @param syntax
* The syntax for the attribute type to generate.
- * @return The requested attribute type, or a generated "default" version if there is no attribute
- * with the specified type defined in the server schema
+ * @return The requested attribute type, or a generated placeholder version if there is no
+ * attribute with the specified type defined in the server schema
*/
- public static AttributeType getAttributeTypeOrDefault(String lowerName, String upperName, Syntax syntax)
+ public static AttributeType getAttributeType(String nameOrOid, Syntax syntax)
{
- return directoryServer.schema.getAttributeType(upperName, syntax);
+ return directoryServer.schema.getAttributeType(nameOrOid, syntax);
}
/**
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/DiskSpaceMonitor.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/DiskSpaceMonitor.java
index 22fd72d..f3c65ed 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/DiskSpaceMonitor.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/DiskSpaceMonitor.java
@@ -144,7 +144,7 @@
private Attribute attr(String name, Syntax syntax, Object value)
{
- AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(name, name, syntax);
+ AttributeType attrType = DirectoryServer.getAttributeType(name, syntax);
return Attributes.create(attrType, String.valueOf(value));
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/monitors/ParallelWorkQueueMonitor.java b/opendj-server-legacy/src/main/java/org/opends/server/monitors/ParallelWorkQueueMonitor.java
index 5c78e97..ac7cbe0 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/monitors/ParallelWorkQueueMonitor.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/monitors/ParallelWorkQueueMonitor.java
@@ -166,7 +166,7 @@
private void putAttribute(ArrayList<Attribute> monitorAttrs, String attrName, Object value)
{
- AttributeType attrType = getAttributeTypeOrDefault(attrName, attrName, getDefaultIntegerSyntax());
+ AttributeType attrType = getAttributeType(attrName, getDefaultIntegerSyntax());
monitorAttrs.add(Attributes.create(attrType, String.valueOf(value)));
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/monitors/TraditionalWorkQueueMonitor.java b/opendj-server-legacy/src/main/java/org/opends/server/monitors/TraditionalWorkQueueMonitor.java
index 5bf5171..8dcf4f5 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/monitors/TraditionalWorkQueueMonitor.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/monitors/TraditionalWorkQueueMonitor.java
@@ -173,7 +173,7 @@
private void putAttribute(ArrayList<Attribute> monitorAttrs, String attrName, Object value)
{
- AttributeType attrType = getAttributeTypeOrDefault(attrName, attrName, getDefaultIntegerSyntax());
+ AttributeType attrType = getAttributeType(attrName, getDefaultIntegerSyntax());
monitorAttrs.add(Attributes.create(attrType, String.valueOf(value)));
}
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/types/TestDN.java b/opendj-server-legacy/src/test/java/org/opends/server/types/TestDN.java
index 7b630d0..c452d2b 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/types/TestDN.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/types/TestDN.java
@@ -169,7 +169,7 @@
TestCaseUtils.startServer();
String attrName = "x-test-integer-type";
- AttributeType dummy = getAttributeTypeOrDefault(attrName, attrName, getDefaultIntegerSyntax());
+ AttributeType dummy = getAttributeType(attrName, getDefaultIntegerSyntax());
DirectoryServer.getSchema().registerAttributeType(dummy, true);
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/types/TestRDN.java b/opendj-server-legacy/src/test/java/org/opends/server/types/TestRDN.java
index 4289c6b..ff1614b 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/types/TestRDN.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/types/TestRDN.java
@@ -73,7 +73,7 @@
AT_CN = DirectoryServer.getAttributeTypeOrNull("cn");
String attrName = "x-test-integer-type";
- AttributeType dummy = getAttributeTypeOrDefault(attrName, attrName, getDefaultIntegerSyntax());
+ AttributeType dummy = getAttributeType(attrName, getDefaultIntegerSyntax());
DirectoryServer.getSchema().registerAttributeType(dummy, true);
AV_DC_ORG = ByteString.valueOfUtf8("org");
--
Gitblit v1.10.0