// Get information about the backends defined in the server. Iterate
// through them, finding the one backend into which the LDIF should be
// imported and finding backends with subordinate base DNs that should be
// excluded from the import.
Backend backend = null;
List<DN> defaultIncludeBranches = null;
List<DN> excludeBranches = new ArrayList<DN>();
List<DN> includeBranches = new ArrayList<DN>();
if (includeBranchStrings.isPresent())
{
includeBranches = new ArrayList<DN>();
for (String s : includeBranchStrings.getValues())
{
DN includeBranch;
try
{
includeBranch = DN.decode(s);
}
catch (DirectoryException de)
{
Message message = ERR_LDIFIMPORT_CANNOT_DECODE_INCLUDE_BASE.get(
s, de.getMessageObject());
logError(message);
return 1;
}
catch (Exception e)
{
Message message = ERR_LDIFIMPORT_CANNOT_DECODE_INCLUDE_BASE.get(
s, getExceptionMessage(e));
logError(message);
return 1;
}
includeBranches.add(includeBranch);
}
}
ArrayList<Backend> backendList = new ArrayList<Backend>();
ArrayList<BackendCfg> entryList = new ArrayList<BackendCfg>();
ArrayList<List<DN>> dnList = new ArrayList<List<DN>>();
int code = BackendToolUtils.getBackends(backendList, entryList, dnList);
if (code != 0)
{
return code;
}
int numBackends = backendList.size();
for (int i=0; i < numBackends; i++)
{
Backend b = backendList.get(i);
if(backendID.isPresent())
{
if (! backendID.getValue().equals(b.getBackendID()))
{
continue;
}
}
else