From c5740d7b39334af983957a9c284ddd792d598f6c Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 10 Jul 2015 15:13:20 +0000
Subject: [PATCH] Code cleanup
---
opendj-server-legacy/src/main/java/org/opends/server/plugins/PasswordPolicyImportPlugin.java | 2
opendj-server-legacy/src/test/java/org/opends/server/schema/GenericSchemaTestCase.java | 9
opendj-server-legacy/src/main/java/org/opends/server/api/AuthenticationPolicyState.java | 3
opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendAddOperation.java | 6
opendj-server-legacy/src/test/java/org/opends/server/extensions/VirtualStaticGroupTestCase.java | 4
opendj-server-legacy/src/main/java/org/opends/server/admin/ManagedObjectPath.java | 6
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargAttrFilterList.java | 2
opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendBindOperation.java | 3
opendj-server-legacy/src/test/java/org/opends/server/core/AddOperationTestCase.java | 3
opendj-server-legacy/src/main/java/org/opends/server/monitors/BackendMonitor.java | 17
opendj-server-legacy/src/main/java/org/opends/server/tasks/InitializeTargetTask.java | 4
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/CustomSearchResult.java | 2
opendj-server-legacy/src/main/java/org/opends/server/protocols/internal/InternalClientConnection.java | 13
opendj-server-legacy/src/main/java/org/opends/server/api/AuthenticationPolicy.java | 3
opendj-server-legacy/src/main/java/org/opends/server/core/SubentryPasswordPolicy.java | 8
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/ParentInheritance.java | 2
opendj-server-legacy/src/main/java/org/opends/server/tasks/ExportTask.java | 10
opendj-server-legacy/src/main/java/org/opends/server/plugins/EntryUUIDPlugin.java | 3
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java | 7
opendj-server-legacy/src/test/java/org/opends/server/extensions/NumSubordinatesVirtualAttributeProviderTestCase.java | 3
opendj-server-legacy/src/main/java/org/opends/server/api/CompressedSchema.java | 30
opendj-server-legacy/src/test/java/org/opends/server/types/VirtualAttributeTestCase.java | 3
opendj-server-legacy/src/main/java/org/opends/server/backends/TrustStoreBackend.java | 17
opendj-server-legacy/src/main/java/org/opends/server/monitors/ConnectionHandlerMonitor.java | 25
opendj-server-legacy/src/test/java/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyTestCase.java | 5
opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java | 11
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciEffectiveRights.java | 2
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPFilter.java | 4
opendj-server-legacy/src/main/java/org/opends/server/backends/task/TaskScheduler.java | 2
opendj-server-legacy/src/main/java/org/opends/server/util/LDIFReader.java | 2
opendj-server-legacy/src/main/java/org/opends/server/tasks/BackupTask.java | 42 -
opendj-server-legacy/src/main/java/org/opends/server/replication/server/ReplicationServer.java | 4
opendj-server-legacy/src/test/java/org/opends/server/authorization/dseecompat/TargetAttrTestCase.java | 2
opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/IfAbsentTag.java | 4
opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java | 36 -
opendj-server-legacy/src/main/java/org/opends/server/config/ConfigEntry.java | 2
opendj-server-legacy/src/main/java/org/opends/server/types/DirectoryConfig.java | 30 -
opendj-server-legacy/src/main/java/org/opends/server/controls/ServerSideSortRequestControl.java | 22
opendj-server-legacy/src/main/java/org/opends/server/extensions/StaticGroup.java | 6
opendj-server-legacy/src/test/java/org/opends/server/protocols/internal/InternalClientConnectionTestCase.java | 2
opendj-server-legacy/src/main/java/org/opends/server/extensions/ExternalSASLMechanismHandler.java | 6
opendj-server-legacy/src/test/java/org/opends/server/plugins/EntryUUIDPluginTestCase.java | 4
opendj-server-legacy/src/test/java/org/opends/server/backends/SchemaBackendTestCase.java | 12
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/HistoricalAttributeValue.java | 2
opendj-server-legacy/src/test/java/org/opends/server/core/ModifyOperationTestCase.java | 28
opendj-server-legacy/src/test/java/org/opends/server/protocols/jmx/JmxPrivilegeTestCase.java | 4
opendj-server-legacy/src/main/java/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyFactory.java | 8
opendj-server-legacy/src/test/java/org/opends/server/controls/VLVControlTestCase.java | 4
opendj-server-legacy/src/main/java/org/opends/server/extensions/ConfigFileHandler.java | 6
opendj-server-legacy/src/main/java/org/opends/server/tasks/InitializeTask.java | 9
opendj-server-legacy/src/main/java/org/opends/server/extensions/SubjectAttributeToUserAttributeCertificateMapper.java | 328 ++++----------
opendj-server-legacy/src/main/java/org/opends/server/tasks/PurgeConflictsHistoricalTask.java | 4
opendj-server-legacy/src/main/java/org/opends/server/crypto/CryptoManagerSync.java | 12
opendj-server-legacy/src/main/java/org/opends/server/admin/server/ServerManagementContext.java | 2
opendj-server-legacy/src/main/java/org/opends/server/config/JMXMBean.java | 4
opendj-server-legacy/src/test/java/org/opends/server/plugins/UniqueAttributePluginTestCase.java | 2
opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/Importer.java | 2
opendj-server-legacy/src/test/java/org/opends/server/plugins/ReferentialIntegrityPluginTestCase.java | 2
opendj-server-legacy/src/main/java/org/opends/server/backends/RootDSEBackend.java | 2
opendj-server-legacy/src/test/java/org/opends/server/types/VirtualAttributeRuleTestCase.java | 3
opendj-server-legacy/src/main/java/org/opends/server/tasks/AddSchemaFileTask.java | 3
opendj-server-legacy/src/main/java/org/opends/server/tasks/ImportTask.java | 46 +-
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/OnDiskMergeBufferImporter.java | 2
opendj-server-legacy/src/main/java/org/opends/server/admin/AttributeTypePropertyDefinition.java | 28
opendj-server-legacy/src/main/java/org/opends/server/types/Attributes.java | 11
opendj-server-legacy/src/test/java/org/opends/server/extensions/SubschemaSubentryVirtualAttributeProviderTestCase.java | 3
opendj-server-legacy/src/test/java/org/opends/server/extensions/IsMemberOfVirtualAttributeProviderTestCase.java | 2
opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/AttributeValueTag.java | 4
opendj-server-legacy/src/main/java/org/opends/server/types/SubEntry.java | 30 -
opendj-server-legacy/src/main/java/org/opends/server/core/PasswordPolicyState.java | 64 +-
opendj-server-legacy/src/main/java/org/opends/server/backends/BackupBackend.java | 30
opendj-server-legacy/src/main/java/org/opends/server/tasks/ShutdownTask.java | 5
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciHandler.java | 18
opendj-server-legacy/src/main/java/org/opends/server/controls/MatchedValuesFilter.java | 2
opendj-server-legacy/src/main/java/org/opends/server/tools/LDIFSearch.java | 2
opendj-server-legacy/src/main/java/org/opends/server/admin/AdministrationDataSync.java | 6
opendj-server-legacy/src/main/java/org/opends/server/tasks/SetGenerationIdTask.java | 4
opendj-server-legacy/src/main/java/org/opends/server/extensions/VirtualStaticGroup.java | 3
opendj-server-legacy/src/main/java/org/opends/server/plugins/LastModPlugin.java | 16
opendj-server-legacy/src/main/java/org/opends/server/tools/ExportLDIF.java | 48 -
opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestLDAPConnectionHandler.java | 26
opendj-server-legacy/src/test/java/org/opends/server/extensions/HasSubordinatesVirtualAttributeProviderTestCase.java | 3
opendj-server-legacy/src/test/java/org/opends/server/types/PrivilegeTestCase.java | 4
opendj-server-legacy/src/main/java/org/opends/server/backends/task/Task.java | 2
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciListenerManager.java | 3
opendj-server-legacy/src/test/java/org/opends/server/controls/ServerSideSortControlTestCase.java | 4
opendj-server-legacy/src/main/java/org/opends/server/tasks/RestoreTask.java | 11
opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/IfPresentTag.java | 4
opendj-server-legacy/src/test/java/org/opends/server/extensions/EntryDNVirtualAttributeProviderTestCase.java | 2
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargetAttr.java | 2
opendj-server-legacy/src/test/java/org/opends/server/extensions/StructuralObjectClassVirtualAttributeProviderTestCase.java | 3
opendj-server-legacy/src/test/java/org/opends/server/extensions/EntryUUIDVirtualAttributeProviderTestCase.java | 2
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ManageTasksPanel.java | 2
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/UserAttr.java | 4
opendj-server-legacy/src/main/java/org/opends/server/controls/GetEffectiveRightsRequestControl.java | 2
opendj-server-legacy/src/main/java/org/opends/server/backends/ChangelogBackend.java | 10
opendj-server-legacy/src/main/java/org/opends/server/types/Schema.java | 3
opendj-server-legacy/src/main/java/org/opends/server/extensions/SMTPAccountStatusNotificationHandler.java | 3
opendj-server-legacy/src/main/java/org/opends/server/tasks/RebuildTask.java | 4
opendj-server-legacy/src/main/java/org/opends/server/extensions/DynamicGroup.java | 4
opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/TemplateFile.java | 8
opendj-server-legacy/src/main/java/org/opends/server/tasks/DisconnectClientTask.java | 6
opendj-server-legacy/src/main/java/org/opends/server/types/AttributeBuilder.java | 2
opendj-server-legacy/src/test/java/org/opends/server/extensions/UserDefinedVirtualAttributeProviderTestCase.java | 7
opendj-server-legacy/src/main/java/org/opends/server/backends/task/RecurringTask.java | 2
opendj-server-legacy/src/test/java/org/opends/server/extensions/PasswordModifyExtendedOperationTestCase.java | 8
opendj-server-legacy/src/test/java/org/opends/server/plugins/LastModPluginTestCase.java | 8
opendj-server-legacy/src/test/java/org/opends/server/extensions/GoverningStructureRuleVirtualAttributeProviderTestCase.java | 3
opendj-server-legacy/src/main/java/org/opends/server/tools/ImportLDIF.java | 4
opendj-server-legacy/src/main/java/org/opends/server/core/CompareOperationBasis.java | 2
110 files changed, 470 insertions(+), 810 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/CustomSearchResult.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/CustomSearchResult.java
index 657f904..04eea91 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/CustomSearchResult.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/CustomSearchResult.java
@@ -320,7 +320,7 @@
}
else
{
- AttributeType attrType = DirectoryServer.getAttributeType(lowerName, attrName);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(lowerName, attrName);
AttributeBuilder builder = new AttributeBuilder(attribute, true);
for (Object value : getAttributeValues(attrName))
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ManageTasksPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ManageTasksPanel.java
index 66b541c..fe18fc1 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ManageTasksPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ManageTasksPanel.java
@@ -695,7 +695,7 @@
}
else
{
- AttributeType attrType = DirectoryServer.getAttributeType(lowerName, attrName);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(lowerName, attrName);
AttributeBuilder builder = new AttributeBuilder(attribute, true);
for (Object value : csr.getAttributeValues(attrName))
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/admin/AdministrationDataSync.java b/opendj-server-legacy/src/main/java/org/opends/server/admin/AdministrationDataSync.java
index d4d405c..d5f5504 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/admin/AdministrationDataSync.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/admin/AdministrationDataSync.java
@@ -109,8 +109,8 @@
return;
}
- AttributeType attrType1 = DirectoryServer.getAttributeType("adminport".toLowerCase(), true);
- AttributeType attrType2 = DirectoryServer.getAttributeType("adminEnabled".toLowerCase(), true);
+ AttributeType attrType1 = DirectoryServer.getAttributeTypeOrDefault("adminport".toLowerCase());
+ AttributeType attrType2 = DirectoryServer.getAttributeTypeOrDefault("adminEnabled".toLowerCase());
LinkedList<Modification> mods = new LinkedList<>();
mods.add(new Modification(ModificationType.REPLACE, Attributes.create(attrType1, adminPort)));
@@ -257,7 +257,7 @@
adminConnectorEntry = result.getFirst();
}
- AttributeType attrType = DirectoryServer.getAttributeType(attrName, true);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attrName);
List<Attribute> attrs = adminConnectorEntry.getAttribute(attrType);
if (attrs != null)
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/admin/AttributeTypePropertyDefinition.java b/opendj-server-legacy/src/main/java/org/opends/server/admin/AttributeTypePropertyDefinition.java
index f425bc3..6b382b2 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/admin/AttributeTypePropertyDefinition.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/admin/AttributeTypePropertyDefinition.java
@@ -24,11 +24,8 @@
* Copyright 2008 Sun Microsystems, Inc.
* Portions Copyright 2014-2015 ForgeRock AS
*/
-
package org.opends.server.admin;
-
-
import static org.forgerock.util.Reject.ifNull;
import java.util.EnumSet;
@@ -36,11 +33,7 @@
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.AttributeType;
-
-
-/**
- * Attribute type property definition.
- */
+/** Attribute type property definition. */
public final class AttributeTypePropertyDefinition extends
PropertyDefinition<AttributeType> {
@@ -170,18 +163,17 @@
ifNull(value);
String name = value.trim().toLowerCase();
- AttributeType type = DirectoryServer.getAttributeType(name,
- !isCheckSchema);
-
+ AttributeType type = isCheckSchema
+ ? DirectoryServer.getAttributeType(name)
+ : DirectoryServer.getAttributeTypeOrDefault(name);
if (type == null) {
throw PropertyException.illegalPropertyValueException(this, value);
- } else {
- try {
- validateValue(type);
- return type;
- } catch (PropertyException e) {
- throw PropertyException.illegalPropertyValueException(this, value);
- }
+ }
+ try {
+ validateValue(type);
+ return type;
+ } catch (PropertyException e) {
+ throw PropertyException.illegalPropertyValueException(this, value);
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/admin/ManagedObjectPath.java b/opendj-server-legacy/src/main/java/org/opends/server/admin/ManagedObjectPath.java
index a20c57d..d0fdb04 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/admin/ManagedObjectPath.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/admin/ManagedObjectPath.java
@@ -150,8 +150,7 @@
// Now add the single RDN representing the named instance.
String type = profile.getRelationChildRDNType(r);
- AttributeType atype = DirectoryServer.getAttributeType(
- type.toLowerCase(), true);
+ AttributeType atype = DirectoryServer.getAttributeTypeOrDefault(type.toLowerCase());
ByteString avalue = ByteString.valueOf(name);
dn = dn.child(RDN.create(atype, avalue));
}
@@ -168,8 +167,7 @@
// Now add the single RDN representing the instance.
String type = profile.getRelationChildRDNType(r);
- AttributeType atype = DirectoryServer.getAttributeType(
- type.toLowerCase(), true);
+ AttributeType atype = DirectoryServer.getAttributeTypeOrDefault(type.toLowerCase());
ByteString avalue = ByteString.valueOf(d.getName());
dn = dn.child(RDN.create(atype, avalue));
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/admin/server/ServerManagementContext.java b/opendj-server-legacy/src/main/java/org/opends/server/admin/server/ServerManagementContext.java
index 7194f01..72a4a58 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/admin/server/ServerManagementContext.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/admin/server/ServerManagementContext.java
@@ -870,7 +870,7 @@
// undefined. We should log a warning here if this is the case
// since the attribute should have been defined.
String attrID = LDAPProfile.getInstance().getAttributeName(d, pd);
- AttributeType type = DirectoryServer.getAttributeType(attrID, true);
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(attrID);
List<Attribute> attributes = configEntry.getEntry().getAttribute(type, true);
List<ByteString> results = new LinkedList<>();
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/api/AuthenticationPolicy.java b/opendj-server-legacy/src/main/java/org/opends/server/api/AuthenticationPolicy.java
index 4cf7442..03eef0d 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/api/AuthenticationPolicy.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/api/AuthenticationPolicy.java
@@ -74,8 +74,7 @@
{
// First check to see if the ds-pwp-password-policy-dn is present.
String userDNString = userEntry.getName().toString();
- AttributeType type = DirectoryServer.getAttributeType(
- OP_ATTR_PWPOLICY_POLICY_DN, true);
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_POLICY_DN);
List<Attribute> attrList = userEntry.getAttribute(type);
if (attrList != null)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/api/AuthenticationPolicyState.java b/opendj-server-legacy/src/main/java/org/opends/server/api/AuthenticationPolicyState.java
index 2034c61..498de0c 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/api/AuthenticationPolicyState.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/api/AuthenticationPolicyState.java
@@ -289,8 +289,7 @@
*/
public boolean isDisabled()
{
- final AttributeType type = DirectoryServer.getAttributeType(
- OP_ATTR_ACCOUNT_DISABLED, true);
+ final AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_ACCOUNT_DISABLED);
try
{
isDisabled = getBoolean(userEntry, type);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/api/CompressedSchema.java b/opendj-server-legacy/src/main/java/org/opends/server/api/CompressedSchema.java
index 4b86808..10a0606 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/api/CompressedSchema.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/api/CompressedSchema.java
@@ -397,21 +397,8 @@
final byte[] encodedAttribute, final String attributeName,
final Collection<String> attributeOptions)
{
- final AttributeType type = DirectoryServer.getAttributeType(
- toLowerCase(attributeName), true);
- final Set<String> options;
- switch (attributeOptions.size())
- {
- case 0:
- options = Collections.emptySet();
- break;
- case 1:
- options = Collections.singleton(attributeOptions.iterator().next());
- break;
- default:
- options = new LinkedHashSet<>(attributeOptions);
- break;
- }
+ final AttributeType type = DirectoryServer.getAttributeTypeOrDefault(toLowerCase(attributeName));
+ final Set<String> options = getOptions(attributeOptions);
final Entry<AttributeType, Set<String>> ad = new SimpleImmutableEntry<>(type, options);
final int id = decodeId(encodedAttribute);
synchronized (adEncodeMap)
@@ -434,7 +421,18 @@
return ad;
}
-
+ private Set<String> getOptions(final Collection<String> attributeOptions)
+ {
+ switch (attributeOptions.size())
+ {
+ case 0:
+ return Collections.emptySet();
+ case 1:
+ return Collections.singleton(attributeOptions.iterator().next());
+ default:
+ return new LinkedHashSet<>(attributeOptions);
+ }
+ }
/**
* Loads an encoded object class into this compressed schema. This method may
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciEffectiveRights.java b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciEffectiveRights.java
index 8c51230..1a87f12 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciEffectiveRights.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciEffectiveRights.java
@@ -278,7 +278,7 @@
}
else
{
- nonRightsAttrs.add(DirectoryServer.getAttributeType(a.toLowerCase(), true));
+ nonRightsAttrs.add(DirectoryServer.getAttributeTypeOrDefault(a.toLowerCase()));
}
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciHandler.java b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciHandler.java
index a7c5fef..d945761 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciHandler.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciHandler.java
@@ -60,6 +60,7 @@
import static org.opends.server.authorization.dseecompat.Aci.*;
import static org.opends.server.authorization.dseecompat.EnumEvalReason.*;
import static org.opends.server.config.ConfigConstants.*;
+import static org.opends.server.core.DirectoryServer.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.opends.server.protocols.internal.Requests.*;
import static org.opends.server.schema.SchemaConstants.*;
@@ -122,10 +123,10 @@
*/
private static void initStatics()
{
- aciType = getAttributeType("aci");
- globalAciType = getAttributeType(ATTR_AUTHZ_GLOBAL_ACI);
- debugSearchIndex = getAttributeType(SuffixContainer.ATTR_DEBUG_SEARCH_INDEX);
- refAttrType = getAttributeType(ATTR_REFERRAL_URL);
+ aciType = getAttributeTypeOrDefault("aci");
+ globalAciType = getAttributeTypeOrDefault(ATTR_AUTHZ_GLOBAL_ACI);
+ debugSearchIndex = getAttributeTypeOrDefault(SuffixContainer.ATTR_DEBUG_SEARCH_INDEX);
+ refAttrType = getAttributeTypeOrDefault(ATTR_REFERRAL_URL);
try
{
@@ -137,13 +138,6 @@
}
}
- private static AttributeType getAttributeType(String name)
- {
- return DirectoryServer.getAttributeType(name, true);
- }
-
-
-
/** The list that holds that ACIs keyed by the DN of the entry holding the ACI. */
private AciList aciList;
@@ -315,7 +309,7 @@
baseName = toLowerCase(rawAttributeType);
}
- container.setCurrentAttributeType(getAttributeType(baseName));
+ container.setCurrentAttributeType(getAttributeTypeOrDefault(baseName));
container.setCurrentAttributeValue(operation.getAssertionValue());
return isAllowed(container, operation);
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciListenerManager.java b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciListenerManager.java
index dc86d77..882d9a3 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciListenerManager.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciListenerManager.java
@@ -393,8 +393,7 @@
// Check to make sure that the backend has a presence index defined
// for the ACI attribute. If it does not, then log a warning message
// because this processing could be very expensive.
- AttributeType aciType =
- DirectoryServer.getAttributeType("aci", true);
+ AttributeType aciType = DirectoryServer.getAttributeTypeOrDefault("aci");
if (backend.getEntryCount() > 0
&& !backend.isIndexed(aciType, IndexType.PRESENCE))
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/ParentInheritance.java b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/ParentInheritance.java
index 39ab2cb..ecf4884 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/ParentInheritance.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/ParentInheritance.java
@@ -220,7 +220,7 @@
* @return The attribute type.
*/
public AttributeType getAttributeType() {
- return DirectoryServer.getAttributeType(attrTypeStr.toLowerCase(), true);
+ return DirectoryServer.getAttributeTypeOrDefault(attrTypeStr.toLowerCase());
}
/**
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargAttrFilterList.java b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargAttrFilterList.java
index 1cb4cba..d55744d 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargAttrFilterList.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargAttrFilterList.java
@@ -132,7 +132,7 @@
attributeName=attributeName.substring(0, semicolon);
}
String filterString=matcher.group(filterPos);
- AttributeType attrType = DirectoryServer.getAttributeType(attributeName, true);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attributeName);
SearchFilter filter;
//Check if it is a valid filter and add it to the list map if ok.
try {
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargetAttr.java b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargetAttr.java
index f46cf72..dc514b5 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargetAttr.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargetAttr.java
@@ -132,7 +132,7 @@
throw new AciException(message);
}
} else {
- AttributeType attrType = DirectoryServer.getAttributeType(attribute, true);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attribute);
if(attrType.isOperational())
{
opAttributes.add(attrType);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/UserAttr.java b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/UserAttr.java
index a4009fa..85d4020 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/UserAttr.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/UserAttr.java
@@ -201,7 +201,7 @@
private EnumEvalResult evalVAL(AciEvalContext evalCtx) {
EnumEvalResult matched= EnumEvalResult.FALSE;
boolean undefined=false;
- AttributeType attrType = DirectoryServer.getAttributeType(attrStr, true);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attrStr);
final SearchRequest request = newSearchRequest(evalCtx.getClientDN(), SearchScope.BASE_OBJECT);
InternalSearchOperation op = getRootConnection().processSearch(request);
LinkedList<SearchResultEntry> result = op.getSearchEntries();
@@ -229,7 +229,7 @@
private EnumEvalResult evalURL(AciEvalContext evalCtx) {
EnumEvalResult matched= EnumEvalResult.FALSE;
boolean undefined=false;
- AttributeType attrType = DirectoryServer.getAttributeType(attrStr, true);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attrStr);
List<Attribute> attrs=evalCtx.getResourceEntry().getAttribute(attrType);
if(!attrs.isEmpty()) {
for(Attribute a : attrs) {
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/BackupBackend.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/BackupBackend.java
index 610cfc1..870bc98 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/BackupBackend.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/BackupBackend.java
@@ -280,7 +280,7 @@
int numEntries = 1;
AttributeType backupPathType =
- DirectoryServer.getAttributeType(ATTR_BACKUP_DIRECTORY_PATH, true);
+ DirectoryServer.getAttributeTypeOrDefault(ATTR_BACKUP_DIRECTORY_PATH);
for (File dir : backupDirectories.keySet())
{
@@ -397,7 +397,7 @@
Entry backupDirEntry = getBackupDirectoryEntry(entryDN);
AttributeType t =
- DirectoryServer.getAttributeType(ATTR_BACKUP_DIRECTORY_PATH, true);
+ DirectoryServer.getAttributeTypeOrDefault(ATTR_BACKUP_DIRECTORY_PATH);
List<Attribute> attrList = backupDirEntry.getAttribute(t);
if (attrList != null && !attrList.isEmpty())
{
@@ -492,8 +492,7 @@
throws DirectoryException
{
// Make sure that the DN specifies a backup directory.
- AttributeType t =
- DirectoryServer.getAttributeType(ATTR_BACKUP_DIRECTORY_PATH, true);
+ AttributeType t = DirectoryServer.getAttributeTypeOrDefault(ATTR_BACKUP_DIRECTORY_PATH);
ByteString v = entryDN.rdn().getAttributeValue(t);
if (v == null)
{
@@ -542,7 +541,7 @@
LinkedHashMap<AttributeType,List<Attribute>> userAttrs = new LinkedHashMap<>(3);
userAttrs.put(t, asList(t, v));
- t = DirectoryServer.getAttributeType(ATTR_BACKUP_BACKEND_DN, true);
+ t = DirectoryServer.getAttributeTypeOrDefault(ATTR_BACKUP_BACKEND_DN);
userAttrs.put(t, asList(t, ByteString.valueOf(backupDirectory.getConfigEntryDN().toString())));
Entry e = new Entry(entryDN, ocMap, userAttrs, opAttrs);
@@ -568,7 +567,7 @@
throws DirectoryException
{
// First, get the backup ID from the entry DN.
- AttributeType idType = DirectoryServer.getAttributeType(ATTR_BACKUP_ID, true);
+ AttributeType idType = DirectoryServer.getAttributeTypeOrDefault(ATTR_BACKUP_ID);
ByteString idValue = entryDN.rdn().getAttributeValue(idType);
if (idValue == null) {
throw newConstraintViolation(ERR_BACKUP_NO_BACKUP_ID_IN_DN.get(entryDN));
@@ -581,8 +580,7 @@
throw newConstraintViolation(ERR_BACKUP_NO_BACKUP_PARENT_DN.get(entryDN));
}
- AttributeType t = DirectoryServer.getAttributeType(
- ATTR_BACKUP_DIRECTORY_PATH, true);
+ AttributeType t = DirectoryServer.getAttributeTypeOrDefault(ATTR_BACKUP_DIRECTORY_PATH);
ByteString v = parentDN.rdn().getAttributeValue(t);
if (v == null) {
throw newConstraintViolation(ERR_BACKUP_NO_BACKUP_DIR_IN_DN.get(entryDN));
@@ -631,7 +629,7 @@
Date backupDate = backupInfo.getBackupDate();
if (backupDate != null) {
- t = DirectoryServer.getAttributeType(ATTR_BACKUP_DATE, true);
+ t = DirectoryServer.getAttributeTypeOrDefault(ATTR_BACKUP_DATE);
userAttrs.put(t,
asList(t, ByteString.valueOf(GeneralizedTimeSyntax.format(backupDate))));
}
@@ -642,7 +640,7 @@
HashSet<String> dependencies = backupInfo.getDependencies();
if (dependencies != null && !dependencies.isEmpty()) {
- t = DirectoryServer.getAttributeType(ATTR_BACKUP_DEPENDENCY, true);
+ t = DirectoryServer.getAttributeTypeOrDefault(ATTR_BACKUP_DEPENDENCY);
AttributeBuilder builder = new AttributeBuilder(t);
builder.addAllStrings(dependencies);
userAttrs.put(t, builder.toAttributeList());
@@ -661,7 +659,7 @@
HashMap<String, String> properties = backupInfo.getBackupProperties();
if (properties != null && !properties.isEmpty()) {
for (Map.Entry<String, String> e : properties.entrySet()) {
- t = DirectoryServer.getAttributeType(toLowerCase(e.getKey()), true);
+ t = DirectoryServer.getAttributeTypeOrDefault(toLowerCase(e.getKey()));
userAttrs.put(t, asList(t, ByteString.valueOf(e.getValue())));
}
}
@@ -673,13 +671,13 @@
private void putByteString(LinkedHashMap<AttributeType, List<Attribute>> userAttrs, String attrName, byte[] value)
{
- AttributeType t = DirectoryServer.getAttributeType(attrName, true);
+ AttributeType t = DirectoryServer.getAttributeTypeOrDefault(attrName);
userAttrs.put(t, asList(t, ByteString.wrap(value)));
}
private void putBoolean(LinkedHashMap<AttributeType, List<Attribute>> attrsMap, String attrName, boolean value)
{
- AttributeType t = DirectoryServer.getAttributeType(attrName, true);
+ AttributeType t = DirectoryServer.getAttributeTypeOrDefault(attrName);
attrsMap.put(t, asList(t, createBooleanValue(value)));
}
@@ -765,7 +763,7 @@
if (scope != SearchScope.BASE_OBJECT && !backupDirectories.isEmpty())
{
AttributeType backupPathType =
- DirectoryServer.getAttributeType(ATTR_BACKUP_DIRECTORY_PATH, true);
+ DirectoryServer.getAttributeTypeOrDefault(ATTR_BACKUP_DIRECTORY_PATH);
for (File dir : backupDirectories.keySet())
{
// Check to see if the descriptor file exists. If not, then skip this
@@ -819,7 +817,7 @@
if (scope != SearchScope.BASE_OBJECT)
{
AttributeType t =
- DirectoryServer.getAttributeType(ATTR_BACKUP_DIRECTORY_PATH, true);
+ DirectoryServer.getAttributeTypeOrDefault(ATTR_BACKUP_DIRECTORY_PATH);
List<Attribute> attrList = backupDirEntry.getAttribute(t);
returnEntries(searchOperation, baseDN, filter, attrList);
}
@@ -861,7 +859,7 @@
{
File dir = new File(v.toString());
BackupDirectory backupDirectory = backupDirectories.get(dir).getBackupDirectory();
- AttributeType idType = DirectoryServer.getAttributeType(ATTR_BACKUP_ID, true);
+ AttributeType idType = DirectoryServer.getAttributeTypeOrDefault(ATTR_BACKUP_ID);
for (String backupID : backupDirectory.getBackups().keySet())
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/ChangelogBackend.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/ChangelogBackend.java
index 3ad9be6..708a884 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/ChangelogBackend.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/ChangelogBackend.java
@@ -100,7 +100,6 @@
import org.opends.server.types.CanceledOperationException;
import org.opends.server.types.Control;
import org.opends.server.types.DN;
-import org.opends.server.types.DirectoryConfig;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.Entry;
import org.opends.server.types.FilterType;
@@ -201,11 +200,10 @@
/** The attribute type for the "creatorsName" attribute. */
private static final AttributeType CREATORS_NAME_TYPE =
- DirectoryConfig.getAttributeType(OP_ATTR_CREATORS_NAME_LC, true);
-
+ DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_CREATORS_NAME_LC);
/** The attribute type for the "modifiersName" attribute. */
private static final AttributeType MODIFIERS_NAME_TYPE =
- DirectoryConfig.getAttributeType(OP_ATTR_MODIFIERS_NAME_LC, true);
+ DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_MODIFIERS_NAME_LC);
/** The base DN for the external change log. */
public static final DN CHANGELOG_BASE_DN;
@@ -749,7 +747,7 @@
private SearchFilter buildSearchFilterFrom(final DN baseDN, final String lowerCaseAttr, final String upperCaseAttr)
{
final RDN rdn = baseDN.rdn();
- AttributeType attrType = DirectoryServer.getAttributeType(lowerCaseAttr, upperCaseAttr);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(lowerCaseAttr, upperCaseAttr);
final ByteString attrValue = rdn.getAttributeValue(attrType);
if (attrValue != null)
{
@@ -1544,7 +1542,7 @@
final Map<AttributeType, List<Attribute>> userAttrs,
final Map<AttributeType, List<Attribute>> operationalAttrs, final boolean addByType)
{
- AttributeType attrType = DirectoryServer.getAttributeType(attrNameLowercase, attrNameUppercase);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attrNameLowercase, attrNameUppercase);
final Attribute a = addByType
? Attributes.create(attrType, attrValue)
: Attributes.create(attrNameUppercase, attrValue);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/RootDSEBackend.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/RootDSEBackend.java
index 8cc34da..5fa1e75 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/RootDSEBackend.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/RootDSEBackend.java
@@ -636,7 +636,7 @@
private Attribute createAttribute(String name, String lowerName,
Collection<? extends Object> values)
{
- AttributeType type = DirectoryServer.getAttributeType(lowerName, name);
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(lowerName, name);
AttributeBuilder builder = new AttributeBuilder(type, name);
builder.addAllStrings(values);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java
index 0c3de1f..c71e989 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java
@@ -31,6 +31,7 @@
import static org.opends.messages.ConfigMessages.*;
import static org.opends.messages.SchemaMessages.*;
import static org.opends.server.config.ConfigConstants.*;
+import static org.opends.server.core.DirectoryServer.*;
import static org.opends.server.schema.SchemaConstants.*;
import static org.opends.server.types.CommonSchemaElements.*;
import static org.opends.server.util.CollectionUtils.*;
@@ -271,31 +272,20 @@
configEntryDN = configEntry.getDN();
// Get all of the attribute types that we will use for schema elements.
- attributeTypesType =
- DirectoryServer.getAttributeType(ATTR_ATTRIBUTE_TYPES_LC, true);
- objectClassesType =
- DirectoryServer.getAttributeType(ATTR_OBJECTCLASSES_LC, true);
- matchingRulesType =
- DirectoryServer.getAttributeType(ATTR_MATCHING_RULES_LC, true);
- ldapSyntaxesType =
- DirectoryServer.getAttributeType(ATTR_LDAP_SYNTAXES_LC, true);
- ditContentRulesType =
- DirectoryServer.getAttributeType(ATTR_DIT_CONTENT_RULES_LC, true);
- ditStructureRulesType =
- DirectoryServer.getAttributeType(ATTR_DIT_STRUCTURE_RULES_LC, true);
- matchingRuleUsesType =
- DirectoryServer.getAttributeType(ATTR_MATCHING_RULE_USE_LC, true);
- nameFormsType = DirectoryServer.getAttributeType(ATTR_NAME_FORMS_LC, true);
+ attributeTypesType = getAttributeTypeOrDefault(ATTR_ATTRIBUTE_TYPES_LC);
+ objectClassesType = getAttributeTypeOrDefault(ATTR_OBJECTCLASSES_LC);
+ matchingRulesType = getAttributeTypeOrDefault(ATTR_MATCHING_RULES_LC);
+ ldapSyntaxesType = getAttributeTypeOrDefault(ATTR_LDAP_SYNTAXES_LC);
+ ditContentRulesType = getAttributeTypeOrDefault(ATTR_DIT_CONTENT_RULES_LC);
+ ditStructureRulesType = getAttributeTypeOrDefault(ATTR_DIT_STRUCTURE_RULES_LC);
+ matchingRuleUsesType = getAttributeTypeOrDefault(ATTR_MATCHING_RULE_USE_LC);
+ nameFormsType = getAttributeTypeOrDefault(ATTR_NAME_FORMS_LC);
// Initialize the lastmod attributes.
- creatorsNameType =
- DirectoryServer.getAttributeType(OP_ATTR_CREATORS_NAME_LC, true);
- createTimestampType =
- DirectoryServer.getAttributeType(OP_ATTR_CREATE_TIMESTAMP_LC, true);
- modifiersNameType =
- DirectoryServer.getAttributeType(OP_ATTR_MODIFIERS_NAME_LC, true);
- modifyTimestampType =
- DirectoryServer.getAttributeType(OP_ATTR_MODIFY_TIMESTAMP_LC, true);
+ creatorsNameType = getAttributeTypeOrDefault(OP_ATTR_CREATORS_NAME_LC);
+ createTimestampType = getAttributeTypeOrDefault(OP_ATTR_CREATE_TIMESTAMP_LC);
+ modifiersNameType = getAttributeTypeOrDefault(OP_ATTR_MODIFIERS_NAME_LC);
+ modifyTimestampType = getAttributeTypeOrDefault(OP_ATTR_MODIFY_TIMESTAMP_LC);
// Construct the set of objectclasses to include in the schema entry.
schemaObjectClasses = new LinkedHashMap<>(3);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/TrustStoreBackend.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/TrustStoreBackend.java
index e3ef97f..00f18d4 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/TrustStoreBackend.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/TrustStoreBackend.java
@@ -433,8 +433,7 @@
throws DirectoryException
{
// Make sure that the DN specifies a certificate alias.
- AttributeType t =
- DirectoryServer.getAttributeType(ATTR_CRYPTO_KEY_ID, true);
+ AttributeType t = DirectoryServer.getAttributeTypeOrDefault(ATTR_CRYPTO_KEY_ID);
ByteString v = entryDN.rdn().getAttributeValue(t);
if (v == null)
{
@@ -477,7 +476,7 @@
userAttrs.put(t, Attributes.createAsList(t, v));
- t = DirectoryServer.getAttributeType(ATTR_CRYPTO_PUBLIC_KEY_CERTIFICATE, true);
+ t = DirectoryServer.getAttributeTypeOrDefault(ATTR_CRYPTO_PUBLIC_KEY_CERTIFICATE);
AttributeBuilder builder = new AttributeBuilder(t);
builder.setOption("binary");
builder.add(certValue);
@@ -600,12 +599,10 @@
if (scope != SearchScope.BASE_OBJECT && aliases.length != 0)
{
- AttributeType certAliasType =
- DirectoryServer.getAttributeType(ATTR_CRYPTO_KEY_ID, true);
+ AttributeType certAliasType = DirectoryServer.getAttributeTypeOrDefault(ATTR_CRYPTO_KEY_ID);
for (String alias : aliases)
{
- DN certDN = makeChildDN(this.baseDN, certAliasType,
- alias);
+ DN certDN = makeChildDN(this.baseDN, certAliasType, alias);
Entry certEntry;
try
@@ -1196,8 +1193,7 @@
DN entryDN = entry.getName();
// Make sure that the DN specifies a certificate alias.
- AttributeType t =
- DirectoryServer.getAttributeType(ATTR_CRYPTO_KEY_ID, true);
+ AttributeType t = DirectoryServer.getAttributeTypeOrDefault(ATTR_CRYPTO_KEY_ID);
ByteString v = entryDN.rdn().getAttributeValue(t);
if (v == null)
{
@@ -1322,8 +1318,7 @@
throws DirectoryException
{
// Make sure that the DN specifies a certificate alias.
- AttributeType t =
- DirectoryServer.getAttributeType(ATTR_CRYPTO_KEY_ID, true);
+ AttributeType t = DirectoryServer.getAttributeTypeOrDefault(ATTR_CRYPTO_KEY_ID);
ByteString v = entryDN.rdn().getAttributeValue(t);
if (v == null)
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/Importer.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/Importer.java
index 70c3356..c7a78a8 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/Importer.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/Importer.java
@@ -164,7 +164,7 @@
private static final int MINIMUM_AVAILABLE_MEMORY = 32 * MB;
/** The DN attribute type. */
- private static final AttributeType dnType = DirectoryServer.getAttributeType("dn", true);
+ private static final AttributeType dnType = DirectoryServer.getAttributeTypeOrDefault("dn");
static final IndexOutputBuffer.IndexComparator indexComparator =
new IndexOutputBuffer.IndexComparator();
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/OnDiskMergeBufferImporter.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/OnDiskMergeBufferImporter.java
index 4e6f2ad..bebd929 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/OnDiskMergeBufferImporter.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/OnDiskMergeBufferImporter.java
@@ -196,7 +196,7 @@
private static final int SMALL_HEAP_SIZE = 256 * MB;
/** The DN attribute type. */
- private static final AttributeType DN_TYPE = DirectoryServer.getAttributeType("dn", true);
+ private static final AttributeType DN_TYPE = DirectoryServer.getAttributeTypeOrDefault("dn");
/** Root container. */
private final RootContainer rootContainer;
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/task/RecurringTask.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/task/RecurringTask.java
index c329fa1..9a87554 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/task/RecurringTask.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/task/RecurringTask.java
@@ -151,7 +151,7 @@
this.recurringTaskEntryDN = recurringTaskEntry.getName();
// Get the recurring task ID from the entry. If there isn't one, then fail.
- AttributeType attrType = DirectoryServer.getAttributeType(
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(
ATTR_RECURRING_TASK_ID.toLowerCase(), ATTR_RECURRING_TASK_ID);
List<Attribute> attrList = recurringTaskEntry.getAttribute(attrType);
if (attrList == null || attrList.isEmpty())
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/task/Task.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/task/Task.java
index 92cb165..01ce8c0 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/task/Task.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/task/Task.java
@@ -973,7 +973,7 @@
String messageString = buffer.toString();
logMessages.add(messageString);
- AttributeType type = DirectoryServer.getAttributeType(
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(
ATTR_TASK_LOG_MESSAGES.toLowerCase(), ATTR_TASK_LOG_MESSAGES);
List<Attribute> attrList = taskEntry.getAttribute(type);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/task/TaskScheduler.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/task/TaskScheduler.java
index 636515a..272ad15 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/task/TaskScheduler.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/task/TaskScheduler.java
@@ -1804,7 +1804,7 @@
throws DirectoryException
{
// Get the name of the class that implements the task logic.
- AttributeType attrType = DirectoryServer.getAttributeType(ATTR_TASK_CLASS.toLowerCase(), ATTR_TASK_CLASS);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(ATTR_TASK_CLASS.toLowerCase(), ATTR_TASK_CLASS);
List<Attribute> attrList = entry.getAttribute(attrType);
if ((attrList == null) || attrList.isEmpty())
{
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 e8579b5..f6177df 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
@@ -192,7 +192,7 @@
throws ConfigException
{
String attrName = stub.getName();
- AttributeType attrType = DirectoryServer.getAttributeType(attrName.toLowerCase(), attrName);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attrName.toLowerCase(), attrName);
List<Attribute> attrList = entry.getAttribute(attrType);
if (attrList != null && !attrList.isEmpty())
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/config/JMXMBean.java b/opendj-server-legacy/src/main/java/org/opends/server/config/JMXMBean.java
index 61a78bb..3b1d3fd 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/config/JMXMBean.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/config/JMXMBean.java
@@ -398,7 +398,7 @@
{
// It's possible that this is a monitor attribute rather than a configurable
// one. Check all of those.
- AttributeType attrType = DirectoryServer.getAttributeType(name.toLowerCase(), name);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(name.toLowerCase(), name);
for (MonitorProvider<? extends MonitorProviderCfg> monitor : monitorProviders)
{
for (org.opends.server.types.Attribute a : monitor.getMonitorData())
@@ -582,7 +582,7 @@
// It's possible that this is a monitor attribute rather than a
// configurable one. Check all of those.
- AttributeType attrType = DirectoryServer.getAttributeType(name.toLowerCase(), name);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(name.toLowerCase(), name);
monitorLoop:
for (MonitorProvider<? extends MonitorProviderCfg> monitor :
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/controls/GetEffectiveRightsRequestControl.java b/opendj-server-legacy/src/main/java/org/opends/server/controls/GetEffectiveRightsRequestControl.java
index 7a0fef1..ac06618 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/controls/GetEffectiveRightsRequestControl.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/controls/GetEffectiveRightsRequestControl.java
@@ -120,7 +120,7 @@
reader.readStartSequence();
while(reader.hasNextElement()) {
String attrStr = reader.readOctetStringAsString();
- attrs.add(DirectoryServer.getAttributeType(attrStr, true));
+ attrs.add(DirectoryServer.getAttributeTypeOrDefault(attrStr));
}
reader.readEndSequence();
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/controls/MatchedValuesFilter.java b/opendj-server-legacy/src/main/java/org/opends/server/controls/MatchedValuesFilter.java
index e07efcb..e5283a7 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/controls/MatchedValuesFilter.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/controls/MatchedValuesFilter.java
@@ -900,7 +900,7 @@
if (attributeType == null && rawAttributeType != null)
{
String lowerName = toLowerCase(rawAttributeType);
- attributeType = DirectoryServer.getAttributeType(lowerName, rawAttributeType);
+ attributeType = DirectoryServer.getAttributeTypeOrDefault(lowerName, rawAttributeType);
}
return attributeType;
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/controls/ServerSideSortRequestControl.java b/opendj-server-legacy/src/main/java/org/opends/server/controls/ServerSideSortRequestControl.java
index a8914c0..4eb24a5 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/controls/ServerSideSortRequestControl.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/controls/ServerSideSortRequestControl.java
@@ -105,13 +105,11 @@
{
reader.readStartSequence();
String attrName = toLowerCase(reader.readOctetStringAsString());
- AttributeType attrType =
- DirectoryServer.getAttributeType(attrName, false);
+ AttributeType attrType = DirectoryServer.getAttributeType(attrName);
if (attrType == null)
{
//This attribute is not defined in the schema. There is no point
- //iterating over the next attribute and return a partially sorted
- //result.
+ //iterating over the next attribute and return a partially sorted result.
return new ServerSideSortRequestControl(isCritical,
new SortOrder(sortKeys.toArray(new SortKey[0])));
}
@@ -440,28 +438,22 @@
ArrayList<SortKey> sortKeys = new ArrayList<>();
for(String[] decodedKey : decodedKeyList)
{
- AttributeType attrType =
- DirectoryServer.getAttributeType(decodedKey[0].toLowerCase(), false);
+ AttributeType attrType = DirectoryServer.getAttributeType(decodedKey[0].toLowerCase());
if (attrType == null)
{
//This attribute is not defined in the schema. There is no point
- //iterating over the next attribute and return a partially sorted
- //result.
+ //iterating over the next attribute and return a partially sorted result.
return new SortOrder(sortKeys.toArray(new SortKey[0]));
}
MatchingRule orderingRule = null;
if(decodedKey[1] != null)
{
- orderingRule =
- DirectoryServer.getMatchingRule(decodedKey[1].toLowerCase());
+ orderingRule = DirectoryServer.getMatchingRule(decodedKey[1].toLowerCase());
if (orderingRule == null)
{
- LocalizableMessage message =
- INFO_SORTREQ_CONTROL_UNDEFINED_ORDERING_RULE.
- get(decodedKey[1]);
- throw new DirectoryException(ResultCode.PROTOCOL_ERROR,
- message);
+ LocalizableMessage message = INFO_SORTREQ_CONTROL_UNDEFINED_ORDERING_RULE.get(decodedKey[1]);
+ throw new DirectoryException(ResultCode.PROTOCOL_ERROR, message);
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/core/CompareOperationBasis.java b/opendj-server-legacy/src/main/java/org/opends/server/core/CompareOperationBasis.java
index 70204c4..75a107a 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/core/CompareOperationBasis.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/core/CompareOperationBasis.java
@@ -232,7 +232,7 @@
baseName = toLowerCase(rawAttributeType);
attributeOptions = null;
}
- attributeType = DirectoryServer.getAttributeType(baseName, true);
+ attributeType = DirectoryServer.getAttributeTypeOrDefault(baseName);
}
/** {@inheritDoc} */
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 ba6811f..9218cf5 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
@@ -2883,19 +2883,14 @@
*
* @param lowerName The lowercase name or OID for the attribute type to
* retrieve.
- * @param returnDefault Indicates whether to generate a default version if
- * the requested attribute type is not defined in the
- * server schema.
- *
* @return The requested attribute type, or <CODE>null</CODE> if there is no
* attribute with the specified type defined in the server schema and
* a default type should not be returned.
*/
- public static AttributeType getAttributeType(String lowerName,
- boolean returnDefault)
+ public static AttributeType getAttributeTypeOrDefault(String lowerName)
{
AttributeType type = directoryServer.schema.getAttributeType(lowerName);
- if (returnDefault && type == null)
+ if (type == null)
{
type = getDefaultAttributeType(lowerName);
}
@@ -2914,7 +2909,7 @@
* @return The requested attribute type, or a generated "default" version if there is no attribute
* with the specified type defined in the server schema
*/
- public static AttributeType getAttributeType(String lowerName, String upperName)
+ public static AttributeType getAttributeTypeOrDefault(String lowerName, String upperName)
{
AttributeType type = directoryServer.schema.getAttributeType(lowerName);
if (type == null)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/core/PasswordPolicyState.java b/opendj-server-legacy/src/main/java/org/opends/server/core/PasswordPolicyState.java
index 3ad8f6a..a0b599e 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/core/PasswordPolicyState.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/core/PasswordPolicyState.java
@@ -317,7 +317,7 @@
if (passwordChangedTime < 0)
{
// Get the password changed time for the user.
- AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_CHANGED_TIME_LC, true);
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_CHANGED_TIME_LC);
try
{
passwordChangedTime = getGeneralizedTime(userEntry, type);
@@ -335,7 +335,7 @@
if (passwordChangedTime < 0)
{
// Get the time that the user's account was created.
- AttributeType createTimeType = DirectoryServer.getAttributeType(OP_ATTR_CREATE_TIMESTAMP_LC, true);
+ AttributeType createTimeType = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_CREATE_TIMESTAMP_LC);
try
{
passwordChangedTime = getGeneralizedTime(userEntry, createTimeType);
@@ -450,14 +450,14 @@
logger.trace("Clearing password changed time for user %s", userDNString);
}
- AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_CHANGED_TIME_LC, true);
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_CHANGED_TIME_LC);
Attribute a = Attributes.empty(type);
modifications.add(new Modification(ModificationType.REPLACE, a, true));
// Fall back to using the entry creation time as the password changed time, if it's defined.
// Otherwise, use a value of zero.
- AttributeType createTimeType = DirectoryServer.getAttributeType(OP_ATTR_CREATE_TIMESTAMP_LC, true);
+ AttributeType createTimeType = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_CREATE_TIMESTAMP_LC);
try
{
passwordChangedTime = getGeneralizedTime(userEntry, createTimeType);
@@ -495,7 +495,7 @@
this.isDisabled = ConditionResult.not(this.isDisabled);
- AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_ACCOUNT_DISABLED, true);
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_ACCOUNT_DISABLED);
if (isDisabled)
{
@@ -528,7 +528,7 @@
return isAccountExpired == ConditionResult.TRUE;
}
- AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_ACCOUNT_EXPIRATION_TIME, true);
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_ACCOUNT_EXPIRATION_TIME);
try {
accountExpirationTime = getGeneralizedTime(userEntry, type);
@@ -607,7 +607,7 @@
}
this.accountExpirationTime = accountExpirationTime;
- AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_ACCOUNT_EXPIRATION_TIME, true);
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_ACCOUNT_EXPIRATION_TIME);
Attribute a = Attributes.create(type, timeStr);
modifications.add(new Modification(ModificationType.REPLACE, a, true));
@@ -628,7 +628,7 @@
accountExpirationTime = -1;
- AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_ACCOUNT_EXPIRATION_TIME, true);
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_ACCOUNT_EXPIRATION_TIME);
modifications.add(new Modification(ModificationType.REPLACE, Attributes.empty(type), true));
}
@@ -655,7 +655,7 @@
return authFailureTimes;
}
- AttributeType type = DirectoryServer.getAttributeType(
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(
OP_ATTR_PWPOLICY_FAILURE_TIME_LC, OP_ATTR_PWPOLICY_FAILURE_TIME);
try
{
@@ -765,7 +765,7 @@
failureTimes.add(highestFailureTime);
// And the attribute in the user entry
- AttributeType type = DirectoryServer.getAttributeType(
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(
OP_ATTR_PWPOLICY_FAILURE_TIME_LC, OP_ATTR_PWPOLICY_FAILURE_TIME);
Attribute addAttr = Attributes.create(type, GeneralizedTimeSyntax.format(highestFailureTime));
modifications.add(new Modification(ModificationType.ADD, addAttr, true));
@@ -800,7 +800,7 @@
return;
}
- AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_FAILURE_TIME_LC, true);
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_FAILURE_TIME_LC);
this.authFailureTimes = authFailureTimes;
AttributeBuilder builder = new AttributeBuilder(type);
@@ -847,7 +847,7 @@
failureTimes.clear(); // Note: failureTimes != this.authFailureTimes
- AttributeType type = DirectoryServer.getAttributeType(
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(
OP_ATTR_PWPOLICY_FAILURE_TIME_LC, OP_ATTR_PWPOLICY_FAILURE_TIME);
modifications.add(new Modification(ModificationType.REPLACE, Attributes.empty(type), true));
}
@@ -865,7 +865,7 @@
return failureLockedTime;
}
- AttributeType type = DirectoryServer.getAttributeType(
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(
OP_ATTR_PWPOLICY_LOCKED_TIME_LC, OP_ATTR_PWPOLICY_LOCKED_TIME);
try
{
@@ -899,7 +899,7 @@
failureLockedTime = time;
- AttributeType type = DirectoryServer.getAttributeType(
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(
OP_ATTR_PWPOLICY_LOCKED_TIME_LC, OP_ATTR_PWPOLICY_LOCKED_TIME);
Attribute a = Attributes.create(type, GeneralizedTimeSyntax.format(failureLockedTime));
modifications.add(new Modification(ModificationType.REPLACE, a, true));
@@ -924,7 +924,7 @@
failureLockedTime = -1L;
- AttributeType type = DirectoryServer.getAttributeType(
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(
OP_ATTR_PWPOLICY_LOCKED_TIME_LC, OP_ATTR_PWPOLICY_LOCKED_TIME);
modifications.add(new Modification(ModificationType.REPLACE, Attributes.empty(type), true));
}
@@ -1250,7 +1250,7 @@
lastLoginTime = -1;
- AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_LAST_LOGIN_TIME, true);
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_LAST_LOGIN_TIME);
modifications.add(new Modification(ModificationType.REPLACE, Attributes.empty(type), true));
}
@@ -1367,7 +1367,7 @@
return false;
}
- AttributeType type = DirectoryServer.getAttributeType(
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(
OP_ATTR_PWPOLICY_RESET_REQUIRED_LC, OP_ATTR_PWPOLICY_RESET_REQUIRED);
try
{
@@ -1415,7 +1415,7 @@
return; // requested state matches current state
}
- AttributeType type = DirectoryServer.getAttributeType(
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(
OP_ATTR_PWPOLICY_RESET_REQUIRED_LC, OP_ATTR_PWPOLICY_RESET_REQUIRED);
this.mustChangePassword = ConditionResult.not(this.mustChangePassword);
if (mustChangePassword)
@@ -1817,7 +1817,7 @@
return requiredChangeTime;
}
- AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_CHANGED_BY_REQUIRED_TIME, true);
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_CHANGED_BY_REQUIRED_TIME);
try
{
@@ -1870,7 +1870,7 @@
{
this.requiredChangeTime = requiredChangeTime;
- AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_CHANGED_BY_REQUIRED_TIME, true);
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_CHANGED_BY_REQUIRED_TIME);
String timeValue = GeneralizedTimeSyntax.format(requiredChangeTime);
Attribute a = Attributes.create(type, timeValue);
@@ -1894,7 +1894,7 @@
this.requiredChangeTime = Long.MIN_VALUE;
- AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_CHANGED_BY_REQUIRED_TIME, true);
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_CHANGED_BY_REQUIRED_TIME);
modifications.add(new Modification(ModificationType.REPLACE, Attributes.empty(type), true));
}
@@ -1909,7 +1909,7 @@
{
if (warnedTime == Long.MIN_VALUE)
{
- AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_WARNED_TIME, true);
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_WARNED_TIME);
try
{
warnedTime = getGeneralizedTime(userEntry, type);
@@ -1960,7 +1960,7 @@
this.warnedTime = warnedTime;
- AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_WARNED_TIME, true);
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_WARNED_TIME);
Attribute a = Attributes.create(type, GeneralizedTimeSyntax.createGeneralizedTimeValue(currentTime));
modifications.add(new Modification(ModificationType.REPLACE, a, true));
@@ -1989,7 +1989,7 @@
}
warnedTime = -1;
- AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_WARNED_TIME, true);
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_WARNED_TIME);
Attribute a = Attributes.empty(type);
modifications.add(new Modification(ModificationType.REPLACE, a, true));
@@ -2010,7 +2010,7 @@
{
if (graceLoginTimes == null)
{
- AttributeType type = DirectoryServer.getAttributeType(
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(
OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME_LC, OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME);
try
{
@@ -2078,7 +2078,7 @@
}
graceTimes.add(highestGraceTime); // graceTimes == this.graceLoginTimes
- AttributeType type = DirectoryServer.getAttributeType(
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(
OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME_LC, OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME);
Attribute addAttr = Attributes.create(type, GeneralizedTimeSyntax.format(highestGraceTime));
modifications.add(new Modification(ModificationType.ADD, addAttr, true));
@@ -2107,7 +2107,7 @@
this.graceLoginTimes = graceLoginTimes;
- AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME_LC, true);
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME_LC);
AttributeBuilder builder = new AttributeBuilder(type);
for (Long l : graceLoginTimes)
{
@@ -2137,7 +2137,7 @@
}
graceTimes.clear(); // graceTimes == this.graceLoginTimes
- AttributeType type = DirectoryServer.getAttributeType(
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(
OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME_LC, OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME);
modifications.add(new Modification(ModificationType.REPLACE, Attributes.empty(type), true));
}
@@ -2651,7 +2651,7 @@
private TreeMap<Long,ByteString> getSortedHistoryValues(List<Attribute> removeAttrs)
{
TreeMap<Long, ByteString> historyMap = new TreeMap<>();
- AttributeType historyType = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_HISTORY_LC, true);
+ AttributeType historyType = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_HISTORY_LC);
List<Attribute> attrList = userEntry.getAttribute(historyType);
if (attrList != null)
{
@@ -2884,7 +2884,7 @@
// If there is a maximum number of values to retain and we would be over the limit with the new value,
// then get rid of enough values (oldest first) to satisfy the count.
- AttributeType historyType = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_HISTORY_LC, true);
+ AttributeType historyType = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_HISTORY_LC);
int historyCount = passwordPolicy.getPasswordHistoryCount();
if (historyCount > 0 && historyMap.size() >= historyCount)
{
@@ -2986,7 +2986,7 @@
public String[] getPasswordHistoryValues()
{
ArrayList<String> historyValues = new ArrayList<>();
- AttributeType historyType = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_HISTORY_LC, true);
+ AttributeType historyType = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_HISTORY_LC);
List<Attribute> attrList = userEntry.getAttribute(historyType);
if (attrList != null)
{
@@ -3014,7 +3014,7 @@
logger.trace("Clearing password history for user %s", userDNString);
}
- AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_HISTORY_LC, true);
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_HISTORY_LC);
modifications.add(new Modification(ModificationType.REPLACE, Attributes.empty(type), true));
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/core/SubentryPasswordPolicy.java b/opendj-server-legacy/src/main/java/org/opends/server/core/SubentryPasswordPolicy.java
index 80eaaf4..c186100 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/core/SubentryPasswordPolicy.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/core/SubentryPasswordPolicy.java
@@ -173,8 +173,7 @@
String value = getAttrValue(entry, PWD_ATTR_ATTRIBUTE);
if (value != null && value.length() > 0)
{
- this.pPasswordAttribute =
- DirectoryServer.getAttributeType(value.toLowerCase(), false);
+ this.pPasswordAttribute = DirectoryServer.getAttributeType(value.toLowerCase());
if (this.pPasswordAttribute == null)
{
throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM,
@@ -249,7 +248,7 @@
objectClasses.containsKey(pwdValidatorPolicyOC))
{
AttributeType pwdAttrType =
- DirectoryServer.getAttributeType(PWD_ATTR_VALIDATOR, true);
+ DirectoryServer.getAttributeTypeOrDefault(PWD_ATTR_VALIDATOR);
List<Attribute> pwdAttrList = entry.getAttribute(pwdAttrType);
if ((pwdAttrList != null) && (!pwdAttrList.isEmpty()))
{
@@ -376,8 +375,7 @@
*/
private String getAttrValue(Entry entry, String pwdAttrName)
{
- AttributeType pwdAttrType = DirectoryServer.getAttributeType(pwdAttrName,
- true);
+ AttributeType pwdAttrType = DirectoryServer.getAttributeTypeOrDefault(pwdAttrName);
List<Attribute> pwdAttrList = entry.getAttribute(pwdAttrType);
if (pwdAttrList != null && !pwdAttrList.isEmpty())
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/crypto/CryptoManagerSync.java b/opendj-server-legacy/src/main/java/org/opends/server/crypto/CryptoManagerSync.java
index 1a0d1ae..60aabaf 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/crypto/CryptoManagerSync.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/crypto/CryptoManagerSync.java
@@ -22,13 +22,14 @@
*
*
* Copyright 2008-2010 Sun Microsystems, Inc.
- * Portions Copyright 2014 ForgeRock AS
+ * Portions Copyright 2014-2015 ForgeRock AS
*/
package org.opends.server.crypto;
import static org.opends.messages.CoreMessages.*;
import static org.opends.server.api.plugin.PluginType.*;
import static org.opends.server.config.ConfigConstants.*;
+import static org.opends.server.core.DirectoryServer.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.opends.server.protocols.internal.Requests.*;
import static org.opends.server.util.ServerConstants.*;
@@ -167,12 +168,9 @@
ocCipherKey = DirectoryServer.getObjectClass(OC_CRYPTO_CIPHER_KEY, true);
ocMacKey = DirectoryServer.getObjectClass(OC_CRYPTO_MAC_KEY, true);
- attrCert = DirectoryServer.getAttributeType(
- ConfigConstants.ATTR_CRYPTO_PUBLIC_KEY_CERTIFICATE, true);
- attrAlias = DirectoryServer.getAttributeType(
- ConfigConstants.ATTR_CRYPTO_KEY_ID, true);
- attrCompromisedTime = DirectoryServer.getAttributeType(
- ConfigConstants.ATTR_CRYPTO_KEY_COMPROMISED_TIME, true);
+ attrCert = getAttributeTypeOrDefault(ATTR_CRYPTO_PUBLIC_KEY_CERTIFICATE);
+ attrAlias = getAttributeTypeOrDefault(ATTR_CRYPTO_KEY_ID);
+ attrCompromisedTime = getAttributeTypeOrDefault(ATTR_CRYPTO_KEY_COMPROMISED_TIME);
if (DirectoryServer.getBackendWithBaseDN(adminSuffixDN) != null)
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/ConfigFileHandler.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/ConfigFileHandler.java
index c7a9b68..45e4142 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/ConfigFileHandler.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/ConfigFileHandler.java
@@ -1126,8 +1126,7 @@
}
AttributeType privType =
- DirectoryServer.getAttributeType(ATTR_DEFAULT_ROOT_PRIVILEGE_NAME,
- true);
+ DirectoryServer.getAttributeTypeOrDefault(ATTR_DEFAULT_ROOT_PRIVILEGE_NAME);
for (Modification m : modifyOperation.getModifications())
{
if (m.getAttribute().getAttributeType().equals(privType))
@@ -1137,8 +1136,7 @@
{
LocalizableMessage message =
ERR_CONFIG_FILE_MODIFY_PRIVS_INSUFFICIENT_PRIVILEGES.get();
- throw new DirectoryException(ResultCode.INSUFFICIENT_ACCESS_RIGHTS,
- message);
+ throw new DirectoryException(ResultCode.INSUFFICIENT_ACCESS_RIGHTS, message);
}
break;
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/DynamicGroup.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/DynamicGroup.java
index 237c5f9..acd855a 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/DynamicGroup.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/DynamicGroup.java
@@ -37,6 +37,7 @@
import org.forgerock.i18n.LocalizableMessage;
import org.opends.server.admin.std.server.DynamicGroupImplementationCfg;
import org.opends.server.api.Group;
+import org.opends.server.core.DirectoryServer;
import org.opends.server.core.ServerContext;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.i18n.slf4j.LocalizedLogger;
@@ -138,8 +139,7 @@
// Get the memberURL attribute from the entry, if there is one, and parse
// out the LDAP URLs that it contains.
LinkedHashSet<LDAPURL> memberURLs = new LinkedHashSet<>();
- AttributeType memberURLType =
- DirectoryConfig.getAttributeType(ATTR_MEMBER_URL_LC, true);
+ AttributeType memberURLType = DirectoryServer.getAttributeTypeOrDefault(ATTR_MEMBER_URL_LC);
List<Attribute> attrList = groupEntry.getAttribute(memberURLType);
if (attrList != null)
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/ExternalSASLMechanismHandler.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/ExternalSASLMechanismHandler.java
index afec40c..930cdee 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/ExternalSASLMechanismHandler.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/ExternalSASLMechanismHandler.java
@@ -125,8 +125,7 @@
if (certificateAttributeType == null)
{
certificateAttributeType =
- DirectoryServer.getAttributeType(DEFAULT_VALIDATION_CERT_ATTRIBUTE,
- true);
+ DirectoryServer.getAttributeTypeOrDefault(DEFAULT_VALIDATION_CERT_ATTRIBUTE);
}
@@ -391,8 +390,7 @@
if (newCertificateType == null)
{
newCertificateType =
- DirectoryServer.getAttributeType(DEFAULT_VALIDATION_CERT_ATTRIBUTE,
- true);
+ DirectoryServer.getAttributeTypeOrDefault(DEFAULT_VALIDATION_CERT_ATTRIBUTE);
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyFactory.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyFactory.java
index f5d871f..5947371 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyFactory.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyFactory.java
@@ -1516,10 +1516,10 @@
{
super(userEntry);
- this.cachedPasswordAttribute = DirectoryServer.getAttributeType(
- OP_ATTR_PTAPOLICY_CACHED_PASSWORD, true);
- this.cachedPasswordTimeAttribute = DirectoryServer.getAttributeType(
- OP_ATTR_PTAPOLICY_CACHED_PASSWORD_TIME, true);
+ this.cachedPasswordAttribute = DirectoryServer.getAttributeTypeOrDefault(
+ OP_ATTR_PTAPOLICY_CACHED_PASSWORD);
+ this.cachedPasswordTimeAttribute = DirectoryServer.getAttributeTypeOrDefault(
+ OP_ATTR_PTAPOLICY_CACHED_PASSWORD_TIME);
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/SMTPAccountStatusNotificationHandler.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/SMTPAccountStatusNotificationHandler.java
index 955aafd..3c8b568 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/SMTPAccountStatusNotificationHandler.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/SMTPAccountStatusNotificationHandler.java
@@ -391,8 +391,7 @@
else if (lowerTokenStr.startsWith("notification-user-attr:"))
{
String attrName = lowerTokenStr.substring(23);
- AttributeType attrType =
- DirectoryServer.getAttributeType(attrName, false);
+ AttributeType attrType = DirectoryServer.getAttributeType(attrName);
if (attrType == null)
{
throw new ConfigException(
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/StaticGroup.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/StaticGroup.java
index 8060e25..7019317 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/StaticGroup.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/StaticGroup.java
@@ -170,7 +170,7 @@
throw new DirectoryException(ResultCode.OBJECTCLASS_VIOLATION, message);
}
- someMemberAttributeType = DirectoryConfig.getAttributeType(ATTR_MEMBER, true);
+ someMemberAttributeType = DirectoryServer.getAttributeTypeOrDefault(ATTR_MEMBER);
}
else if (hasGroupOfNamesClass)
{
@@ -181,11 +181,11 @@
throw new DirectoryException(ResultCode.OBJECTCLASS_VIOLATION, message);
}
- someMemberAttributeType = DirectoryConfig.getAttributeType(ATTR_MEMBER, true);
+ someMemberAttributeType = DirectoryServer.getAttributeTypeOrDefault(ATTR_MEMBER);
}
else if (hasGroupOfUniqueNamesClass)
{
- someMemberAttributeType = DirectoryConfig.getAttributeType(ATTR_UNIQUE_MEMBER_LC, true);
+ someMemberAttributeType = DirectoryServer.getAttributeTypeOrDefault(ATTR_UNIQUE_MEMBER_LC);
}
else
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/SubjectAttributeToUserAttributeCertificateMapper.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/SubjectAttributeToUserAttributeCertificateMapper.java
index bdc34ed..ac5f788 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/SubjectAttributeToUserAttributeCertificateMapper.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/SubjectAttributeToUserAttributeCertificateMapper.java
@@ -45,6 +45,7 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
+import org.forgerock.opendj.config.server.ConfigChangeResult;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.SearchScope;
@@ -58,7 +59,6 @@
import org.opends.server.protocols.internal.InternalSearchOperation;
import org.opends.server.protocols.internal.SearchRequest;
import org.opends.server.types.AttributeType;
-import org.forgerock.opendj.config.server.ConfigChangeResult;
import org.opends.server.types.DN;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.Entry;
@@ -86,13 +86,10 @@
/** The DN of the configuration entry for this certificate mapper. */
private DN configEntryDN;
-
/** The mappings between certificate attribute names and user attribute types. */
private LinkedHashMap<String,AttributeType> attributeMap;
-
/** The current configuration for this certificate mapper. */
private SubjectAttributeToUserAttributeCertificateMapperCfg currentConfig;
-
/** The set of attributes to return in search result entries. */
private LinkedHashSet<String> requestedAttributes;
@@ -112,79 +109,32 @@
/** {@inheritDoc} */
@Override
public void initializeCertificateMapper(
- SubjectAttributeToUserAttributeCertificateMapperCfg
- configuration)
+ SubjectAttributeToUserAttributeCertificateMapperCfg configuration)
throws ConfigException, InitializationException
{
- configuration
- .addSubjectAttributeToUserAttributeChangeListener(this);
+ configuration.addSubjectAttributeToUserAttributeChangeListener(this);
currentConfig = configuration;
configEntryDN = configuration.dn();
// Get and validate the subject attribute to user attribute mappings.
- attributeMap = new LinkedHashMap<>();
- for (String mapStr : configuration.getSubjectAttributeMapping())
+ ConfigChangeResult ccr = new ConfigChangeResult();
+ attributeMap = buildAttributeMap(configuration, configEntryDN, ccr);
+ List<LocalizableMessage> messages = ccr.getMessages();
+ if (!messages.isEmpty())
{
- String lowerMap = toLowerCase(mapStr);
- int colonPos = lowerMap.indexOf(':');
- if (colonPos <= 0)
- {
- LocalizableMessage message = ERR_SATUACM_INVALID_MAP_FORMAT.get(configEntryDN, mapStr);
- throw new ConfigException(message);
- }
-
- String certAttrName = lowerMap.substring(0, colonPos).trim();
- String userAttrName = lowerMap.substring(colonPos+1).trim();
- if ((certAttrName.length() == 0) || (userAttrName.length() == 0))
- {
- LocalizableMessage message = ERR_SATUACM_INVALID_MAP_FORMAT.get(configEntryDN, mapStr);
- throw new ConfigException(message);
- }
-
- // Try to normalize the provided certAttrName
- certAttrName = normalizeAttributeName(certAttrName);
-
-
- if (attributeMap.containsKey(certAttrName))
- {
- LocalizableMessage message = ERR_SATUACM_DUPLICATE_CERT_ATTR.get(configEntryDN, certAttrName);
- throw new ConfigException(message);
- }
-
- AttributeType userAttrType =
- DirectoryServer.getAttributeType(userAttrName, false);
- if (userAttrType == null)
- {
- LocalizableMessage message = ERR_SATUACM_NO_SUCH_ATTR.get(mapStr, configEntryDN, userAttrName);
- throw new ConfigException(message);
- }
-
- for (AttributeType attrType : attributeMap.values())
- {
- if (attrType.equals(userAttrType))
- {
- throw new ConfigException(ERR_SATUACM_DUPLICATE_USER_ATTR.get(configEntryDN, attrType.getNameOrOID()));
- }
- }
-
- attributeMap.put(certAttrName, userAttrType);
+ throw new ConfigException(messages.iterator().next());
}
// Make sure that all the user attributes are configured with equality
// indexes in all appropriate backends.
- Set<DN> cfgBaseDNs = configuration.getUserBaseDN();
- if ((cfgBaseDNs == null) || cfgBaseDNs.isEmpty())
- {
- cfgBaseDNs = DirectoryServer.getPublicNamingContexts().keySet();
- }
-
+ Set<DN> cfgBaseDNs = getUserBaseDNs(configuration);
for (DN baseDN : cfgBaseDNs)
{
for (AttributeType t : attributeMap.values())
{
- Backend b = DirectoryServer.getBackend(baseDN);
- if ((b != null) && (! b.isIndexed(t, IndexType.EQUALITY)))
+ Backend<?> b = DirectoryServer.getBackend(baseDN);
+ if (b != null && ! b.isIndexed(t, IndexType.EQUALITY))
{
logger.warn(WARN_SATUACM_ATTR_UNINDEXED, configuration.dn(),
t.getNameOrOID(), b.getBackendID());
@@ -192,21 +142,18 @@
}
}
- // Create the attribute list to include in search requests. We want to
+ // Create the attribute list to include in search requests. We want to
// include all user and operational attributes.
requestedAttributes = new LinkedHashSet<>(2);
requestedAttributes.add("*");
requestedAttributes.add("+");
}
-
-
/** {@inheritDoc} */
@Override
public void finalizeCertificateMapper()
{
- currentConfig
- .removeSubjectAttributeToUserAttributeChangeListener(this);
+ currentConfig.removeSubjectAttributeToUserAttributeChangeListener(this);
}
@@ -216,8 +163,7 @@
public Entry mapCertificateToUser(Certificate[] certificateChain)
throws DirectoryException
{
- SubjectAttributeToUserAttributeCertificateMapperCfg config =
- currentConfig;
+ SubjectAttributeToUserAttributeCertificateMapperCfg config = currentConfig;
LinkedHashMap<String,AttributeType> theAttributeMap = this.attributeMap;
@@ -257,8 +203,7 @@
{
LocalizableMessage message = ERR_SATUACM_CANNOT_DECODE_SUBJECT_AS_DN.get(
peerName, de.getMessageObject());
- throw new DirectoryException(ResultCode.INVALID_CREDENTIALS, message,
- de);
+ throw new DirectoryException(ResultCode.INVALID_CREDENTIALS, message, de);
}
LinkedList<SearchFilter> filterComps = new LinkedList<>();
@@ -275,8 +220,7 @@
AttributeType attrType = theAttributeMap.get(lowerName);
if (attrType != null)
{
- filterComps.add(SearchFilter.createEqualityFilter(attrType,
- rdn.getAttributeValue(j)));
+ filterComps.add(SearchFilter.createEqualityFilter(attrType, rdn.getAttributeValue(j)));
}
}
}
@@ -288,19 +232,9 @@
}
SearchFilter filter = SearchFilter.createANDFilter(filterComps);
+ Collection<DN> baseDNs = getUserBaseDNs(config);
-
- // If we have an explicit set of base DNs, then use it. Otherwise, use the
- // set of public naming contexts in the server.
- Collection<DN> baseDNs = config.getUserBaseDN();
- if ((baseDNs == null) || baseDNs.isEmpty())
- {
- baseDNs = DirectoryServer.getPublicNamingContexts().keySet();
- }
-
-
- // For each base DN, issue an internal search in an attempt to map the
- // certificate.
+ // For each base DN, issue an internal search in an attempt to map the certificate.
Entry userEntry = null;
InternalClientConnection conn = getRootConnection();
for (DN baseDN : baseDNs)
@@ -360,8 +294,6 @@
return userEntry;
}
-
-
/** {@inheritDoc} */
@Override
public boolean isConfigurationAcceptable(CertificateMapperCfg configuration,
@@ -377,160 +309,34 @@
/** {@inheritDoc} */
@Override
public boolean isConfigurationChangeAcceptable(
- SubjectAttributeToUserAttributeCertificateMapperCfg
- configuration,
+ SubjectAttributeToUserAttributeCertificateMapperCfg configuration,
List<LocalizableMessage> unacceptableReasons)
{
- boolean configAcceptable = true;
- DN cfgEntryDN = configuration.dn();
-
- // Get and validate the subject attribute to user attribute mappings.
- LinkedHashMap<String,AttributeType> newAttributeMap = new LinkedHashMap<>();
-mapLoop:
- for (String mapStr : configuration.getSubjectAttributeMapping())
- {
- String lowerMap = toLowerCase(mapStr);
- int colonPos = lowerMap.indexOf(':');
- if (colonPos <= 0)
- {
- unacceptableReasons.add(ERR_SATUACM_INVALID_MAP_FORMAT.get(cfgEntryDN, mapStr));
- configAcceptable = false;
- break;
- }
-
- String certAttrName = lowerMap.substring(0, colonPos).trim();
- String userAttrName = lowerMap.substring(colonPos+1).trim();
- if ((certAttrName.length() == 0) || (userAttrName.length() == 0))
- {
- unacceptableReasons.add(ERR_SATUACM_INVALID_MAP_FORMAT.get(cfgEntryDN, mapStr));
- configAcceptable = false;
- break;
- }
-
- // Try to normalize the provided certAttrName
- certAttrName = normalizeAttributeName(certAttrName);
-
- if (newAttributeMap.containsKey(certAttrName))
- {
- unacceptableReasons.add(ERR_SATUACM_DUPLICATE_CERT_ATTR.get(cfgEntryDN, certAttrName));
- configAcceptable = false;
- break;
- }
-
- AttributeType userAttrType =
- DirectoryServer.getAttributeType(userAttrName, false);
- if (userAttrType == null)
- {
- unacceptableReasons.add(ERR_SATUACM_NO_SUCH_ATTR.get(mapStr, cfgEntryDN, userAttrName));
- configAcceptable = false;
- break;
- }
-
- for (AttributeType attrType : newAttributeMap.values())
- {
- if (attrType.equals(userAttrType))
- {
- unacceptableReasons.add(ERR_SATUACM_DUPLICATE_USER_ATTR.get(cfgEntryDN, attrType.getNameOrOID()));
- configAcceptable = false;
- break mapLoop;
- }
- }
-
- newAttributeMap.put(certAttrName, userAttrType);
- }
-
- return configAcceptable;
+ ConfigChangeResult ccr = new ConfigChangeResult();
+ buildAttributeMap(configuration, configuration.dn(), ccr);
+ unacceptableReasons.addAll(ccr.getMessages());
+ return ResultCode.SUCCESS.equals(ccr.getResultCode());
}
-
-
/** {@inheritDoc} */
@Override
- public ConfigChangeResult applyConfigurationChange(
- SubjectAttributeToUserAttributeCertificateMapperCfg
- configuration)
+ public ConfigChangeResult applyConfigurationChange(SubjectAttributeToUserAttributeCertificateMapperCfg configuration)
{
final ConfigChangeResult ccr = new ConfigChangeResult();
-
-
- // Get and validate the subject attribute to user attribute mappings.
- LinkedHashMap<String,AttributeType> newAttributeMap = new LinkedHashMap<>();
-mapLoop:
- for (String mapStr : configuration.getSubjectAttributeMapping())
- {
- String lowerMap = toLowerCase(mapStr);
- int colonPos = lowerMap.indexOf(':');
- if (colonPos <= 0)
- {
- ccr.setResultCodeIfSuccess(ResultCode.CONSTRAINT_VIOLATION);
-
-
- ccr.addMessage(ERR_SATUACM_INVALID_MAP_FORMAT.get(configEntryDN, mapStr));
- break;
- }
-
- String certAttrName = lowerMap.substring(0, colonPos).trim();
- String userAttrName = lowerMap.substring(colonPos+1).trim();
- if ((certAttrName.length() == 0) || (userAttrName.length() == 0))
- {
- ccr.setResultCodeIfSuccess(ResultCode.CONSTRAINT_VIOLATION);
-
-
- ccr.addMessage(ERR_SATUACM_INVALID_MAP_FORMAT.get(configEntryDN, mapStr));
- break;
- }
-
- // Try to normalize the provided certAttrName
- certAttrName = normalizeAttributeName(certAttrName);
-
- if (newAttributeMap.containsKey(certAttrName))
- {
- ccr.setResultCodeIfSuccess(ResultCode.CONSTRAINT_VIOLATION);
- ccr.addMessage(ERR_SATUACM_DUPLICATE_CERT_ATTR.get(configEntryDN, certAttrName));
- break;
- }
-
- AttributeType userAttrType =
- DirectoryServer.getAttributeType(userAttrName, false);
- if (userAttrType == null)
- {
- ccr.setResultCodeIfSuccess(ResultCode.CONSTRAINT_VIOLATION);
- ccr.addMessage(ERR_SATUACM_NO_SUCH_ATTR.get(mapStr, configEntryDN, userAttrName));
- break;
- }
-
- for (AttributeType attrType : newAttributeMap.values())
- {
- if (attrType.equals(userAttrType))
- {
- ccr.setResultCodeIfSuccess(ResultCode.CONSTRAINT_VIOLATION);
-
-
- ccr.addMessage(ERR_SATUACM_DUPLICATE_USER_ATTR.get(configEntryDN, attrType.getNameOrOID()));
- break mapLoop;
- }
- }
-
- newAttributeMap.put(certAttrName, userAttrType);
- }
+ LinkedHashMap<String, AttributeType> newAttributeMap = buildAttributeMap(configuration, configEntryDN, ccr);
// Make sure that all the user attributes are configured with equality
// indexes in all appropriate backends.
- Set<DN> cfgBaseDNs = configuration.getUserBaseDN();
- if ((cfgBaseDNs == null) || cfgBaseDNs.isEmpty())
- {
- cfgBaseDNs = DirectoryServer.getPublicNamingContexts().keySet();
- }
-
+ Set<DN> cfgBaseDNs = getUserBaseDNs(configuration);
for (DN baseDN : cfgBaseDNs)
{
for (AttributeType t : newAttributeMap.values())
{
- Backend b = DirectoryServer.getBackend(baseDN);
- if ((b != null) && (! b.isIndexed(t, IndexType.EQUALITY)))
+ Backend<?> b = DirectoryServer.getBackend(baseDN);
+ if (b != null && !b.isIndexed(t, IndexType.EQUALITY))
{
- LocalizableMessage message = WARN_SATUACM_ATTR_UNINDEXED.get(
- configuration.dn(), t.getNameOrOID(), b.getBackendID());
+ LocalizableMessage message =
+ WARN_SATUACM_ATTR_UNINDEXED.get(configuration.dn(), t.getNameOrOID(), b.getBackendID());
ccr.addMessage(message);
logger.error(message);
}
@@ -539,12 +345,78 @@
if (ccr.getResultCode() == ResultCode.SUCCESS)
{
- attributeMap = newAttributeMap;
+ attributeMap = newAttributeMap;
currentConfig = configuration;
}
+ return ccr;
+ }
- return ccr;
+ /**
+ * If we have an explicit set of base DNs, then use it.
+ * Otherwise, use the set of public naming contexts in the server.
+ */
+ private Set<DN> getUserBaseDNs(SubjectAttributeToUserAttributeCertificateMapperCfg config)
+ {
+ Set<DN> baseDNs = config.getUserBaseDN();
+ if ((baseDNs == null) || baseDNs.isEmpty())
+ {
+ baseDNs = DirectoryServer.getPublicNamingContexts().keySet();
+ }
+ return baseDNs;
+ }
+
+ /** Get and validate the subject attribute to user attribute mappings. */
+ private LinkedHashMap<String, AttributeType> buildAttributeMap(
+ SubjectAttributeToUserAttributeCertificateMapperCfg configuration, DN cfgEntryDN, ConfigChangeResult ccr)
+ {
+ LinkedHashMap<String, AttributeType> results = new LinkedHashMap<>();
+ for (String mapStr : configuration.getSubjectAttributeMapping())
+ {
+ String lowerMap = toLowerCase(mapStr);
+ int colonPos = lowerMap.indexOf(':');
+ if (colonPos <= 0)
+ {
+ ccr.setResultCodeIfSuccess(ResultCode.CONSTRAINT_VIOLATION);
+ ccr.addMessage(ERR_SATUACM_INVALID_MAP_FORMAT.get(cfgEntryDN, mapStr));
+ return null;
+ }
+
+ String certAttrName = lowerMap.substring(0, colonPos).trim();
+ String userAttrName = lowerMap.substring(colonPos+1).trim();
+ if ((certAttrName.length() == 0) || (userAttrName.length() == 0))
+ {
+ ccr.setResultCodeIfSuccess(ResultCode.CONSTRAINT_VIOLATION);
+ ccr.addMessage(ERR_SATUACM_INVALID_MAP_FORMAT.get(cfgEntryDN, mapStr));
+ return null;
+ }
+
+ // Try to normalize the provided certAttrName
+ certAttrName = normalizeAttributeName(certAttrName);
+ if (results.containsKey(certAttrName))
+ {
+ ccr.setResultCodeIfSuccess(ResultCode.CONSTRAINT_VIOLATION);
+ ccr.addMessage(ERR_SATUACM_DUPLICATE_CERT_ATTR.get(cfgEntryDN, certAttrName));
+ return null;
+ }
+
+ AttributeType userAttrType = DirectoryServer.getAttributeType(userAttrName);
+ if (userAttrType == null)
+ {
+ ccr.setResultCodeIfSuccess(ResultCode.CONSTRAINT_VIOLATION);
+ ccr.addMessage(ERR_SATUACM_NO_SUCH_ATTR.get(mapStr, cfgEntryDN, userAttrName));
+ return null;
+ }
+ if (results.values().contains(userAttrType))
+ {
+ ccr.setResultCodeIfSuccess(ResultCode.CONSTRAINT_VIOLATION);
+ ccr.addMessage(ERR_SATUACM_DUPLICATE_USER_ATTR.get(cfgEntryDN, userAttrType.getNameOrOID()));
+ return null;
+ }
+
+ results.put(certAttrName, userAttrType);
+ }
+ return results;
}
@@ -559,8 +431,7 @@
*/
private static String normalizeAttributeName(String attrName)
{
- AttributeType attrType =
- DirectoryServer.getAttributeType(attrName, false);
+ AttributeType attrType = DirectoryServer.getAttributeType(attrName);
if (attrType != null)
{
String attrNameNormalized = attrType.getNormalizedPrimaryName();
@@ -572,4 +443,3 @@
return attrName;
}
}
-
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/VirtualStaticGroup.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/VirtualStaticGroup.java
index cfc8687..ad78277 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/VirtualStaticGroup.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/VirtualStaticGroup.java
@@ -132,8 +132,7 @@
// Get the target group DN attribute from the entry, if there is one.
DN targetDN = null;
- AttributeType targetType =
- DirectoryServer.getAttributeType(ATTR_TARGET_GROUP_DN, true);
+ AttributeType targetType = DirectoryServer.getAttributeTypeOrDefault(ATTR_TARGET_GROUP_DN);
List<Attribute> attrList = groupEntry.getAttribute(targetType);
if (attrList != null)
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/monitors/BackendMonitor.java b/opendj-server-legacy/src/main/java/org/opends/server/monitors/BackendMonitor.java
index 6ecb5c5..ebb9c66 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/monitors/BackendMonitor.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/monitors/BackendMonitor.java
@@ -36,6 +36,7 @@
import org.opends.server.admin.std.server.MonitorProviderCfg;
import org.opends.server.api.Backend;
import org.opends.server.api.MonitorProvider;
+import org.opends.server.core.DirectoryServer;
import org.opends.server.schema.BooleanSyntax;
import org.opends.server.types.*;
@@ -84,16 +85,12 @@
{
monitorName = backend.getBackendID() + " Backend";
- backendIDType = DirectoryConfig.getAttributeType(ATTR_MONITOR_BACKEND_ID, true);
- baseDNType = DirectoryConfig.getAttributeType(ATTR_MONITOR_BACKEND_BASE_DN, true);
- entryCountType =
- DirectoryConfig.getAttributeType(ATTR_MONITOR_BACKEND_ENTRY_COUNT, true);
- baseDNEntryCountType =
- DirectoryConfig.getAttributeType(ATTR_MONITOR_BASE_DN_ENTRY_COUNT, true);
- isPrivateType =
- DirectoryConfig.getAttributeType(ATTR_MONITOR_BACKEND_IS_PRIVATE, true);
- writabilityModeType =
- DirectoryConfig.getAttributeType(ATTR_MONITOR_BACKEND_WRITABILITY_MODE, true);
+ backendIDType = DirectoryServer.getAttributeTypeOrDefault(ATTR_MONITOR_BACKEND_ID);
+ baseDNType = DirectoryServer.getAttributeTypeOrDefault(ATTR_MONITOR_BACKEND_BASE_DN);
+ entryCountType = DirectoryServer.getAttributeTypeOrDefault(ATTR_MONITOR_BACKEND_ENTRY_COUNT);
+ baseDNEntryCountType = DirectoryServer.getAttributeTypeOrDefault(ATTR_MONITOR_BASE_DN_ENTRY_COUNT);
+ isPrivateType = DirectoryServer.getAttributeTypeOrDefault(ATTR_MONITOR_BACKEND_IS_PRIVATE);
+ writabilityModeType = DirectoryServer.getAttributeTypeOrDefault(ATTR_MONITOR_BACKEND_WRITABILITY_MODE);
}
@Override
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/monitors/ConnectionHandlerMonitor.java b/opendj-server-legacy/src/main/java/org/opends/server/monitors/ConnectionHandlerMonitor.java
index d976965..097f822 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/monitors/ConnectionHandlerMonitor.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/monitors/ConnectionHandlerMonitor.java
@@ -36,6 +36,7 @@
import org.opends.server.api.ClientConnection;
import org.opends.server.api.ConnectionHandler;
import org.opends.server.api.MonitorProvider;
+import org.opends.server.core.DirectoryServer;
import org.opends.server.types.*;
/**
@@ -94,25 +95,11 @@
{
monitorName = connectionHandler.getConnectionHandlerName();
- connectionsType =
- DirectoryConfig.getAttributeType(ATTR_MONITOR_CONNHANDLER_CONNECTION,
- true);
-
- listenerType =
- DirectoryConfig.getAttributeType(ATTR_MONITOR_CONNHANDLER_LISTENER,
- true);
-
- numConnectionsType =
- DirectoryConfig.getAttributeType(
- ATTR_MONITOR_CONNHANDLER_NUMCONNECTIONS, true);
-
- protocolType =
- DirectoryConfig.getAttributeType(ATTR_MONITOR_CONNHANDLER_PROTOCOL,
- true);
-
- configDnType =
- DirectoryConfig.getAttributeType(ATTR_MONITOR_CONFIG_DN,
- true);
+ connectionsType = DirectoryServer.getAttributeTypeOrDefault(ATTR_MONITOR_CONNHANDLER_CONNECTION);
+ listenerType = DirectoryServer.getAttributeTypeOrDefault(ATTR_MONITOR_CONNHANDLER_LISTENER);
+ numConnectionsType = DirectoryServer.getAttributeTypeOrDefault(ATTR_MONITOR_CONNHANDLER_NUMCONNECTIONS);
+ protocolType = DirectoryServer.getAttributeTypeOrDefault(ATTR_MONITOR_CONNHANDLER_PROTOCOL);
+ configDnType = DirectoryServer.getAttributeTypeOrDefault(ATTR_MONITOR_CONFIG_DN);
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/plugins/EntryUUIDPlugin.java b/opendj-server-legacy/src/main/java/org/opends/server/plugins/EntryUUIDPlugin.java
index f6f102b..b5b9d5f 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/plugins/EntryUUIDPlugin.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/plugins/EntryUUIDPlugin.java
@@ -45,6 +45,7 @@
import org.opends.server.api.plugin.DirectoryServerPlugin;
import org.opends.server.api.plugin.PluginResult;
import org.opends.server.api.plugin.PluginType;
+import org.opends.server.core.DirectoryServer;
import org.opends.server.types.*;
import org.opends.server.types.operation.PreOperationAddOperation;
@@ -89,7 +90,7 @@
// Get the entryUUID attribute type. This needs to be done in the
// constructor in order to make the associated variables "final".
- AttributeType at = DirectoryConfig.getAttributeType(ENTRYUUID, false);
+ AttributeType at = DirectoryServer.getAttributeType(ENTRYUUID);
if (at == null)
{
String definition =
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/plugins/LastModPlugin.java b/opendj-server-legacy/src/main/java/org/opends/server/plugins/LastModPlugin.java
index a5924d9..017d662 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/plugins/LastModPlugin.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/plugins/LastModPlugin.java
@@ -42,6 +42,7 @@
import org.opends.server.api.plugin.DirectoryServerPlugin;
import org.opends.server.api.plugin.PluginResult;
import org.opends.server.api.plugin.PluginType;
+import org.opends.server.core.DirectoryServer;
import org.opends.server.types.*;
import org.opends.server.types.operation.PreOperationAddOperation;
import org.opends.server.types.operation.PreOperationModifyDNOperation;
@@ -87,16 +88,11 @@
// Get the attribute types for the attributes that we will use. This needs
- // to be done in the constructor in order to make the associated variables
- // "final".
- createTimestampType =
- DirectoryConfig.getAttributeType(OP_ATTR_CREATE_TIMESTAMP_LC, true);
- creatorsNameType =
- DirectoryConfig.getAttributeType(OP_ATTR_CREATORS_NAME_LC, true);
- modifiersNameType =
- DirectoryConfig.getAttributeType(OP_ATTR_MODIFIERS_NAME_LC, true);
- modifyTimestampType =
- DirectoryConfig.getAttributeType(OP_ATTR_MODIFY_TIMESTAMP_LC, true);
+ // to be done in the constructor in order to make the associated variables "final".
+ createTimestampType = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_CREATE_TIMESTAMP_LC);
+ creatorsNameType = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_CREATORS_NAME_LC);
+ modifiersNameType = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_MODIFIERS_NAME_LC);
+ modifyTimestampType = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_MODIFY_TIMESTAMP_LC);
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/plugins/PasswordPolicyImportPlugin.java b/opendj-server-legacy/src/main/java/org/opends/server/plugins/PasswordPolicyImportPlugin.java
index 5e2ea65..b7140ad 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/plugins/PasswordPolicyImportPlugin.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/plugins/PasswordPolicyImportPlugin.java
@@ -126,7 +126,7 @@
configuration.addPasswordPolicyImportChangeListener(this);
customPolicyAttribute =
- DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_POLICY_DN, true);
+ DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_POLICY_DN);
// Make sure that the plugin has been enabled for the appropriate types.
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/protocols/internal/InternalClientConnection.java b/opendj-server-legacy/src/main/java/org/opends/server/protocols/internal/InternalClientConnection.java
index c411377..becc153 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/protocols/internal/InternalClientConnection.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/protocols/internal/InternalClientConnection.java
@@ -125,12 +125,9 @@
LinkedHashMap<AttributeType,List<Attribute>> userAttrs = new LinkedHashMap<>();
- AttributeType cnAT =
- DirectoryServer.getAttributeType(ATTR_COMMON_NAME, true);
- AttributeType snAT = DirectoryServer.getAttributeType(ATTR_SN, true);
- AttributeType altDNAT =
- DirectoryServer.getAttributeType(
- ATTR_ROOTDN_ALTERNATE_BIND_DN, true);
+ AttributeType cnAT = DirectoryServer.getAttributeTypeOrDefault(ATTR_COMMON_NAME);
+ AttributeType snAT = DirectoryServer.getAttributeTypeOrDefault(ATTR_SN);
+ AttributeType altDNAT = DirectoryServer.getAttributeTypeOrDefault(ATTR_ROOTDN_ALTERNATE_BIND_DN);
LinkedList<Attribute> attrList = new LinkedList<>();
attrList.add(Attributes.create(ATTR_COMMON_NAME, commonName));
@@ -147,9 +144,7 @@
LinkedHashMap<AttributeType,List<Attribute>> operationalAttrs = new LinkedHashMap<>();
- AttributeType privType =
- DirectoryServer.getAttributeType(OP_ATTR_PRIVILEGE_NAME, true);
-
+ AttributeType privType = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PRIVILEGE_NAME);
AttributeBuilder builder = new AttributeBuilder(privType);
for (Privilege p : Privilege.getDefaultRootPrivileges())
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPFilter.java b/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPFilter.java
index 99188db..8dcc73f 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPFilter.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPFilter.java
@@ -1910,7 +1910,7 @@
if (semicolonPos > 0)
{
String baseName = attributeType.substring(0, semicolonPos);
- attrType = DirectoryServer.getAttributeType(toLowerCase(baseName), baseName);
+ attrType = DirectoryServer.getAttributeTypeOrDefault(toLowerCase(baseName), baseName);
options = new HashSet<>();
StringTokenizer tokenizer =
new StringTokenizer(attributeType.substring(semicolonPos+1), ";");
@@ -1922,7 +1922,7 @@
else
{
options = null;
- attrType = DirectoryServer.getAttributeType(toLowerCase(attributeType), attributeType);
+ attrType = DirectoryServer.getAttributeTypeOrDefault(toLowerCase(attributeType), attributeType);
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/HistoricalAttributeValue.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/HistoricalAttributeValue.java
index 2adc7e7..94dc7d8 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/HistoricalAttributeValue.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/HistoricalAttributeValue.java
@@ -117,7 +117,7 @@
{
// This HistVal was used to store the date when some
// modifications were done to the entries.
- attrType = DirectoryServer.getAttributeType(attrString, true);
+ attrType = DirectoryServer.getAttributeTypeOrDefault(attrString);
}
else
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java
index 04a084b..203e218 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java
@@ -2177,8 +2177,7 @@
conn, nextOperationID(), nextMessageID(), new ArrayList<Control>(0),
targetDN, newRDN, false, parentDN);
- AttributeType attrType =
- DirectoryServer.getAttributeType(DS_SYNC_CONFLICT, true);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(DS_SYNC_CONFLICT);
if (markConflict)
{
Attribute attr =
@@ -3003,7 +3002,7 @@
private void markConflictEntry(Operation op, DN currentDN, DN conflictDN)
{
// create new internal modify operation and run it.
- AttributeType attrType = DirectoryServer.getAttributeType(DS_SYNC_CONFLICT, true);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(DS_SYNC_CONFLICT);
Attribute attr = Attributes.create(attrType, conflictDN.toString());
List<Modification> mods = newArrayList(new Modification(ModificationType.REPLACE, attr));
@@ -3429,7 +3428,7 @@
Set<AttributeType> includeAttributes = new HashSet<>();
for (String attrName : includeAttributeStrings)
{
- includeAttributes.add(DirectoryServer.getAttributeType(attrName, true));
+ includeAttributes.add(DirectoryServer.getAttributeTypeOrDefault(attrName));
}
exportConfig.setIncludeAttributes(includeAttributes);
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/server/ReplicationServer.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/server/ReplicationServer.java
index 2b2617b..d11d16b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/server/ReplicationServer.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/server/ReplicationServer.java
@@ -560,9 +560,7 @@
// create a rule and register it into the DirectoryServer
provider.initializeVirtualAttributeProvider(null);
- AttributeType attributeType = DirectoryServer.getAttributeType(
- attrName, false);
-
+ AttributeType attributeType = DirectoryServer.getAttributeType(attrName);
return new VirtualAttributeRule(attributeType, provider,
baseDNs, SearchScope.BASE_OBJECT,
groupDNs, filters, conflictBehavior);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tasks/AddSchemaFileTask.java b/opendj-server-legacy/src/main/java/org/opends/server/tasks/AddSchemaFileTask.java
index b5a4880..5b8d02c 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tasks/AddSchemaFileTask.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tasks/AddSchemaFileTask.java
@@ -93,8 +93,7 @@
// Get the attribute that specifies which schema file(s) to add.
Entry taskEntry = getTaskEntry();
- AttributeType attrType = DirectoryServer.getAttributeType(
- ATTR_TASK_ADDSCHEMAFILE_FILENAME, true);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(ATTR_TASK_ADDSCHEMAFILE_FILENAME);
List<Attribute> attrList = taskEntry.getAttribute(attrType);
if ((attrList == null) || attrList.isEmpty())
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tasks/BackupTask.java b/opendj-server-legacy/src/main/java/org/opends/server/tasks/BackupTask.java
index 7ff7bfd..3d7680d 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tasks/BackupTask.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tasks/BackupTask.java
@@ -149,38 +149,16 @@
Entry taskEntry = getTaskEntry();
- AttributeType typeBackupAll;
- AttributeType typeCompress;
- AttributeType typeEncrypt;
- AttributeType typeHash;
- AttributeType typeIncremental;
- AttributeType typeSignHash;
- AttributeType typeBackendID;
- AttributeType typeBackupID;
- AttributeType typeBackupDirectory;
- AttributeType typeIncrementalBaseID;
-
-
- typeBackupAll =
- getAttributeType(ATTR_TASK_BACKUP_ALL, true);
- typeCompress =
- getAttributeType(ATTR_TASK_BACKUP_COMPRESS, true);
- typeEncrypt =
- getAttributeType(ATTR_TASK_BACKUP_ENCRYPT, true);
- typeHash =
- getAttributeType(ATTR_TASK_BACKUP_HASH, true);
- typeIncremental =
- getAttributeType(ATTR_TASK_BACKUP_INCREMENTAL, true);
- typeSignHash =
- getAttributeType(ATTR_TASK_BACKUP_SIGN_HASH, true);
- typeBackendID =
- getAttributeType(ATTR_TASK_BACKUP_BACKEND_ID, true);
- typeBackupID =
- getAttributeType(ATTR_BACKUP_ID, true);
- typeBackupDirectory =
- getAttributeType(ATTR_BACKUP_DIRECTORY_PATH, true);
- typeIncrementalBaseID =
- getAttributeType(ATTR_TASK_BACKUP_INCREMENTAL_BASE_ID, true);
+ AttributeType typeBackupAll = getAttributeTypeOrDefault(ATTR_TASK_BACKUP_ALL);
+ AttributeType typeCompress = getAttributeTypeOrDefault(ATTR_TASK_BACKUP_COMPRESS);
+ AttributeType typeEncrypt = getAttributeTypeOrDefault(ATTR_TASK_BACKUP_ENCRYPT);
+ AttributeType typeHash = getAttributeTypeOrDefault(ATTR_TASK_BACKUP_HASH);
+ AttributeType typeIncremental = getAttributeTypeOrDefault(ATTR_TASK_BACKUP_INCREMENTAL);
+ AttributeType typeSignHash = getAttributeTypeOrDefault(ATTR_TASK_BACKUP_SIGN_HASH);
+ AttributeType typeBackendID = getAttributeTypeOrDefault(ATTR_TASK_BACKUP_BACKEND_ID);
+ AttributeType typeBackupID = getAttributeTypeOrDefault(ATTR_BACKUP_ID);
+ AttributeType typeBackupDirectory = getAttributeTypeOrDefault(ATTR_BACKUP_DIRECTORY_PATH);
+ AttributeType typeIncrementalBaseID = getAttributeTypeOrDefault(ATTR_TASK_BACKUP_INCREMENTAL_BASE_ID);
List<Attribute> attrList;
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tasks/DisconnectClientTask.java b/opendj-server-legacy/src/main/java/org/opends/server/tasks/DisconnectClientTask.java
index d26ddcb..7aeee51 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tasks/DisconnectClientTask.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tasks/DisconnectClientTask.java
@@ -105,7 +105,7 @@
private long getConnectionID(Entry taskEntry) throws DirectoryException
{
- final AttributeType attrType = DirectoryServer.getAttributeType(ATTR_TASK_DISCONNECT_CONN_ID, true);
+ final AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(ATTR_TASK_DISCONNECT_CONN_ID);
final List<Attribute> attrList = taskEntry.getAttribute(attrType);
if (attrList != null)
{
@@ -130,7 +130,7 @@
private boolean mustNotifyClient(Entry taskEntry) throws DirectoryException
{
- final AttributeType attrType = DirectoryServer.getAttributeType(ATTR_TASK_DISCONNECT_NOTIFY_CLIENT, true);
+ final AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(ATTR_TASK_DISCONNECT_NOTIFY_CLIENT);
final List<Attribute> attrList = taskEntry.getAttribute(attrType);
if (attrList != null)
{
@@ -160,7 +160,7 @@
private LocalizableMessage getDisconnectMessage(Entry taskEntry)
{
- AttributeType attrType = DirectoryServer.getAttributeType(ATTR_TASK_DISCONNECT_MESSAGE, true);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(ATTR_TASK_DISCONNECT_MESSAGE);
List<Attribute> attrList = taskEntry.getAttribute(attrType);
if (attrList != null)
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tasks/ExportTask.java b/opendj-server-legacy/src/main/java/org/opends/server/tasks/ExportTask.java
index 8e16b23..4413a0e 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tasks/ExportTask.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tasks/ExportTask.java
@@ -140,7 +140,7 @@
Entry taskEntry = getTaskEntry();
- AttributeType typeWrapColumn = getAttributeType(ATTR_TASK_EXPORT_WRAP_COLUMN, true);
+ AttributeType typeWrapColumn = getAttributeTypeOrDefault(ATTR_TASK_EXPORT_WRAP_COLUMN);
ldifFile = toString(taskEntry, ATTR_TASK_EXPORT_LDIF_FILE);
File f = new File (ldifFile);
@@ -177,21 +177,21 @@
private boolean toBoolean(Entry entry, boolean defaultValue, String attrName)
{
- final AttributeType attrType = getAttributeType(attrName, true);
+ final AttributeType attrType = getAttributeTypeOrDefault(attrName);
final List<Attribute> attrs = entry.getAttribute(attrType);
return TaskUtils.getBoolean(attrs, defaultValue);
}
private ArrayList<String> toListOfString(Entry entry, String attrName)
{
- final AttributeType attrType = getAttributeType(attrName, true);
+ final AttributeType attrType = getAttributeTypeOrDefault(attrName);
final List<Attribute> attrs = entry.getAttribute(attrType);
return TaskUtils.getMultiValueString(attrs);
}
private String toString(Entry entry, String attrName)
{
- final AttributeType attrType = getAttributeType(attrName, true);
+ final AttributeType attrType = getAttributeTypeOrDefault(attrName);
final List<Attribute> attrs = entry.getAttribute(attrType);
return TaskUtils.getSingleValueString(attrs);
}
@@ -492,7 +492,7 @@
HashSet<AttributeType> attributes = new HashSet<>();
for (String attrName : attributeStrings)
{
- attributes.add(DirectoryServer.getAttributeType(attrName.toLowerCase(), attrName));
+ attributes.add(DirectoryServer.getAttributeTypeOrDefault(attrName.toLowerCase(), attrName));
}
return attributes;
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tasks/ImportTask.java b/opendj-server-legacy/src/main/java/org/opends/server/tasks/ImportTask.java
index a51574c..a671060 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tasks/ImportTask.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tasks/ImportTask.java
@@ -154,28 +154,28 @@
Entry taskEntry = getTaskEntry();
- AttributeType typeLdifFile = getAttributeType(ATTR_IMPORT_LDIF_FILE, true);
- AttributeType typeTemplateFile = getAttributeType(ATTR_IMPORT_TEMPLATE_FILE, true);
- AttributeType typeAppend = getAttributeType(ATTR_IMPORT_APPEND, true);
- AttributeType typeReplaceExisting = getAttributeType(ATTR_IMPORT_REPLACE_EXISTING, true);
- AttributeType typeBackendID = getAttributeType(ATTR_IMPORT_BACKEND_ID, true);
- AttributeType typeIncludeBranch = getAttributeType(ATTR_IMPORT_INCLUDE_BRANCH, true);
- AttributeType typeExcludeBranch = getAttributeType(ATTR_IMPORT_EXCLUDE_BRANCH, true);
- AttributeType typeIncludeAttribute = getAttributeType(ATTR_IMPORT_INCLUDE_ATTRIBUTE, true);
- AttributeType typeExcludeAttribute = getAttributeType(ATTR_IMPORT_EXCLUDE_ATTRIBUTE, true);
- AttributeType typeIncludeFilter = getAttributeType(ATTR_IMPORT_INCLUDE_FILTER, true);
- AttributeType typeExcludeFilter = getAttributeType(ATTR_IMPORT_EXCLUDE_FILTER, true);
- AttributeType typeRejectFile = getAttributeType(ATTR_IMPORT_REJECT_FILE, true);
- AttributeType typeSkipFile = getAttributeType(ATTR_IMPORT_SKIP_FILE, true);
- AttributeType typeOverwrite = getAttributeType(ATTR_IMPORT_OVERWRITE, true);
- AttributeType typeSkipSchemaValidation = getAttributeType(ATTR_IMPORT_SKIP_SCHEMA_VALIDATION, true);
- AttributeType typeIsCompressed = getAttributeType(ATTR_IMPORT_IS_COMPRESSED, true);
- AttributeType typeIsEncrypted = getAttributeType(ATTR_IMPORT_IS_ENCRYPTED, true);
- AttributeType typeClearBackend = getAttributeType(ATTR_IMPORT_CLEAR_BACKEND, true);
- AttributeType typeRandomSeed = getAttributeType(ATTR_IMPORT_RANDOM_SEED, true);
- AttributeType typeThreadCount = getAttributeType(ATTR_IMPORT_THREAD_COUNT, true);
- AttributeType typeTmpDirectory = getAttributeType(ATTR_IMPORT_TMP_DIRECTORY, true);
- AttributeType typeDNCheckPhase2 = getAttributeType(ATTR_IMPORT_SKIP_DN_VALIDATION, true);
+ AttributeType typeLdifFile = getAttributeTypeOrDefault(ATTR_IMPORT_LDIF_FILE);
+ AttributeType typeTemplateFile = getAttributeTypeOrDefault(ATTR_IMPORT_TEMPLATE_FILE);
+ AttributeType typeAppend = getAttributeTypeOrDefault(ATTR_IMPORT_APPEND);
+ AttributeType typeReplaceExisting = getAttributeTypeOrDefault(ATTR_IMPORT_REPLACE_EXISTING);
+ AttributeType typeBackendID = getAttributeTypeOrDefault(ATTR_IMPORT_BACKEND_ID);
+ AttributeType typeIncludeBranch = getAttributeTypeOrDefault(ATTR_IMPORT_INCLUDE_BRANCH);
+ AttributeType typeExcludeBranch = getAttributeTypeOrDefault(ATTR_IMPORT_EXCLUDE_BRANCH);
+ AttributeType typeIncludeAttribute = getAttributeTypeOrDefault(ATTR_IMPORT_INCLUDE_ATTRIBUTE);
+ AttributeType typeExcludeAttribute = getAttributeTypeOrDefault(ATTR_IMPORT_EXCLUDE_ATTRIBUTE);
+ AttributeType typeIncludeFilter = getAttributeTypeOrDefault(ATTR_IMPORT_INCLUDE_FILTER);
+ AttributeType typeExcludeFilter = getAttributeTypeOrDefault(ATTR_IMPORT_EXCLUDE_FILTER);
+ AttributeType typeRejectFile = getAttributeTypeOrDefault(ATTR_IMPORT_REJECT_FILE);
+ AttributeType typeSkipFile = getAttributeTypeOrDefault(ATTR_IMPORT_SKIP_FILE);
+ AttributeType typeOverwrite = getAttributeTypeOrDefault(ATTR_IMPORT_OVERWRITE);
+ AttributeType typeSkipSchemaValidation = getAttributeTypeOrDefault(ATTR_IMPORT_SKIP_SCHEMA_VALIDATION);
+ AttributeType typeIsCompressed = getAttributeTypeOrDefault(ATTR_IMPORT_IS_COMPRESSED);
+ AttributeType typeIsEncrypted = getAttributeTypeOrDefault(ATTR_IMPORT_IS_ENCRYPTED);
+ AttributeType typeClearBackend = getAttributeTypeOrDefault(ATTR_IMPORT_CLEAR_BACKEND);
+ AttributeType typeRandomSeed = getAttributeTypeOrDefault(ATTR_IMPORT_RANDOM_SEED);
+ AttributeType typeThreadCount = getAttributeTypeOrDefault(ATTR_IMPORT_THREAD_COUNT);
+ AttributeType typeTmpDirectory = getAttributeTypeOrDefault(ATTR_IMPORT_TMP_DIRECTORY);
+ AttributeType typeDNCheckPhase2 = getAttributeTypeOrDefault(ATTR_IMPORT_SKIP_DN_VALIDATION);
ArrayList<String> ldifFilestmp = asListOfStrings(taskEntry, typeLdifFile);
ldifFiles = new ArrayList<>(ldifFilestmp.size());
@@ -834,7 +834,7 @@
final HashSet<AttributeType> attrTypes = new HashSet<>(attrNames.size());
for (String attrName : attrNames)
{
- attrTypes.add(DirectoryServer.getAttributeType(attrName.toLowerCase(), attrName));
+ attrTypes.add(DirectoryServer.getAttributeTypeOrDefault(attrName.toLowerCase(), attrName));
}
return attrTypes;
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tasks/InitializeTargetTask.java b/opendj-server-legacy/src/main/java/org/opends/server/tasks/InitializeTargetTask.java
index adfbbab..9e7e163 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tasks/InitializeTargetTask.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tasks/InitializeTargetTask.java
@@ -79,8 +79,8 @@
// FIXME -- Do we need any special authorization here?
Entry taskEntry = getTaskEntry();
- AttributeType typeDomainBase = getAttributeType(ATTR_TASK_INITIALIZE_TARGET_DOMAIN_DN, true);
- AttributeType typeScope = getAttributeType(ATTR_TASK_INITIALIZE_TARGET_SCOPE, true);
+ AttributeType typeDomainBase = getAttributeTypeOrDefault(ATTR_TASK_INITIALIZE_TARGET_DOMAIN_DN);
+ AttributeType typeScope = getAttributeTypeOrDefault(ATTR_TASK_INITIALIZE_TARGET_SCOPE);
List<Attribute> attrList = taskEntry.getAttribute(typeDomainBase);
domainString = TaskUtils.getSingleValueString(attrList);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tasks/InitializeTask.java b/opendj-server-legacy/src/main/java/org/opends/server/tasks/InitializeTask.java
index d0bc05d..0fb0245 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tasks/InitializeTask.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tasks/InitializeTask.java
@@ -82,13 +82,8 @@
// FIXME -- Do we need any special authorization here?
Entry taskEntry = getTaskEntry();
- AttributeType typeDomainBase;
- AttributeType typeSourceScope;
-
- typeDomainBase =
- getAttributeType(ATTR_TASK_INITIALIZE_DOMAIN_DN, true);
- typeSourceScope =
- getAttributeType(ATTR_TASK_INITIALIZE_SOURCE, true);
+ AttributeType typeDomainBase = getAttributeTypeOrDefault(ATTR_TASK_INITIALIZE_DOMAIN_DN);
+ AttributeType typeSourceScope = getAttributeTypeOrDefault(ATTR_TASK_INITIALIZE_SOURCE);
List<Attribute> attrList;
attrList = taskEntry.getAttribute(typeDomainBase);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tasks/PurgeConflictsHistoricalTask.java b/opendj-server-legacy/src/main/java/org/opends/server/tasks/PurgeConflictsHistoricalTask.java
index 9bc4aa0..6189809 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tasks/PurgeConflictsHistoricalTask.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tasks/PurgeConflictsHistoricalTask.java
@@ -103,7 +103,7 @@
// FIXME -- Do we need any special authorization here?
Entry taskEntry = getTaskEntry();
- AttributeType typeDomainBase = getAttributeType(ATTR_TASK_CONFLICTS_HIST_PURGE_DOMAIN_DN, true);
+ AttributeType typeDomainBase = getAttributeTypeOrDefault(ATTR_TASK_CONFLICTS_HIST_PURGE_DOMAIN_DN);
List<Attribute> attrList = taskEntry.getAttribute(typeDomainBase);
domainString = TaskUtils.getSingleValueString(attrList);
@@ -121,7 +121,7 @@
throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, mb.toMessage());
}
- AttributeType typeMaxDuration = getAttributeType(ATTR_TASK_CONFLICTS_HIST_PURGE_MAX_DURATION, true);
+ AttributeType typeMaxDuration = getAttributeTypeOrDefault(ATTR_TASK_CONFLICTS_HIST_PURGE_MAX_DURATION);
attrList = taskEntry.getAttribute(typeMaxDuration);
String maxDurationStringInSec = TaskUtils.getSingleValueString(attrList);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tasks/RebuildTask.java b/opendj-server-legacy/src/main/java/org/opends/server/tasks/RebuildTask.java
index 6272ad8..26a3ee9 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tasks/RebuildTask.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tasks/RebuildTask.java
@@ -104,7 +104,7 @@
final String val = asString(taskEntry, ATTR_REBUILD_INDEX_CLEARDEGRADEDSTATE);
isClearDegradedState = Boolean.parseBoolean(val);
- AttributeType typeIndex = getAttributeType(ATTR_REBUILD_INDEX, true);
+ AttributeType typeIndex = getAttributeTypeOrDefault(ATTR_REBUILD_INDEX);
List<Attribute> attrList = taskEntry.getAttribute(typeIndex);
indexes = TaskUtils.getMultiValueString(attrList);
@@ -122,7 +122,7 @@
private String asString(Entry taskEntry, String attrName)
{
- final AttributeType attrType = getAttributeType(attrName, true);
+ final AttributeType attrType = getAttributeTypeOrDefault(attrName);
final List<Attribute> attrList = taskEntry.getAttribute(attrType);
return TaskUtils.getSingleValueString(attrList);
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tasks/RestoreTask.java b/opendj-server-legacy/src/main/java/org/opends/server/tasks/RestoreTask.java
index 78e9d16..ca17af6 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tasks/RestoreTask.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tasks/RestoreTask.java
@@ -120,14 +120,9 @@
Entry taskEntry = getTaskEntry();
- AttributeType typeBackupDirectory;
- AttributeType typebackupID;
- AttributeType typeVerifyOnly;
-
-
- typeBackupDirectory = getAttributeType(ATTR_BACKUP_DIRECTORY_PATH, true);
- typebackupID = getAttributeType(ATTR_BACKUP_ID, true);
- typeVerifyOnly = getAttributeType(ATTR_TASK_RESTORE_VERIFY_ONLY, true);
+ AttributeType typeBackupDirectory = getAttributeTypeOrDefault(ATTR_BACKUP_DIRECTORY_PATH);
+ AttributeType typebackupID = getAttributeTypeOrDefault(ATTR_BACKUP_ID);
+ AttributeType typeVerifyOnly = getAttributeTypeOrDefault(ATTR_TASK_RESTORE_VERIFY_ONLY);
List<Attribute> attrList;
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tasks/SetGenerationIdTask.java b/opendj-server-legacy/src/main/java/org/opends/server/tasks/SetGenerationIdTask.java
index d36960a..9e4ee3a 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tasks/SetGenerationIdTask.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tasks/SetGenerationIdTask.java
@@ -77,7 +77,7 @@
Entry taskEntry = getTaskEntry();
// Retrieves the eventual generation-ID
- AttributeType typeNewValue = getAttributeType(ATTR_TASK_SET_GENERATION_ID_NEW_VALUE, true);
+ AttributeType typeNewValue = getAttributeTypeOrDefault(ATTR_TASK_SET_GENERATION_ID_NEW_VALUE);
List<Attribute> attrList = taskEntry.getAttribute(typeNewValue);
if (attrList != null && !attrList.isEmpty())
{
@@ -95,7 +95,7 @@
}
// Retrieves the replication domain
- AttributeType typeDomainBase = getAttributeType(ATTR_TASK_SET_GENERATION_ID_DOMAIN_DN, true);
+ AttributeType typeDomainBase = getAttributeTypeOrDefault(ATTR_TASK_SET_GENERATION_ID_DOMAIN_DN);
attrList = taskEntry.getAttribute(typeDomainBase);
domainString = TaskUtils.getSingleValueString(attrList);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tasks/ShutdownTask.java b/opendj-server-legacy/src/main/java/org/opends/server/tasks/ShutdownTask.java
index 12e7cba..d3e30c6 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tasks/ShutdownTask.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tasks/ShutdownTask.java
@@ -94,8 +94,7 @@
restart = false;
shutdownMessage = INFO_TASK_SHUTDOWN_DEFAULT_MESSAGE.get(taskEntry.getName());
- AttributeType attrType =
- DirectoryServer.getAttributeType(ATTR_SHUTDOWN_MESSAGE, true);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(ATTR_SHUTDOWN_MESSAGE);
List<Attribute> attrList = taskEntry.getAttribute(attrType);
if (attrList != null && !attrList.isEmpty())
{
@@ -108,7 +107,7 @@
}
- attrType = DirectoryServer.getAttributeType(ATTR_RESTART_SERVER, true);
+ attrType = DirectoryServer.getAttributeTypeOrDefault(ATTR_RESTART_SERVER);
attrList = taskEntry.getAttribute(attrType);
if (attrList != null && !attrList.isEmpty())
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/ExportLDIF.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/ExportLDIF.java
index 103d16d..b986439 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/ExportLDIF.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/ExportLDIF.java
@@ -38,6 +38,7 @@
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
@@ -569,35 +570,8 @@
// See if there were any user-defined sets of include/exclude attributes or
// filters. If so, then process them.
- HashSet<AttributeType> excludeAttributes;
- if (excludeAttributeStrings == null)
- {
- excludeAttributes = null;
- }
- else
- {
- excludeAttributes = new HashSet<>();
- for (String attrName : excludeAttributeStrings.getValues())
- {
- excludeAttributes.add(
- DirectoryServer.getAttributeType(attrName.toLowerCase(), attrName));
- }
- }
-
- HashSet<AttributeType> includeAttributes;
- if (includeAttributeStrings == null)
- {
- includeAttributes = null;
- }
- else
- {
- includeAttributes = new HashSet<>();
- for (String attrName : includeAttributeStrings.getValues())
- {
- includeAttributes.add(
- DirectoryServer.getAttributeType(attrName.toLowerCase(), attrName));
- }
- }
+ Set<AttributeType> excludeAttributes = toAttributeTypes(excludeAttributeStrings);
+ Set<AttributeType> includeAttributes = toAttributeTypes(includeAttributeStrings);
ArrayList<SearchFilter> excludeFilters;
if (excludeFilterStrings == null)
@@ -866,14 +840,22 @@
// Clean up after the export by closing the export config.
exportConfig.close();
- if (!errorOccurred)
+ return !errorOccurred ? 0 : 1;
+ }
+
+ private Set<AttributeType> toAttributeTypes(StringArgument attributeArg)
+ {
+ if (attributeArg == null)
{
- return 0;
+ return null;
}
- else
+
+ Set<AttributeType> results = new HashSet<>();
+ for (String attrName : attributeArg.getValues())
{
- return 1;
+ results.add(DirectoryServer.getAttributeTypeOrDefault(attrName.toLowerCase(), attrName));
}
+ return results;
}
/** {@inheritDoc} */
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/ImportLDIF.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/ImportLDIF.java
index 3337d99..cebdfc2 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/ImportLDIF.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/ImportLDIF.java
@@ -772,7 +772,7 @@
}
else
{
- excludeAttributes.add(DirectoryServer.getAttributeType(lowerName, attrName));
+ excludeAttributes.add(DirectoryServer.getAttributeTypeOrDefault(lowerName, attrName));
}
}
}
@@ -800,7 +800,7 @@
}
else
{
- includeAttributes.add(DirectoryServer.getAttributeType(lowerName, attrName));
+ includeAttributes.add(DirectoryServer.getAttributeTypeOrDefault(lowerName, attrName));
}
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/LDIFSearch.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/LDIFSearch.java
index f370e47..960d203 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/LDIFSearch.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/LDIFSearch.java
@@ -492,7 +492,7 @@
LinkedHashSet<AttributeType> operationalAttributeTypes = new LinkedHashSet<>();
for (String attributeName : attributeNames)
{
- AttributeType t = DirectoryServer.getAttributeType(attributeName, true);
+ AttributeType t = DirectoryServer.getAttributeTypeOrDefault(attributeName);
if (t.isOperational())
{
operationalAttributeTypes.add(t);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/AttributeValueTag.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/AttributeValueTag.java
index 0786a7d..23c8555 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/AttributeValueTag.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/AttributeValueTag.java
@@ -121,7 +121,7 @@
}
String lowerName = toLowerCase(arguments[0]);
- attributeType = DirectoryServer.getAttributeType(lowerName, true);
+ attributeType = DirectoryServer.getAttributeTypeOrDefault(lowerName);
if (! branch.hasAttribute(attributeType))
{
LocalizableMessage message =
@@ -184,7 +184,7 @@
}
String lowerName = toLowerCase(arguments[0]);
- attributeType = DirectoryServer.getAttributeType(lowerName, true);
+ attributeType = DirectoryServer.getAttributeTypeOrDefault(lowerName);
if (! template.hasAttribute(attributeType))
{
LocalizableMessage message =
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/IfAbsentTag.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/IfAbsentTag.java
index b8f29b5..f3f84f9 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/IfAbsentTag.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/IfAbsentTag.java
@@ -121,7 +121,7 @@
}
String lowerName = toLowerCase(arguments[0]);
- AttributeType t = DirectoryServer.getAttributeType(lowerName, true);
+ AttributeType t = DirectoryServer.getAttributeTypeOrDefault(lowerName);
if (! branch.hasAttribute(t))
{
LocalizableMessage message =
@@ -169,7 +169,7 @@
}
String lowerName = toLowerCase(arguments[0]);
- attributeType = DirectoryServer.getAttributeType(lowerName, true);
+ attributeType = DirectoryServer.getAttributeTypeOrDefault(lowerName);
if (! template.hasAttribute(attributeType))
{
LocalizableMessage message =
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/IfPresentTag.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/IfPresentTag.java
index 1ed57b4..a51fd80 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/IfPresentTag.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/IfPresentTag.java
@@ -121,7 +121,7 @@
}
String lowerName = toLowerCase(arguments[0]);
- AttributeType t = DirectoryServer.getAttributeType(lowerName, true);
+ AttributeType t = DirectoryServer.getAttributeTypeOrDefault(lowerName);
if (! branch.hasAttribute(t))
{
LocalizableMessage message =
@@ -169,7 +169,7 @@
}
String lowerName = toLowerCase(arguments[0]);
- attributeType = DirectoryServer.getAttributeType(lowerName, true);
+ attributeType = DirectoryServer.getAttributeTypeOrDefault(lowerName);
if (! template.hasAttribute(attributeType))
{
LocalizableMessage message =
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/TemplateFile.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/TemplateFile.java
index 6fc7a50..cec1464 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/TemplateFile.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/TemplateFile.java
@@ -1082,8 +1082,7 @@
StringTokenizer tokenizer = new StringTokenizer(rdnAttrNames, "+");
while (tokenizer.hasMoreTokens())
{
- attrList.add(DirectoryServer.getAttributeType(tokenizer.nextToken(),
- true));
+ attrList.add(DirectoryServer.getAttributeTypeOrDefault(tokenizer.nextToken()));
}
rdnAttributes = new AttributeType[attrList.size()];
@@ -1253,10 +1252,7 @@
}
}
- AttributeType attributeType =
- DirectoryServer.getAttributeType(lowerLine.substring(0, colonPos),
- true);
-
+ AttributeType attributeType = DirectoryServer.getAttributeTypeOrDefault(lowerLine.substring(0, colonPos));
// First, check whether the value is an URL value: <attrName>:< <url>
int length = line.length();
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/AttributeBuilder.java b/opendj-server-legacy/src/main/java/org/opends/server/types/AttributeBuilder.java
index d321a03..101dee7 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/AttributeBuilder.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/AttributeBuilder.java
@@ -1020,7 +1020,7 @@
*/
private static AttributeType getAttributeType(String attributeName)
{
- return DirectoryServer.getAttributeType(toLowerCase(attributeName), attributeName);
+ return DirectoryServer.getAttributeTypeOrDefault(toLowerCase(attributeName), attributeName);
}
/** The attribute type for this attribute. */
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/Attributes.java b/opendj-server-legacy/src/main/java/org/opends/server/types/Attributes.java
index d66696d..b5344b9 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/Attributes.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/Attributes.java
@@ -185,8 +185,7 @@
public static Attribute create(String attributeName,
String valueString)
{
- return create(getAttributeType(attributeName), attributeName,
- valueString);
+ return create(getAttributeType(attributeName), attributeName, valueString);
}
/**
@@ -411,16 +410,14 @@
}
/**
- * Gets the named attribute type, creating a default attribute if
- * necessary.
+ * Gets the named attribute type, creating a default attribute if necessary.
*
* @param attributeName
* The name of the attribute type.
- * @return The attribute type associated with the provided attribute
- * name.
+ * @return The attribute type associated with the provided attribute name.
*/
private static AttributeType getAttributeType(String attributeName)
{
- return DirectoryServer.getAttributeType(toLowerCase(attributeName), attributeName);
+ return DirectoryServer.getAttributeTypeOrDefault(toLowerCase(attributeName), attributeName);
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/DirectoryConfig.java b/opendj-server-legacy/src/main/java/org/opends/server/types/DirectoryConfig.java
index bc4c34d..b4349e7 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/DirectoryConfig.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/DirectoryConfig.java
@@ -33,12 +33,12 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.ResultCode;
-import org.opends.server.api.AlertGenerator;
+import org.forgerock.opendj.ldap.schema.MatchingRule;
import org.forgerock.opendj.ldap.schema.Syntax;
+import org.opends.server.api.AlertGenerator;
import org.opends.server.api.ConfigHandler;
import org.opends.server.api.ExtendedOperationHandler;
import org.opends.server.api.InvokableComponent;
-import org.forgerock.opendj.ldap.schema.MatchingRule;
import org.opends.server.api.SASLMechanismHandler;
import org.opends.server.api.ServerShutdownListener;
import org.opends.server.config.ConfigEntry;
@@ -359,32 +359,6 @@
return DirectoryServer.getAttributeTypes();
}
-
-
- /**
- * Retrieves the attribute type for the provided lowercase name or
- * OID. It can optionally return a generated "default" version 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 returnDefault Indicates whether to generate a default
- * version if the requested attribute type is
- * not defined in the server schema.
- *
- * @return The requested attribute type, or <CODE>null</CODE> if
- * there is no attribute with the specified type defined in
- * the server schema and a default type should not be
- * returned.
- */
- public static AttributeType
- getAttributeType(String lowerName, boolean returnDefault)
- {
- return DirectoryServer.getAttributeType(lowerName, returnDefault);
- }
-
-
-
/**
* Retrieves the attribute type for the "objectClass" attribute.
*
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/Schema.java b/opendj-server-legacy/src/main/java/org/opends/server/types/Schema.java
index 8cb53e9..ead7891 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/Schema.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/Schema.java
@@ -2474,9 +2474,6 @@
AttributeType elementType,
List<Modification> mods)
{
- AttributeType attributeTypesType =
- DirectoryServer.getAttributeType(ATTR_ATTRIBUTE_TYPES_LC, true);
-
AttributeBuilder builder = new AttributeBuilder(elementType);
for (String s : oldElements)
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/SubEntry.java b/opendj-server-legacy/src/main/java/org/opends/server/types/SubEntry.java
index df082a8..185d075 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/SubEntry.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/SubEntry.java
@@ -189,10 +189,8 @@
this.subTreeSpec = null;
String specString = null;
boolean isValidSpec = true;
- AttributeType specAttrType = DirectoryServer.getAttributeType(
- ATTR_SUBTREE_SPEC_LC, true);
- List<Attribute> specAttrList =
- entry.getAttribute(specAttrType);
+ AttributeType specAttrType = DirectoryServer.getAttributeTypeOrDefault(ATTR_SUBTREE_SPEC_LC);
+ List<Attribute> specAttrList = entry.getAttribute(specAttrType);
if (specAttrList != null)
{
for (Attribute attr : specAttrList)
@@ -298,10 +296,7 @@
{
for (ByteString value : attr)
{
- this.inheritFromDNType =
- DirectoryServer.getAttributeType(
- value.toString().toLowerCase(),
- true);
+ this.inheritFromDNType = DirectoryServer.getAttributeTypeOrDefault(value.toString().toLowerCase());
this.inheritFromDNAttrValue = value;
break;
}
@@ -311,41 +306,32 @@
if (this.isInheritedFromRDNCollective)
{
- List<Attribute> attrList = entry.getAttribute(
- ATTR_INHERIT_COLLECTIVE_FROM_RDN);
+ List<Attribute> attrList = entry.getAttribute(ATTR_INHERIT_COLLECTIVE_FROM_RDN);
if ((attrList != null) && !attrList.isEmpty())
{
for (Attribute attr : attrList)
{
for (ByteString value : attr)
{
- this.inheritFromRDNAttrType =
- DirectoryServer.getAttributeType(
- value.toString().toLowerCase(),
- true);
+ this.inheritFromRDNAttrType = DirectoryServer.getAttributeTypeOrDefault(value.toString().toLowerCase());
this.inheritFromRDNAttrValue = value;
break;
}
}
}
- attrList = entry.getAttribute(
- ATTR_INHERIT_COLLECTIVE_FROM_RDN_TYPE);
+ attrList = entry.getAttribute(ATTR_INHERIT_COLLECTIVE_FROM_RDN_TYPE);
if ((attrList != null) && !attrList.isEmpty())
{
for (Attribute attr : attrList)
{
for (ByteString value : attr)
{
- this.inheritFromRDNType =
- DirectoryServer.getAttributeType(
- value.toString().toLowerCase(),
- true);
+ this.inheritFromRDNType = DirectoryServer.getAttributeTypeOrDefault(value.toString().toLowerCase());
break;
}
}
}
- attrList = entry.getAttribute(
- ATTR_INHERIT_COLLECTIVE_FROM_BASE);
+ attrList = entry.getAttribute(ATTR_INHERIT_COLLECTIVE_FROM_BASE);
if ((attrList != null) && !attrList.isEmpty())
{
for (Attribute attr : attrList)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/util/LDIFReader.java b/opendj-server-legacy/src/main/java/org/opends/server/util/LDIFReader.java
index bd491ec..0f2d16c 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/util/LDIFReader.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/util/LDIFReader.java
@@ -839,7 +839,7 @@
}
else
{
- AttributeType attrType = DirectoryServer.getAttributeType(lowerName, attrName);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(lowerName, attrName);
if (! importConfig.includeAttribute(attrType))
{
if (logger.isTraceEnabled())
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendAddOperation.java b/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendAddOperation.java
index da661f9..c6c8474 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendAddOperation.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendAddOperation.java
@@ -380,13 +380,11 @@
// Check to see if the entry includes a privilege specification. If so,
// then the requester must have the PRIVILEGE_CHANGE privilege.
- AttributeType privType =
- DirectoryServer.getAttributeType(OP_ATTR_PRIVILEGE_NAME, true);
+ AttributeType privType = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PRIVILEGE_NAME);
if (entry.hasAttribute(privType)
&& !clientConnection.hasPrivilege(Privilege.PRIVILEGE_CHANGE, this))
{
- appendErrorMessage(ERR_ADD_CHANGE_PRIVILEGE_INSUFFICIENT_PRIVILEGES
- .get());
+ appendErrorMessage(ERR_ADD_CHANGE_PRIVILEGE_INSUFFICIENT_PRIVILEGES.get());
setResultCode(ResultCode.INSUFFICIENT_ACCESS_RIGHTS);
return;
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendBindOperation.java b/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendBindOperation.java
index 724d8a1..eb50bb4 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendBindOperation.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendBindOperation.java
@@ -1127,8 +1127,7 @@
Arg1<Object> nonUniqueAttributeMessage,
Arg2<Object, Object> cannotProcessAttributeMessage)
{
- AttributeType attrType =
- DirectoryServer.getAttributeType(attributeTypeName, true);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attributeTypeName);
List<Attribute> attrList = userEntry.getAttribute(attrType);
if ((attrList != null) && (attrList.size() == 1))
{
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/authorization/dseecompat/TargetAttrTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/authorization/dseecompat/TargetAttrTestCase.java
index ecec7dd..27d6ddf 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/authorization/dseecompat/TargetAttrTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/authorization/dseecompat/TargetAttrTestCase.java
@@ -412,7 +412,7 @@
{
EnumTargetOperator op = EnumTargetOperator.createOperator(eqOperator);
TargetAttr targetAttr = TargetAttr.decode(op, targetAttrString);
- AttributeType attrType = DirectoryServer.getAttributeType(attribute, true);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attribute);
assertEquals(TargetAttr.isApplicable(attrType, targetAttr), expectedResult);
}
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/backends/SchemaBackendTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/backends/SchemaBackendTestCase.java
index 4b0c6e2..6f61778 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/backends/SchemaBackendTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/backends/SchemaBackendTestCase.java
@@ -4569,14 +4569,10 @@
Entry schemaEntry = DirectoryServer.getEntry(DN.valueOf("cn=schema"));
assertNotNull(schemaEntry);
- AttributeType cnType =
- DirectoryServer.getAttributeType("creatorsname", true);
- AttributeType ctType =
- DirectoryServer.getAttributeType("createtimestamp", true);
- AttributeType mnType =
- DirectoryServer.getAttributeType("modifiersname", true);
- AttributeType mtType =
- DirectoryServer.getAttributeType("modifytimestamp", true);
+ AttributeType cnType = DirectoryServer.getAttributeTypeOrDefault("creatorsname");
+ AttributeType ctType = DirectoryServer.getAttributeTypeOrDefault("createtimestamp");
+ AttributeType mnType = DirectoryServer.getAttributeTypeOrDefault("modifiersname");
+ AttributeType mtType = DirectoryServer.getAttributeTypeOrDefault("modifytimestamp");
assertTrue(schemaEntry.hasAttribute(cnType));
assertTrue(schemaEntry.hasAttribute(ctType));
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/controls/ServerSideSortControlTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/controls/ServerSideSortControlTestCase.java
index 1689cb6..7011a16 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/controls/ServerSideSortControlTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/controls/ServerSideSortControlTestCase.java
@@ -97,10 +97,10 @@
{
TestCaseUtils.startServer();
- givenNameType = DirectoryServer.getAttributeType("givenname", false);
+ givenNameType = DirectoryServer.getAttributeType("givenname");
assertNotNull(givenNameType);
- snType = DirectoryServer.getAttributeType("sn", false);
+ snType = DirectoryServer.getAttributeType("sn");
assertNotNull(snType);
aaccfJohnsonDN = DN.valueOf("uid=aaccf.johnson,dc=example,dc=com");
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/controls/VLVControlTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/controls/VLVControlTestCase.java
index ecde700..735a2d0 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/controls/VLVControlTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/controls/VLVControlTestCase.java
@@ -96,10 +96,10 @@
{
TestCaseUtils.startServer();
- givenNameType = DirectoryServer.getAttributeType("givenname", false);
+ givenNameType = DirectoryServer.getAttributeType("givenname");
assertNotNull(givenNameType);
- snType = DirectoryServer.getAttributeType("sn", false);
+ snType = DirectoryServer.getAttributeType("sn");
assertNotNull(snType);
aaccfJohnsonDN = DN.valueOf("uid=aaccf.johnson,dc=example,dc=com");
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/core/AddOperationTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/core/AddOperationTestCase.java
index 625c0ad..a5ccb6a 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/core/AddOperationTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/core/AddOperationTestCase.java
@@ -484,8 +484,7 @@
UpdatePreOpPlugin.reset();
- AttributeType attrType = DirectoryServer.getAttributeType("description",
- true);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault("description");
UpdatePreOpPlugin.addAttributeToRemove(attrType);
AddOperation addOperation = getRootConnection().processAdd(entry);
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/core/ModifyOperationTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/core/ModifyOperationTestCase.java
index b39ee60..613c9b1 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/core/ModifyOperationTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/core/ModifyOperationTestCase.java
@@ -435,7 +435,7 @@
public void testGetAndAddModifications() throws Exception
{
Entry e = DirectoryServer.getEntry(DN.valueOf("o=test"));
- assertNull(e.getAttribute(DirectoryServer.getAttributeType("description", true)));
+ assertNull(e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("description")));
UpdatePreOpPlugin.reset();
UpdatePreOpPlugin.addModification(
@@ -453,7 +453,7 @@
retrieveSuccessfulOperationElements(modifyOperation);
e = DirectoryServer.getEntry(DN.valueOf("o=test"));
- assertNotNull(e.getAttribute(DirectoryServer.getAttributeType("description", true)));
+ assertNotNull(e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("description")));
UpdatePreOpPlugin.reset();
}
@@ -552,7 +552,7 @@
public void testSuccessAddAttribute() throws Exception
{
Entry e = DirectoryServer.getEntry(DN.valueOf("o=test"));
- assertNull(e.getAttribute(DirectoryServer.getAttributeType("description", true)));
+ assertNull(e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("description")));
LDAPAttribute attr = newLDAPAttribute("description", "foo");
ModifyOperation modifyOperation = processModify("o=test", replace(attr));
@@ -560,7 +560,7 @@
retrieveSuccessfulOperationElements(modifyOperation);
e = DirectoryServer.getEntry(DN.valueOf("o=test"));
- assertNotNull(e.getAttribute(DirectoryServer.getAttributeType("description", true)));
+ assertNotNull(e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("description")));
}
@@ -577,7 +577,7 @@
Entry e = DirectoryServer.getEntry(DN.valueOf("o=test"));
List<Attribute> attrList =
- e.getAttribute(DirectoryServer.getAttributeType("o", true));
+ e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("o"));
assertEquals(countValues(attrList), 1);
LDAPAttribute attr = newLDAPAttribute("o", "test2");
@@ -586,7 +586,7 @@
retrieveSuccessfulOperationElements(modifyOperation);
e = DirectoryServer.getEntry(DN.valueOf("o=test"));
- attrList = e.getAttribute(DirectoryServer.getAttributeType("o", true));
+ attrList = e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("o"));
assertEquals(countValues(attrList), 2);
}
@@ -605,7 +605,7 @@
Entry e = DirectoryServer.getEntry(DN.valueOf(baseDN));
List<Attribute> attrList =
- e.getAttribute(DirectoryServer.getAttributeType("o", true));
+ e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("o"));
assertEquals(countValues(attrList), 1);
LDAPAttribute attr = newLDAPAttribute("o;lang-en-us", "test");
@@ -614,7 +614,7 @@
retrieveSuccessfulOperationElements(modifyOperation);
e = DirectoryServer.getEntry(DN.valueOf(baseDN));
- attrList = e.getAttribute(DirectoryServer.getAttributeType("o", true));
+ attrList = e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("o"));
assertEquals(countValues(attrList), 2);
}
@@ -1878,7 +1878,7 @@
Entry e = DirectoryServer.getEntry(DN.valueOf("uid=test.user," + baseDN));
List<Attribute> attrList =
- e.getAttribute(DirectoryServer.getAttributeType("employeenumber", true));
+ e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("employeenumber"));
assertNotNull(attrList);
assertIntegerValueExists(attrList, 2);
}
@@ -1917,7 +1917,7 @@
Entry e = DirectoryServer.getEntry(DN.valueOf("uid=test.user," + baseDN));
List<Attribute> attrList =
- e.getAttribute(DirectoryServer.getAttributeType("employeenumber", true));
+ e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("employeenumber"));
assertNotNull(attrList);
assertIntegerValueExists(attrList, 11);
}
@@ -1956,7 +1956,7 @@
Entry e = DirectoryServer.getEntry(DN.valueOf("uid=test.user," + baseDN));
List<Attribute> attrList =
- e.getAttribute(DirectoryServer.getAttributeType("employeenumber", true));
+ e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("employeenumber"));
assertNotNull(attrList);
assertIntegerValueExists(attrList, 0);
}
@@ -3187,7 +3187,7 @@
assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
assertTrue(DirectoryServer.entryExists(DN.valueOf("o=test")));
assertFalse(DirectoryServer.getEntry(DN.valueOf("o=test")).hasAttribute(
- DirectoryServer.getAttributeType("description", true)));
+ DirectoryServer.getAttributeTypeOrDefault("description")));
}
@@ -3422,7 +3422,7 @@
"userPassword: password");
List<Attribute> attrList =
- e.getAttribute(DirectoryServer.getAttributeType("userpassword", true));
+ e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("userpassword"));
assertNotNull(attrList);
String passwd = null;
@@ -3661,7 +3661,7 @@
Entry e = DirectoryServer.getEntry(DN.valueOf("uid=test.user," + baseDN));
List<Attribute> attrList =
- e.getAttribute(DirectoryServer.getAttributeType("usercertificate", true));
+ e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("usercertificate"));
assertNotNull(attrList);
assertEquals(attrList.size(), 1);
Attribute a = attrList.get(0);
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/EntryDNVirtualAttributeProviderTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/EntryDNVirtualAttributeProviderTestCase.java
index 27fd574..81e76f2 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/EntryDNVirtualAttributeProviderTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/EntryDNVirtualAttributeProviderTestCase.java
@@ -75,7 +75,7 @@
TestCaseUtils.initializeTestBackend(true);
TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com");
- entryDNType = DirectoryServer.getAttributeType("entrydn", false);
+ entryDNType = DirectoryServer.getAttributeType("entrydn");
assertNotNull(entryDNType);
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/EntryUUIDVirtualAttributeProviderTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/EntryUUIDVirtualAttributeProviderTestCase.java
index e4c3265..b250c8b 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/EntryUUIDVirtualAttributeProviderTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/EntryUUIDVirtualAttributeProviderTestCase.java
@@ -71,7 +71,7 @@
{
TestCaseUtils.startServer();
- entryUUIDType = DirectoryServer.getAttributeType("entryuuid", false);
+ entryUUIDType = DirectoryServer.getAttributeType("entryuuid");
assertNotNull(entryUUIDType);
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/GoverningStructureRuleVirtualAttributeProviderTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/GoverningStructureRuleVirtualAttributeProviderTestCase.java
index f9a50ae..c694240 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/GoverningStructureRuleVirtualAttributeProviderTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/GoverningStructureRuleVirtualAttributeProviderTestCase.java
@@ -80,8 +80,7 @@
TestCaseUtils.initializeTestBackend(true);
TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com");
- governingStructureRuleType =
- DirectoryServer.getAttributeType("governingstructurerule", false);
+ governingStructureRuleType = DirectoryServer.getAttributeType("governingstructurerule");
assertNotNull(governingStructureRuleType);
int resultCode = TestCaseUtils.applyModifications(true,
"dn: cn=schema",
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/HasSubordinatesVirtualAttributeProviderTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/HasSubordinatesVirtualAttributeProviderTestCase.java
index f1ef502..674ee03 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/HasSubordinatesVirtualAttributeProviderTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/HasSubordinatesVirtualAttributeProviderTestCase.java
@@ -70,8 +70,7 @@
{
TestCaseUtils.startServer();
- hasSubordinatesType =
- DirectoryServer.getAttributeType("hassubordinates", false);
+ hasSubordinatesType = DirectoryServer.getAttributeType("hassubordinates");
assertNotNull(hasSubordinatesType);
entries = TestCaseUtils.makeEntries(
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/IsMemberOfVirtualAttributeProviderTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/IsMemberOfVirtualAttributeProviderTestCase.java
index ae4d50b..ecace3d 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/IsMemberOfVirtualAttributeProviderTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/IsMemberOfVirtualAttributeProviderTestCase.java
@@ -79,7 +79,7 @@
{
TestCaseUtils.restartServer();
- isMemberOfType = DirectoryServer.getAttributeType("ismemberof", false);
+ isMemberOfType = DirectoryServer.getAttributeType("ismemberof");
assertNotNull(isMemberOfType);
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyTestCase.java
index 4aaf2c9..4710419 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyTestCase.java
@@ -66,6 +66,7 @@
import static org.opends.server.extensions.LDAPPassThroughAuthenticationPolicyFactory.*;
import static org.opends.server.protocols.ldap.LDAPConstants.*;
+import static org.opends.server.util.StaticUtils.*;
import static org.testng.Assert.*;
/**
@@ -598,8 +599,8 @@
MockPolicyCfg withMappedAttribute(final String atype)
{
- mappedAttributes.add(DirectoryServer.getAttributeType(
- StaticUtils.toLowerCase(atype), true));
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(toLowerCase(atype));
+ mappedAttributes.add(attrType);
return this;
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/NumSubordinatesVirtualAttributeProviderTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/NumSubordinatesVirtualAttributeProviderTestCase.java
index b7a49df..b14da7f 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/NumSubordinatesVirtualAttributeProviderTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/NumSubordinatesVirtualAttributeProviderTestCase.java
@@ -66,8 +66,7 @@
{
TestCaseUtils.restartServer();
- numSubordinatesType =
- DirectoryServer.getAttributeType("numsubordinates", false);
+ numSubordinatesType = DirectoryServer.getAttributeType("numsubordinates");
assertNotNull(numSubordinatesType);
entries = TestCaseUtils.makeEntries(
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/PasswordModifyExtendedOperationTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/PasswordModifyExtendedOperationTestCase.java
index 2a93120..0dcf58a 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/PasswordModifyExtendedOperationTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/PasswordModifyExtendedOperationTestCase.java
@@ -1695,8 +1695,7 @@
try
{
- AttributeType lastLoginTimeAttr =
- DirectoryServer.getAttributeType("ds-pwp-last-login-time", false);
+ AttributeType lastLoginTimeAttr = DirectoryServer.getAttributeType("ds-pwp-last-login-time");
assertNotNull(lastLoginTimeAttr);
DN userDN = DN.valueOf("uid=test.user,o=test");
@@ -1753,8 +1752,7 @@
try
{
- AttributeType authFailureTimesAttr =
- DirectoryServer.getAttributeType("pwdfailuretime", false);
+ AttributeType authFailureTimesAttr = DirectoryServer.getAttributeType("pwdfailuretime");
assertNotNull(authFailureTimesAttr);
DN userDN = DN.valueOf("uid=test.user,o=test");
@@ -1805,7 +1803,7 @@
try
{
- AttributeType pwdHistoryAttr = DirectoryServer.getAttributeType("pwdhistory", false);
+ AttributeType pwdHistoryAttr = DirectoryServer.getAttributeType("pwdhistory");
assertNotNull(pwdHistoryAttr);
DN userDN = DN.valueOf("uid=test.user,o=test");
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/StructuralObjectClassVirtualAttributeProviderTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/StructuralObjectClassVirtualAttributeProviderTestCase.java
index 68d79f1..00852a8 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/StructuralObjectClassVirtualAttributeProviderTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/StructuralObjectClassVirtualAttributeProviderTestCase.java
@@ -77,8 +77,7 @@
TestCaseUtils.initializeTestBackend(true);
TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com");
- structuralObjectClassType =
- DirectoryServer.getAttributeType("structuralobjectclass", false);
+ structuralObjectClassType = DirectoryServer.getAttributeType("structuralobjectclass");
assertNotNull(structuralObjectClassType);
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/SubschemaSubentryVirtualAttributeProviderTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/SubschemaSubentryVirtualAttributeProviderTestCase.java
index 20ac129..7940198 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/SubschemaSubentryVirtualAttributeProviderTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/SubschemaSubentryVirtualAttributeProviderTestCase.java
@@ -76,8 +76,7 @@
TestCaseUtils.initializeTestBackend(true);
TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com");
- subschemaSubentryType =
- DirectoryServer.getAttributeType("subschemasubentry", false);
+ subschemaSubentryType = DirectoryServer.getAttributeType("subschemasubentry");
assertNotNull(subschemaSubentryType);
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/UserDefinedVirtualAttributeProviderTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/UserDefinedVirtualAttributeProviderTestCase.java
index badb5dd..11e1e08 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/UserDefinedVirtualAttributeProviderTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/UserDefinedVirtualAttributeProviderTestCase.java
@@ -77,14 +77,13 @@
{
TestCaseUtils.startServer();
- descriptionType = DirectoryServer.getAttributeType("description", false);
+ descriptionType = DirectoryServer.getAttributeType("description");
assertNotNull(descriptionType);
- pwPolicyDNType =
- DirectoryServer.getAttributeType("ds-pwp-password-policy-dn", false);
+ pwPolicyDNType = DirectoryServer.getAttributeType("ds-pwp-password-policy-dn");
assertNotNull(pwPolicyDNType);
- privNameType = DirectoryServer.getAttributeType("ds-privilege-name", false);
+ privNameType = DirectoryServer.getAttributeType("ds-privilege-name");
assertNotNull(privNameType);
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/VirtualStaticGroupTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/VirtualStaticGroupTestCase.java
index 3b904e9..94d8031 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/VirtualStaticGroupTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/VirtualStaticGroupTestCase.java
@@ -251,10 +251,10 @@
{
TestCaseUtils.startServer();
- memberType = DirectoryServer.getAttributeType("member", false);
+ memberType = DirectoryServer.getAttributeType("member");
assertNotNull(memberType);
- uniqueMemberType = DirectoryServer.getAttributeType("uniquemember", false);
+ uniqueMemberType = DirectoryServer.getAttributeType("uniquemember");
assertNotNull(uniqueMemberType);
groupManager = DirectoryServer.getGroupManager();
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/plugins/EntryUUIDPluginTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/plugins/EntryUUIDPluginTestCase.java
index 228602e..c5a88a0 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/plugins/EntryUUIDPluginTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/plugins/EntryUUIDPluginTestCase.java
@@ -43,7 +43,6 @@
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.AttributeType;
import org.opends.server.types.DN;
-import org.opends.server.types.DirectoryConfig;
import org.opends.server.types.Entry;
import org.opends.server.types.LDIFImportConfig;
import org.testng.annotations.BeforeClass;
@@ -159,8 +158,7 @@
public void testInitializeWithValidConfigsWithoutSchema(Entry e)
throws Exception
{
- AttributeType entryUUIDType = DirectoryConfig.getAttributeType("entryuuid",
- false);
+ AttributeType entryUUIDType = DirectoryServer.getAttributeType("entryuuid");
DirectoryServer.deregisterAttributeType(entryUUIDType);
HashSet<PluginType> pluginTypes = TestCaseUtils.getPluginTypes(e);
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/plugins/LastModPluginTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/plugins/LastModPluginTestCase.java
index 09e2898..fffbfa6 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/plugins/LastModPluginTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/plugins/LastModPluginTestCase.java
@@ -173,10 +173,10 @@
public void testInitializeWithValidConfigsWithoutSchema(Entry e)
throws Exception
{
- AttributeType ctType = DirectoryConfig.getAttributeType("createtimestamp", false);
- AttributeType cnType = DirectoryConfig.getAttributeType("creatorsname", false);
- AttributeType mtType = DirectoryConfig.getAttributeType("modifytimestamp", false);
- AttributeType mnType = DirectoryConfig.getAttributeType("modifiersname", false);
+ AttributeType ctType = DirectoryServer.getAttributeType("createtimestamp");
+ AttributeType cnType = DirectoryServer.getAttributeType("creatorsname");
+ AttributeType mtType = DirectoryServer.getAttributeType("modifytimestamp");
+ AttributeType mnType = DirectoryServer.getAttributeType("modifiersname");
DirectoryServer.deregisterAttributeType(ctType);
DirectoryServer.deregisterAttributeType(cnType);
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/plugins/ReferentialIntegrityPluginTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/plugins/ReferentialIntegrityPluginTestCase.java
index 5893bdf..52b5715 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/plugins/ReferentialIntegrityPluginTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/plugins/ReferentialIntegrityPluginTestCase.java
@@ -1068,7 +1068,7 @@
}
private AttributeType getAttrType(String attrTypeString) {
- return DirectoryServer.getAttributeType(attrTypeString, true);
+ return DirectoryServer.getAttributeTypeOrDefault(attrTypeString);
}
private void deleteEntries(String... dns) throws Exception{
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/plugins/UniqueAttributePluginTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/plugins/UniqueAttributePluginTestCase.java
index 39b059f..7264241 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/plugins/UniqueAttributePluginTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/plugins/UniqueAttributePluginTestCase.java
@@ -816,7 +816,7 @@
}
private AttributeType getAttrType(String attrTypeString) {
- return DirectoryServer.getAttributeType(attrTypeString, true);
+ return DirectoryServer.getAttributeTypeOrDefault(attrTypeString);
}
/**
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/protocols/internal/InternalClientConnectionTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/protocols/internal/InternalClientConnectionTestCase.java
index 5633cd6..df26674 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/protocols/internal/InternalClientConnectionTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/protocols/internal/InternalClientConnectionTestCase.java
@@ -467,7 +467,7 @@
InternalClientConnection conn = getRootConnection();
CompareOperation compareOperation =
conn.processCompare(DN.valueOf("cn=test,o=test"),
- DirectoryServer.getAttributeType("cn", true),
+ DirectoryServer.getAttributeTypeOrDefault("cn"),
ByteString.valueOf("test"));
assertEquals(compareOperation.getResultCode(), ResultCode.COMPARE_TRUE);
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/protocols/jmx/JmxPrivilegeTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/protocols/jmx/JmxPrivilegeTestCase.java
index b82f3c1..a896f6e 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/protocols/jmx/JmxPrivilegeTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/protocols/jmx/JmxPrivilegeTestCase.java
@@ -700,7 +700,7 @@
CompareOperationBasis compareOperation =
new CompareOperationBasis(conn, conn.nextOperationID(),
conn.nextMessageID(), controls, targetDN,
- DirectoryServer.getAttributeType("cn", true),
+ DirectoryServer.getAttributeTypeOrDefault("cn"),
ByteString.valueOf("PWReset Target"));
compareOperation.run();
@@ -895,7 +895,7 @@
CompareOperationBasis compareOperation =
new CompareOperationBasis(conn, conn.nextOperationID(),
conn.nextMessageID(), controls, targetDN,
- DirectoryServer.getAttributeType("cn", true),
+ DirectoryServer.getAttributeTypeOrDefault("cn"),
ByteString.valueOf("PWReset Target"));
compareOperation.run();
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestLDAPConnectionHandler.java b/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestLDAPConnectionHandler.java
index 0ab67b7..082e265 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestLDAPConnectionHandler.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestLDAPConnectionHandler.java
@@ -121,7 +121,7 @@
//Reset some things for the SSL handler
Attribute useSSL=Attributes.create(ATTR_USE_SSL, String.valueOf(false));
Attribute startTls=Attributes.create(ATTR_ALLOW_STARTTLS, String.valueOf(false));
- AttributeType attrType=DirectoryServer.getAttributeType(ATTR_LISTEN_PORT, true);
+ AttributeType attrType=DirectoryServer.getAttributeTypeOrDefault(ATTR_LISTEN_PORT);
Attribute a=Attributes.empty(attrType);
LDAPHandlerEntry.removeAttribute(a, null);
LDAPHandlerEntry.removeAttribute(useSSL, null);
@@ -241,21 +241,21 @@
"ds-cfg-trust-manager-provider: cn=JKS,cn=Trust Manager Providers,cn=config");
LDAPConnectionHandler LDAPConnHandler=getLDAPHandlerInstance(GoodHandlerEntry);
//Make attrTypes to remove
- AttributeType at0=DirectoryServer.getAttributeType(ATTR_LISTEN_PORT, true);
+ AttributeType at0=DirectoryServer.getAttributeTypeOrDefault(ATTR_LISTEN_PORT);
// AttributeType at1=DirectoryServer.getAttributeType(ATTR_LISTEN_ADDRESS, true);
// Attribute rAttr1=new Attribute(at1);
// GoodHandlerEntry.removeAttribute(rAttr1, null);
- AttributeType at2=DirectoryServer.getAttributeType(ATTR_ALLOW_LDAPV2, true);
- AttributeType at3=DirectoryServer.getAttributeType(ATTR_ALLOW_LDAPV2, true);
- AttributeType at4=DirectoryServer.getAttributeType(ATTR_KEEP_LDAP_STATS, true);
- AttributeType at5=DirectoryServer.getAttributeType(ATTR_SEND_REJECTION_NOTICE,true);
- AttributeType at6=DirectoryServer.getAttributeType(ATTR_USE_TCP_KEEPALIVE,true);
- AttributeType at7=DirectoryServer.getAttributeType(ATTR_USE_TCP_NODELAY,true);
- AttributeType at8=DirectoryServer.getAttributeType(ATTR_ALLOW_REUSE_ADDRESS,true);
- AttributeType at9=DirectoryServer.getAttributeType(ATTR_USE_SSL,true);
- AttributeType at10=DirectoryServer.getAttributeType(ATTR_ALLOW_STARTTLS,true);
- AttributeType at11=DirectoryServer.getAttributeType(ATTR_MAX_REQUEST_SIZE,true);
- AttributeType at12=DirectoryServer.getAttributeType(ATTR_ACCEPT_BACKLOG,true);
+ AttributeType at2=DirectoryServer.getAttributeTypeOrDefault(ATTR_ALLOW_LDAPV2);
+ AttributeType at3=DirectoryServer.getAttributeTypeOrDefault(ATTR_ALLOW_LDAPV2);
+ AttributeType at4=DirectoryServer.getAttributeTypeOrDefault(ATTR_KEEP_LDAP_STATS);
+ AttributeType at5=DirectoryServer.getAttributeTypeOrDefault(ATTR_SEND_REJECTION_NOTICE);
+ AttributeType at6=DirectoryServer.getAttributeTypeOrDefault(ATTR_USE_TCP_KEEPALIVE);
+ AttributeType at7=DirectoryServer.getAttributeTypeOrDefault(ATTR_USE_TCP_NODELAY);
+ AttributeType at8=DirectoryServer.getAttributeTypeOrDefault(ATTR_ALLOW_REUSE_ADDRESS);
+ AttributeType at9=DirectoryServer.getAttributeTypeOrDefault(ATTR_USE_SSL);
+ AttributeType at10=DirectoryServer.getAttributeTypeOrDefault(ATTR_ALLOW_STARTTLS);
+ AttributeType at11=DirectoryServer.getAttributeTypeOrDefault(ATTR_MAX_REQUEST_SIZE);
+ AttributeType at12=DirectoryServer.getAttributeTypeOrDefault(ATTR_ACCEPT_BACKLOG);
//Remove them
Attribute rAttr0=Attributes.empty(at0);
GoodHandlerEntry.removeAttribute(rAttr0, null);
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/schema/GenericSchemaTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/schema/GenericSchemaTestCase.java
index cf2dc36..e87bf27 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/schema/GenericSchemaTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/schema/GenericSchemaTestCase.java
@@ -187,8 +187,7 @@
continue;
}
- AttributeType attrType =
- DirectoryServer.getAttributeType("attributetypes", false);
+ AttributeType attrType = DirectoryServer.getAttributeType("attributetypes");
assertNotNull(attrType);
List<Attribute> attrList = e.getAttribute(attrType);
if (attrList == null)
@@ -264,8 +263,7 @@
continue;
}
- AttributeType attrType =
- DirectoryServer.getAttributeType("objectclasses", false);
+ AttributeType attrType = DirectoryServer.getAttributeType("objectclasses");
assertNotNull(attrType);
List<Attribute> attrList = e.getAttribute(attrType);
if (attrList == null)
@@ -340,8 +338,7 @@
continue;
}
- AttributeType attrType =
- DirectoryServer.getAttributeType("nameforms", false);
+ AttributeType attrType = DirectoryServer.getAttributeType("nameforms");
assertNotNull(attrType);
List<Attribute> attrList = e.getAttribute(attrType);
if (attrList == null)
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/types/PrivilegeTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/types/PrivilegeTestCase.java
index 7b36328..255a70d 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/types/PrivilegeTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/types/PrivilegeTestCase.java
@@ -1266,7 +1266,7 @@
CompareOperation compareOperation = new CompareOperationBasis(conn,
nextOperationID(), nextMessageID(),
controls, targetDN,
- DirectoryServer.getAttributeType("cn", true),
+ DirectoryServer.getAttributeTypeOrDefault("cn"),
ByteString.valueOf("PWReset Target"));
compareOperation.run();
if (hasProxyPrivilege)
@@ -1412,7 +1412,7 @@
// Test a compare operation against the PWReset Target user.
CompareOperation compareOperation = new CompareOperationBasis(conn, nextOperationID(),
nextMessageID(), controls, targetDN,
- DirectoryServer.getAttributeType("cn", true),
+ DirectoryServer.getAttributeTypeOrDefault("cn"),
ByteString.valueOf("PWReset Target"));
compareOperation.run();
if (hasProxyPrivilege)
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/types/VirtualAttributeRuleTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/types/VirtualAttributeRuleTestCase.java
index 234d2b8..258593e 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/types/VirtualAttributeRuleTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/types/VirtualAttributeRuleTestCase.java
@@ -32,6 +32,7 @@
import org.forgerock.opendj.ldap.SearchScope;
import org.opends.server.TestCaseUtils;
import org.opends.server.admin.std.meta.VirtualAttributeCfgDefn.ConflictBehavior;
+import org.opends.server.core.DirectoryServer;
import org.opends.server.extensions.EntryDNVirtualAttributeProvider;
import org.opends.server.protocols.internal.InternalClientConnection;
import org.testng.annotations.BeforeClass;
@@ -65,7 +66,7 @@
{
TestCaseUtils.startServer();
- entryDNType = DirectoryConfig.getAttributeType("entrydn", false);
+ entryDNType = DirectoryServer.getAttributeType("entrydn");
assertNotNull(entryDNType);
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/types/VirtualAttributeTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/types/VirtualAttributeTestCase.java
index 313c890..fa95cc3 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/types/VirtualAttributeTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/types/VirtualAttributeTestCase.java
@@ -34,6 +34,7 @@
import org.forgerock.opendj.ldap.SearchScope;
import org.opends.server.TestCaseUtils;
import org.opends.server.admin.std.meta.VirtualAttributeCfgDefn.ConflictBehavior;
+import org.opends.server.core.DirectoryServer;
import org.opends.server.extensions.EntryDNVirtualAttributeProvider;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -68,7 +69,7 @@
{
TestCaseUtils.startServer();
- entryDNType = DirectoryConfig.getAttributeType("entrydn", false);
+ entryDNType = DirectoryServer.getAttributeType("entrydn");
assertNotNull(entryDNType);
EntryDNVirtualAttributeProvider provider =
--
Gitblit v1.10.0