com.atlassian.crowd.apacheds
Class ApacheDSContextListener

java.lang.Object
  extended by com.atlassian.crowd.apacheds.ApacheDSContextListener
All Implemented Interfaces:
java.util.EventListener, javax.servlet.ServletContextListener

public class ApacheDSContextListener
extends java.lang.Object
implements javax.servlet.ServletContextListener

A Servlet context listener to start and stop ApacheDS. The following environment variables are supported:

The server is both self-contained and light-weight.


Constructor Summary
ApacheDSContextListener()
           
 
Method Summary
 void contextDestroyed(javax.servlet.ServletContextEvent evt)
          Shutdown ApacheDS embedded.
 void contextInitialized(javax.servlet.ServletContextEvent evt)
          Startup ApacheDS embedded.
protected  int getLdapPort()
           
protected  java.lang.String getLdifFile()
           
protected  java.lang.String getPartitionDN()
           
protected  java.util.List<org.apache.directory.shared.ldap.ldif.LdifEntry> loadLdif(java.io.InputStream in, boolean verifyEntries)
          Loads an LDIF from an input stream and adds the entries it contains to the server.
protected  void verify(org.apache.directory.shared.ldap.ldif.LdifEntry entry)
          Verifies that an entry exists in the directory with the specified attributes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ApacheDSContextListener

public ApacheDSContextListener()
Method Detail

getPartitionDN

protected java.lang.String getPartitionDN()

getLdapPort

protected int getLdapPort()

getLdifFile

protected java.lang.String getLdifFile()

loadLdif

protected java.util.List<org.apache.directory.shared.ldap.ldif.LdifEntry> loadLdif(java.io.InputStream in,
                                                                                   boolean verifyEntries)
                                                                            throws java.lang.Exception
Loads an LDIF from an input stream and adds the entries it contains to the server. It appears as though the administrator added these entries to the server.

Parameters:
in - the input stream containing the LDIF entries to load
verifyEntries - whether or not all entry additions are checked to see if they were in fact correctly added to the server
Returns:
a list of entries added to the server in the order they were added
Throws:
javax.naming.NamingException - of the load fails
java.lang.Exception

verify

protected void verify(org.apache.directory.shared.ldap.ldif.LdifEntry entry)
               throws java.lang.Exception
Verifies that an entry exists in the directory with the specified attributes.

Parameters:
entry - the entry to verify
Throws:
javax.naming.NamingException - if there are problems accessing the entry
java.lang.Exception

contextInitialized

public void contextInitialized(javax.servlet.ServletContextEvent evt)
Startup ApacheDS embedded. If you get an error message in the logs like: "The value 'inetOrgPerson' is incorrect, it hasn't been added" Don't stress, it's an ApacheDS bug: https://issues.apache.org/jira/browse/DIRSERVER-1253 Also if you see an error message like this: "OID for name 'monitorcontext' was not found within the OID registry" It's an Apache LDAP Studio bug.

Specified by:
contextInitialized in interface javax.servlet.ServletContextListener

contextDestroyed

public void contextDestroyed(javax.servlet.ServletContextEvent evt)
Shutdown ApacheDS embedded.

Specified by:
contextDestroyed in interface javax.servlet.ServletContextListener


Copyright © 2010 Atlassian. All Rights Reserved.