forked from inbloom/ldap-in-memory
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Todd Fritz
committed
Feb 12, 2014
1 parent
40216d6
commit d510e82
Showing
27 changed files
with
13,175 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
lib/ | ||
|
||
# Compiled source # | ||
################### | ||
*.com | ||
*.class | ||
*.dll | ||
*.exe | ||
*.o | ||
*.so | ||
|
||
# Packages # | ||
############ | ||
# it's better to unpack these files and commit the raw source | ||
# git has its own built in compression methods | ||
*.7z | ||
*.dmg | ||
*.gz | ||
*.iso | ||
*.jar | ||
*.rar | ||
*.tar | ||
*.zip | ||
*.war | ||
*.ear | ||
|
||
# Logs and databases # | ||
###################### | ||
*.log | ||
*.out | ||
*.sql | ||
*.sqlite | ||
|
||
# OS generated files # | ||
###################### | ||
.DS_Store | ||
.DS_Store? | ||
._* | ||
.Spotlight-V100 | ||
.Trashes | ||
ehthumbs.db | ||
Thumbs.db | ||
|
||
# Eclipse | ||
.classpath | ||
.project | ||
.settings/ | ||
|
||
# Intellij | ||
*.idea/ | ||
*.iml | ||
*.iws | ||
|
||
# Maven | ||
log/ | ||
target/ | ||
|
||
|
||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>org.slc.sli.ldap.inmemory</groupId> | ||
<artifactId>ldap-inmemory</artifactId> | ||
<packaging>war</packaging> | ||
<version>1.0-SNAPSHOT</version> | ||
|
||
<name>ldap-inmemory Maven Webapp</name> | ||
<url>http://maven.apache.org</url> | ||
|
||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
<jdk.version>1.6</jdk.version> | ||
|
||
<maven.plugin.compiler>3.1</maven.plugin.compiler> | ||
<maven.plugin.resources>2.6</maven.plugin.resources> | ||
<!-- <ldap.conf>${sli.home}/config/properties/sli-test.properties</ldap.conf> --> | ||
|
||
<apache.commons.cli.version>1.2</apache.commons.cli.version> | ||
<apache.commons.logging.version>1.1.3</apache.commons.logging.version> | ||
<apache.commons.lang.version>3.2.1</apache.commons.lang.version> | ||
<j2ee.servlet.version>2.5</j2ee.servlet.version> | ||
<jdk.version>1.6</jdk.version> | ||
<junit.version>4.9</junit.version> | ||
<log4j.version>1.2.17</log4j.version> | ||
<maven.jetty.version>6.1.12</maven.jetty.version> | ||
<slf4j.version>1.7.5</slf4j.version> | ||
<unbounded.ldap.version>2.3.5</unbounded.ldap.version> | ||
</properties> | ||
|
||
<dependencies> | ||
|
||
<dependency> | ||
<groupId>javax.servlet</groupId> | ||
<artifactId>servlet-api</artifactId> | ||
<version>${j2ee.servlet.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.unboundid</groupId> | ||
<artifactId>unboundid-ldapsdk</artifactId> | ||
<version>${unbounded.ldap.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-lang3</artifactId> | ||
<version>${apache.commons.lang.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>commons-cli</groupId> | ||
<artifactId>commons-cli</artifactId> | ||
<version>${apache.commons.cli.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
<version>${slf4j.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-log4j12</artifactId> | ||
<version>${slf4j.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>log4j</groupId> | ||
<artifactId>log4j</artifactId> | ||
<version>${log4j.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>${junit.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
|
||
<build> | ||
<finalName>ldap-inmemory</finalName> | ||
|
||
<sourceDirectory>src/main/java</sourceDirectory> | ||
<testSourceDirectory>src/test/java</testSourceDirectory> | ||
|
||
<resources> | ||
<resource> | ||
<directory>src/main/resources</directory> | ||
<includes> | ||
<include>log4j.xml</include> | ||
<include>ldap-inmemory-config.xsd</include> | ||
</includes> | ||
</resource> | ||
</resources> | ||
|
||
<testResources> | ||
<testResource> | ||
<directory>src/test/resources</directory> | ||
</testResource> | ||
</testResources> | ||
|
||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>${maven.plugin.compiler}</version> | ||
<configuration> | ||
<source>${jdk.version}</source> | ||
<target>${jdk.version}</target> | ||
</configuration> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>org.mortbay.jetty</groupId> | ||
<artifactId>maven-jetty-plugin</artifactId> | ||
<version>${maven.jetty.version}</version> | ||
<configuration> | ||
<!-- The useTestClasspath configuration tells the jetty plugin to use the test classpath, which will include ldif resources and configuration that is checked in. --> | ||
<useTestClasspath>true</useTestClasspath> | ||
<scanIntervalSeconds>5</scanIntervalSeconds> | ||
<!--<systemProperties> | ||
<systemProperty> | ||
<name>ldap.conf</name> | ||
<value>${ldap.conf}</value> | ||
</systemProperty> | ||
</systemProperties> --> | ||
<connectors> | ||
<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector"> | ||
<port>8093</port> | ||
</connector> | ||
</connectors> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
|
||
</build> | ||
|
||
|
||
</project> |
31 changes: 31 additions & 0 deletions
31
src/main/java/org/slc/sli/ldap/inmemory/LdapInMemoryContextListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.slc.sli.ldap.inmemory; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import javax.servlet.ServletContext; | ||
import javax.servlet.ServletContextEvent; | ||
import javax.servlet.ServletContextListener; | ||
|
||
/** | ||
* Created by tfritz on 12/26/13. | ||
*/ | ||
|
||
public class LdapInMemoryContextListener implements ServletContextListener { | ||
private final static Logger LOG = LoggerFactory.getLogger(LdapInMemoryContextListener.class); | ||
|
||
ServletContext context; | ||
|
||
public void contextInitialized(ServletContextEvent event) { | ||
try { | ||
LdapServer.getInstance().start(); | ||
} catch (Exception e) { | ||
LOG.error(e.getMessage(), e); | ||
} | ||
} | ||
|
||
public void contextDestroyed(ServletContextEvent event) { | ||
LdapServer.getInstance().stop(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package org.slc.sli.ldap.inmemory; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
/** | ||
* This class encapsulates an in-memory LDAP server, which is hydrated from an LDIF file (an LDAP export), | ||
* using the UnboundedId java SDK. | ||
* | ||
* NOTE: THIS CLASS IS NOT INTENDED FOR PRODUCTION USE, IT IS ONLY INTENDED FOR DEVELOPMENT USES. | ||
* | ||
* Created by tfritz on 12/30/13. | ||
*/ | ||
public class LdapServer { | ||
private final static Logger LOG = LoggerFactory.getLogger(LdapServer.class); | ||
|
||
/** | ||
* Hide the default Constructor. | ||
*/ | ||
private LdapServer() { | ||
} | ||
|
||
/** | ||
* Holder is loaded on first execution of getInstance(), or on first access to INSTANCE; not before. * | ||
*/ | ||
private static class SingletonHolder { | ||
public static final LdapServerImpl INSTANCE = new LdapServerImpl(); | ||
} | ||
|
||
/** | ||
* Returns the singleton instance. * | ||
*/ | ||
public static LdapServerImpl getInstance() { | ||
return SingletonHolder.INSTANCE; | ||
} | ||
|
||
public LdapServerImpl getLdapServer() { | ||
return SingletonHolder.INSTANCE; | ||
} | ||
|
||
} |
Oops, something went wrong.