public class ExampleDirectory extends Object implements javax.servlet.ServletContextListener
The directory server is configured by a set of "exampleDirectoryServer.*"
properties, see ExampleDirectory.Configuration
.
The example 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 exampleDirectoryServer.configurationFile
.
Modifier and Type | Class and Description |
---|---|
static class |
ExampleDirectory.Configuration
The example directory server configuration.
|
Constructor and Description |
---|
ExampleDirectory() |
Modifier and Type | Method and 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(ExampleDirectory.Configuration config)
Starts the example in-memory directory server.
|
void |
stop()
Stops the example in-memory directory server (if previously started).
|
public ExampleDirectory()
public void start(ExampleDirectory.Configuration config) throws com.unboundid.ldap.sdk.LDAPException, IOException, com.unboundid.ldif.LDIFException
config
- The example 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 example directory server configuration is retrieved from a
properties file which location is specified by a servlet context
parameter named exampleDirectory.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 © 2016 Connect2id. All Rights Reserved.