| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2010-2011 ForgeRock AS. |
| | | * Portions Copyright 2010-2012 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | /** |
| | | * The default timeout used to start the server in detach mode. |
| | | */ |
| | | public static int DEFAULT_TIMEOUT = 200; |
| | | public static final int DEFAULT_TIMEOUT = 200; |
| | | |
| | | /** |
| | | * Creates a new instance of the Directory Server. This will allow only a |
| | |
| | | * @return The DN of the configuration entry with which this alert generator |
| | | * is associated. |
| | | */ |
| | | @Override |
| | | public DN getComponentEntryDN() |
| | | { |
| | | try |
| | |
| | | * @return The fully-qualified name of the Java class for this alert |
| | | * generator implementation. |
| | | */ |
| | | @Override |
| | | public String getClassName() |
| | | { |
| | | return CLASS_NAME; |
| | |
| | | * @return Information about the set of alerts that this generator may |
| | | * produce. |
| | | */ |
| | | @Override |
| | | public LinkedHashMap<String,String> getAlerts() |
| | | { |
| | | LinkedHashMap<String,String> alerts = new LinkedHashMap<String,String>(); |
| | |
| | | |
| | | |
| | | // Create the command-line argument parser for use with this program. |
| | | Message toolDescription = DirectoryServer.toolDescription; |
| | | Message theToolDescription = DirectoryServer.toolDescription; |
| | | ArgumentParser argParser = |
| | | new ArgumentParser("org.opends.server.core.DirectoryServer", |
| | | toolDescription, false); |
| | | theToolDescription, false); |
| | | |
| | | |
| | | // Initialize all the command-line argument types and register them with the |
| | |
| | | |
| | | // Install the default loggers so the startup messages |
| | | // will be printed. |
| | | TextErrorLogPublisher startupErrorLogPublisher = null; |
| | | TextDebugLogPublisher startupDebugLogPublisher = null; |
| | | |
| | | startupErrorLogPublisher = |
| | | TextErrorLogPublisher startupErrorLogPublisher = |
| | | TextErrorLogPublisher.getStartupTextErrorPublisher( |
| | | new TextWriter.STDOUT()); |
| | | ErrorLogger.addErrorLogPublisher(startupErrorLogPublisher); |
| | | |
| | | startupDebugLogPublisher = |
| | | TextDebugLogPublisher startupDebugLogPublisher = |
| | | TextDebugLogPublisher.getStartupTextDebugPublisher( |
| | | new TextWriter.STDOUT()); |
| | | DebugLogger.addDebugLogPublisher(startupDebugLogPublisher); |
| | |
| | | |
| | | |
| | | // Bootstrap and start the Directory Server. |
| | | DirectoryServer directoryServer = DirectoryServer.getInstance(); |
| | | DirectoryServer theDirectoryServer = DirectoryServer.getInstance(); |
| | | try |
| | | { |
| | | directoryServer.setEnvironmentConfig(environmentConfig); |
| | | directoryServer.bootstrapServer(); |
| | | directoryServer.initializeConfiguration(configClass.getValue(), |
| | | theDirectoryServer.setEnvironmentConfig(environmentConfig); |
| | | theDirectoryServer.bootstrapServer(); |
| | | theDirectoryServer.initializeConfiguration(configClass.getValue(), |
| | | configFile.getValue()); |
| | | } |
| | | catch (InitializationException ie) |
| | |
| | | } |
| | | |
| | | try { |
| | | directoryServer.serviceTagRegistry = |
| | | theDirectoryServer.serviceTagRegistry = |
| | | ServiceTagRegistration.getRegistrationService(); |
| | | directoryServer.serviceTagRegistry.registerServiceTags("Server"); |
| | | theDirectoryServer.serviceTagRegistry.registerServiceTags("Server"); |
| | | } |
| | | catch(Exception ex) { |
| | | // ServiceTags Registration errors do not prevent the server to |
| | |
| | | |
| | | try |
| | | { |
| | | directoryServer.startServer(); |
| | | theDirectoryServer.startServer(); |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | |
| | | } |
| | | |
| | | Message message = ERR_DSCORE_CANNOT_START.get(ie.getMessage()); |
| | | shutDown(directoryServer.getClass().getName(), message); |
| | | shutDown(theDirectoryServer.getClass().getName(), message); |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | |
| | | |
| | | Message message = ERR_DSCORE_CANNOT_START.get(ce.getMessage() + |
| | | (ce.getCause() != null ? " " + ce.getCause().getLocalizedMessage() : "")); |
| | | shutDown(directoryServer.getClass().getName(), message); |
| | | shutDown(theDirectoryServer.getClass().getName(), message); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | Message message = ERR_DSCORE_CANNOT_START.get( |
| | | stackTraceToSingleLineString(e)); |
| | | shutDown(directoryServer.getClass().getName(), message); |
| | | shutDown(theDirectoryServer.getClass().getName(), message); |
| | | } |
| | | |
| | | ErrorLogger.removeErrorLogPublisher(startupErrorLogPublisher); |