public void handleExtendedOperation( LdapSession requestor, InternalExtendedRequest req )
throws Exception
{
DirectoryService service = requestor.getCoreSession().getDirectoryService();
if ( ! requestor.getCoreSession().isAnAdministrator() )
{
requestor.getIoSession().write( new LaunchDiagnosticUiResponse( req.getMessageId(),
ResultCodeEnum.INSUFFICIENT_ACCESS_RIGHTS ) );
return;
}
requestor.getIoSession().write( new LaunchDiagnosticUiResponse( req.getMessageId() ) );
PartitionNexus nexus = service.getPartitionNexus();
DN adminDn = new DN( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
adminDn.normalize( service.getSchemaManager().getNormalizerMapping() );
LdapPrincipal principal = new LdapPrincipal( adminDn, AuthenticationLevel.STRONG );
CoreSession session = service.getSession( principal );
Set<String> suffixes = nexus.listSuffixes( new ListSuffixOperationContext( session ) );
int launchedWindowCount = 0;
for ( String suffix:suffixes )
{
DN dn = new DN( suffix );
Partition partition = nexus.getPartition( dn );
if ( partition instanceof BTreePartition )
{
try
{
BTreePartition btPartition = ( BTreePartition ) partition;
// TODO : If a partition does not have an initial entry associated, we wil:
// get a NPE : this has to be fixed.
PartitionFrame frame = new PartitionFrame( btPartition, service.getSchemaManager() );
Point pos = getCenteredPosition( frame );
pos.y = launchedWindowCount * 20 + pos.y;
double multiplier = getAspectRatio() * 20.0;
pos.x = ( int ) ( launchedWindowCount * multiplier ) + pos.x;
frame.setLocation( pos );