/** * Sets the Substr MR for this AttributeType * * @param substring The Substr MR for this AttributeType */ public void setSubstring( MatchingRule substring ) { if ( locked ) { throw new UnsupportedOperationException( I18n.err( I18n.ERR_13700_CANNOT_MODIFY_LOCKED_SCHEMA_OBJECT, getName() ) ); } this.substring = substring; this.substringOid = substring.getOid(); }
/** * Delete the MR references (using and usedBy) : * MR -> C * MR -> N * MR -> S * * @param matchingRule The MatchinRule refere ce to delete */ public void delCrossReferences( MatchingRule matchingRule ) { if ( matchingRule.getLdapComparator() != null ) { delReference( matchingRule, matchingRule.getLdapComparator() ); } if ( matchingRule.getNormalizer() != null ) { delReference( matchingRule, matchingRule.getNormalizer() ); } if ( matchingRule.getSyntax() != null ) { delReference( matchingRule, matchingRule.getSyntax() ); } }
/** * Checks to see if two matchingRule match exactly. * * @param matchingRule0 the first matchingRule to compare * @param matchingRule1 the second matchingRule to compare * @return true if the matchingRules match exactly, false otherwise */ public static boolean matchingRulesMatch( MatchingRule matchingRule0, MatchingRule matchingRule1 ) { // compare all common description parameters if ( !descriptionsMatch( matchingRule0, matchingRule1 ) ) { return false; } // check that the syntaxes of the matchingRules match if ( !matchingRule0.getSyntaxOid().equals( matchingRule1.getSyntaxOid() ) ) { return false; } return true; }
if ( matchingRule.getNormalizer() == null ) if ( !normalizerRegistry.contains( matchingRule.getNormalizer().getOid() ) ) LOG.debug( I18n.msg( I18n.MSG_13709_CANT_FIND_NORM_FOR_MR, matchingRule.getNormalizer() .getOid(), matchingRule ) ); if ( matchingRule.getLdapComparator() == null ) if ( !comparatorRegistry.contains( matchingRule.getLdapComparator().getOid() ) ) LOG.debug( I18n.msg( I18n.MSG_13707_CANT_FIND_AT_FOR_MR, matchingRule.getLdapComparator().getOid(), matchingRule ) ); if ( matchingRule.getSyntax() == null ) if ( !ldapSyntaxRegistry.contains( matchingRule.getSyntax().getOid() ) ) LOG.debug( I18n.msg( I18n.MSG_13712_CANT_FIND_SYN_FOR_MR, matchingRule.getSyntax().getOid(), matchingRule ) ); if ( !checkReferences( matchingRule, matchingRule.getSyntax(), "Syntax" ) ) if ( !checkReferences( matchingRule, matchingRule.getNormalizer(), "Normalizer" ) ) if ( !checkReferences( matchingRule, matchingRule.getLdapComparator(), "Comparator" ) ) if ( !matchingRuleRegistry.contains( attributeType.getEquality().getOid() ) )
String syntaxOid = matchingRule.getSyntaxOid(); LdapSchemaExceptionCodes.OID_ALREADY_REGISTERED, I18n.err( I18n.ERR_13748_MATCHING_RULE_NO_SYNTAX, matchingRule.getOid() ), ne ); ldapSchemaException.setSourceObject( matchingRule ); LdapSchemaExceptionCodes.OID_ALREADY_REGISTERED, I18n.err( I18n.ERR_13748_MATCHING_RULE_NO_SYNTAX, matchingRule.getOid() ) ); ldapSchemaException.setSourceObject( matchingRule ); errorHandler.handle( LOG, ldapSchemaException.getMessage(), ldapSchemaException ); Normalizer normalizer = matchingRule.getNormalizer(); I18n.ERR_13220_NO_NORMALIZER, matchingRule.getOid() ) ); errorHandler.handle( LOG, error.getMessage(), error ); LdapComparator<?> comparator = matchingRule.getLdapComparator(); I18n.ERR_13413_MR_DOES_NOT_HAVE_A_COMP, matchingRule.getOid() ) ); errorHandler.handle( LOG, error.getMessage(), error );
normalizer = attributeType.getEquality().getNormalizer(); LdapComparator<Object> ldapComparator = equalityMR.getLdapComparator();
/** * Gets the normalizer for equality matching. * * @param attributeType the attributeType * @return the normalizer for equality matching * @throws LdapException if there is a failure */ private Normalizer getNormalizer( AttributeType attributeType ) throws LdapException { MatchingRule mrule = getMatchingRule( attributeType, EQUALITY_MATCH ); return mrule.getNormalizer(); }
/** * Gets the comparator for equality matching. * * @param attributeType the attributeType * @return the comparator for equality matching * @throws LdapException if there is a failure */ private LdapComparator<? super Object> getComparator( AttributeType attributeType ) throws LdapException { MatchingRule mrule = getMatchingRule( attributeType, EQUALITY_MATCH ); return mrule.getLdapComparator(); }
matchingRule.setSpecification( value.getValue() ); if ( !schemaManager.getLdapSyntaxRegistry().contains( matchingRule.getSyntaxOid() ) ) I18n.err( I18n.ERR_425, matchingRule.getSyntaxOid() ) );
/** * Check if a syntax is used by an AT or a MR */ private List<SchemaObject> checkInUse( String oid ) { List<SchemaObject> dependees = new ArrayList<>(); for ( AttributeType attributeType : schemaManager.getAttributeTypeRegistry() ) { if ( oid.equals( attributeType.getSyntax().getOid() ) ) { dependees.add( attributeType ); } } for ( MatchingRule matchingRule : schemaManager.getMatchingRuleRegistry() ) { if ( oid.equals( matchingRule.getSyntax().getOid() ) ) { dependees.add( matchingRule ); } } return dependees; }
matchingRule.setSpecification( matchingRuleDescription );
/** * {@inheritDoc} */ @Override public void clear() { // Clear the common elements super.clear(); // Clear the references ldapComparator = null; ldapSyntax = null; normalizer = null; } }
/** * Copy an MatchingRule */ @Override public MatchingRule copy() { MatchingRule copy = new MutableMatchingRule( oid ); // Copy the SchemaObject common data copy.copy( this ); // All the references to other Registries object are set to null. copy.ldapComparator = null; copy.ldapSyntax = null; copy.normalizer = null; // Copy the syntax OID copy.ldapSyntaxOid = ldapSyntaxOid; return copy; }
if ( !compareOid( ldapSyntaxOid, that.ldapSyntaxOid ) )
if ( matchingRule.getNormalizer() == null ) if ( !normalizerRegistry.contains( matchingRule.getNormalizer().getOid() ) ) LOG.debug( I18n.msg( I18n.MSG_13709_CANT_FIND_NORM_FOR_MR, matchingRule.getNormalizer() .getOid(), matchingRule ) ); if ( matchingRule.getLdapComparator() == null ) if ( !comparatorRegistry.contains( matchingRule.getLdapComparator().getOid() ) ) LOG.debug( I18n.msg( I18n.MSG_13707_CANT_FIND_AT_FOR_MR, matchingRule.getLdapComparator().getOid(), matchingRule ) ); if ( matchingRule.getSyntax() == null ) if ( !ldapSyntaxRegistry.contains( matchingRule.getSyntax().getOid() ) ) LOG.debug( I18n.msg( I18n.MSG_13712_CANT_FIND_SYN_FOR_MR, matchingRule.getSyntax().getOid(), matchingRule ) ); if ( !checkReferences( matchingRule, matchingRule.getSyntax(), "Syntax" ) ) if ( !checkReferences( matchingRule, matchingRule.getNormalizer(), "Normalizer" ) ) if ( !checkReferences( matchingRule, matchingRule.getLdapComparator(), "Comparator" ) ) if ( !matchingRuleRegistry.contains( attributeType.getEquality().getOid() ) )
String syntaxOid = matchingRule.getSyntaxOid(); LdapSchemaExceptionCodes.OID_ALREADY_REGISTERED, I18n.err( I18n.ERR_13748_MATCHING_RULE_NO_SYNTAX, matchingRule.getOid() ), ne ); ldapSchemaException.setSourceObject( matchingRule ); LdapSchemaExceptionCodes.OID_ALREADY_REGISTERED, I18n.err( I18n.ERR_13748_MATCHING_RULE_NO_SYNTAX, matchingRule.getOid() ) ); ldapSchemaException.setSourceObject( matchingRule ); errorHandler.handle( LOG, ldapSchemaException.getMessage(), ldapSchemaException ); Normalizer normalizer = matchingRule.getNormalizer(); I18n.ERR_13220_NO_NORMALIZER, matchingRule.getOid() ) ); errorHandler.handle( LOG, error.getMessage(), error ); LdapComparator<?> comparator = matchingRule.getLdapComparator(); I18n.ERR_13413_MR_DOES_NOT_HAVE_A_COMP, matchingRule.getOid() ) ); errorHandler.handle( LOG, error.getMessage(), error );
normalizer = attributeType.getEquality().getNormalizer(); LdapComparator<Object> ldapComparator = equalityMR.getLdapComparator();
String normalizedOther = attributeType.getEquality().getNormalizer().normalize( other );