{
String value = ( String ) ne.nextElement();
try
{
ObjectClassDescriptionSchemaParser parser = new ObjectClassDescriptionSchemaParser();
parser.setQuirksMode( true );
ObjectClass ocd = parser.parseObjectClassDescription( value );
MutableObjectClass impl = new MutableObjectClass( ocd.getOid() );
impl.setNames( ocd.getNames().toArray( new String[0] ) );
impl.setDescription( ocd.getDescription() );
impl.setSuperiorOids( ocd.getSuperiorOids() );
impl.setType( ocd.getType() );
impl.setObsolete( ocd.isObsolete() );
impl.setMustAttributeTypeOids( ocd.getMustAttributeTypeOids() );
impl.setMayAttributeTypeOids( ocd.getMayAttributeTypeOids() );
impl.setSchemaName( schema.getSchemaName() );
schema.addObjectClass( impl );
}
catch ( ParseException e )
{
// Logging the exception and incrementing the counter
PluginUtils.logError( "Unable to parse the object class.", e );
parseErrorCount++;
}
}
}
}
Attribute ldapSyntaxesAttribute = searchResult.getAttributes().get( "ldapSyntaxes" ); //$NON-NLS-1$
if ( ldapSyntaxesAttribute != null )
{
NamingEnumeration<?> ne = ldapSyntaxesAttribute.getAll();
if ( ne != null )
{
while ( ne.hasMoreElements() )
{
String value = ( String ) ne.nextElement();
try
{
LdapSyntaxDescriptionSchemaParser parser = new LdapSyntaxDescriptionSchemaParser();
parser.setQuirksMode( true );
LdapSyntax lsd = parser.parseLdapSyntaxDescription( value );
LdapSyntax impl = new LdapSyntax( lsd.getOid() );
impl.setDescription( lsd.getDescription() );
impl.setNames( new String[]
{ lsd.getDescription() } );
//impl.setObsolete( lsd.isObsolete() );
impl.setHumanReadable( true );
impl.setSchemaName( schema.getSchemaName() );
schema.addSyntax( impl );
}
catch ( ParseException e )
{
// Logging the exception and incrementing the counter
PluginUtils.logError( "Unable to parse the syntax.", e );
parseErrorCount++;
}
}
}
}
// if online: assume all received syntaxes in attributes are valid -> create dummy syntaxes if missing
for ( AttributeType at : schema.getAttributeTypes() )
{
String syntaxOid = at.getSyntaxOid();
if ( syntaxOid != null && schema.getSyntax( syntaxOid ) == null )
{
LdapSyntax impl = new LdapSyntax( syntaxOid );
impl.setSchemaName( schema.getSchemaName() );
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" ); //$NON-NLS-1$
if ( matchingRulesAttribute != null )
{
NamingEnumeration<?> ne = matchingRulesAttribute.getAll();
if ( ne != null )
{
while ( ne.hasMoreElements() )
{
String value = ( String ) ne.nextElement();
try
{
MatchingRuleDescriptionSchemaParser parser = new MatchingRuleDescriptionSchemaParser();
parser.setQuirksMode( true );
MatchingRule mrd = parser.parseMatchingRuleDescription( value );
MutableMatchingRule impl = new MutableMatchingRule( mrd.getOid() );
impl.setDescription( mrd.getDescription() );
impl.setNames( mrd.getNames().toArray( new String[0] ) );
impl.setObsolete( mrd.isObsolete() );