}
catch (Throwable t)
{
Message message = ERR_CONFIG_FILE_CANNOT_OPEN_FOR_READ.get(
f.getAbsolutePath(), String.valueOf(t));
throw new InitializationException(message, t);
}
if (! f.exists())
{
Message message =
ERR_CONFIG_FILE_DOES_NOT_EXIST.get(f.getAbsolutePath());
throw new InitializationException(message);
}
configEntries.clear();
// Read the first entry from the configuration file.
Entry entry;
try
{
entry = reader.readEntry(checkSchema);
if (entry == null)
{
Message message = ERR_CONFIG_FILE_EMPTY.get(f.getAbsolutePath());
throw new InitializationException(message);
}
configRootEntry = new ConfigEntry(entry, null);
baseDNs = new DN[] { configRootEntry.getDN() };
configEntries.put(entry.getDN(), configRootEntry);
// Iterate through the rest of the configuration file and process the
// remaining entries.
while (entry != null)
{
// Read the next entry from the configuration.
entry = reader.readEntry(checkSchema);
if (entry != null)
{
DN entryDN = entry.getDN();
DN parentDN = entryDN.getParent();
ConfigEntry parentEntry = null;
if (parentDN != null)
{
parentEntry = configEntries.get(parentDN);
}
if (parentEntry == null)
{
if (parentDN == null)
{
Message message = ERR_CONFIG_FILE_UNKNOWN_PARENT.get(
entryDN.toString(),
reader.getLastEntryLineNumber(),
f.getAbsolutePath());
throw new InitializationException(message);
}
else
{
Message message =
ERR_CONFIG_FILE_NO_PARENT.get(entryDN.toString(),
reader.getLastEntryLineNumber(),
f.getAbsolutePath(), parentDN.toString());
throw new InitializationException(message);
}
}
else
{
ConfigEntry configEntry = new ConfigEntry(entry, parentEntry);
parentEntry.addChild(configEntry);
configEntries.put(entryDN, configEntry);
}
}
}
}
catch (InitializationException ie)
{
throw ie;
}
catch (LDIFException le)
{
Message message = ERR_CONFIG_FILE_INVALID_LDIF_ENTRY.get(
le.getLineNumber(), f.getAbsolutePath(),
String.valueOf(le));
throw new InitializationException(message, le);
}
catch (Throwable t)
{
Message message = ERR_CONFIG_FILE_READ_ERROR.get(f.getAbsolutePath(),
String.valueOf(t));
throw new InitializationException(message, t);
}
// Determine the appropriate server root.
File rootFile = DirectoryServer.getEnvironmentConfig().getServerRoot();