1 17 package org.apache.ldap.server.schema; 18 19 20 import org.apache.ldap.common.name.NameComponentNormalizer; 21 import org.apache.ldap.common.schema.AttributeType; 22 import org.apache.ldap.common.schema.Normalizer; 23 24 import javax.naming.NamingException ; 25 26 27 35 public class ConcreteNameComponentNormalizer implements NameComponentNormalizer 36 { 37 38 private final AttributeTypeRegistry registry; 39 40 41 48 public ConcreteNameComponentNormalizer( AttributeTypeRegistry registry ) 49 { 50 this.registry = registry; 51 } 52 53 54 57 public String normalizeByName( String name, String value ) throws NamingException 58 { 59 return lookup( name ).normalize( value ).toString(); 60 } 61 62 63 66 public String normalizeByOid( String oid, String value ) throws NamingException 67 { 68 return lookup( oid ).normalize( value ).toString(); 69 } 70 71 72 83 private Normalizer lookup( String id ) throws NamingException 84 { 85 AttributeType type = registry.lookup( id ); 86 return type.getEquality().getNormalizer(); 87 } 88 } 89 | Popular Tags |