knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmin...@apache.org
Subject git commit: KNOX-208: Add main to SimpleLdapDirectoryServer.
Date Mon, 02 Dec 2013 18:53:42 GMT
Updated Branches:
  refs/heads/master b5f302065 -> 61e85e0b8


KNOX-208: Add main to SimpleLdapDirectoryServer.


Project: http://git-wip-us.apache.org/repos/asf/incubator-knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-knox/commit/61e85e0b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-knox/tree/61e85e0b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-knox/diff/61e85e0b

Branch: refs/heads/master
Commit: 61e85e0b89b415361159bb973d050bdd8ab92acb
Parents: b5f3020
Author: Kevin Minder <kevin.minder@hortonworks.com>
Authored: Mon Dec 2 13:48:25 2013 -0500
Committer: Kevin Minder <kevin.minder@hortonworks.com>
Committed: Mon Dec 2 13:50:35 2013 -0500

----------------------------------------------------------------------
 .../ldap/SimpleLdapDirectoryServer.java         | 21 ++++++++++++++++++++
 1 file changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/61e85e0b/gateway-test-ldap/src/main/java/org/apache/hadoop/gateway/security/ldap/SimpleLdapDirectoryServer.java
----------------------------------------------------------------------
diff --git a/gateway-test-ldap/src/main/java/org/apache/hadoop/gateway/security/ldap/SimpleLdapDirectoryServer.java
b/gateway-test-ldap/src/main/java/org/apache/hadoop/gateway/security/ldap/SimpleLdapDirectoryServer.java
index 0400f37..96e3914 100644
--- a/gateway-test-ldap/src/main/java/org/apache/hadoop/gateway/security/ldap/SimpleLdapDirectoryServer.java
+++ b/gateway-test-ldap/src/main/java/org/apache/hadoop/gateway/security/ldap/SimpleLdapDirectoryServer.java
@@ -24,6 +24,7 @@ import org.apache.directory.server.core.api.partition.Partition;
 import org.apache.directory.server.core.factory.DirectoryServiceFactory;
 import org.apache.directory.server.ldap.LdapServer;
 import org.apache.directory.server.protocol.shared.store.LdifFileLoader;
+import org.apache.directory.server.protocol.shared.transport.TcpTransport;
 import org.apache.directory.server.protocol.shared.transport.Transport;
 
 import java.io.File;
@@ -73,4 +74,24 @@ public class SimpleLdapDirectoryServer {
     }
   }
 
+  public static void main( String[] args ) throws Exception {
+    SimpleLdapDirectoryServer ldap;
+
+    File file;
+    if ( args.length < 1 ) {
+      file = new File( "conf/users.ldif" );
+    } else {
+      File dir = new File( args[0] );
+      if( !dir.exists() || !dir.isDirectory() ) {
+        throw new FileNotFoundException( dir.getAbsolutePath() );
+      }
+      file = new File( dir, "users.ldif" );
+    }
+    if( !file.exists() || !file.canRead() ) {
+      throw new FileNotFoundException( file.getAbsolutePath() );
+    }
+    ldap = new SimpleLdapDirectoryServer( "dc=hadoop,dc=apache,dc=org", file, new TcpTransport(
33389 ) );
+    ldap.start();
+  }
+
 }


Mime
View raw message