EventListener
, javax.servlet.ServletContextListener
public class SampleDirectory extends Object implements javax.servlet.ServletContextListener
The directory server is configured by a set of "sampleDirectoryServer.*"
properties, see SampleDirectory.Configuration
.
The sample directory implements ServletContextListener
. This
enables its automatic startup and shutdown in a servlet container (Java web
server), such as Apache Tomcat. When started from a servlet container the
directory configuration is obtained from a properties file specified by a
context parameter named sampleDirectoryServer.configurationFile
.
Modifier and Type | Class | Description |
---|---|---|
static class |
SampleDirectory.Configuration |
The sample directory server configuration.
|
Constructor | Description |
---|---|
SampleDirectory() |
Modifier and Type | Method | Description |
---|---|---|
void |
contextDestroyed(javax.servlet.ServletContextEvent sce) |
Handler for servlet context shutdown events.
|
void |
contextInitialized(javax.servlet.ServletContextEvent sce) |
Handler for servlet context startup events.
|
void |
start(SampleDirectory.Configuration config) |
Starts the sample in-memory directory server.
|
void |
stop() |
Stops the sample in-memory directory server (if previously started).
|
public SampleDirectory()
public void start(SampleDirectory.Configuration config) throws com.unboundid.ldap.sdk.LDAPException, IOException, com.unboundid.ldif.LDIFException
config
- The sample directory server configuration. Must not
be null
.com.unboundid.ldap.sdk.LDAPException
- If the in-memory directory server couldn't be
started or its initialisation failed.IOException
- If a schema file was specified and it couldn't
be read.com.unboundid.ldif.LDIFException
- If a schema file was specified that is not
valid LDIF.public void stop()
public void contextInitialized(javax.servlet.ServletContextEvent sce)
The sample directory server configuration is retrieved from a
properties file which location is specified by a servlet context
parameter named sampleDirectory.configurationFile
.
contextInitialized
in interface javax.servlet.ServletContextListener
sce
- A servlet context event.public void contextDestroyed(javax.servlet.ServletContextEvent sce)
contextDestroyed
in interface javax.servlet.ServletContextListener
sce
- A servlet context event.Copyright © 2018 Connect2id. All rights reserved.