| | |
| | | import java.lang.management.ManagementFactory; |
| | | import java.net.InetAddress; |
| | | import java.text.DecimalFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | |
| | | private WritabilityMode writabilityMode; |
| | | |
| | | /** The memory reservation system. */ |
| | | private MemoryQuota memoryQuota; |
| | | private final MemoryQuota memoryQuota; |
| | | |
| | | /** The Disk Space Monitor. */ |
| | | private DiskSpaceMonitor diskSpaceMonitor; |
| | | private final DiskSpaceMonitor diskSpaceMonitor; |
| | | |
| | | /** The lock manager which will be used for coordinating access to LDAP entries. */ |
| | | private final LockManager lockManager = new LockManager(); |
| | |
| | | ERROR_DEBUG_LOGGERS; |
| | | } |
| | | |
| | | private String configFile; |
| | | private Set<PluginType> pluginTypes = new HashSet<>(); |
| | | private static EnumSet<SubSystem> subSystemsToInitialize = EnumSet.noneOf(SubSystem.class); |
| | | private final String configFile; |
| | | private final Set<PluginType> pluginTypes = new HashSet<>(); |
| | | private final EnumSet<SubSystem> subSystemsToInitialize = EnumSet.noneOf(SubSystem.class); |
| | | private PrintStream loggingOut; |
| | | private PrintStream errConfiguringLogging; |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | private static void checkSubsystemIsInitialized(SubSystem subsystem) throws InitializationException |
| | | private void checkSubsystemIsInitialized(SubSystem subsystem) throws InitializationException |
| | | { |
| | | if (!subSystemsToInitialize.contains(subsystem)) |
| | | { |
| | |
| | | } |
| | | |
| | | /** |
| | | * Initialize the root DSE in the Directory Server. |
| | | * |
| | | * @throws ConfigException If a problem occurs retrieving the root DSE backend |
| | | * configuration. |
| | | * @throws InitializationException If a problem occurs initializing the root |
| | | * root DSE backend. |
| | | */ |
| | | public void initializeRootDSE() |
| | | throws ConfigException, InitializationException { |
| | | RootDSEBackendCfg rootDSECfg; |
| | | try { |
| | | rootDSECfg = serverContext.getRootConfig().getRootDSEBackend(); |
| | | } catch (Exception e) { |
| | | logger.traceException(e); |
| | | LocalizableMessage message = ERR_CANNOT_GET_ROOT_DSE_CONFIG_ENTRY.get( |
| | | stackTraceToSingleLineString(e)); |
| | | throw new InitializationException(message, e); |
| | | } |
| | | rootDSEBackend = new RootDSEBackend(); |
| | | rootDSEBackend.configureBackend(rootDSECfg, serverContext); |
| | | rootDSEBackend.openBackend(); |
| | | } |
| | | |
| | | /** |
| | | * Retrieves a reference to the Directory Server plugin configuration manager. |
| | | * |
| | | * @return A reference to the Directory Server plugin configuration manager. |
| | |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the set of objectclasses defined in the Directory Server. |
| | | * |
| | | * @return The set of objectclasses defined in the Directory Server. |
| | | */ |
| | | public static ConcurrentMap<String, ObjectClass> getObjectClasses() |
| | | { |
| | | return directoryServer.schema.getObjectClasses(); |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the objectclass for the provided lowercase name or OID. |
| | | * |
| | | * @param lowerName The lowercase name or OID for the objectclass to |
| | |
| | | } |
| | | |
| | | /** |
| | | * Registers the provided attribute type with the Directory Server. |
| | | * |
| | | * @param attributeType The attribute type to register with the |
| | | * Directory Server. |
| | | * @param overwriteExisting Indicates whether to overwrite an existing |
| | | * mapping if there are any conflicts (i.e., |
| | | * another attribute type with the same OID or |
| | | * name). |
| | | * |
| | | * @throws DirectoryException If a conflict is encountered and the |
| | | * <CODE>overwriteExisting</CODE> flag is set to |
| | | * <CODE>false</CODE> |
| | | */ |
| | | public static void registerAttributeType(AttributeType attributeType, |
| | | boolean overwriteExisting) |
| | | throws DirectoryException |
| | | { |
| | | directoryServer.schema.registerAttributeType(attributeType, overwriteExisting); |
| | | } |
| | | |
| | | /** |
| | | * Deregisters the provided attribute type with the Directory Server. |
| | | * |
| | | * @param attributeType The attribute type to deregister with the Directory |
| | | * Server. |
| | | * @throws DirectoryException |
| | | * If the attribute type is referenced by another schema element. |
| | | */ |
| | | public static void deregisterAttributeType(AttributeType attributeType) throws DirectoryException |
| | | { |
| | | directoryServer.schema.deregisterAttributeType(attributeType); |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the attribute type for the "objectClass" attribute. |
| | | * |
| | | * @return The attribute type for the "objectClass" attribute. |
| | |
| | | * @return The default attribute syntax that should be used for attributes |
| | | * that are not defined in the server schema. |
| | | */ |
| | | public static Syntax getDefaultAttributeSyntax() |
| | | private static Syntax getDefaultAttributeSyntax() |
| | | { |
| | | return DirectoryServer.directoryServer.schema.getDefaultSyntax(); |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the set of DIT content rules defined in the Directory Server. |
| | | * |
| | | * @return The set of DIT content rules defined in the Directory Server. |
| | | */ |
| | | public static ConcurrentMap<ObjectClass, DITContentRule> |
| | | getDITContentRules() |
| | | { |
| | | return directoryServer.schema.getDITContentRules(); |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the DIT content rule associated with the specified objectclass. |
| | | * |
| | | * @param objectClass The objectclass for which to retrieve the associated |
| | |
| | | } |
| | | |
| | | /** |
| | | * Registers the provided DIT content rule with the Directory Server. |
| | | * |
| | | * @param ditContentRule The DIT content rule to register with the |
| | | * server. |
| | | * @param overwriteExisting Indicates whether to overwrite an existing |
| | | * mapping if there are any conflicts (i.e., |
| | | * another DIT content rule with the same |
| | | * structural objectclass). |
| | | * |
| | | * @throws DirectoryException If a conflict is encountered and the |
| | | * <CODE>overwriteExisting</CODE> flag is set to |
| | | * <CODE>false</CODE> |
| | | */ |
| | | public static void registerDITContentRule(DITContentRule ditContentRule, |
| | | boolean overwriteExisting) |
| | | throws DirectoryException |
| | | { |
| | | directoryServer.schema.registerDITContentRule(ditContentRule, |
| | | overwriteExisting); |
| | | } |
| | | |
| | | /** |
| | | * Deregisters the provided DIT content rule with the Directory Server. |
| | | * |
| | | * @param ditContentRule The DIT content rule to deregister with the server. |
| | |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the set of DIT structure rules defined in the Directory Server. |
| | | * |
| | | * @return The set of DIT structure rules defined in the Directory Server. |
| | | */ |
| | | public static ConcurrentMap<NameForm, DITStructureRule> |
| | | getDITStructureRules() |
| | | { |
| | | return directoryServer.schema.getDITStructureRulesByNameForm(); |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the DIT structure rule associated with the provided rule ID. |
| | | * |
| | | * @param ruleID The rule ID for which to retrieve the associated DIT |
| | |
| | | } |
| | | |
| | | /** |
| | | * Registers the provided DIT structure rule with the Directory Server. |
| | | * |
| | | * @param ditStructureRule The DIT structure rule to register with the |
| | | * server. |
| | | * @param overwriteExisting Indicates whether to overwrite an existing |
| | | * mapping if there are any conflicts (i.e., |
| | | * another DIT structure rule with the same name |
| | | * form). |
| | | * |
| | | * @throws DirectoryException If a conflict is encountered and the |
| | | * <CODE>overwriteExisting</CODE> flag is set to |
| | | * <CODE>false</CODE> |
| | | */ |
| | | public static void registerDITStructureRule(DITStructureRule ditStructureRule, |
| | | boolean overwriteExisting) |
| | | throws DirectoryException |
| | | { |
| | | directoryServer.schema.registerDITStructureRule(ditStructureRule, |
| | | overwriteExisting); |
| | | } |
| | | |
| | | /** |
| | | * Deregisters the provided DIT structure rule with the Directory Server. |
| | | * |
| | | * @param ditStructureRule The DIT structure rule to deregister with the |
| | |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the set of name forms defined in the Directory Server. |
| | | * |
| | | * @return The set of name forms defined in the Directory Server. |
| | | */ |
| | | public static ConcurrentMap<ObjectClass, List<NameForm>> getNameForms() |
| | | { |
| | | return directoryServer.schema.getNameFormsByObjectClass(); |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the name forms associated with the specified objectclass. |
| | | * |
| | | * @param objectClass The objectclass for which to retrieve the associated |
| | |
| | | } |
| | | |
| | | /** |
| | | * Registers the provided name form with the Directory Server. |
| | | * |
| | | * @param nameForm The name form to register with the server. |
| | | * @param overwriteExisting Indicates whether to overwrite an existing |
| | | * mapping if there are any conflicts (i.e., |
| | | * another name form with the same structural |
| | | * objectclass). |
| | | * |
| | | * @throws DirectoryException If a conflict is encountered and the |
| | | * <CODE>overwriteExisting</CODE> flag is set to |
| | | * <CODE>false</CODE> |
| | | */ |
| | | public static void registerNameForm(NameForm nameForm, |
| | | boolean overwriteExisting) |
| | | throws DirectoryException |
| | | { |
| | | directoryServer.schema.registerNameForm(nameForm, overwriteExisting); |
| | | } |
| | | |
| | | /** |
| | | * Deregisters the provided name form with the Directory Server. |
| | | * |
| | | * @param nameForm The name form to deregister with the server. |
| | |
| | | * |
| | | * @return The set of JMX MBeans that are associated with the server. |
| | | */ |
| | | public static ConcurrentHashMap<DN,JMXMBean> getJMXMBeans() |
| | | public static Collection<JMXMBean> getJMXMBeans() |
| | | { |
| | | return directoryServer.mBeans; |
| | | return directoryServer.mBeans.values(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return The set of password storage schemes defined in the Directory |
| | | * Server. |
| | | */ |
| | | public static ConcurrentHashMap<String, PasswordStorageScheme<?>> getPasswordStorageSchemes() |
| | | public static Collection<PasswordStorageScheme<?>> getPasswordStorageSchemes() |
| | | { |
| | | return directoryServer.passwordStorageSchemes; |
| | | return directoryServer.passwordStorageSchemes.values(); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the set of password validators that have been registered for use |
| | | * with the Directory Server as a mapping between the DN of the associated |
| | | * validator configuration entry and the validator implementation. |
| | | * |
| | | * @return The set of password validators that have been registered for use |
| | | * with the Directory Server. |
| | | */ |
| | | public static ConcurrentMap<DN, |
| | | PasswordValidator<? extends PasswordValidatorCfg>> |
| | | getPasswordValidators() |
| | | { |
| | | return directoryServer.passwordValidators; |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the password validator registered with the provided configuration |
| | | * entry DN. |
| | | * |
| | |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the set of account status notification handlers defined in the |
| | | * Directory Server, as a mapping between the DN of the configuration entry |
| | | * and the notification handler implementation. |
| | | * |
| | | * @return The set of account status notification handlers defined in the |
| | | * Directory Server. |
| | | */ |
| | | public static ConcurrentMap<DN, AccountStatusNotificationHandler<?>> |
| | | getAccountStatusNotificationHandlers() |
| | | { |
| | | return directoryServer.accountStatusNotificationHandlers; |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the account status notification handler with the specified |
| | | * configuration entry DN. |
| | | * |
| | |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the set of password generators that have been registered for use |
| | | * with the Directory Server as a mapping between the DN of the associated |
| | | * generator configuration entry and the generator implementation. |
| | | * |
| | | * @return The set of password generators that have been registered for use |
| | | * with the Directory Server. |
| | | */ |
| | | public static ConcurrentMap<DN, PasswordGenerator<?>> getPasswordGenerators() |
| | | { |
| | | return directoryServer.passwordGenerators; |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the password generator registered with the provided configuration |
| | | * entry DN. |
| | | * |
| | |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the monitor provider with the specified name. |
| | | * |
| | | * @param lowerName The name of the monitor provider to retrieve, in all |
| | | * lowercase characters. |
| | | * |
| | | * @return The requested resource monitor, or {@code null} if none |
| | | * exists with the specified name. |
| | | */ |
| | | public static MonitorProvider<? extends MonitorProviderCfg> |
| | | getMonitorProvider(String lowerName) |
| | | { |
| | | return directoryServer.monitorProviders.get(lowerName); |
| | | } |
| | | |
| | | /** |
| | | * Registers the provided monitor provider with the Directory Server. Note |
| | | * that if a monitor provider is already registered with the specified name, |
| | | * then it will be replaced with the provided implementation. |
| | |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the set of key manager providers registered with the Directory |
| | | * Server. |
| | | * |
| | | * @return The set of key manager providers registered with the Directory |
| | | * Server. |
| | | */ |
| | | public static Map<DN, KeyManagerProvider<?>> getKeyManagerProviders() |
| | | { |
| | | return directoryServer.keyManagerProviders; |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the key manager provider registered with the provided entry DN. |
| | | * |
| | | * @param providerDN The DN with which the key manager provider is |
| | |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the set of trust manager providers registered with the Directory |
| | | * Server. |
| | | * |
| | | * @return The set of trust manager providers registered with the Directory |
| | | * Server. |
| | | */ |
| | | public static Map<DN, TrustManagerProvider<?>> getTrustManagerProviders() |
| | | { |
| | | return directoryServer.trustManagerProviders; |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the trust manager provider registered with the provided entry DN. |
| | | * |
| | | * @param providerDN The DN with which the trust manager provider is |
| | |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the set of certificate mappers registered with the Directory |
| | | * Server. |
| | | * |
| | | * @return The set of certificate mappers registered with the Directory |
| | | * Server. |
| | | */ |
| | | public static Map<DN, CertificateMapper<?>> getCertificateMappers() |
| | | { |
| | | return directoryServer.certificateMappers; |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the certificate mapper registered with the provided entry DN. |
| | | * |
| | | * @param mapperDN The DN with which the certificate mapper is registered. |
| | |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the set of alternate bind DNs for root users, mapped between the |
| | | * alternate DN and the real DN. The contents of the returned map must not be |
| | | * altered by the caller. |
| | | * |
| | | * @return The set of alternate bind DNs for root users, mapped between the |
| | | * alternate DN and the real DN. |
| | | */ |
| | | public static ConcurrentMap<DN, DN> getAlternateRootBindDNs() |
| | | { |
| | | return directoryServer.alternateRootBindDNs; |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the real entry DN for the root user with the provided alternate |
| | | * bind DN. |
| | | * |
| | |
| | | * @return The set of backends that have been registered with the Directory |
| | | * Server. |
| | | */ |
| | | public static Map<String, Backend<?>> getBackends() |
| | | public static Collection<Backend<?>> getBackends() |
| | | { |
| | | return new TreeMap<>(directoryServer.backends); |
| | | return new ArrayList<>(directoryServer.backends.values()); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the entire set of base DNs registered with the Directory Server, |
| | | * mapped from the base DN to the backend responsible for that base DN. The |
| | | * same backend may be present multiple times, mapped from different base DNs. |
| | | * |
| | | * @return The entire set of base DNs registered with the Directory Server. |
| | | */ |
| | | public static Map<DN, Backend<?>> getBaseDNs() |
| | | { |
| | | return directoryServer.baseDnRegistry.getBaseDnMap(); |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the backend with the specified base DN. |
| | | * |
| | | * @param baseDN The DN that is registered as one of the base DNs for the |
| | |
| | | * @return The set of extended operations that may be processed by the |
| | | * Directory Server. |
| | | */ |
| | | public static ConcurrentMap<String, ExtendedOperationHandler<?>> getSupportedExtensions() |
| | | public static Set<String> getSupportedExtensions() |
| | | { |
| | | return directoryServer.extendedOperationHandlers; |
| | | return directoryServer.extendedOperationHandlers.keySet(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return The set of SASL mechanisms that are supported by the Directory |
| | | * Server. |
| | | */ |
| | | public static ConcurrentMap<String, SASLMechanismHandler<?>> getSupportedSASLMechanisms() |
| | | public static Set<String> getSupportedSASLMechanisms() |
| | | { |
| | | return directoryServer.saslMechanismHandlers; |
| | | return directoryServer.saslMechanismHandlers.keySet(); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the set of identity mappers defined in the Directory Server |
| | | * configuration, as a mapping between the DN of the configuration entry and |
| | | * the identity mapper. |
| | | * |
| | | * @return The set of identity mappers defined in the Directory Server |
| | | * configuration. |
| | | */ |
| | | public static ConcurrentMap<DN, IdentityMapper<?>> getIdentityMappers() |
| | | { |
| | | return directoryServer.identityMappers; |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the Directory Server identity mapper whose configuration resides |
| | | * in the specified configuration entry. |
| | | * |
| | |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the Directory Server should save a copy of its |
| | | * configuration whenever it is started successfully. |
| | | * |
| | | * @return {@code true} if the server should save a copy of its configuration |
| | | * whenever it is started successfully, or {@code false} if not. |
| | | */ |
| | | public static boolean saveConfigOnSuccessfulStartup() |
| | | { |
| | | return directoryServer.saveConfigOnSuccessfulStartup; |
| | | } |
| | | |
| | | /** |
| | | * Specifies whether the Directory Server should save a copy of its |
| | | * configuration whenever it is started successfully. |
| | | * |
| | |
| | | * Reinitializes the server following a shutdown, preparing it for a call to |
| | | * {@code startServer}. |
| | | * |
| | | * @return The new Directory Server instance created during the |
| | | * re-initialization process. |
| | | * |
| | | * @throws InitializationException If a problem occurs while trying to |
| | | * initialize the config handler or |
| | | * bootstrap that server. |
| | | */ |
| | | public static DirectoryServer reinitialize() |
| | | throws InitializationException |
| | | { |
| | | return reinitialize(directoryServer.environmentConfig); |
| | | } |
| | | |
| | | /** |
| | | * Reinitializes the server following a shutdown, preparing it for a call to |
| | | * {@code startServer}. |
| | | * |
| | | * @param config The environment configuration for the Directory Server. |
| | | * |
| | | * @return The new Directory Server instance created during the |
| | |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the maximum number of concurrent client connections that may be |
| | | * established. |
| | | * |
| | | * @return The maximum number of concurrent client connections that may be |
| | | * established, or -1 if there is no limit. |
| | | */ |
| | | public static long getMaxAllowedConnections() |
| | | { |
| | | return directoryServer.maxAllowedConnections; |
| | | } |
| | | |
| | | /** |
| | | * Specifies the maximum number of concurrent client connections that may be |
| | | * established. A value that is less than or equal to zero will indicate that |
| | | * no limit should be enforced. |
| | |
| | | * @throws IOException If a problem occurs while attempting to write the |
| | | * version information to the provided output stream. |
| | | */ |
| | | public static void printVersion(OutputStream outputStream) |
| | | throws IOException |
| | | private static void printVersion(OutputStream outputStream) throws IOException |
| | | { |
| | | outputStream.write(PRINTABLE_VERSION_STRING.getBytes()); |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether an unauthenticated request should be rejected. |
| | | * |
| | | * @return <CODE>true</CODE>if an unauthenticated request should be |
| | | * rejected, or <CODE>false</CODE>f if not. |
| | | */ |
| | | public static boolean rejectUnauthenticatedRequests() |
| | | { |
| | | return directoryServer.rejectUnauthenticatedRequests; |
| | | } |
| | | |
| | | /** |
| | | * Specifies whether an unauthenticated request should be rejected. |
| | | * |
| | | * @param rejectUnauthenticatedRequests Indicates whether an |
| | |
| | | } |
| | | |
| | | /** |
| | | * Sets the message to be displayed on the command-line when the user asks for |
| | | * the usage. |
| | | * @param msg the message to be displayed on the command-line when the user |
| | | * asks for the usage. |
| | | */ |
| | | public static void setToolDescription (LocalizableMessage msg) |
| | | { |
| | | toolDescription = msg; |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the DN of the configuration entry with which this alert generator |
| | | * is associated. |
| | | * |
| | |
| | | StringArgument configFile = null; |
| | | |
| | | // Create the command-line argument parser for use with this program. |
| | | LocalizableMessage theToolDescription = DirectoryServer.toolDescription; |
| | | ArgumentParser argParser = |
| | | new ArgumentParser("org.opends.server.core.DirectoryServer", |
| | | theToolDescription, false); |
| | | DirectoryServer.toolDescription, false); |
| | | argParser.setShortToolDescription(REF_SHORT_DESC_START_DS.get()); |
| | | |
| | | // Initialize all the command-line argument types and register them with the parser. |
| | |
| | | } |
| | | |
| | | /** |
| | | * Gets the class loader to be used with this directory server |
| | | * application. |
| | | * Gets the class loader to be used with this directory server application. |
| | | * <p> |
| | | * The class loader will automatically load classes from plugins |
| | | * where required. |
| | | * The class loader will automatically load classes from plugins where required. |
| | | * <p> |
| | | * Note: {@code public} access is required for compiling the |
| | | * {@code org.opends.server.snmp.SNMPConnectionHandler}. |
| | | * |
| | | * @return Returns the class loader to be used with this directory |
| | | * server application. |
| | | * @return Returns the class loader to be used with this directory server application. |
| | | */ |
| | | public static ClassLoader getClassLoader() |
| | | { |