Extracted method ServerContext.getRootConfig()
| | |
| | | } |
| | | else |
| | | { |
| | | RootCfg root = |
| | | DirectoryServer.getInstance().getServerContext().getServerManagementContext().getRootConfiguration(); |
| | | RootCfg root = DirectoryServer.getInstance().getServerContext().getRootConfig(); |
| | | ReplicationSynchronizationProviderCfg sync = null; |
| | | try |
| | | { |
| | |
| | | final Set<BackendDescriptor> backendDescriptors, final Set<DN> alternateBindDNs, |
| | | final List<OpenDsException> errors) throws OpenDsException, ConfigException |
| | | { |
| | | // Get the Directory Server configuration handler and use it. |
| | | final RootCfg root = |
| | | DirectoryServer.getInstance().getServerContext().getServerManagementContext().getRootConfiguration(); |
| | | final RootCfg root = DirectoryServer.getInstance().getServerContext().getRootConfig(); |
| | | readAdminConnector(root, errors); |
| | | readConnectionHandlers(connectionHandlers, root, errors); |
| | | isSchemaEnabled = root.getGlobalConfiguration().isCheckSchema(); |
| | |
| | | } |
| | | if (couldInitializeConfig) |
| | | { |
| | | // Get the Directory Server configuration handler and use it. |
| | | RootCfg root = |
| | | DirectoryServer.getInstance().getServerContext().getServerManagementContext().getRootConfiguration(); |
| | | RootCfg root = DirectoryServer.getInstance().getServerContext().getRootConfig(); |
| | | administrationConnectorCfg = root.getAdministrationConnector(); |
| | | |
| | | String trustManagerStr = administrationConnectorCfg.getTrustManagerProvider(); |
| | |
| | | } |
| | | if (couldInitializeConfiguration) |
| | | { |
| | | RootCfg root = |
| | | DirectoryServer.getInstance().getServerContext().getServerManagementContext().getRootConfiguration(); |
| | | RootCfg root = DirectoryServer.getInstance().getServerContext().getRootConfig(); |
| | | return root.getAdministrationConnector().getListenPort(); |
| | | } |
| | | else |
| | |
| | | // check if the initialization is required |
| | | try |
| | | { |
| | | DirectoryServer.getInstance().getServerContext().getServerManagementContext() |
| | | .getRootConfiguration().getAdministrationConnector(); |
| | | DirectoryServer.getInstance().getServerContext().getRootConfig().getAdministrationConnector(); |
| | | } |
| | | catch (java.lang.Throwable th) |
| | | catch (Throwable th) |
| | | { |
| | | try |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | RootCfg root = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | RootCfg root = serverContext.getRootConfig(); |
| | | AdministrationConnectorCfg config = root.getAdministrationConnector(); |
| | | |
| | | // Check if certificate generation is needed |
| | |
| | | import org.forgerock.opendj.config.server.ConfigurationChangeListener; |
| | | import org.forgerock.opendj.server.config.meta.AccessControlHandlerCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.AccessControlHandlerCfg; |
| | | import org.forgerock.opendj.server.config.server.RootCfg; |
| | | import org.opends.server.api.AccessControlHandler; |
| | | import org.opends.server.api.AlertGenerator; |
| | | import org.forgerock.opendj.config.server.ConfigChangeResult; |
| | |
| | | throws ConfigException, InitializationException |
| | | { |
| | | this.serverContext = serverContext; |
| | | RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | |
| | | // Don't register as an add and delete listener with the root configuration |
| | | // as we can have only one object at a given time. |
| | | |
| | | // //Initialize the current Access control. |
| | | AccessControlHandlerCfg accessControlConfiguration = |
| | | rootConfiguration.getAccessControlHandler(); |
| | | // Initialize the current Access control. |
| | | AccessControlHandlerCfg accessControlConfiguration = serverContext.getRootConfig().getAccessControlHandler(); |
| | | |
| | | // We have a valid usable entry, so register a change listener in |
| | | // order to handle configuration changes. |
| | |
| | | public void initializeNotificationHandlers() |
| | | throws ConfigException, InitializationException |
| | | { |
| | | RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | |
| | | // Register as an add and delete listener with the root configuration so |
| | | // we can be notified if any account status notification handler entry |
| | | // is added or removed. |
| | | RootCfg rootConfiguration = serverContext.getRootConfig(); |
| | | rootConfiguration.addAccountStatusNotificationHandlerAddListener (this); |
| | | rootConfiguration.addAccountStatusNotificationHandlerDeleteListener (this); |
| | | |
| | |
| | | public void initializeAlertHandlers() |
| | | throws ConfigException, InitializationException |
| | | { |
| | | RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | |
| | | |
| | | // Register as an add and delete listener with the root configuration so we |
| | | // can be notified if any alert handler entries are added or removed. |
| | | RootCfg rootConfiguration = serverContext.getRootConfig(); |
| | | rootConfiguration.addAlertHandlerAddListener(this); |
| | | rootConfiguration.addAlertHandlerDeleteListener(this); |
| | | |
| | |
| | | public void initializeAttributeSyntaxes() |
| | | throws ConfigException, InitializationException |
| | | { |
| | | RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | |
| | | |
| | | // Register as an add and delete listener with the root configuration so we |
| | | // can be notified if any attribute syntax entries are added or removed. |
| | | RootCfg rootConfiguration = serverContext.getRootConfig(); |
| | | rootConfiguration.addAttributeSyntaxAddListener(this); |
| | | rootConfiguration.addAttributeSyntaxDeleteListener(this); |
| | | |
| | |
| | | public void initializeBackendConfig() |
| | | throws ConfigException, InitializationException |
| | | { |
| | | // Create an internal server management context and retrieve |
| | | // the root configuration. |
| | | |
| | | RootCfg root = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | |
| | | // Register add and delete listeners. |
| | | RootCfg root = serverContext.getRootConfig(); |
| | | root.addBackendAddListener(this); |
| | | root.addBackendDeleteListener(this); |
| | | |
| | |
| | | public void initializeCertificateMappers() |
| | | throws ConfigException, InitializationException |
| | | { |
| | | RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | |
| | | |
| | | // Register as an add and delete listener with the root configuration so we |
| | | // can be notified if any certificate mapper entries are added or removed. |
| | | RootCfg rootConfiguration = serverContext.getRootConfig(); |
| | | rootConfiguration.addCertificateMapperAddListener(this); |
| | | rootConfiguration.addCertificateMapperDeleteListener(this); |
| | | |
| | |
| | | |
| | | initializeAdministrationConnectorConfig(); |
| | | |
| | | RootCfg root = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | |
| | | // Register as an add and delete listener so that we can |
| | | // be notified if new connection handlers are added or existing |
| | | // connection handlers are removed. |
| | | RootCfg root = serverContext.getRootConfig(); |
| | | root.addConnectionHandlerAddListener(this); |
| | | root.addConnectionHandlerDeleteListener(this); |
| | | |
| | |
| | | |
| | | private void initializeAdministrationConnectorConfig() |
| | | throws ConfigException, InitializationException { |
| | | |
| | | RootCfg root = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | AdministrationConnectorCfg administrationConnectorCfg = |
| | | root.getAdministrationConnector(); |
| | | serverContext.getRootConfig().getAdministrationConnector(); |
| | | |
| | | AdministrationConnector ac = new AdministrationConnector(serverContext); |
| | | ac.initializeAdministrationConnector(administrationConnectorCfg); |
| | |
| | | import org.forgerock.opendj.server.config.meta.GlobalCfgDefn.InvalidAttributeSyntaxBehavior; |
| | | import org.forgerock.opendj.server.config.meta.GlobalCfgDefn.SingleStructuralObjectclassBehavior; |
| | | import org.forgerock.opendj.server.config.server.GlobalCfg; |
| | | import org.forgerock.opendj.server.config.server.RootCfg; |
| | | import org.opends.server.api.AuthenticationPolicy; |
| | | import org.opends.server.loggers.CommonAudit; |
| | | import org.opends.server.types.*; |
| | |
| | | public void initializeCoreConfig() |
| | | throws ConfigException, InitializationException |
| | | { |
| | | RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | |
| | | |
| | | // Get the global configuration and register with it as a change listener. |
| | | GlobalCfg globalConfig = rootConfiguration.getGlobalConfiguration(); |
| | | GlobalCfg globalConfig = serverContext.getRootConfig().getGlobalConfiguration(); |
| | | globalConfig.addChangeListener(this); |
| | | |
| | | |
| | | // If there are any STMP servers specified, then make sure that if the value |
| | | // contains a colon that the portion after it is an integer between 1 and |
| | | // 65535. |
| | | // contains a colon that the portion after it is an integer between 1 and 65535. |
| | | Set<String> smtpServers = globalConfig.getSMTPServer(); |
| | | if (smtpServers != null) |
| | | { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public RootCfg getRootConfig() |
| | | { |
| | | return getServerManagementContext().getRootConfiguration(); |
| | | } |
| | | |
| | | @Override |
| | | public MemoryQuota getMemoryQuota() |
| | | { |
| | | return directoryServer.memoryQuota; |
| | |
| | | public void initializeCryptoManager() |
| | | throws ConfigException, InitializationException |
| | | { |
| | | RootCfg root = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | CryptoManagerCfg cryptoManagerCfg = root.getCryptoManager(); |
| | | CryptoManagerCfg cryptoManagerCfg = serverContext.getRootConfig().getCryptoManager(); |
| | | cryptoManager = new CryptoManagerImpl(serverContext, cryptoManagerCfg); |
| | | } |
| | | |
| | |
| | | backendConfigManager = new BackendConfigManager(serverContext); |
| | | backendConfigManager.initializeBackendConfig(); |
| | | |
| | | // Make sure to initialize the root DSE backend separately after all other |
| | | // backends. |
| | | // Make sure to initialize the root DSE backend separately after all other backends. |
| | | RootDSEBackendCfg rootDSECfg; |
| | | try |
| | | { |
| | | RootCfg root = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | rootDSECfg = root.getRootDSEBackend(); |
| | | rootDSECfg = serverContext.getRootConfig().getRootDSEBackend(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | throws ConfigException, InitializationException { |
| | | RootDSEBackendCfg rootDSECfg; |
| | | try { |
| | | RootCfg root = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | rootDSECfg = root.getRootDSEBackend(); |
| | | rootDSECfg = serverContext.getRootConfig().getRootDSEBackend(); |
| | | } catch (Exception e) { |
| | | logger.traceException(e); |
| | | LocalizableMessage message = ERR_CANNOT_GET_ROOT_DSE_CONFIG_ENTRY.get( |
| | |
| | | public void initializeEntryCache() |
| | | throws ConfigException |
| | | { |
| | | RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | |
| | | // Default entry cache should be already installed with |
| | | // <CODE>initializeDefaultEntryCache()</CODE> method so |
| | | // that there will be one even if we encounter a problem later. |
| | | |
| | | // Register as an add and delete listener with the root configuration so we |
| | | // can be notified if any entry cache entry is added or removed. |
| | | RootCfg rootConfiguration = serverContext.getRootConfig(); |
| | | rootConfiguration.addEntryCacheAddListener(this); |
| | | rootConfiguration.addEntryCacheDeleteListener(this); |
| | | |
| | |
| | | ) |
| | | throws InitializationException |
| | | { |
| | | RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | |
| | | // Load the entry cache class... |
| | | EntryCache<? extends EntryCacheCfg> entryCache = |
| | | loadEntryCache (className, configuration, true); |
| | |
| | | new EntryCacheMonitorProvider(configuration.dn(). |
| | | rdn().getFirstAVA().getAttributeValue().toString(), entryCache); |
| | | try { |
| | | RootCfg rootConfiguration = serverContext.getRootConfig(); |
| | | monitor.initializeMonitorProvider((EntryCacheMonitorProviderCfg) |
| | | rootConfiguration.getMonitorProvider( |
| | | DEFAULT_ENTRY_CACHE_MONITOR_PROVIDER)); |
| | | rootConfiguration.getMonitorProvider(DEFAULT_ENTRY_CACHE_MONITOR_PROVIDER)); |
| | | } catch (ConfigException ce) { |
| | | // ConfigException here means that either the entry cache monitor |
| | | // config entry is not present or the monitor is not enabled. In |
| | |
| | | public void initializeExtendedOperationHandlers() |
| | | throws ConfigException, InitializationException |
| | | { |
| | | // Create an internal server management context and retrieve |
| | | // the root configuration which has the extended operation handler relation. |
| | | |
| | | RootCfg root = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | |
| | | // Register add and delete listeners. |
| | | RootCfg root = serverContext.getRootConfig(); |
| | | root.addExtendedOperationHandlerAddListener(this); |
| | | root.addExtendedOperationHandlerDeleteListener(this); |
| | | |
| | |
| | | public void initializeGroupImplementations() |
| | | throws ConfigException, InitializationException |
| | | { |
| | | RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | |
| | | |
| | | // Register as an add and delete listener with the root configuration so we |
| | | // can be notified if any group implementation entries are added or removed. |
| | | RootCfg rootConfiguration = serverContext.getRootConfig(); |
| | | rootConfiguration.addGroupImplementationAddListener(this); |
| | | rootConfiguration.addGroupImplementationDeleteListener(this); |
| | | |
| | |
| | | public void initializeIdentityMappers() |
| | | throws ConfigException, InitializationException |
| | | { |
| | | RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | |
| | | |
| | | // Register as an add and delete listener with the root configuration so we |
| | | // can be notified if any identity mapper entries are added or removed. |
| | | RootCfg rootConfiguration = serverContext.getRootConfig(); |
| | | rootConfiguration.addIdentityMapperAddListener(this); |
| | | rootConfiguration.addIdentityMapperDeleteListener(this); |
| | | |
| | |
| | | public void initializeKeyManagerProviders() |
| | | throws ConfigException, InitializationException |
| | | { |
| | | RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | |
| | | |
| | | // Register as an add and delete listener with the root configuration so we |
| | | // can be notified if any key manager provider entries are added or removed. |
| | | RootCfg rootConfiguration = serverContext.getRootConfig(); |
| | | rootConfiguration.addKeyManagerProviderAddListener(this); |
| | | rootConfiguration.addKeyManagerProviderDeleteListener(this); |
| | | |
| | |
| | | */ |
| | | public void initializeLogRetentionPolicyConfig() throws ConfigException, InitializationException |
| | | { |
| | | |
| | | RootCfg root = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | |
| | | RootCfg root = serverContext.getRootConfig(); |
| | | root.addLogRetentionPolicyAddListener(this); |
| | | root.addLogRetentionPolicyDeleteListener(this); |
| | | |
| | |
| | | { |
| | | LogRetentionPolicyCfg config = root.getLogRetentionPolicy(name); |
| | | |
| | | RetentionPolicy RetentionPolicy = getRetentionPolicy(config); |
| | | |
| | | RetentionPolicy<LogRetentionPolicyCfg> RetentionPolicy = getRetentionPolicy(config); |
| | | DirectoryServer.registerRetentionPolicy(config.dn(), RetentionPolicy); |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAddAcceptable( |
| | | LogRetentionPolicyCfg configuration, |
| | |
| | | return isJavaClassAcceptable(configuration, unacceptableReasons); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationDeleteAcceptable( |
| | | LogRetentionPolicyCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd(LogRetentionPolicyCfg config) |
| | | { |
| | |
| | | |
| | | try |
| | | { |
| | | RetentionPolicy RetentionPolicy = getRetentionPolicy(config); |
| | | |
| | | DirectoryServer.registerRetentionPolicy(config.dn(), RetentionPolicy); |
| | | RetentionPolicy<LogRetentionPolicyCfg> retentionPolicy = getRetentionPolicy(config); |
| | | DirectoryServer.registerRetentionPolicy(config.dn(), retentionPolicy); |
| | | } |
| | | catch (ConfigException e) { |
| | | logger.traceException(e); |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | LogRetentionPolicyCfg config) |
| | | { |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | RetentionPolicy policy = DirectoryServer.getRetentionPolicy(config.dn()); |
| | | RetentionPolicy<?> policy = DirectoryServer.getRetentionPolicy(config.dn()); |
| | | if(policy != null) |
| | | { |
| | | DirectoryServer.deregisterRetentionPolicy(config.dn()); |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | LogRetentionPolicyCfg configuration, |
| | |
| | | return isJavaClassAcceptable(configuration, unacceptableReasons); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | LogRetentionPolicyCfg configuration) |
| | |
| | | Class<? extends RetentionPolicy> theClass = |
| | | pd.loadClass(className, RetentionPolicy.class); |
| | | // Explicitly cast to check that implementation implements the correct interface. |
| | | RetentionPolicy retentionPolicy = theClass.newInstance(); |
| | | RetentionPolicy<?> retentionPolicy = theClass.newInstance(); |
| | | // next line is here to ensure that eclipse does not remove the cast in the line above |
| | | retentionPolicy.hashCode(); |
| | | return true; |
| | |
| | | } |
| | | } |
| | | |
| | | private RetentionPolicy getRetentionPolicy(LogRetentionPolicyCfg config) |
| | | private RetentionPolicy<LogRetentionPolicyCfg> getRetentionPolicy(LogRetentionPolicyCfg config) |
| | | throws ConfigException { |
| | | String className = config.getJavaClass(); |
| | | LogRetentionPolicyCfgDefn d = LogRetentionPolicyCfgDefn.getInstance(); |
| | |
| | | try { |
| | | Class<? extends RetentionPolicy> theClass = |
| | | pd.loadClass(className, RetentionPolicy.class); |
| | | RetentionPolicy retentionPolicy = theClass.newInstance(); |
| | | |
| | | RetentionPolicy<LogRetentionPolicyCfg> retentionPolicy = theClass.newInstance(); |
| | | retentionPolicy.initializeLogRetentionPolicy(config); |
| | | |
| | | return retentionPolicy; |
| | | } catch (Exception e) { |
| | | LocalizableMessage message = ERR_CONFIG_RETENTION_POLICY_INVALID_CLASS.get( |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | public void initializeLogRotationPolicyConfig() throws ConfigException, InitializationException |
| | | { |
| | | |
| | | RootCfg root = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | |
| | | RootCfg root = serverContext.getRootConfig(); |
| | | root.addLogRotationPolicyAddListener(this); |
| | | root.addLogRotationPolicyDeleteListener(this); |
| | | |
| | | for(String name : root.listLogRotationPolicies()) |
| | | { |
| | | LogRotationPolicyCfg config = root.getLogRotationPolicy(name); |
| | | |
| | | RotationPolicy rotationPolicy = getRotationPolicy(config); |
| | | |
| | | RotationPolicy<LogRotationPolicyCfg> rotationPolicy = getRotationPolicy(config); |
| | | DirectoryServer.registerRotationPolicy(config.dn(), rotationPolicy); |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAddAcceptable( |
| | | LogRotationPolicyCfg configuration, |
| | |
| | | return isJavaClassAcceptable(configuration, unacceptableReasons); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationDeleteAcceptable( |
| | | LogRotationPolicyCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd(LogRotationPolicyCfg config) |
| | | { |
| | |
| | | |
| | | try |
| | | { |
| | | RotationPolicy rotationPolicy = getRotationPolicy(config); |
| | | |
| | | RotationPolicy<LogRotationPolicyCfg> rotationPolicy = getRotationPolicy(config); |
| | | DirectoryServer.registerRotationPolicy(config.dn(), rotationPolicy); |
| | | } |
| | | catch (ConfigException e) { |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | LogRotationPolicyCfg config) |
| | | { |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | RotationPolicy policy = DirectoryServer.getRotationPolicy(config.dn()); |
| | | RotationPolicy<?> policy = DirectoryServer.getRotationPolicy(config.dn()); |
| | | if(policy != null) |
| | | { |
| | | DirectoryServer.deregisterRotationPolicy(config.dn()); |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | LogRotationPolicyCfg configuration, |
| | |
| | | return isJavaClassAcceptable(configuration, unacceptableReasons); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | LogRotationPolicyCfg configuration) |
| | | { |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | RotationPolicy policy = |
| | | DirectoryServer.getRotationPolicy(configuration.dn()); |
| | | RotationPolicy<?> policy = DirectoryServer.getRotationPolicy(configuration.dn()); |
| | | String className = configuration.getJavaClass(); |
| | | if(!className.equals(policy.getClass().getName())) |
| | | { |
| | |
| | | Class<? extends RotationPolicy> theClass = |
| | | pd.loadClass(className, RotationPolicy.class); |
| | | // Explicitly cast to check that implementation implements the correct interface. |
| | | RotationPolicy retentionPolicy = theClass.newInstance(); |
| | | RotationPolicy<?> retentionPolicy = theClass.newInstance(); |
| | | // next line is here to ensure that eclipse does not remove the cast in the line above |
| | | retentionPolicy.hashCode(); |
| | | return true; |
| | |
| | | } |
| | | } |
| | | |
| | | private RotationPolicy getRotationPolicy(LogRotationPolicyCfg config) |
| | | private RotationPolicy<LogRotationPolicyCfg> getRotationPolicy(LogRotationPolicyCfg config) |
| | | throws ConfigException { |
| | | String className = config.getJavaClass(); |
| | | LogRotationPolicyCfgDefn d = LogRotationPolicyCfgDefn.getInstance(); |
| | |
| | | try { |
| | | Class<? extends RotationPolicy> theClass = |
| | | pd.loadClass(className, RotationPolicy.class); |
| | | RotationPolicy rotationPolicy = theClass.newInstance(); |
| | | |
| | | RotationPolicy<LogRotationPolicyCfg> rotationPolicy = theClass.newInstance(); |
| | | rotationPolicy.initializeLogRotationPolicy(config); |
| | | |
| | | return rotationPolicy; |
| | | } catch (Exception e) { |
| | | LocalizableMessage message = ERR_CONFIG_ROTATION_POLICY_INVALID_CLASS.get( |
| | |
| | | */ |
| | | public void initializeLoggerConfig() throws ConfigException, InitializationException |
| | | { |
| | | // Create an internal server management context and retrieve |
| | | // the root configuration which has the log publisher relation. |
| | | |
| | | RootCfg root = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | |
| | | RootCfg root = serverContext.getRootConfig(); |
| | | root.addLogPublisherAddListener(this); |
| | | root.addLogPublisherDeleteListener(this); |
| | | |
| | |
| | | public void initializeMatchingRules() |
| | | throws ConfigException, InitializationException |
| | | { |
| | | RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | |
| | | |
| | | // Register as an add and delete listener with the root configuration so we |
| | | // can be notified if any matching rule entries are added or removed. |
| | | RootCfg rootConfiguration = serverContext.getRootConfig(); |
| | | rootConfiguration.addMatchingRuleAddListener(this); |
| | | rootConfiguration.addMatchingRuleDeleteListener(this); |
| | | |
| | |
| | | public void initializeMonitorProviders() |
| | | throws ConfigException, InitializationException |
| | | { |
| | | RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | |
| | | |
| | | // Register as an add and delete listener with the root configuration so we |
| | | // can be notified if any monitor provider entries are added or removed. |
| | | RootCfg rootConfiguration = serverContext.getRootConfig(); |
| | | rootConfiguration.addMonitorProviderAddListener(this); |
| | | rootConfiguration.addMonitorProviderDeleteListener(this); |
| | | |
| | |
| | | public void initializePasswordGenerators() |
| | | throws ConfigException, InitializationException |
| | | { |
| | | RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | |
| | | // Register as an add and delete listener with the root configuration so we |
| | | // can be notified if any password generator entries are added or removed. |
| | | RootCfg rootConfiguration = serverContext.getRootConfig(); |
| | | rootConfiguration.addPasswordGeneratorAddListener(this); |
| | | rootConfiguration.addPasswordGeneratorDeleteListener(this); |
| | | |
| | |
| | | this.serverContext = serverContext; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Initializes all authentication policies currently defined in the Directory |
| | | * Server configuration. This should only be called at Directory Server |
| | |
| | | public void initializeAuthenticationPolicies() throws ConfigException, |
| | | InitializationException |
| | | { |
| | | RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | |
| | | // Register as an add and delete listener with the root configuration so we |
| | | // can be notified if any password policy entries are added or removed. |
| | | RootCfg rootConfiguration = serverContext.getRootConfig(); |
| | | rootConfiguration.addPasswordPolicyAddListener(this); |
| | | rootConfiguration.addPasswordPolicyDeleteListener(this); |
| | | |
| | |
| | | DirectoryServer.getSubentryManager().registerChangeListener(this); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Perform any required finalization tasks for all authentication policies |
| | | * currently defined. This should only be called at Directory Server shutdown. |
| | | */ |
| | | public void finalizeAuthenticationPolicies() |
| | | { |
| | | // Deregister this as subentry change listener with SubentryManager. |
| | | DirectoryServer.getSubentryManager().deregisterChangeListener(this); |
| | | |
| | | // Deregister as configuration change listeners. |
| | | |
| | | RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | RootCfg rootConfiguration = serverContext.getRootConfig(); |
| | | rootConfiguration.removePasswordPolicyAddListener(this); |
| | | rootConfiguration.removePasswordPolicyDeleteListener(this); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAddAcceptable( |
| | | AuthenticationPolicyCfg configuration, List<LocalizableMessage> unacceptableReason) |
| | |
| | | unacceptableReason); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd(AuthenticationPolicyCfg configuration) |
| | | { |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationDeleteAcceptable( |
| | | AuthenticationPolicyCfg configuration, List<LocalizableMessage> unacceptableReason) |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete(AuthenticationPolicyCfg configuration) |
| | | { |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void checkSubentryAddAcceptable(Entry entry) throws DirectoryException |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void checkSubentryDeleteAcceptable(Entry entry) |
| | | throws DirectoryException |
| | |
| | | // either directly or via a virtual attribute). |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void checkSubentryModifyAcceptable(Entry oldEntry, Entry newEntry) |
| | | throws DirectoryException |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void checkSubentryModifyDNAcceptable(Entry oldEntry, Entry newEntry) |
| | | throws DirectoryException |
| | |
| | | // either directly or via a virtual attribute). |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void handleSubentryAdd(Entry entry) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void handleSubentryDelete(Entry entry) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void handleSubentryModify(Entry oldEntry, Entry newEntry) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void handleSubentryModifyDN(Entry oldEntry, Entry newEntry) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates and registers the provided authentication policy |
| | | * configuration. |
| | | */ |
| | | /** Creates and registers the provided authentication policy configuration. */ |
| | | private <T extends AuthenticationPolicyCfg> void createAuthenticationPolicy( |
| | | T policyConfiguration) throws ConfigException, InitializationException |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Determines whether or not the new authentication policy configuration's |
| | | * implementation class is acceptable. |
| | |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | public void initializePasswordStorageSchemes() |
| | | throws ConfigException, InitializationException |
| | | { |
| | | RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | |
| | | // Register as an add and delete listener with the root configuration so we |
| | | // can be notified if any entry cache entry is added or removed. |
| | | RootCfg rootConfiguration = serverContext.getRootConfig(); |
| | | rootConfiguration.addPasswordStorageSchemeAddListener (this); |
| | | rootConfiguration.addPasswordStorageSchemeDeleteListener (this); |
| | | |
| | |
| | | public void initializePasswordValidators() |
| | | throws ConfigException, InitializationException |
| | | { |
| | | RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | |
| | | |
| | | // Register as an add and delete listener with the root configuration so we |
| | | // can be notified if any password validator entries are added or removed. |
| | | RootCfg rootConfiguration = serverContext.getRootConfig(); |
| | | rootConfiguration.addPasswordValidatorAddListener(this); |
| | | rootConfiguration.addPasswordValidatorDeleteListener(this); |
| | | |
| | |
| | | import org.forgerock.opendj.server.config.meta.PluginCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.PluginCfg; |
| | | import org.forgerock.opendj.server.config.server.PluginRootCfg; |
| | | import org.forgerock.opendj.server.config.server.RootCfg; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.api.plugin.DirectoryServerPlugin; |
| | | import org.opends.server.api.plugin.InternalDirectoryServerPlugin; |
| | |
| | | { |
| | | registeredPlugins.clear(); |
| | | |
| | | RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | |
| | | // Get the plugin root configuration and register with it as an add and |
| | | // delete listener so we can be notified if any plugin entries are added or removed. |
| | | pluginRootConfig = rootConfiguration.getPluginRoot(); |
| | | pluginRootConfig = serverContext.getRootConfig().getPluginRoot(); |
| | | pluginRootConfig.addPluginAddListener(this); |
| | | pluginRootConfig.addPluginDeleteListener(this); |
| | | } |
| | |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | |
| | | import java.util.HashSet; |
| | |
| | | import org.forgerock.opendj.config.server.ConfigurationAddListener; |
| | | import org.forgerock.opendj.config.server.ConfigurationChangeListener; |
| | | import org.forgerock.opendj.config.server.ConfigurationDeleteListener; |
| | | import org.forgerock.opendj.server.config.server.RootCfg; |
| | | import org.forgerock.opendj.server.config.server.RootDNCfg; |
| | | import org.forgerock.opendj.server.config.server.RootDNUserCfg; |
| | | import org.forgerock.opendj.config.server.ConfigChangeResult; |
| | |
| | | public void initializeRootDNs() |
| | | throws ConfigException, InitializationException |
| | | { |
| | | RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | |
| | | |
| | | // Get the root DN configuration object, use it to set the default root |
| | | // privileges, and register a change listener for it. |
| | | RootDNCfg rootDNCfg = rootConfiguration.getRootDN(); |
| | | RootDNCfg rootDNCfg = serverContext.getRootConfig().getRootDN(); |
| | | rootPrivilegeChangeListener.setDefaultRootPrivileges(rootDNCfg); |
| | | rootDNCfg.addChangeListener(rootPrivilegeChangeListener); |
| | | |
| | | |
| | | // Register as an add and delete listener for new root DN users. |
| | | rootDNCfg.addRootDNUserAddListener(this); |
| | | rootDNCfg.addRootDNUserDeleteListener(this); |
| | | |
| | |
| | | public void initializeSASLMechanismHandlers() |
| | | throws ConfigException, InitializationException |
| | | { |
| | | RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | |
| | | |
| | | // Register as an add and delete listener with the root configuration so we |
| | | // can be notified if any SASL mechanism handler entries are added or |
| | | // removed. |
| | | RootCfg rootConfiguration = serverContext.getRootConfig(); |
| | | rootConfiguration.addSASLMechanismHandlerAddListener(this); |
| | | rootConfiguration.addSASLMechanismHandlerDeleteListener(this); |
| | | |
| | |
| | | { |
| | | this.serverContext = serverContext; |
| | | |
| | | final RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | final org.opends.server.types.Schema schema = serverContext.getSchema(); |
| | | |
| | | schema.exclusiveLock(); |
| | |
| | | final SchemaBuilder schemaBuilder = new SchemaBuilder(Schema.getCoreSchema()); |
| | | |
| | | // Take providers into account. |
| | | loadSchemaFromProviders(rootConfiguration, schemaBuilder); |
| | | loadSchemaFromProviders(serverContext.getRootConfig(), schemaBuilder); |
| | | |
| | | // Take schema files into account (TODO : or load files using provider mechanism ?) |
| | | completeSchemaFromFiles(schemaBuilder); |
| | |
| | | package org.opends.server.core; |
| | | |
| | | import org.forgerock.opendj.config.server.ServerManagementContext; |
| | | import org.forgerock.opendj.server.config.server.RootCfg; |
| | | import org.opends.server.extensions.DiskSpaceMonitor; |
| | | import org.opends.server.loggers.CommonAudit; |
| | | import org.opends.server.types.DirectoryEnvironmentConfig; |
| | |
| | | ServerManagementContext getServerManagementContext(); |
| | | |
| | | /** |
| | | * Returns the root configuration object. |
| | | * <p> |
| | | * Equivalent to calling {@code getServerManagementContext().getRootConfiguration()}. |
| | | * |
| | | * @return the root configuration object |
| | | */ |
| | | RootCfg getRootConfig(); |
| | | |
| | | /** |
| | | * Returns the memory quota system for reserving long term memory. |
| | | * |
| | | * @return the memory quota system |
| | |
| | | public void initializeSynchronizationProviders() |
| | | throws ConfigException, InitializationException |
| | | { |
| | | // Create an internal server management context and retrieve |
| | | // the root configuration which has the synchronization provider relation. |
| | | |
| | | RootCfg root = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | |
| | | // Register as an add and delete listener so that we can |
| | | // be notified when new synchronization providers are added or existing |
| | | // synchronization providers are removed. |
| | | RootCfg root = serverContext.getRootConfig(); |
| | | root.addSynchronizationProviderAddListener(this); |
| | | root.addSynchronizationProviderDeleteListener(this); |
| | | |
| | |
| | | public void initializeTrustManagerProviders() |
| | | throws ConfigException, InitializationException |
| | | { |
| | | RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | |
| | | |
| | | // Register as an add and delete listener with the root configuration so we |
| | | // can be notified if any trust manager provider entries are added or |
| | | // removed. |
| | | RootCfg rootConfiguration = serverContext.getRootConfig(); |
| | | rootConfiguration.addTrustManagerProviderAddListener(this); |
| | | rootConfiguration.addTrustManagerProviderDeleteListener(this); |
| | | |
| | |
| | | public void initializeVirtualAttributes() |
| | | throws ConfigException, InitializationException |
| | | { |
| | | RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | |
| | | |
| | | // Register as an add and delete listener with the root configuration so we |
| | | // can be notified if any virtual attribute provider entries are added or |
| | | // removed. |
| | | RootCfg rootConfiguration = serverContext.getRootConfig(); |
| | | rootConfiguration.addVirtualAttributeAddListener(this); |
| | | rootConfiguration.addVirtualAttributeDeleteListener(this); |
| | | |
| | |
| | | import org.forgerock.opendj.config.ClassPropertyDefinition; |
| | | import org.forgerock.opendj.config.server.ConfigurationChangeListener; |
| | | import org.forgerock.opendj.server.config.meta.WorkQueueCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.RootCfg; |
| | | import org.forgerock.opendj.server.config.server.WorkQueueCfg; |
| | | import org.opends.server.api.WorkQueue; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | |
| | | public WorkQueue initializeWorkQueue() |
| | | throws ConfigException, InitializationException |
| | | { |
| | | RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | |
| | | |
| | | // Get the work queue configuration and register with it as a change |
| | | // listener. |
| | | WorkQueueCfg workQueueConfig = rootConfiguration.getWorkQueue(); |
| | | // Get the work queue configuration and register with it as a change listener. |
| | | WorkQueueCfg workQueueConfig = serverContext.getRootConfig().getWorkQueue(); |
| | | workQueueConfig.addChangeListener(this); |
| | | |
| | | |
| | |
| | | import org.forgerock.opendj.server.config.server.LogPublisherCfg; |
| | | import org.forgerock.opendj.server.config.server.LogRetentionPolicyCfg; |
| | | import org.forgerock.opendj.server.config.server.LogRotationPolicyCfg; |
| | | import org.forgerock.opendj.server.config.server.RootCfg; |
| | | import org.forgerock.opendj.server.config.server.SizeLimitLogRetentionPolicyCfg; |
| | | import org.forgerock.opendj.server.config.server.SizeLimitLogRotationPolicyCfg; |
| | | import org.forgerock.opendj.server.config.server.TimeLimitLogRotationPolicyCfg; |
| | |
| | | private void addCsvHandlerRotationConfig(PublisherConfig publisher, CsvConfigData config, |
| | | CsvAuditEventHandlerConfiguration auditConfig) throws ConfigException |
| | | { |
| | | RootCfg root = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | SortedSet<String> rotationPolicies = config.getRotationPolicies(); |
| | | if (rotationPolicies.isEmpty()) |
| | | { |
| | |
| | | fileRotation.setRotationEnabled(true); |
| | | for (final String policy : rotationPolicies) |
| | | { |
| | | LogRotationPolicyCfg policyConfig = root.getLogRotationPolicy(policy); |
| | | LogRotationPolicyCfg policyConfig = serverContext.getRootConfig().getLogRotationPolicy(policy); |
| | | if (policyConfig instanceof FixedTimeLogRotationPolicyCfg) |
| | | { |
| | | List<String> times = convertTimesOfDay(publisher, (FixedTimeLogRotationPolicyCfg) policyConfig); |
| | |
| | | private void addCsvHandlerRetentionConfig(PublisherConfig publisher, CsvConfigData config, |
| | | CsvAuditEventHandlerConfiguration auditConfig) throws ConfigException |
| | | { |
| | | RootCfg root = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | SortedSet<String> retentionPolicies = config.getRetentionPolicies(); |
| | | if (retentionPolicies.isEmpty()) |
| | | { |
| | |
| | | FileRetention fileRetention = new FileRetention(); |
| | | for (final String policy : retentionPolicies) |
| | | { |
| | | LogRetentionPolicyCfg policyConfig = root.getLogRetentionPolicy(policy); |
| | | LogRetentionPolicyCfg policyConfig = serverContext.getRootConfig().getLogRetentionPolicy(policy); |
| | | if (policyConfig instanceof FileCountLogRetentionPolicyCfg) |
| | | { |
| | | fileRetention.setMaxNumberOfHistoryFiles(((FileCountLogRetentionPolicyCfg) policyConfig).getNumberOfFiles()); |
| | |
| | | */ |
| | | private static FractionalConfig getStaticReplicationDomainFractionalConfig(ServerContext serverContext, |
| | | Entry entry) throws Exception { |
| | | RootCfg root = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | RootCfg root = serverContext.getRootConfig(); |
| | | ReplicationSynchronizationProviderCfg sync = |
| | | (ReplicationSynchronizationProviderCfg) |
| | | root.getSynchronizationProvider("Multimaster Synchronization"); |
| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizableMessageDescriptor.Arg1; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.adapter.server3x.Converters; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.requests.ModifyRequest; |
| | | import org.forgerock.opendj.config.server.ServerManagementContext; |
| | | import org.forgerock.opendj.server.config.server.BackendCfg; |
| | | import org.forgerock.opendj.server.config.server.RootCfg; |
| | | import org.opends.server.api.Backend; |
| | |
| | | */ |
| | | public static BackendCfg getConfigEntry(Backend<?> backend) |
| | | { |
| | | RootCfg root = getServerManagementContext().getRootConfiguration(); |
| | | try |
| | | { |
| | | return root.getBackend(backend.getBackendID()); |
| | | return getRootConfig().getBackend(backend.getBackendID()); |
| | | } |
| | | catch (ConfigException e) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | private static ServerManagementContext getServerManagementContext() |
| | | private static RootCfg getRootConfig() |
| | | { |
| | | return DirectoryServer.getInstance().getServerContext().getServerManagementContext(); |
| | | return DirectoryServer.getInstance().getServerContext().getRootConfig(); |
| | | } |
| | | |
| | | /** |
| | |
| | | public static void enableBackend(String backendID) |
| | | throws DirectoryException |
| | | { |
| | | DN configEntryDN; |
| | | RootCfg root = getServerManagementContext().getRootConfiguration(); |
| | | try |
| | | { |
| | | BackendCfg cfg = root.getBackend(backendID); |
| | | configEntryDN = cfg.dn(); |
| | | } |
| | | catch (ConfigException e) |
| | | { |
| | | throw new DirectoryException(DirectoryServer.getServerErrorResultCode(), |
| | | e.getMessageObject(), e); |
| | | } |
| | | |
| | | ModifyRequest modifyRequest = newModifyRequest(configEntryDN) |
| | | .addModification(REPLACE, ATTR_BACKEND_ENABLED, TRUE_VALUE); |
| | | ModifyOperation internalModify = getRootConnection().processModify(modifyRequest); |
| | | |
| | | ResultCode resultCode = internalModify.getResultCode(); |
| | | if (resultCode != ResultCode.SUCCESS) |
| | | { |
| | | LocalizableMessage message = ERR_TASK_CANNOT_ENABLE_BACKEND.get(configEntryDN); |
| | | throw new DirectoryException(resultCode, message); |
| | | } |
| | | enableBackend(backendID, TRUE_VALUE, ERR_TASK_CANNOT_ENABLE_BACKEND); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | public static void disableBackend(String backendID) throws DirectoryException |
| | | { |
| | | enableBackend(backendID, FALSE_VALUE, ERR_TASK_CANNOT_DISABLE_BACKEND); |
| | | } |
| | | |
| | | private static void enableBackend(String backendID, ByteString enableValue, Arg1<Object> errorMsg) |
| | | throws DirectoryException { |
| | | DN configEntryDN; |
| | | RootCfg root = getServerManagementContext().getRootConfiguration(); |
| | | try |
| | | { |
| | | BackendCfg cfg = root.getBackend(backendID); |
| | | configEntryDN = cfg.dn(); |
| | | configEntryDN = getRootConfig().getBackend(backendID).dn(); |
| | | } |
| | | catch (ConfigException e) |
| | | { |
| | | throw new DirectoryException(DirectoryServer.getServerErrorResultCode(), |
| | | e.getMessageObject(), e); |
| | | throw new DirectoryException(DirectoryServer.getServerErrorResultCode(), e.getMessageObject(), e); |
| | | } |
| | | |
| | | ModifyRequest modifyRequest = newModifyRequest(configEntryDN) |
| | | .addModification(REPLACE, ATTR_BACKEND_ENABLED, FALSE_VALUE); |
| | | ModifyOperation internalModify = getRootConnection().processModify(modifyRequest); |
| | | .addModification(REPLACE, ATTR_BACKEND_ENABLED, enableValue); |
| | | ModifyOperation modifyOp = getRootConnection().processModify(modifyRequest); |
| | | |
| | | ResultCode resultCode = internalModify.getResultCode(); |
| | | ResultCode resultCode = modifyOp.getResultCode(); |
| | | if (resultCode != ResultCode.SUCCESS) |
| | | { |
| | | LocalizableMessage message = ERR_TASK_CANNOT_DISABLE_BACKEND.get(configEntryDN); |
| | | throw new DirectoryException(resultCode, message); |
| | | throw new DirectoryException(resultCode, errorMsg.get(configEntryDN)); |
| | | } |
| | | } |
| | | |
| | |
| | | try |
| | | { |
| | | // Iterate through the immediate children, attempting to parse them as backends. |
| | | final RootCfg root = |
| | | DirectoryServer.getInstance().getServerContext().getServerManagementContext().getRootConfiguration(); |
| | | final RootCfg root = DirectoryServer.getInstance().getServerContext().getRootConfig(); |
| | | ConfigurationHandler configHandler = DirectoryServer.getConfigurationHandler(); |
| | | final DN backendBaseDN = getBackendBaseDN(); |
| | | for (final DN childrenDn : configHandler.getChildren(backendBaseDN)) |
| | |
| | | final DN rootDN = parseRootDN(); |
| | | final String rootPW = parseRootDNPassword(); |
| | | |
| | | // Get the Directory Server configuration handler and use it to make the |
| | | // appropriate configuration changes. |
| | | configHandler = DirectoryServer.getConfigurationHandler(); |
| | | |
| | | checkManagerProvider(keyManagerProviderDN, JCKES_KEY_MANAGER_DN, JCKES_KEY_MANAGER_LDIF_ENTRY, true); |
| | |
| | | throws InitializationException, ConfigException { |
| | | directoryServer.initializeRootDSE(); |
| | | |
| | | RootCfg root = directoryServer.getServerContext().getServerManagementContext().getRootConfiguration(); |
| | | Entry backendRoot; |
| | | try { |
| | | DN configEntryDN = DN.valueOf(ConfigConstants.DN_BACKEND_BASE); |
| | |
| | | LocalizableMessage message = ERR_CONFIG_BACKEND_BASE_DOES_NOT_EXIST.get(); |
| | | throw new ConfigException(message); |
| | | } |
| | | |
| | | RootCfg root = directoryServer.getServerContext().getRootConfig(); |
| | | for (String name : root.listBackends()) { |
| | | BackendCfg backendCfg = root.getBackend(name); |
| | | String backendID = backendCfg.getBackendId(); |
| | |
| | | * Ensure that configuration is fully bootstrapped. Only use when necessary as |
| | | * it will impact test performance. |
| | | */ |
| | | public ServerContextBuilder withConfigurationBootstrapped() |
| | | throws InitializationException |
| | | public ServerContextBuilder withConfigurationBootstrapped() throws InitializationException |
| | | { |
| | | final ConfigurationHandler configHandler = ConfigurationHandler.bootstrapConfiguration(serverContext); |
| | | final ServerManagementContext serverManagementContext = new ServerManagementContext(configHandler); |
| | | when(serverContext.getServerManagementContext()).thenReturn(serverManagementContext); |
| | | when(serverContext.getRootConfig()).thenReturn(serverManagementContext.getRootConfiguration()); |
| | | return this; |
| | | } |
| | | |
| | |
| | | { |
| | | try |
| | | { |
| | | final RootCfg root = |
| | | DirectoryServer.getInstance().getServerContext().getServerManagementContext().getRootConfiguration(); |
| | | final RootCfg root = DirectoryServer.getInstance().getServerContext().getRootConfig(); |
| | | final String errorMsg = "Unexpected content in reject file:\n\n" + readFile(reject) |
| | | + "\n\nThe backend was configured with the following base DNs: " |
| | | + root.getBackend(beID).getBaseDN() + "\n\n"; |