public class ApacheDSContainer extends Object implements InitializingBean, DisposableBean, Lifecycle, ApplicationContextAware
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, only, and is not considered part of the framework's public API.
Constructor and Description |
---|
ApacheDSContainer(String root,
String ldifs) |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
void |
destroy() |
org.apache.directory.server.core.DefaultDirectoryService |
getService() |
boolean |
isRunning() |
void |
setApplicationContext(ApplicationContext applicationContext) |
void |
setCertificatePassord(String certificatePassord)
Will set the certificate password on the underlying
LdapServer . |
void |
setKeyStoreFile(File keyStoreFile)
The keyStore must not be null and must be a valid file.
|
void |
setLdapOverSslEnabled(boolean ldapOverSslEnabled)
If set to
true will enable LDAP over SSL (LDAPs). |
void |
setPort(int port) |
void |
setWorkingDirectory(File workingDir) |
void |
start() |
void |
stop() |
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface InitializingBean
Exception
public void destroy() throws Exception
destroy
in interface DisposableBean
Exception
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
setApplicationContext
in interface ApplicationContextAware
BeansException
public void setWorkingDirectory(File workingDir)
public void setPort(int port)
public void setLdapOverSslEnabled(boolean ldapOverSslEnabled)
true
will enable LDAP over SSL (LDAPs). If set to true
setCertificatePassord(String)
must be set as well.ldapOverSslEnabled
- If not set, will default to falsepublic void setKeyStoreFile(File keyStoreFile)
LdapServer
.keyStoreFile
- Mandatory if LDAPs is enabledpublic void setCertificatePassord(String certificatePassord)
LdapServer
.certificatePassord
- May be nullpublic org.apache.directory.server.core.DefaultDirectoryService getService()