org.springframework.security.ldap.server
Class ApacheDSContainer

java.lang.Object
  extended by org.springframework.security.ldap.server.ApacheDSContainer
All Implemented Interfaces:
org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, org.springframework.context.Lifecycle

public class ApacheDSContainer
extends java.lang.Object
implements org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean, org.springframework.context.Lifecycle, org.springframework.context.ApplicationContextAware

Provides lifecycle services for the embedded apacheDS server defined by the supplied configuration. Used by {code LdapServerBeanDefinitionParser}. An instance will be stored in the application context for each embedded server instance. It will start the server when the context is initialized and shut it down when it is closed. It is intended for temporary embedded use and will not retain changes across start/stop boundaries. The working directory is deleted on shutdown.

If used repeatedly in a single JVM process with the same configuration (for example, when repeatedly loading an application context during testing), it's important that the application context is closed to allow the bean to be disposed of and the server shutdown prior to attempting to start it again.

This class is intended for testing and internal security namespace use and is not considered part of framework public API.


Constructor Summary
ApacheDSContainer(java.lang.String root, java.lang.String ldifs)
           
 
Method Summary
 void afterPropertiesSet()
           
 void destroy()
           
 org.apache.directory.server.core.DefaultDirectoryService getService()
           
 boolean isRunning()
           
 void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
           
 void setPort(int port)
           
 void setWorkingDirectory(java.io.File workingDir)
           
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ApacheDSContainer

public ApacheDSContainer(java.lang.String root,
                         java.lang.String ldifs)
                  throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
java.lang.Exception

destroy

public void destroy()
             throws java.lang.Exception
Specified by:
destroy in interface org.springframework.beans.factory.DisposableBean
Throws:
java.lang.Exception

setApplicationContext

public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
                           throws org.springframework.beans.BeansException
Specified by:
setApplicationContext in interface org.springframework.context.ApplicationContextAware
Throws:
org.springframework.beans.BeansException

setWorkingDirectory

public void setWorkingDirectory(java.io.File workingDir)

setPort

public void setPort(int port)

getService

public org.apache.directory.server.core.DefaultDirectoryService getService()

start

public void start()
Specified by:
start in interface org.springframework.context.Lifecycle

stop

public void stop()
Specified by:
stop in interface org.springframework.context.Lifecycle

isRunning

public boolean isRunning()
Specified by:
isRunning in interface org.springframework.context.Lifecycle