On 07/11/2019 04:11, Krish Dey wrote:
Hi All,
I am trying to do User Lookup and eventually returning their groups.

Its returning the result very slow. A single filtering is taking around 2
secs.
Though i have done the following,

partitionFactory.addIndex
<https://www.codota.com/code/java/methods/org.apache.directory.server.core.factory.PartitionFactory/addIndex>(partition,
SchemaConstants.OBJECT_CLASS_AT, 5000);

This is just adding an Index on the ObjectClass attributeType. You might want to add more indexes, depending on the search Filter you are using.

Typically, you may want to index the SAMAccount attribute.



Is it not enough?
I have added a custom attribute to my partition which is sAMAccount.

Do I need to do anything different?

Any help would be appreciated.

Thanks
Krish


On Tue, Feb 14, 2017 at 3:16 PM Cyril FILLON <[email protected]>
wrote:


Many thanks, this link has been really helpful for me.
Thanks again.




----- Mail original -----
De : Krish <[email protected]>
À : [email protected]
Envoyé le : Jeudi 9 février 2017 17h20
Objet : Re: Embedded ApacheDS


https://github.com/krishdey/EmbeddedLdapKDC
Sorry forgot to paste the link
Sent from my iPhone


On Feb 9, 2017, at 10:49 AM, Krish <[email protected]> wrote:

Look into this project and see if it helps.
I have created an embedded apache ds and also loaded custom partook and
Microsoft schema custom attributes to it.
Thanks
Krish

Sent from my iPhone

On Feb 9, 2017, at 10:18 AM, Cyril FILLON <[email protected]>
wrote:
Hi all,


I am trying to setup an embedded ApacheDS 2.0.0-M23 server from my java
code, snippet is given below.
I tried to create a new partition, but unfortunately it fails miserably
since I cannot see this partition from ApacheDS Studio.
Anyone could help me or give me a code snippet in order to be able to
start the ApacheDS server from Java code and create a partition?
I already gave a look to the documentation page
http://directory.apache.org/apacheds/basic-ug/1.4.3-adding-partition.html,
however the code snippet does not work as well.

Many thanks in advance.

public void start()
{
   ApacheDsService apacheDsService = new ApacheDsService();

   apacheDsService.start(new InstanceLayout(this.ldapInstanceFolder));
   DirectoryService directoryService =
this.apacheDsService.getDirectoryService();
   directoryService.getChangeLog().setEnabled(true);
   directoryService.setAllowAnonymousAccess(true);

   final SchemaManager schemaManager =
this.directoryService.getSchemaManager();

   // Create the partition
   final Dn suffixDn = new Dn(schemaManager, "o=sevenSeas");    final
JdbmPartition partition = getJdbmPartition(this.directoryService,
"sevenSeas", suffixDn, contextEntry);
   partition.initialize();


   directoryService.addPartition(partition);
}


private JdbmPartition getJdbmPartition(final DirectoryService
directoryService, final String partitionId, final Dn suffixDN, final Entry
entry) throws ConfigurationException
  {
   final JdbmPartition jdbmPartition = new
JdbmPartition(directoryService.getSchemaManager(),
directoryService.getDnFactory());
   jdbmPartition.setId(partitionId);
   jdbmPartition.setCacheSize(1000);
   jdbmPartition.setOptimizerEnabled(true);
   File partitionPath = new
File(directoryService.getInstanceLayout().getPartitionsDirectory(),
partitionId);
   jdbmPartition.setPartitionPath(partitionPath.toURI());

   try
   {
     jdbmPartition.setSuffixDn(suffixDN);
   }
   catch (final LdapInvalidDnException lide)
   {
     lide.printStackTrace();
     throw new ConfigurationException(lide.getMessage());
   }

   jdbmPartition.setSyncOnWrite(true);

      return jdbmPartition;
}

Cyril

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to