Re: Embedded ApacheDS

2017-02-09 Thread Krish

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

> On Feb 9, 2017, at 10:49 AM, Krish  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  
>> 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


Re: Embedded ApacheDS

2017-02-09 Thread Emmanuel Lécharny


Le 09/02/2017 à 16:18, Cyril FILLON a écrit :
> 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.

Have you added a context Entry ? If not, you won't see your partition in
Studio (but you should see in the rootDSE's NamingContexts)

-- 
Emmanuel Lecharny

Symas.com
directory.apache.org



Re: Embedded ApacheDS

2017-02-09 Thread Krish
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  
> 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


Embedded ApacheDS

2017-02-09 Thread Cyril FILLON
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


Re: Transferring an entire directory from one server to another

2017-02-09 Thread Emmanuel Lécharny


Le 09/02/2017 à 01:49, Steve Sobol - Lobos Studios a écrit :
> Good afternoon
>
> I'm using Studio (on Windows 10) to create a directory tree and do some
> local testing of a Java app I'm writing. I'm eventually going to want to
> copy the tree over to an ApacheDS server which will run on Ubuntu 16.04 (or
> 14.04, I forget which I have installed) and start populating it with live
> users.
>
> Is the process as simple as exporting everything from the Root DSE down as
> an LDIF? Or is it more nuanced than that?

It shoudl be as simple as that.
>
> Is there a command-line utility I can use to import the data on the Linux
> server? (If not, that's cool, I can use Studio over an SSH tunnel)

ldapadd , which is part of the OpenLDAP package (the client part)

-- 
Emmanuel Lecharny

Symas.com
directory.apache.org