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
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(java.lang.String root,
java.lang.String ldifs) |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
void |
destroy() |
org.apache.directory.server.core.DefaultDirectoryService |
getService() |
boolean |
isRunning() |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
void |
setCertificatePassord(java.lang.String certificatePassord)
Will set the certificate password on the underlying
LdapServer . |
void |
setKeyStoreFile(java.io.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(java.io.File workingDir) |
void |
start() |
void |
stop() |
public ApacheDSContainer(java.lang.String root, java.lang.String ldifs) throws java.lang.Exception
java.lang.Exception
public void afterPropertiesSet() throws java.lang.Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
java.lang.Exception
public void destroy() throws java.lang.Exception
destroy
in interface org.springframework.beans.factory.DisposableBean
java.lang.Exception
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
org.springframework.beans.BeansException
public void setWorkingDirectory(java.io.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(java.io.File keyStoreFile)
LdapServer
.keyStoreFile
- Mandatory if LDAPs is enabledpublic void setCertificatePassord(java.lang.String certificatePassord)
LdapServer
.certificatePassord
- May be nullpublic org.apache.directory.server.core.DefaultDirectoryService getService()
public void start()
start
in interface org.springframework.context.Lifecycle
public void stop()
stop
in interface org.springframework.context.Lifecycle
public boolean isRunning()
isRunning
in interface org.springframework.context.Lifecycle