opendj-sdk/opendj-core/clirr-ignored-api-changes.xml
@@ -188,7 +188,7 @@ <difference> <className>org/forgerock/opendj/ldap/schema/MatchingRuleImpl</className> <differenceType>7012</differenceType> <method>org.forgerock.opendj.ldap.spi.Indexer getIndexer()</method> <method>java.util.Collection getIndexers()</method> <justification>OPENDJ-1308 Migrate schema support: allows decoupling indexing from a specific backend</justification> </difference> <difference> opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractApproximateMatchingRuleImpl.java
@@ -25,6 +25,9 @@ */ package org.forgerock.opendj.ldap.schema; import java.util.Collection; import java.util.Collections; import org.forgerock.opendj.ldap.Assertion; import org.forgerock.opendj.ldap.ByteSequence; import org.forgerock.opendj.ldap.DecodeException; @@ -36,7 +39,8 @@ */ abstract class AbstractApproximateMatchingRuleImpl extends AbstractMatchingRuleImpl { private final Indexer indexer = new DefaultIndexer("approximate"); private final Collection<? extends Indexer> indexers = Collections.singleton(new DefaultIndexer("approximate")); AbstractApproximateMatchingRuleImpl() { // Nothing to do. @@ -50,7 +54,7 @@ /** {@inheritDoc} */ @Override public Indexer getIndexer() { return indexer; public Collection<? extends Indexer> getIndexers() { return indexers; } } opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractEqualityMatchingRuleImpl.java
@@ -25,6 +25,9 @@ */ package org.forgerock.opendj.ldap.schema; import java.util.Collection; import java.util.Collections; import org.forgerock.opendj.ldap.Assertion; import org.forgerock.opendj.ldap.ByteSequence; import org.forgerock.opendj.ldap.DecodeException; @@ -36,7 +39,8 @@ */ abstract class AbstractEqualityMatchingRuleImpl extends AbstractMatchingRuleImpl { private final Indexer indexer = new DefaultIndexer("equality"); private final Collection<? extends Indexer> indexers = Collections.singleton(new DefaultIndexer("equality")); AbstractEqualityMatchingRuleImpl() { // Nothing to do. @@ -50,7 +54,7 @@ /** {@inheritDoc} */ @Override public Indexer getIndexer() { return indexer; public Collection<? extends Indexer> getIndexers() { return indexers; } } opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractMatchingRuleImpl.java
@@ -63,10 +63,12 @@ this.normalizedAssertionValue = normalizedAssertionValue; } public ConditionResult matches(final ByteSequence attributeValue) { return ConditionResult.valueOf(normalizedAssertionValue.equals(attributeValue)); @Override public ConditionResult matches(final ByteSequence normalizedAttributeValue) { return ConditionResult.valueOf(normalizedAssertionValue.equals(normalizedAttributeValue)); } @Override public <T> T createIndexQuery(IndexQueryFactory<T> factory) throws DecodeException { return factory.createExactMatchQuery(indexID, normalizedAssertionValue); } @@ -93,10 +95,12 @@ }; private static final Assertion UNDEFINED_ASSERTION = new Assertion() { public ConditionResult matches(final ByteSequence attributeValue) { @Override public ConditionResult matches(final ByteSequence normalizedAttributeValue) { return ConditionResult.UNDEFINED; } @Override public <T> T createIndexQuery(IndexQueryFactory<T> factory) throws DecodeException { // Subclassing this class will always work, albeit inefficiently. // This is better than throwing an exception for no good reason. @@ -106,6 +110,7 @@ private static final Comparator<ByteSequence> DEFAULT_COMPARATOR = new Comparator<ByteSequence>() { @Override public int compare(final ByteSequence o1, final ByteSequence o2) { return o1.compareTo(o2); } @@ -115,26 +120,31 @@ // Nothing to do. } @Override public Comparator<ByteSequence> comparator(final Schema schema) { return DEFAULT_COMPARATOR; } @Override public Assertion getAssertion(final Schema schema, final ByteSequence assertionValue) throws DecodeException { return UNDEFINED_ASSERTION; } @Override public Assertion getSubstringAssertion(final Schema schema, final ByteSequence subInitial, final List<? extends ByteSequence> subAnyElements, final ByteSequence subFinal) throws DecodeException { return UNDEFINED_ASSERTION; } @Override public Assertion getGreaterOrEqualAssertion(final Schema schema, final ByteSequence value) throws DecodeException { return UNDEFINED_ASSERTION; } @Override public Assertion getLessOrEqualAssertion(final Schema schema, final ByteSequence value) throws DecodeException { return UNDEFINED_ASSERTION; @@ -143,7 +153,7 @@ /** {@inheritDoc} */ @Override public boolean isIndexingSupported() { return getIndexer() != null; return getIndexers().isEmpty(); } } opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractOrderingMatchingRuleImpl.java
@@ -26,6 +26,9 @@ */ package org.forgerock.opendj.ldap.schema; import java.util.Collection; import java.util.Collections; import org.forgerock.opendj.ldap.Assertion; import org.forgerock.opendj.ldap.ByteSequence; import org.forgerock.opendj.ldap.ByteString; @@ -40,7 +43,8 @@ */ abstract class AbstractOrderingMatchingRuleImpl extends AbstractMatchingRuleImpl { private final Indexer indexer = new DefaultIndexer("ordering"); private final Collection<? extends Indexer> indexers = Collections.singleton(new DefaultIndexer("ordering")); AbstractOrderingMatchingRuleImpl() { // Nothing to do. @@ -66,8 +70,8 @@ throws DecodeException { final ByteString normAssertion = normalizeAttributeValue(schema, value); return new Assertion() { public ConditionResult matches(final ByteSequence attributeValue) { return ConditionResult.valueOf(attributeValue.compareTo(normAssertion) >= 0); public ConditionResult matches(final ByteSequence normalizedAttributeValue) { return ConditionResult.valueOf(normalizedAttributeValue.compareTo(normAssertion) >= 0); } @Override @@ -82,8 +86,8 @@ throws DecodeException { final ByteString normAssertion = normalizeAttributeValue(schema, value); return new Assertion() { public ConditionResult matches(final ByteSequence attributeValue) { return ConditionResult.valueOf(attributeValue.compareTo(normAssertion) <= 0); public ConditionResult matches(final ByteSequence normalizedAttributeValue) { return ConditionResult.valueOf(normalizedAttributeValue.compareTo(normAssertion) <= 0); } @Override @@ -95,7 +99,7 @@ /** {@inheritDoc} */ @Override public Indexer getIndexer() { return indexer; public Collection<? extends Indexer> getIndexers() { return indexers; } } opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractSubstringMatchingRuleImpl.java
@@ -29,6 +29,7 @@ import static com.forgerock.opendj.ldap.CoreMessages.*; import java.util.Collection; import java.util.Collections; import java.util.LinkedList; import java.util.List; import java.util.TreeSet; @@ -79,8 +80,8 @@ /** {@inheritDoc} */ @Override public ConditionResult matches(final ByteSequence attributeValue) { final int valueLength = attributeValue.length(); public ConditionResult matches(final ByteSequence normalizedAttributeValue) { final int valueLength = normalizedAttributeValue.length(); int pos = 0; if (normInitial != null) { @@ -90,7 +91,7 @@ } for (; pos < initialLength; pos++) { if (normInitial.byteAt(pos) != attributeValue.byteAt(pos)) { if (normInitial.byteAt(pos) != normalizedAttributeValue.byteAt(pos)) { return ConditionResult.FALSE; } } @@ -105,10 +106,10 @@ final int end = valueLength - anyLength; boolean match = false; for (; pos <= end; pos++) { if (element.byteAt(0) == attributeValue.byteAt(pos)) { if (element.byteAt(0) == normalizedAttributeValue.byteAt(pos)) { boolean subMatch = true; for (int i = 1; i < anyLength; i++) { if (element.byteAt(i) != attributeValue.byteAt(pos + i)) { if (element.byteAt(i) != normalizedAttributeValue.byteAt(pos + i)) { subMatch = false; break; } @@ -138,7 +139,7 @@ pos = valueLength - finalLength; for (int i = 0; i < finalLength; i++, pos++) { if (normFinal.byteAt(i) != attributeValue.byteAt(pos)) { if (normFinal.byteAt(i) != normalizedAttributeValue.byteAt(pos)) { return ConditionResult.FALSE; } } @@ -251,7 +252,8 @@ } } private SubstringIndexer substringIndexer = new SubstringIndexer(); private final Collection<? extends Indexer> indexers = Collections.singleton(new SubstringIndexer()); AbstractSubstringMatchingRuleImpl() { // Nothing to do. @@ -565,8 +567,8 @@ /** {@inheritDoc} */ @Override public Indexer getIndexer() { return substringIndexer; public Collection<? extends Indexer> getIndexers() { return indexers; } } opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/KeywordEqualityMatchingRuleImpl.java
@@ -29,6 +29,9 @@ import static com.forgerock.opendj.util.StringPrepProfile.CASE_FOLD; import static com.forgerock.opendj.util.StringPrepProfile.TRIM; import java.util.Collection; import java.util.Collections; import org.forgerock.opendj.ldap.Assertion; import org.forgerock.opendj.ldap.ByteSequence; import org.forgerock.opendj.ldap.ByteString; @@ -119,8 +122,8 @@ /** {@inheritDoc} */ @Override public Indexer getIndexer() { return null; public Collection<? extends Indexer> getIndexers() { return Collections.emptySet(); } public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) { opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRule.java
@@ -359,12 +359,12 @@ } /** * Returns the indexer for this matching rule. * Returns the indexers for this matching rule. * * @return the indexer for this matching rule. * @return the collection of indexers for this matching rule. */ public Indexer getIndexer() { return impl.getIndexer(); public Collection<? extends Indexer> getIndexers() { return impl.getIndexers(); } /** opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleImpl.java
@@ -26,6 +26,7 @@ */ package org.forgerock.opendj.ldap.schema; import java.util.Collection; import java.util.Comparator; import java.util.List; @@ -141,11 +142,11 @@ throws DecodeException; /** * Returns the indexer for this matching rule. * Returns the indexers for this matching rule. * * @return the indexer for this matching rule. * @return a non null collection of indexers for this matching rule. */ Indexer getIndexer(); Collection<? extends Indexer> getIndexers(); /** * Returns whether a backend can build an index for this matching rule.