PrintStream err) {
// Perform the initial bootstrap of the Directory Server and process the
// configuration.
DirectoryServer directoryServer = DirectoryServer.getInstance();
if (initializeServer)
{
try
{
DirectoryServer.bootstrapClient();
DirectoryServer.initializeJMX();
}
catch (Exception e)
{
Message message = ERR_SERVER_BOOTSTRAP_ERROR.get(
getExceptionMessage(e));
err.println(wrapText(message, MAX_LINE_WIDTH));
return 1;
}
try
{
directoryServer.initializeConfiguration(configClass.getValue(),
configFile.getValue());
}
catch (InitializationException ie)
{
Message message = ERR_CANNOT_LOAD_CONFIG.get(ie.getMessage());
err.println(wrapText(message, MAX_LINE_WIDTH));
return 1;
}
catch (Exception e)
{
Message message = ERR_CANNOT_LOAD_CONFIG.get(getExceptionMessage(e));
err.println(wrapText(message, MAX_LINE_WIDTH));
return 1;
}
// Initialize the Directory Server schema elements.
try
{
directoryServer.initializeSchema();
}
catch (ConfigException ce)
{
Message message = ERR_CANNOT_LOAD_SCHEMA.get(ce.getMessage());
err.println(wrapText(message, MAX_LINE_WIDTH));
return 1;
}
catch (InitializationException ie)
{
Message message = ERR_CANNOT_LOAD_SCHEMA.get(ie.getMessage());
err.println(wrapText(message, MAX_LINE_WIDTH));
return 1;
}
catch (Exception e)
{
Message message = ERR_CANNOT_LOAD_SCHEMA.get(getExceptionMessage(e));
err.println(wrapText(message, MAX_LINE_WIDTH));
return 1;
}
// Initialize the Directory Server core configuration.
try
{
CoreConfigManager coreConfigManager = new CoreConfigManager();
coreConfigManager.initializeCoreConfig();
}
catch (ConfigException ce)
{
Message message = ERR_CANNOT_INITIALIZE_CORE_CONFIG.get(
ce.getMessage());
err.println(wrapText(message, MAX_LINE_WIDTH));
return 1;
}
catch (InitializationException ie)
{
Message message = ERR_CANNOT_INITIALIZE_CORE_CONFIG.get(
ie.getMessage());
err.println(wrapText(message, MAX_LINE_WIDTH));
return 1;
}
catch (Exception e)
{
Message message = ERR_CANNOT_INITIALIZE_CORE_CONFIG.get(
getExceptionMessage(e));
err.println(wrapText(message, MAX_LINE_WIDTH));
return 1;
}
// Initialize the Directory Server crypto manager.
try
{
directoryServer.initializeCryptoManager();
}
catch (ConfigException ce)
{
Message message = ERR_CANNOT_INITIALIZE_CRYPTO_MANAGER.get(
ce.getMessage());
err.println(wrapText(message, MAX_LINE_WIDTH));
return 1;
}
catch (InitializationException ie)
{
Message message = ERR_CANNOT_INITIALIZE_CRYPTO_MANAGER.get(
ie.getMessage());
err.println(wrapText(message, MAX_LINE_WIDTH));
return 1;
}
catch (Exception e)
{
Message message = ERR_CANNOT_INITIALIZE_CRYPTO_MANAGER.get(
getExceptionMessage(e));
err.println(wrapText(message, MAX_LINE_WIDTH));
return 1;
}
if (! quietMode.isPresent())
{
try
{
ErrorLogPublisher<?> errorLogPublisher =
TextErrorLogPublisher.getStartupTextErrorPublisher(
new TextWriter.STREAM(out));
ErrorLogger.addErrorLogPublisher(errorLogPublisher);
}
catch(Exception e)
{
err.println("Error installing the custom error logger: " +
stackTraceToSingleLineString(e));
}
}
// Initialize the root DNs.
try
{
directoryServer.initializeRootDNConfigManager();
}
catch (ConfigException ce)
{
Message message = ERR_CANNOT_INITIALIZE_ROOTDN_MANAGER.get(
ce.getMessage());
err.println(wrapText(message, MAX_LINE_WIDTH));
return 1;
}
catch (InitializationException ie)
{
Message message = ERR_CANNOT_INITIALIZE_ROOTDN_MANAGER.get(
ie.getMessage());
err.println(wrapText(message, MAX_LINE_WIDTH));
return 1;
}
// Initialize the plugin manager.
try
{
HashSet<PluginType> pluginTypes = new HashSet<PluginType>(1);
directoryServer.initializePlugins(pluginTypes);
}
catch (ConfigException ce)
{
Message message = ERR_LDIFIMPORT_CANNOT_INITIALIZE_PLUGINS.get(
ce.getMessage());
err.println(wrapText(message, MAX_LINE_WIDTH));
return 1;
}
catch (InitializationException ie)
{
Message message = ERR_LDIFIMPORT_CANNOT_INITIALIZE_PLUGINS.get(
ie.getMessage());
err.println(wrapText(message, MAX_LINE_WIDTH));
return 1;
}
catch (Exception e)
{
Message message = ERR_LDIFIMPORT_CANNOT_INITIALIZE_PLUGINS.get(
getExceptionMessage(e));
err.println(wrapText(message, MAX_LINE_WIDTH));
return 1;
}
// Initialize the subentry manager.
try
{
directoryServer.initializeSubentryManager();
}
catch (InitializationException ie)
{
Message message = ERR_CANNOT_INITIALIZE_SUBENTRY_MANAGER.get(
ie.getMessage());
err.println(wrapText(message, MAX_LINE_WIDTH));
return 1;
}
// Initialize all the password policy information.
try
{
directoryServer.initializePasswordPolicyComponents();
}
catch (ConfigException ce)
{
Message message = ERR_LDIFIMPORT_CANNOT_INITIALIZE_PWPOLICY.get(
ce.getMessage());