directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tino Schwarze <t...@in-chemnitz.de>
Subject Re: I'm impressed
Date Fri, 29 Dec 2006 08:47:29 GMT
Hi Johan,

I'm CCing to the list since it might be interesting for other people as well.

On Fri, Dec 29, 2006 at 08:26:11AM +0100, Johan Asterholm wrote:

> Im about to do the same but towards another system. Any chance that you
> could share whats needed in
> order to do this?

I implemented the following:

- EISPartition 
  (implements org.apache.directory.server.core.partition.Partition)
- EISPartitionConfiguration (implements
  org.apache.directory.server.core.partition.PartitionConfiguration,
  adds some open-EIS specific options)
- EISObjectClass (implements
  org.apache.directory.shared.ldap.schema.ObjectClass)
- EISAttributeType (implements
  org.apache.directory.shared.ldap.schema.AttributeType)
- EISSchemaMgr
  * provides Template -> ObjectClass mapping (creates EISObjectClasses,
    figures out mandatory and optional attributes)
  * provides Component -> AttributeType mapping (creates
    EISAttributeType)
  * provides Template GUID -> OID mapping
  * provides Component -> OID mapping (some open-EIS components are
    special and will be shared amongst templates)
  * caches the above

You may also want to have a look at
org.apache.directory.server.core.schema.bootstrap.SystemSyntaxProducer
and
org.apache.directory.server.core.schema.bootstrap.SystemMatchingRuleProducer
for default syntaxes and matching rules available (@developers: There
are a lot of strings in there which should be collected somewhere
central as constants with readable names - not everybody knows by heart 
that 1.3.6.1.4.1.1466.115.121.1.15 is a Directory String -
BOOTSTRAP_SYNTAX_DIRECTORY_STRING would be more readable and could be
reused somewhere else; I've got the same strings in my classes now).

Then I added my partition to the server:

  MutableServerStartupConfiguration _serverconfig = new MutableServerStartupConfiguration
();
  // ... initialize system partition, add bootstrap schema (I do it by
  // hand)

  // then setup our EIS partition
  EISPartitionConfiguration _eispc = new EISPartitionConfiguration();
  
  _eispc.setName("eis");
  _eispc.setSuffix("o=community4you.de");
  
  _objectClassAttr = new BasicAttribute("objectClass", "top");
  _objectClassAttr.add("organization");
  _objectClassAttr.add("extensibleObject");
  _entryAttr = new BasicAttributes ("o", "community4you.de");
  _entryAttr.put (_objectClassAttr);
  _eispc.setContextEntry(_entryAttr);
  // use our special partition
  _eispc.setContextPartition(new EISPartition());
  // and configure it
  _eispc.setRootCategory(new ContentHandle<Category> (CoreCategories.CORE_ADMIN_USERS,

      LanguageMgr.getInstance().getDefaultLanguageGUID(), Category.TEMPLATE_GUID));
  
  Set<PartitionConfiguration> _contextPartitions = new LinkedHashSet<PartitionConfiguration>();
  _contextPartitions.add (_eispc);
  _serverconfig.setContextPartitionConfigurations(_contextPartitions);

  // then launch server via JNDI
  Hashtable<String, Object> _environment = new Hashtable<String, Object>();
  
  _environment.put ("java.naming.security.authentication", "simple");
  _environment.put ("java.naming.security.principal", "uid=admin,ou=system");
  _environment.put ("java.naming.security.credentials", "secret");
  
  _environment.put ("java.naming.provider.url", "ou=system");
  _environment.put ("java.naming.factory.initial", "org.apache.directory.server.jndi.ServerContextFactory");
  _environment.put ("org.apache.directory.server.core.configuration.Configuration", _serverconfig);
 
  // this actually starts up the server
  InitialDirContext _idc = new InitialDirContext (_environment);


HTH,

Tino.

-- 
www.quantenfeuerwerk.de
www.spiritualdesign-chemnitz.de
www.lebensraum11.de

Mime
View raw message