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 IntegrationUtils()
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 org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapException
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 org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapException
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 org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapException
public static void disableSchema(DirectoryService service, String schemaName) throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapException
public static boolean isDisabled(DirectoryService service, String schemaName)
service
- The Directory ServiceschemaName
- The name of the Schema to checkpublic static boolean isLoaded(DirectoryService service, String schemaName)
service
- The Directory ServiceschemaName
- The schema to checkpublic static boolean isEnabled(DirectoryService service, String schemaName)
service
- The Directory ServiceschemaName
- The name of the Schema to checkpublic static org.apache.directory.ldap.client.api.LdapConnection getAdminConnection(DirectoryService dirService) throws org.apache.directory.api.ldap.model.exception.LdapException
dirService
- The Directory Service to be connected toorg.apache.directory.api.ldap.model.exception.LdapException
- If the connection could not be established.public static org.apache.directory.ldap.client.api.LdapConnection getConnectionAs(DirectoryService dirService, String dn, String password) throws org.apache.directory.api.ldap.model.exception.LdapException
dirService
- The Directory Service to be connected todn
- The User's DN as a Stringpassword
- The User's password as a Stringorg.apache.directory.api.ldap.model.exception.LdapException
- If the connection could not be established.public static org.apache.directory.ldap.client.api.LdapConnection getConnectionAs(DirectoryService dirService, org.apache.directory.api.ldap.model.name.Dn dn, String password) throws org.apache.directory.api.ldap.model.exception.LdapException
dirService
- The Directory Service to be connected todn
- The User's DNpassword
- The User's password as a Stringorg.apache.directory.api.ldap.model.exception.LdapException
- If the connection could not be established.public static org.apache.directory.ldap.client.api.LdapConnection getNetworkConnectionAs(String host, int port, String dn, String password) throws org.apache.directory.api.ldap.model.exception.LdapException
host
- The server to connect toport
- The port to connect ondn
- The User's DN as a Stringpassword
- The User's password as a Stringorg.apache.directory.api.ldap.model.exception.LdapException
- If the connection could not be established.public static org.apache.directory.ldap.client.api.LdapConnection getAnonymousNetworkConnection(LdapServer ldapServer) throws org.apache.directory.api.ldap.model.exception.LdapException
ldapServer
- The LdapServer to be connected toorg.apache.directory.api.ldap.model.exception.LdapException
- If the connection could not be established.public static org.apache.directory.ldap.client.api.LdapConnection getAnonymousNetworkConnection(String host, int port) throws org.apache.directory.api.ldap.model.exception.LdapException
host
- The server to connect toport
- The port to connect onorg.apache.directory.api.ldap.model.exception.LdapException
- If the connection could not be established.public static org.apache.directory.ldap.client.api.LdapConnection getAdminNetworkConnection(LdapServer ldapServer) throws org.apache.directory.api.ldap.model.exception.LdapException
ldapServer
- The LdapServer to be connected toorg.apache.directory.api.ldap.model.exception.LdapException
- If the connection could not be established.public static org.apache.directory.ldap.client.api.LdapConnection getNetworkConnectionAs(LdapServer ldapServer, String userDn, String password) throws org.apache.directory.api.ldap.model.exception.LdapException
ldapServer
- The LdapServer to be connected touserDn
- The User's DN as a Stringpassword
- The User's password as a Stringorg.apache.directory.api.ldap.model.exception.LdapException
- If the connection could not be established.public static void closeConnections()
Copyright © 2003–2020 The Apache Software Foundation. All rights reserved.