public class LdifFileLoader
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected CoreSession |
coreSession
a handle on the top core session
|
private int |
count
the total count of entries loaded
|
protected java.util.List<LdifLoadFilter> |
filters
the filters to use while loading entries into the server
|
protected java.io.File |
ldif
the LDIF file or directory containing LDIFs to load
|
protected java.lang.ClassLoader |
loader
the class loader to use if we cannot file the file as a path
|
private static org.slf4j.Logger |
LOG
the log for this class
|
| Constructor and Description |
|---|
LdifFileLoader(CoreSession coreSession,
java.io.File ldif,
java.util.List<? extends LdifLoadFilter> filters)
Creates a new instance of LdifFileLoader.
|
LdifFileLoader(CoreSession coreSession,
java.io.File ldif,
java.util.List<? extends LdifLoadFilter> filters,
java.lang.ClassLoader loader)
Creates a new instance of LdifFileLoader.
|
LdifFileLoader(CoreSession coreSession,
java.lang.String ldif)
Creates a new instance of LdifFileLoader.
|
| Modifier and Type | Method and Description |
|---|---|
private boolean |
applyFilters(org.apache.directory.api.ldap.model.name.Dn dn,
org.apache.directory.api.ldap.model.entry.Entry entry)
Applies filters making sure failures in one filter do not effect another.
|
int |
execute()
Opens the LDIF file and loads the entries into the context.
|
private java.io.InputStream |
getLdifStream()
Tries to find an LDIF file either on the file system or packaged within a jar.
|
private static final org.slf4j.Logger LOG
protected CoreSession coreSession
protected java.io.File ldif
protected final java.util.List<LdifLoadFilter> filters
protected final java.lang.ClassLoader loader
private int count
public LdifFileLoader(CoreSession coreSession, java.lang.String ldif)
coreSession - the context to load the entries into.ldif - the file of LDIF entries to load.public LdifFileLoader(CoreSession coreSession, java.io.File ldif, java.util.List<? extends LdifLoadFilter> filters)
coreSession - ldif - filters - public LdifFileLoader(CoreSession coreSession, java.io.File ldif, java.util.List<? extends LdifLoadFilter> filters, java.lang.ClassLoader loader)
coreSession - ldif - filters - loader - private boolean applyFilters(org.apache.directory.api.ldap.model.name.Dn dn,
org.apache.directory.api.ldap.model.entry.Entry entry)
dn - the Dn of the entryentry - the attributes of the entrypublic int execute()
private java.io.InputStream getLdifStream()
throws java.io.FileNotFoundException
java.io.FileNotFoundException - if the file cannot be found.