public class IntegrationUtils extends Object
Constructor and Description |
---|
IntegrationUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
apply(DirectoryService service,
org.apache.directory.api.ldap.model.ldif.LdifEntry entry) |
static void |
closeConnections() |
static void |
disableSchema(DirectoryService service,
String schemaName) |
static void |
doDelete(File wkdir)
Deletes the working directory.
|
static void |
enableSchema(DirectoryService service,
String schemaName) |
static org.apache.directory.ldap.client.api.LdapConnection |
getAdminConnection(DirectoryService dirService)
Gets a LdapCoreSessionConnection bound using the default admin Dn uid=admin,ou=system and password "secret"
|
static org.apache.directory.ldap.client.api.LdapConnection |
getAdminNetworkConnection(LdapServer ldapServer)
Gets a LdapNetworkConnection bound to the Admin user (uid=admin,ou=system).
|
static org.apache.directory.ldap.client.api.LdapConnection |
getAnonymousNetworkConnection(LdapServer ldapServer)
Gets an anonymous LdapNetworkConnection
|
static org.apache.directory.ldap.client.api.LdapConnection |
getAnonymousNetworkConnection(String host,
int port)
Gets an anonymous LdapNetworkConnection
|
static org.apache.directory.ldap.client.api.LdapConnection |
getConnectionAs(DirectoryService dirService,
org.apache.directory.api.ldap.model.name.Dn dn,
String password)
Gets a LdapCoreSessionConnection bound using a user's DN and a password.
|
static org.apache.directory.ldap.client.api.LdapConnection |
getConnectionAs(DirectoryService dirService,
String dn,
String password)
Gets a LdapCoreSessionConnection bound using a user's DN and a password.
|
static LdapContext |
getContext(String principalDn,
DirectoryService service,
String dn) |
static CoreSession |
getCoreSession(String principalDn,
DirectoryService service,
String dn) |
static org.apache.directory.ldap.client.api.LdapConnection |
getNetworkConnectionAs(LdapServer ldapServer,
String userDn,
String password)
Gets a LdapNetworkConnection bound using a user's DN and a password.
|
static org.apache.directory.ldap.client.api.LdapConnection |
getNetworkConnectionAs(String host,
int port,
String dn,
String password)
Gets a LdapNetworkConnection bound using a user's DN and a password.
|
static LdapContext |
getRootContext(DirectoryService service) |
static LdapContext |
getSchemaContext(DirectoryService service) |
static LdapContext |
getSystemContext(DirectoryService service) |
static org.apache.directory.api.ldap.model.ldif.LdifEntry |
getUserAddLdif() |
static org.apache.directory.api.ldap.model.ldif.LdifEntry |
getUserAddLdif(String dnstr,
byte[] password,
String cn,
String sn) |
static void |
injectEntries(DirectoryService service,
String ldif)
Inject an ldif String into the server.
|
static boolean |
isDisabled(DirectoryService service,
String schemaName)
A helper method which tells if a schema is disabled.
|
static boolean |
isEnabled(DirectoryService service,
String schemaName)
A helper method which tells if a schema is enabled.
|
static boolean |
isLoaded(DirectoryService service,
String schemaName)
A helper method which tells if a schema is loaded.
|
public static void doDelete(File wkdir) throws IOException
wkdir
- the working directory to deleteIOException
- if the working directory cannot be deletedpublic static void injectEntries(DirectoryService service, String ldif) throws Exception
service
- the directory service to useldif
- the ldif containing entries to add to the server.NamingException
- if there is a problem adding the entries from the LDIFException
public static org.apache.directory.api.ldap.model.ldif.LdifEntry getUserAddLdif() throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapException
public static LdapContext getContext(String principalDn, DirectoryService service, String dn) throws Exception
Exception
public static CoreSession getCoreSession(String principalDn, DirectoryService service, String dn) throws Exception
Exception
public static LdapContext getSystemContext(DirectoryService service) throws Exception
Exception
public static LdapContext getSchemaContext(DirectoryService service) throws Exception
Exception
public static LdapContext getRootContext(DirectoryService service) throws Exception
Exception
public static void apply(DirectoryService service, org.apache.directory.api.ldap.model.ldif.LdifEntry entry) throws Exception
Exception
public static org.apache.directory.api.ldap.model.ldif.LdifEntry getUserAddLdif(String dnstr, byte[] password, String cn, String sn) throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapException
public static void enableSchema(DirectoryService service, String schemaName) throws Exception
Exception
public static void disableSchema(DirectoryService service, String schemaName) throws Exception
Exception
public static boolean isDisabled(DirectoryService service, String schemaName)
public static boolean isLoaded(DirectoryService service, String schemaName)
public static boolean isEnabled(DirectoryService service, String schemaName)
public static org.apache.directory.ldap.client.api.LdapConnection getAdminConnection(DirectoryService dirService) throws Exception
dirService
- The Directory Service to be connected toIf
- the connection could not be established.Exception
public static org.apache.directory.ldap.client.api.LdapConnection getConnectionAs(DirectoryService dirService, String dn, String password) throws Exception
dirService
- The Directory Service to be connected todn
- The User's DN as a Stringpassword
- The User's password as a StringIf
- the connection could not be established.Exception
public static org.apache.directory.ldap.client.api.LdapConnection getConnectionAs(DirectoryService dirService, org.apache.directory.api.ldap.model.name.Dn dn, String password) throws Exception
dirService
- The Directory Service to be connected todn
- The User's DNpassword
- The User's password as a StringIf
- the connection could not be established.Exception
public static org.apache.directory.ldap.client.api.LdapConnection getNetworkConnectionAs(String host, int port, String dn, String password) throws Exception
dirService
- The Directory Service to be connected todn
- The User's DN as a Stringpassword
- The User's password as a StringIf
- the connection could not be established.Exception
public static org.apache.directory.ldap.client.api.LdapConnection getAnonymousNetworkConnection(LdapServer ldapServer) throws Exception
dirService
- The Directory Service to be connected toIf
- the connection could not be established.Exception
public static org.apache.directory.ldap.client.api.LdapConnection getAnonymousNetworkConnection(String host, int port) throws Exception
dirService
- The Directory Service to be connected toIf
- the connection could not be established.Exception
public static org.apache.directory.ldap.client.api.LdapConnection getAdminNetworkConnection(LdapServer ldapServer) throws Exception
dirService
- The Directory Service to be connected toIf
- the connection could not be established.Exception
public static org.apache.directory.ldap.client.api.LdapConnection getNetworkConnectionAs(LdapServer ldapServer, String userDn, String password) throws Exception
ldapServer
- The LdapServer to be connected todn
- The User's DN as a Stringpassword
- The User's password as a StringIf
- the connection could not be established.Exception
public static void closeConnections()
Copyright © 2016. All rights reserved.