throws NamingException
{
monitor.subTask( name );
// Creating the schema
Schema schema = new Schema( name );
// Looking for the nodes of the schema
SearchControls constraintSearch = new SearchControls();
constraintSearch.setSearchScope( SearchControls.SUBTREE_SCOPE );
NamingEnumeration<SearchResult> answer = wrapper.search( "cn=" + name + ", ou=schema", "(objectclass=*)", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
constraintSearch, DEREF_ALIAS_METHOD, HANDLE_REFERALS_METHOD, null, monitor, null );
if ( answer != null )
{
try
{
while ( answer.hasMore() )
{
SearchResult searchResult = answer.next();
switch ( getNodeType( searchResult ) )
{
case ATTRIBUTE_TYPE:
AttributeType at = createAttributeType( searchResult );
at.setSchemaName( name );
schema.addAttributeType( at );
break;
case OBJECT_CLASS:
MutableObjectClass oc = createObjectClass( searchResult );
oc.setSchemaName( name );
schema.addObjectClass( oc );
break;
case MATCHING_RULE:
MatchingRule mr = createMatchingRule( searchResult );
mr.setSchemaName( name );
schema.addMatchingRule( mr );
break;
case SYNTAX:
LdapSyntax syntax = createSyntax( searchResult );
syntax.setSchemaName( name );
schema.addSyntax( syntax );
break;
default:
break;
}
}