String value = ( String ) ne.nextElement();
LdapSyntaxDescriptionSchemaParser parser = new LdapSyntaxDescriptionSchemaParser();
parser.setQuirksMode( true );
LdapSyntaxDescription lsd = parser.parseLdapSyntaxDescription( value );
SyntaxImpl impl = new SyntaxImpl( lsd.getNumericOid() );
impl.setDescription( lsd.getDescription() );
impl.setNames( new String[]
{ lsd.getDescription() } );
//impl.setObsolete( lsd.isObsolete() );
impl.setHumanReadable( true );
impl.setSchema( schema.getName() );
impl.setSchemaObject( schema );
schema.addSyntax( impl );
}
}
}
// if online: assume all received syntaxes in attributes are valid -> create dummy syntaxes if missing
for ( AttributeTypeImpl at : schema.getAttributeTypes() )
{
String syntaxOid = at.getSyntaxOid();
if ( syntaxOid != null && schema.getSyntax( syntaxOid ) == null )
{
SyntaxImpl impl = new SyntaxImpl( syntaxOid );
impl.setSchema( schema.getName() );
impl.setSchemaObject( schema );
String oidDescription = Utils.getOidDescription( syntaxOid );
impl.setDescription( oidDescription != null ? oidDescription : "Dummy" ); //$NON-NLS-1$
impl.setNames( new String[]
{ impl.getDescription() } );
schema.addSyntax( impl );
}
}
Attribute matchingRulesAttribute = searchResult.getAttributes().get( "matchingRules" );
if ( matchingRulesAttribute != null )
{
NamingEnumeration<?> ne = matchingRulesAttribute.getAll();
if ( ne != null )
{
while ( ne.hasMoreElements() )
{
String value = ( String ) ne.nextElement();
MatchingRuleDescriptionSchemaParser parser = new MatchingRuleDescriptionSchemaParser();
parser.setQuirksMode( true );
MatchingRuleDescription mrd = parser.parseMatchingRuleDescription( value );
MatchingRuleImpl impl = new MatchingRuleImpl( mrd.getNumericOid() );
impl.setDescription( mrd.getDescription() );
impl.setNames( mrd.getNames().toArray( new String[0] ) );
impl.setObsolete( mrd.isObsolete() );
impl.setSyntaxOid( mrd.getSyntax() );
impl.setSchema( schema.getName() );
impl.setSchemaObject( schema );
schema.addMatchingRule( impl );
}
}
}