in spring-apacheds/src/main/java/org/apache/archiva/components/apacheds/DefaultApacheDs.java [144:190]
public Partition addSimplePartition( String name, String[] domainComponents )
throws NamingException
{
if ( domainComponents.length == 0 )
{
throw new NamingException( "Illegal argument, there has to be at least one domain component." );
}
StringBuilder suffix = new StringBuilder( );
for ( int i = 0; i < domainComponents.length; i++ )
{
String dc = domainComponents[i];
suffix.append( "dc=" ).append( dc );
if ( i != domainComponents.length - 1 )
{
suffix.append( "," );
}
}
// ----------------------------------------------------------------------
// The root entry of the partition
// ----------------------------------------------------------------------
Attributes attributes = new BasicAttributes( true );
attributes.put( "dc", domainComponents[0] );
Attribute objectClass = new BasicAttribute( "objectClass" );
objectClass.add( "top" );
objectClass.add( "domain" );
objectClass.add( "extensibleObject" );
attributes.put( objectClass );
Partition partition = new Partition( );
partition.setName( name );
partition.setSuffix( suffix.toString( ) );
partition.setContextAttributes( attributes );
HashSet set = new HashSet( );
set.add( "uid" );
set.add( "cn" );
partition.setIndexedAttributes( set );
addPartition( partition );
return partition;
}