use of org.apache.directory.server.protocol.shared.store.LdifFileLoader in project aws-iam-ldap-bridge by denismo.
the class ApacheDSUtils method loadLdif.
public void loadLdif(String s) throws LdapException {
if (getClass().getClassLoader().getResourceAsStream(s) == null) {
s = new File("E:\\WS\\ApacheDS_AWSIAM\\dist\\apacheds\\" + s).getAbsolutePath();
}
LdifFileLoader loader = new LdifFileLoader(service.getAdminSession(), s);
loader.execute();
}
use of org.apache.directory.server.protocol.shared.store.LdifFileLoader in project spring-security by spring-projects.
the class ApacheDSContainer method importLdifs.
private void importLdifs() throws Exception {
// Import any ldif files
Resource[] ldifs;
if (ctxt == null) {
// Not running within an app context
ldifs = new PathMatchingResourcePatternResolver().getResources(ldifResources);
} else {
ldifs = ctxt.getResources(ldifResources);
}
if (ldifs == null || ldifs.length == 0) {
return;
}
if (ldifs.length == 1) {
String ldifFile;
try {
ldifFile = ldifs[0].getFile().getAbsolutePath();
} catch (IOException e) {
ldifFile = ldifs[0].getURI().toString();
}
logger.info("Loading LDIF file: " + ldifFile);
LdifFileLoader loader = new LdifFileLoader(service.getAdminSession(), new File(ldifFile), null, getClass().getClassLoader());
loader.execute();
} else {
throw new IllegalArgumentException("More than one LDIF resource found with the supplied pattern:" + ldifResources + " Got " + Arrays.toString(ldifs));
}
}
Aggregations