directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alan Hazelton" <>
Subject [ApacheDS] How to register a new AttributeType within an interceptor's startup?
Date Fri, 19 Mar 2010 18:42:18 GMT
I have written an interceptor that makes use of a custom AttributeType
and it works fine when I manually import that AttributeType via an ldif
import.  I want to make my interceptor more robust by automatically
registering the AttributeType on startup if it is not yet defined.  I
tried the code below but I get a
"javax.naming.ServiceUnavailableException: Directory service is not
started." error when I add the entry.  What is the correct way to add a
new AttributeType within an interceptor?
[called from the interceptor's init() method]
private void registerEntryDNAttributeType(DirectoryService
      LdapDN entryDN = new
      ServerEntry serverEntry = directoryService.newEntry(entryDN);
      serverEntry.add("m-name", ENTRY_DN_NAME);
      serverEntry.add("m-description", "Sun ONE defined virtual
attribute type");
      serverEntry.add("m-equality", "");
      serverEntry.add("m-syntax", "");
      serverEntry.add("m-singleValue", "true"); 
      serverEntry.add("m-usage", "DSA_OPERATION");
    catch (Exception e)
       logger.error("Failed adding entryDN attribute type", e); 

View raw message