try
{
if ( attributeName.equalsIgnoreCase( SchemaConstants.OBJECT_CLASSES_AT ) )
{
ObjectClassDescription ocd = ocdPparser.parseObjectClassDescription( value );
ocd.addExtension( RAW_SCHEMA_DEFINITION_LDIF_VALUE, ldifValues );
addObjectClassDescription( ocd );
}
else if ( attributeName.equalsIgnoreCase( SchemaConstants.ATTRIBUTE_TYPES_AT ) )
{
AttributeTypeDescription atd = atdParser.parseAttributeTypeDescription( value );
atd.addExtension( RAW_SCHEMA_DEFINITION_LDIF_VALUE, ldifValues );
addAttributeTypeDescription( atd );
}
else if ( attributeName.equalsIgnoreCase( SchemaConstants.LDAP_SYNTAXES_AT ) )
{
LdapSyntaxDescription lsd = lsdParser.parseLdapSyntaxDescription( value );
if ( StringUtils.isEmpty( lsd.getDescription() )
&& Utils.getOidDescription( lsd.getNumericOid() ) != null )
{
lsd.setDescription( Utils.getOidDescription( lsd.getNumericOid() ) );
}
lsd.addExtension( RAW_SCHEMA_DEFINITION_LDIF_VALUE, ldifValues );
addLdapSyntaxDescription( lsd );
}
else if ( attributeName.equalsIgnoreCase( SchemaConstants.MATCHING_RULES_AT ) )
{
MatchingRuleDescription mrd = mrdParser.parseMatchingRuleDescription( value );
mrd.addExtension( RAW_SCHEMA_DEFINITION_LDIF_VALUE, ldifValues );
addMatchingRuleDescription( mrd );
}
else if ( attributeName.equalsIgnoreCase( SchemaConstants.MATCHING_RULE_USE_AT ) )
{
MatchingRuleUseDescription mrud = mrudParser.parseMatchingRuleUseDescription( value );
mrud.addExtension( RAW_SCHEMA_DEFINITION_LDIF_VALUE, ldifValues );
addMatchingRuleUseDescription( mrud );
}
else if ( attributeName.equalsIgnoreCase( SchemaConstants.CREATE_TIMESTAMP_AT ) )
{
setCreateTimestamp( value );
}
else if ( attributeName.equalsIgnoreCase( SchemaConstants.MODIFY_TIMESTAMP_AT ) )
{
setModifyTimestamp( value );
}
}
catch ( Exception e )
{
// TODO: exception handling
System.out.println( "Error reading schema: " + attributeName + " = " + value );
System.out.println( e.getMessage() );
}
}
for ( AttributeTypeDescription atd : getAttributeTypeDescriptions() )
{
// assume all received syntaxes in attributes are valid -> create pseudo syntaxes if missing
String syntaxOid = atd.getSyntax();
if ( syntaxOid != null && !hasLdapSyntaxDescription( syntaxOid ) )
{
LdapSyntaxDescription lsd = new LdapSyntaxDescription();
lsd.setNumericOid( syntaxOid );
lsd.setDescription( Utils.getOidDescription( syntaxOid ) );
addLdapSyntaxDescription( lsd );
}
// assume all received matching rules in attributes are valid -> create pseudo matching rules if missing
String emr = atd.getEqualityMatchingRule();
String omr = atd.getOrderingMatchingRule();
String smr = atd.getSubstringsMatchingRule();
checkMatchingRules( emr, omr, smr );
}
// set extensibleObject may attributes
ObjectClassDescription extensibleObjectOcd = this
.getObjectClassDescription( SchemaConstants.EXTENSIBLE_OBJECT_OC );
Collection<AttributeTypeDescription> userAtds = SchemaUtils.getUserAttributeDescriptions( this );
Collection<String> atdNames = SchemaUtils.getNames( userAtds );
List<String> atdNames2 = new ArrayList<String>( atdNames );
extensibleObjectOcd.setMayAttributeTypes( atdNames2 );
}