}
// Iterate through the immediate children, attempting to parse them as
// backends.
RootCfg root = ServerManagementContext.getInstance().getRootConfiguration();
for (ConfigEntry configEntry : baseEntry.getChildren().values())
{
// Get the backend ID attribute from the entry. If there isn't one, then
// skip the entry.
String backendID;
try
{
StringConfigAttribute idStub =
new StringConfigAttribute(ATTR_BACKEND_ID,
INFO_CONFIG_BACKEND_ATTR_DESCRIPTION_BACKEND_ID.get(),
true, false, true);
StringConfigAttribute idAttr =
(StringConfigAttribute) configEntry.getConfigAttribute(idStub);
if (idAttr == null)
{
continue;
}
else
{
backendID = idAttr.activeValue();
}
}
catch (ConfigException ce)
{
Message message = ERR_CANNOT_DETERMINE_BACKEND_ID.get(
String.valueOf(configEntry.getDN()), ce.getMessage());
logError(message);
return 1;
}
catch (Exception e)
{
Message message = ERR_CANNOT_DETERMINE_BACKEND_ID.get(
String.valueOf(configEntry.getDN()), getExceptionMessage(e));
logError(message);
return 1;
}
// Get the backend class name attribute from the entry. If there isn't
// one, then just skip the entry.
String backendClassName;
try
{
StringConfigAttribute classStub =
new StringConfigAttribute(
ATTR_BACKEND_CLASS,
INFO_CONFIG_BACKEND_ATTR_DESCRIPTION_CLASS.get(),
true, false, false);
StringConfigAttribute classAttr =
(StringConfigAttribute) configEntry.getConfigAttribute(classStub);
if (classAttr == null)
{
continue;
}
else
{
backendClassName = classAttr.activeValue();
}
}
catch (ConfigException ce)
{
Message message = ERR_CANNOT_DETERMINE_BACKEND_CLASS.get(
String.valueOf(configEntry.getDN()), ce.getMessage());
logError(message);
return 1;
}
catch (Exception e)
{
Message message = ERR_CANNOT_DETERMINE_BACKEND_CLASS.get(
String.valueOf(configEntry.getDN()), getExceptionMessage(e));
logError(message);
return 1;
}
Class backendClass;
try
{
backendClass = Class.forName(backendClassName);
}
catch (Exception e)
{
Message message = ERR_CANNOT_LOAD_BACKEND_CLASS.
get(backendClassName, String.valueOf(configEntry.getDN()),
getExceptionMessage(e));
logError(message);
return 1;
}
Backend backend;
BackendCfg cfg;
try
{
backend = (Backend) backendClass.newInstance();
backend.setBackendID(backendID);
cfg = root.getBackend(backendID);
backend.configureBackend(cfg);
}
catch (Exception e)
{
Message message = ERR_CANNOT_INSTANTIATE_BACKEND_CLASS.