MatchingRule matchingRule = new MatchingRule( "1.1.2" ); matchingRule.setSyntax( syntax ); matchingRule.setLdapComparator( new LdapComparator<String>( matchingRule.getOid() ) matchingRule.setNormalizer( new DeepTrimToLowerNormalizer( matchingRule.getOid() ) );
if ( mr.getComparator() == null ) String schema = matchingRuleRegistry.getSchemaName( mr.getOid() ); errors.add( new NullPointerException( "matchingRule " + mr.getName() + " in schema " + schema + " with OID " + mr.getOid() + " has a null comparator" ) ); isSuccess = false; if ( mr.getNormalizer() == null ) String schema = matchingRuleRegistry.getSchemaName( mr.getOid() ); errors.add( new NullPointerException( "matchingRule " + mr.getName() + " in schema " + schema + " with OID " + mr.getOid() + " has a null normalizer" ) ); isSuccess = false; isSuccess &= resolve( mr.getSyntax(), errors ); if ( mr.getSyntax() == null ) String schema = matchingRuleRegistry.getSchemaName( mr.getOid() ); errors.add( new NullPointerException( "matchingRule " + mr.getName() + " in schema " + schema + " with OID " + mr.getOid() + " has a null Syntax" ) ); isSuccess = false;
/** * Delete the MR references (using and usedBy) : * MR -> C * MR -> N * MR -> S */ 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() ); } }
/** * Copy an MatchingRule */ public MatchingRule copy() { MatchingRule copy = new MatchingRule( 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; }
public void register( String schema, MatchingRule dITContentRule ) throws NamingException { if ( byOid.containsKey( dITContentRule.getOid() ) || bootstrap.hasMatchingRule( dITContentRule.getOid() ) ) { NamingException e = new NamingException( "dITContentRule w/ OID " + dITContentRule.getOid() + " has already been registered!" ); monitor.registerFailed( dITContentRule, e ); throw e; } oidRegistry.register( dITContentRule.getName(), dITContentRule.getOid() ); byOid.put( dITContentRule.getOid(), dITContentRule ); oidToSchema.put( dITContentRule.getOid(), schema ); monitor.registered( dITContentRule ); }
/** * Update the associated Substring MatchingRule, even if the SchemaObject is readOnly * * @param substring The Substr MR for this AttributeType */ public void updateSubstring( MatchingRule substring ) { if ( locked ) { throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) ); } this.substring = substring; this.substringOid = substring.getOid(); }
buf.append( matchingRule.getOid() ); buf.append( '\n' ); if ( matchingRule.getNames() != null ) getQDescrs( buf, matchingRule.getNames() ); if ( matchingRule.getDescription() != null ) buf.append( matchingRule.getDescription() ); buf.append( '\n' ); if ( matchingRule.isObsolete() ) buf.append( matchingRule.getSyntaxOid() ); buf.append( '\n' ); if ( matchingRule.getExtensions() != null ) getExtensions( buf, matchingRule.getExtensions() );
buf.append( "( " ).append( mr.getOid() ); List<String> names = mr.getNames(); if ( mr.getDescription() != null ) renderQDString( buf, mr.getDescription() ); if ( mr.isObsolete() ) buf.append( " SYNTAX " ).append( mr.getSyntax().getOid() ); buf.append( mr.getSchemaName() ); buf.append( "'" );
String syntaxOid = matchingRule.getSyntaxOid(); I18n.err( I18n.ERR_04294, matchingRule.getOid() ) ); errors.add( error ); Normalizer normalizer = matchingRule.getNormalizer(); I18n.err( I18n.ERR_04295, matchingRule.getOid() ) ); errors.add( error ); LdapComparator<?> comparator = matchingRule.getLdapComparator(); I18n.err( I18n.ERR_04296, matchingRule.getOid() ) ); errors.add( error );
/** * Gets the normalizer for equality matching. * * @param attrId the attribute identifier * @return the normalizer for equality matching * @throws javax.naming.NamingException if there is a failure */ private Normalizer getNormalizer( String attrId ) throws NamingException { MatchingRule mrule = getMatchingRule( attrId, EQUALITY_MATCH ); return mrule.getNormalizer(); }
if ( matchingRule.getNormalizer() == null ) if ( !normalizerRegistry.contains( matchingRule.getNormalizer().getOid() ) ) LOG.debug( "Cannot find the Normalizer {} for the MatchingRule {}", matchingRule.getNormalizer() .getOid(), matchingRule ); if ( matchingRule.getLdapComparator() == null ) if ( !comparatorRegistry.contains( matchingRule.getLdapComparator().getOid() ) ) LOG.debug( "Cannot find the Comparator {} for the MatchingRule {}", matchingRule.getLdapComparator() .getOid(), matchingRule ); if ( matchingRule.getSyntax() == null ) if ( !ldapSyntaxRegistry.contains( matchingRule.getSyntax().getOid() ) ) LOG.debug( "Cannot find the Syntax {} for the MatchingRule {}", 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() ) )
matchingRule = new MatchingRule(numericoid(oid.getText())); et.track("NAME", name); matchingRule.setNames(qdescrs(name.getText())); et.track("DESC", desc); matchingRule.setDescription(qdstring(desc.getText())); et.track("OBSOLETE", obsolete); matchingRule.setObsolete( true ); et.track("SYNTAX", syntax); matchingRule.setSyntaxOid(numericoid(syntax.getText())); matchingRule.addExtension(ex.key, ex.values);
/** * @see MatchingRuleRegistry#register(String, MatchingRule) */ public void register( String schema, MatchingRule matchingRule ) throws NamingException { if ( byOid.containsKey( matchingRule.getOid() ) ) { NamingException e = new NamingException( "matchingRule w/ OID " + matchingRule.getOid() + " has already been registered!" ); monitor.registerFailed( matchingRule, e ); throw e; } oidToSchema.put( matchingRule.getOid(), schema ); String[] names = matchingRule.getNames(); for ( int ii = 0; ii < names.length; ii++ ) { oidRegistry.register( names[ii], matchingRule.getOid() ); } byOid.put( matchingRule.getOid(), matchingRule ); monitor.registered( matchingRule ); }
/** * Gets the MatchingRule name for this AttributeType used for Ordering matching. * * @return the Ordering matching rule name */ public String getOrderingName() { if ( ordering != null ) { return ordering.getName(); } else { return orderingOid; } }
normalizer = mr.getNormalizer(); LdapComparator<K> comp = ( LdapComparator<K> ) mr.getLdapComparator();
MatchingRule matchingRule = new MatchingRule( oid ); matchingRule.setSyntaxOid( mSyntax.getString() );
public static MatchingRule matchingRuleFactory( String oid ) { MatchingRule matchingRule = new MatchingRule( oid ); return matchingRule; } /**
/** * Checks to see if two matchingRule match exactly. * * @param mrd0 the first matchingRule to compare * @param mrd1 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; }
/** * Gets a comparator using getMatchingRule() to resolve the matching * that the comparator is extracted from. * * @return a comparator associated with the attributeType or null if one cannot be found * @throws LdapException if resolution of schema entities fail */ protected LdapComparator<T> getLdapComparator() throws LdapException { if ( attributeType != null ) { MatchingRule mr = getMatchingRule(); if ( mr == null ) { return null; } return (LdapComparator<T>)mr.getLdapComparator(); } else { return null; } }
/** * Update the associated Equality MatchingRule, even if the SchemaObject is readOnly * * @param equality The Equality MR for this AttributeType */ public void updateEquality( MatchingRule equality ) { if ( locked ) { throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) ); } this.equality = equality; this.equalityOid = equality.getOid(); }