From 04ff552c42f3200dd71a58f94e9d57436b67c4f3 Mon Sep 17 00:00:00 2001
From: Violette Roche-Montane <violette.roche-montane@forgerock.com>
Date: Fri, 09 Nov 2012 15:26:03 +0000
Subject: [PATCH] - rename SchemaBuilderTest.java in SchemaBuilderTestCase.java. - SchemaBuilderTestCase.java: added new tests. - SchemaBuilder.java : - fix a small bug about 'removeDITContentRule(final DITContentRule rule)'. - 'rewrap' comments. - checkstyle : ok.
---
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaBuilder.java | 99 +++++++++++++++++--------------------------------
1 files changed, 35 insertions(+), 64 deletions(-)
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaBuilder.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaBuilder.java
index 33e9ae8..50c2c78 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaBuilder.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaBuilder.java
@@ -95,8 +95,8 @@
// Constructs a search request for retrieving the subschemaSubentry
// attribute from the named entry.
private static SearchRequest getReadSchemaForEntrySearchRequest(final DN dn) {
- return Requests.newSearchRequest(dn, SearchScope.BASE_OBJECT, Filter
- .objectClassPresent(), SUBSCHEMA_SUBENTRY_ATTRS);
+ return Requests.newSearchRequest(dn, SearchScope.BASE_OBJECT, Filter.objectClassPresent(),
+ SUBSCHEMA_SUBENTRY_ATTRS);
}
// Constructs a search request for retrieving the named subschema
@@ -324,8 +324,7 @@
} else if (tokenName.equalsIgnoreCase("obsolete")) {
// This indicates whether the attribute type should be
// considered obsolete. We do not need to do any more
- // parsing
- // for this token.
+ // parsing for this token.
isObsolete = true;
} else if (tokenName.equalsIgnoreCase("sup")) {
// This specifies the name or OID of the superior attribute
@@ -350,27 +349,22 @@
} else if (tokenName.equalsIgnoreCase("syntax")) {
// This specifies the numeric OID of the syntax for this
// matching rule. It may optionally be immediately followed
- // by
- // an open curly brace, an integer definition, and a close
+ // by an open curly brace, an integer definition, and a close
// curly brace to suggest the minimum number of characters
// that should be allowed in values of that type. This
// implementation will ignore any such length because it
- // does
- // not impose any practical limit on the length of attribute
+ // does not impose any practical limit on the length of attribute
// values.
syntax = SchemaUtils.readOIDLen(reader, allowMalformedNamesAndOptions);
} else if (tokenName.equalsIgnoreCase("single-definition")) {
// This indicates that attributes of this type are allowed
- // to
- // have at most one definition. We do not need any more
+ // to have at most one definition. We do not need any more
// parsing for this token.
isSingleValue = true;
} else if (tokenName.equalsIgnoreCase("single-value")) {
// This indicates that attributes of this type are allowed
- // to
- // have at most one value. We do not need any more parsing
- // for
- // this token.
+ // to have at most one value. We do not need any more parsing
+ // for this token.
isSingleValue = true;
} else if (tokenName.equalsIgnoreCase("collective")) {
// This indicates that attributes of this type are
@@ -385,8 +379,7 @@
isNoUserModification = true;
} else if (tokenName.equalsIgnoreCase("usage")) {
// This specifies the usage string for this attribute type.
- // It
- // should be followed by one of the strings
+ // It should be followed by one of the strings
// "userApplications", "directoryOperation",
// "distributedOperation", or "dSAOperation".
int length = 0;
@@ -417,8 +410,7 @@
} else if (tokenName.matches("^X-[A-Za-z_-]+$")) {
// This must be a non-standard property and it must be
// followed by either a single definition in single quotes
- // or
- // an open parenthesis followed by one or more values in
+ // or an open parenthesis followed by one or more values in
// single quotes separated by spaces followed by a close
// parenthesis.
if (extraProperties.isEmpty()) {
@@ -627,8 +619,7 @@
} else if (tokenName.equalsIgnoreCase("obsolete")) {
// This indicates whether the attribute type should be
// considered obsolete. We do not need to do any more
- // parsing
- // for this token.
+ // parsing for this token.
isObsolete = true;
} else if (tokenName.equalsIgnoreCase("aux")) {
auxiliaryClasses = SchemaUtils.readOIDs(reader, allowMalformedNamesAndOptions);
@@ -644,8 +635,7 @@
} else if (tokenName.matches("^X-[A-Za-z_-]+$")) {
// This must be a non-standard property and it must be
// followed by either a single definition in single quotes
- // or
- // an open parenthesis followed by one or more values in
+ // or an open parenthesis followed by one or more values in
// single quotes separated by spaces followed by a close
// parenthesis.
if (extraProperties.isEmpty()) {
@@ -856,8 +846,7 @@
} else if (tokenName.equalsIgnoreCase("obsolete")) {
// This indicates whether the attribute type should be
// considered obsolete. We do not need to do any more
- // parsing
- // for this token.
+ // parsing for this token.
isObsolete = true;
} else if (tokenName.equalsIgnoreCase("form")) {
nameForm = SchemaUtils.readOID(reader, allowMalformedNamesAndOptions);
@@ -866,8 +855,7 @@
} else if (tokenName.matches("^X-[A-Za-z_-]+$")) {
// This must be a non-standard property and it must be
// followed by either a single definition in single quotes
- // or
- // an open parenthesis followed by one or more values in
+ // or an open parenthesis followed by one or more values in
// single quotes separated by spaces followed by a close
// parenthesis.
if (extraProperties.isEmpty()) {
@@ -1021,23 +1009,20 @@
names = SchemaUtils.readNameDescriptors(reader, allowMalformedNamesAndOptions);
} else if (tokenName.equalsIgnoreCase("desc")) {
// This specifies the description for the matching rule. It
- // is
- // an arbitrary string of characters enclosed in single
+ // is an arbitrary string of characters enclosed in single
// quotes.
description = SchemaUtils.readQuotedString(reader);
} else if (tokenName.equalsIgnoreCase("obsolete")) {
// This indicates whether the matching rule should be
// considered obsolete. We do not need to do any more
- // parsing
- // for this token.
+ // parsing for this token.
isObsolete = true;
} else if (tokenName.equalsIgnoreCase("syntax")) {
syntax = SchemaUtils.readOID(reader, allowMalformedNamesAndOptions);
} else if (tokenName.matches("^X-[A-Za-z_-]+$")) {
// This must be a non-standard property and it must be
// followed by either a single definition in single quotes
- // or
- // an open parenthesis followed by one or more values in
+ // or an open parenthesis followed by one or more values in
// single quotes separated by spaces followed by a close
// parenthesis.
if (extraProperties.isEmpty()) {
@@ -1199,16 +1184,14 @@
} else if (tokenName.equalsIgnoreCase("obsolete")) {
// This indicates whether the attribute type should be
// considered obsolete. We do not need to do any more
- // parsing
- // for this token.
+ // parsing for this token.
isObsolete = true;
} else if (tokenName.equalsIgnoreCase("applies")) {
attributes = SchemaUtils.readOIDs(reader, allowMalformedNamesAndOptions);
} else if (tokenName.matches("^X-[A-Za-z_-]+$")) {
// This must be a non-standard property and it must be
// followed by either a single definition in single quotes
- // or
- // an open parenthesis followed by one or more values in
+ // or an open parenthesis followed by one or more values in
// single quotes separated by spaces followed by a close
// parenthesis.
if (extraProperties.isEmpty()) {
@@ -1368,8 +1351,7 @@
} else if (tokenName.equalsIgnoreCase("obsolete")) {
// This indicates whether the attribute type should be
// considered obsolete. We do not need to do any more
- // parsing
- // for this token.
+ // parsing for this token.
isObsolete = true;
} else if (tokenName.equalsIgnoreCase("oc")) {
structuralClass = SchemaUtils.readOID(reader, allowMalformedNamesAndOptions);
@@ -1382,8 +1364,7 @@
} else if (tokenName.matches("^X-[A-Za-z_-]+$")) {
// This must be a non-standard property and it must be
// followed by either a single definition in single quotes
- // or
- // an open parenthesis followed by one or more values in
+ // or an open parenthesis followed by one or more values in
// single quotes separated by spaces followed by a close
// parenthesis.
if (extraProperties.isEmpty()) {
@@ -1560,8 +1541,7 @@
} else if (tokenName.equalsIgnoreCase("obsolete")) {
// This indicates whether the attribute type should be
// considered obsolete. We do not need to do any more
- // parsing
- // for this token.
+ // parsing for this token.
isObsolete = true;
} else if (tokenName.equalsIgnoreCase("sup")) {
superiorClasses = SchemaUtils.readOIDs(reader, allowMalformedNamesAndOptions);
@@ -1573,13 +1553,11 @@
objectClassType = ObjectClassType.ABSTRACT;
} else if (tokenName.equalsIgnoreCase("structural")) {
// This indicates that this is a structural objectclass. We
- // do
- // not need any more parsing for this token.
+ // do not need any more parsing for this token.
objectClassType = ObjectClassType.STRUCTURAL;
} else if (tokenName.equalsIgnoreCase("auxiliary")) {
// This indicates that this is an auxiliary objectclass. We
- // do
- // not need any more parsing for this token.
+ // do not need any more parsing for this token.
objectClassType = ObjectClassType.AUXILIARY;
} else if (tokenName.equalsIgnoreCase("must")) {
requiredAttributes =
@@ -1590,8 +1568,7 @@
} else if (tokenName.matches("^X-[A-Za-z_-]+$")) {
// This must be a non-standard property and it must be
// followed by either a single definition in single quotes
- // or
- // an open parenthesis followed by one or more values in
+ // or an open parenthesis followed by one or more values in
// single quotes separated by spaces followed by a close
// parenthesis.
if (extraProperties.isEmpty()) {
@@ -2142,8 +2119,7 @@
} else if (tokenName.matches("^X-[A-Za-z_-]+$")) {
// This must be a non-standard property and it must be
// followed by either a single definition in single quotes
- // or
- // an open parenthesis followed by one or more values in
+ // or an open parenthesis followed by one or more values in
// single quotes separated by spaces followed by a close
// parenthesis.
if (extraProperties.isEmpty()) {
@@ -2249,19 +2225,17 @@
}
/**
- * Specifies whether or not the JPEG Photo syntax should allow values
- * which do not conform to the JFIF or Exif specifications.
+ * Specifies whether or not the JPEG Photo syntax should allow values which
+ * do not conform to the JFIF or Exif specifications.
* <p>
* By default this compatibility option is set to {@code true}.
*
* @param allowMalformedJPEGPhotos
- * {@code true} if the JPEG Photo syntax should allow
- * values which do not conform to the JFIF or Exif
- * specifications.
+ * {@code true} if the JPEG Photo syntax should allow values
+ * which do not conform to the JFIF or Exif specifications.
* @return A reference to this {@code SchemaBuilder}.
*/
- public SchemaBuilder allowMalformedJPEGPhotos(
- final boolean allowMalformedJPEGPhotos) {
+ public SchemaBuilder allowMalformedJPEGPhotos(final boolean allowMalformedJPEGPhotos) {
lazyInitBuilder();
this.allowMalformedJPEGPhotos = allowMalformedJPEGPhotos;
@@ -2510,15 +2484,13 @@
public Schema toSchema() {
// If this schema builder was initialized from another schema and no
// modifications have been made since then we can simply return the
- // original
- // schema.
+ // original schema.
if (copyOnWriteSchema != null) {
return copyOnWriteSchema;
}
// We still need to ensure that this builder has been initialized
- // (otherwise
- // some fields may still be null).
+ // (otherwise some fields may still be null).
lazyInitBuilder();
final String localSchemaName;
@@ -2899,7 +2871,7 @@
final List<DITContentRule> rules = name2ContentRules.get(lowerName);
if (rules != null && rules.contains(rule)) {
if (rules.size() <= 1) {
- name2AttributeTypes.remove(lowerName);
+ name2ContentRules.remove(lowerName);
} else {
rules.remove(rule);
}
@@ -3012,8 +2984,7 @@
}
// Attribute types need special processing because they have
- // hierarchical
- // dependencies.
+ // hierarchical dependencies.
final List<AttributeType> invalidAttributeTypes = new LinkedList<AttributeType>();
for (final AttributeType attributeType : numericOID2AttributeTypes.values()) {
attributeType.validate(schema, invalidAttributeTypes, warnings);
--
Gitblit v1.10.0