Code cleanup
*.java:
In applyConfiguration*(), replaced the triplet (resultCode, adminActionRequired, messages) with a single ConfigChangeResult object.
ConfigChangeResult.java:
Removed now unused ctor ConfigChangeResult(ResultCode, boolean adminActionRequired).
Added method setResultCodeIfSuccess().
| | |
| | | this.config = config; |
| | | |
| | | // Update was successfull, no restart required. |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.DN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | |
| | | /** |
| | | * Aggregation property definition. |
| | |
| | | ServerManagedObject<? extends S> mo) { |
| | | try { |
| | | if (targetIsEnabledCondition.evaluate(mo)) { |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | } catch (ConfigException e) { |
| | | // This should not happen - ignore it and throw an exception |
| | |
| | | throw new IllegalStateException("Attempting to delete a referenced " |
| | | + relationDefinition.getChildDefinition().getUserFriendlyName()); |
| | | } else { |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | } |
| | | |
| | |
| | | DN expectedDN = DNBuilder.create(childPath); |
| | | if (!configEntry.getDN().equals(expectedDN)) { |
| | | // Doesn't apply to us. |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | } |
| | | |
| | |
| | | } else { |
| | | // The dependent entry was not found. |
| | | configEntry.deregisterChangeListener(this); |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | } |
| | | |
| | |
| | | if (configEntry.getDN().equals(dn)) { |
| | | finalizeChangeListener(); |
| | | } |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | |
| | | DN expectedDN = DNBuilder.create(childPath); |
| | | if (!configEntry.getDN().equals(expectedDN)) { |
| | | // Doesn't apply to us. |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | package org.opends.server.admin.server; |
| | | |
| | | |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | |
| | | import org.opends.server.api.ConfigAddListener; |
| | |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.DN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | |
| | | |
| | | /** |
| | | * A configuration add listener which will monitor a parent entry to |
| | | * see when a specified child entry has been added. When the child |
| | |
| | | } |
| | | } |
| | | |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange(BackupBackendCfg cfg) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | Set<String> values = cfg.getBackupDirectory(); |
| | | backupDirectories = new LinkedHashMap<File,CachedBackupDirectory>(values.size()); |
| | |
| | | } |
| | | |
| | | currentConfig = cfg; |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | package org.opends.server.backends; |
| | | |
| | | import static org.opends.messages.BackendMessages.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.io.File; |
| | | import java.util.*; |
| | | import java.util.concurrent.locks.ReentrantReadWriteLock; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ConditionResult; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.server.LDIFBackendCfg; |
| | | import org.opends.server.api.AlertGenerator; |
| | | import org.opends.server.api.Backend; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.controls.SubtreeDeleteControl; |
| | | import org.opends.server.core.*; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.util.LDIFException; |
| | | import org.opends.server.util.LDIFReader; |
| | | import org.opends.server.util.LDIFWriter; |
| | | import org.opends.server.util.StaticUtils; |
| | | |
| | | import static org.opends.messages.BackendMessages.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | /** |
| | | * This class provides a backend implementation that stores the underlying data |
| | | * in an LDIF file. When the backend is initialized, the contents of the |
| | |
| | | // We don't actually need to do anything in response to this. However, if |
| | | // the base DNs or LDIF file are different from what we're currently using |
| | | // then indicate that admin action is required. |
| | | boolean adminActionRequired = false; |
| | | LinkedList<LocalizableMessage> messages = new LinkedList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | if (ldifFilePath != null) |
| | | { |
| | |
| | | File newLDIF = getFileForPath(configuration.getLDIFFile()); |
| | | if (! currentLDIF.equals(newLDIF)) |
| | | { |
| | | messages.add(INFO_LDIF_BACKEND_LDIF_FILE_CHANGED.get()); |
| | | adminActionRequired = true; |
| | | ccr.addMessage(INFO_LDIF_BACKEND_LDIF_FILE_CHANGED.get()); |
| | | ccr.setAdminActionRequired(true); |
| | | } |
| | | } |
| | | |
| | | if (baseDNSet != null && !baseDNSet.equals(configuration.getBaseDN())) |
| | | { |
| | | messages.add(INFO_LDIF_BACKEND_BASE_DN_CHANGED.get()); |
| | | adminActionRequired = true; |
| | | ccr.addMessage(INFO_LDIF_BACKEND_BASE_DN_CHANGED.get()); |
| | | ccr.setAdminActionRequired(true); |
| | | } |
| | | |
| | | currentConfig = configuration; |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, adminActionRequired, |
| | | messages); |
| | | return ccr; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | final MonitorBackendCfg backendCfg) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | final boolean adminActionRequired = false; |
| | | final ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | // Check to see if there is a new set of user-defined attributes. |
| | | final ArrayList<Attribute> userAttrs = new ArrayList<Attribute>(); |
| | |
| | | { |
| | | logger.traceException(e); |
| | | |
| | | messages.add(ERR_CONFIG_BACKEND_ERROR_INTERACTING_WITH_BACKEND_ENTRY.get( |
| | | ccr.addMessage(ERR_CONFIG_BACKEND_ERROR_INTERACTING_WITH_BACKEND_ENTRY.get( |
| | | configEntryDN, stackTraceToSingleLineString(e))); |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | |
| | | userDefinedAttributes = userAttrs; |
| | | |
| | | final LocalizableMessage message = INFO_MONITOR_USING_NEW_USER_ATTRS.get(); |
| | | messages.add(message); |
| | | ccr.addMessage(INFO_MONITOR_USING_NEW_USER_ATTRS.get()); |
| | | |
| | | currentConfig = backendCfg; |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | |
| | | */ |
| | | package org.opends.server.backends; |
| | | |
| | | import static org.opends.messages.BackendMessages.*; |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Collection; |
| | |
| | | import org.opends.server.util.BuildVersion; |
| | | import org.opends.server.util.LDIFWriter; |
| | | |
| | | import static org.opends.messages.BackendMessages.*; |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | /** |
| | | * This class defines a backend to hold the Directory Server root DSE. It is a |
| | | * kind of meta-backend in that it will dynamically generate the root DSE entry |
| | |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange(RootDSEBackendCfg cfg) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // Check to see if we should apply a new set of base DNs. |
| | |
| | | if (backend == null) |
| | | { |
| | | // This is not fine. We can't use a suffix that doesn't exist. |
| | | messages.add(WARN_ROOTDSE_NO_BACKEND_FOR_SUBORDINATE_BASE.get(baseDN)); |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | } |
| | | ccr.addMessage(WARN_ROOTDSE_NO_BACKEND_FOR_SUBORDINATE_BASE.get(baseDN)); |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | logger.traceException(e); |
| | | |
| | | LocalizableMessage message = WARN_ROOTDSE_SUBORDINATE_BASE_EXCEPTION.get( |
| | | stackTraceToSingleLineString(e)); |
| | | messages.add(message); |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | } |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(WARN_ROOTDSE_SUBORDINATE_BASE_EXCEPTION.get( |
| | | stackTraceToSingleLineString(e))); |
| | | |
| | | subBases = null; |
| | | } |
| | |
| | | { |
| | | logger.traceException(e); |
| | | |
| | | messages.add(ERR_CONFIG_BACKEND_ERROR_INTERACTING_WITH_BACKEND_ENTRY.get( |
| | | ccr.addMessage(ERR_CONFIG_BACKEND_ERROR_INTERACTING_WITH_BACKEND_ENTRY.get( |
| | | configEntryDN, stackTraceToSingleLineString(e))); |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | subordinateBaseDNs = subBases; |
| | | |
| | | if (subordinateBaseDNs == null) |
| | | { |
| | | messages.add(INFO_ROOTDSE_USING_SUFFIXES_AS_BASE_DNS.get()); |
| | | ccr.addMessage(INFO_ROOTDSE_USING_SUFFIXES_AS_BASE_DNS.get()); |
| | | } |
| | | else |
| | | { |
| | | String basesStr = "{ " + Utils.joinAsString(", ", subordinateBaseDNs.keySet()) + " }"; |
| | | messages.add(INFO_ROOTDSE_USING_NEW_SUBORDINATE_BASE_DNS.get(basesStr)); |
| | | ccr.addMessage(INFO_ROOTDSE_USING_NEW_SUBORDINATE_BASE_DNS.get(basesStr)); |
| | | } |
| | | |
| | | |
| | | if (showAllAttributes != newShowAll) |
| | | { |
| | | showAllAttributes = newShowAll; |
| | | messages.add(INFO_ROOTDSE_UPDATED_SHOW_ALL_ATTRS.get( |
| | | ccr.addMessage(INFO_ROOTDSE_UPDATED_SHOW_ALL_ATTRS.get( |
| | | ATTR_ROOTDSE_SHOW_ALL_ATTRIBUTES, showAllAttributes)); |
| | | } |
| | | |
| | | |
| | | userDefinedAttributes = userAttrs; |
| | | messages.add(INFO_ROOTDSE_USING_NEW_USER_ATTRS.get()); |
| | | ccr.addMessage(INFO_ROOTDSE_USING_NEW_USER_ATTRS.get()); |
| | | } |
| | | |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | SchemaBackendCfg backendCfg) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // Check to see if we should apply a new set of base DNs. |
| | |
| | | { |
| | | logger.traceException(e); |
| | | |
| | | |
| | | messages.add(ERR_SCHEMA_CANNOT_DETERMINE_BASE_DN.get( |
| | | ccr.addMessage(ERR_SCHEMA_CANNOT_DETERMINE_BASE_DN.get( |
| | | configEntryDN, getExceptionMessage(e))); |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | newBaseDNs = null; |
| | | } |
| | | |
| | |
| | | { |
| | | logger.traceException(e); |
| | | |
| | | messages.add(ERR_CONFIG_BACKEND_ERROR_INTERACTING_WITH_BACKEND_ENTRY.get( |
| | | ccr.addMessage(ERR_CONFIG_BACKEND_ERROR_INTERACTING_WITH_BACKEND_ENTRY.get( |
| | | configEntryDN, stackTraceToSingleLineString(e))); |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | // Get an array containing the new base DNs to use. |
| | | DN[] dnArray = new DN[newBaseDNs.size()]; |
| | |
| | | try |
| | | { |
| | | DirectoryServer.deregisterBaseDN(dn); |
| | | messages.add(INFO_SCHEMA_DEREGISTERED_BASE_DN.get(dn)); |
| | | ccr.addMessage(INFO_SCHEMA_DEREGISTERED_BASE_DN.get(dn)); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | logger.traceException(e); |
| | | |
| | | messages.add(ERR_SCHEMA_CANNOT_DEREGISTER_BASE_DN.get(dn, getExceptionMessage(e))); |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.addMessage(ERR_SCHEMA_CANNOT_DEREGISTER_BASE_DN.get(dn, getExceptionMessage(e))); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | } |
| | | |
| | |
| | | try |
| | | { |
| | | DirectoryServer.registerBaseDN(dn, this, true); |
| | | messages.add(INFO_SCHEMA_REGISTERED_BASE_DN.get(dn)); |
| | | ccr.addMessage(INFO_SCHEMA_REGISTERED_BASE_DN.get(dn)); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | logger.traceException(e); |
| | | |
| | | messages.add(ERR_SCHEMA_CANNOT_REGISTER_BASE_DN.get(dn, getExceptionMessage(e))); |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.addMessage(ERR_SCHEMA_CANNOT_REGISTER_BASE_DN.get(dn, getExceptionMessage(e))); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | userDefinedAttributes = newUserAttrs; |
| | | LocalizableMessage message = INFO_SCHEMA_USING_NEW_USER_ATTRS.get(); |
| | | messages.add(message); |
| | | ccr.addMessage(message); |
| | | } |
| | | |
| | | |
| | | currentConfig = backendCfg; |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange(TrustStoreBackendCfg cfg) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | DN configEntryDN = cfg.dn(); |
| | | |
| | | // Get the path to the trust store file. |
| | |
| | | File f = getFileForPath(newTrustStoreFile); |
| | | if (! (f.exists() && f.isFile())) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | |
| | | messages.add(ERR_TRUSTSTORE_NO_SUCH_FILE.get(newTrustStoreFile, configEntryDN)); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ERR_TRUSTSTORE_NO_SUCH_FILE.get(newTrustStoreFile, configEntryDN)); |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | logger.traceException(kse); |
| | | |
| | | messages.add(ERR_TRUSTSTORE_INVALID_TYPE.get(newTrustStoreType, configEntryDN, getExceptionMessage(kse))); |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.addMessage(ERR_TRUSTSTORE_INVALID_TYPE.get(newTrustStoreType, configEntryDN, getExceptionMessage(kse))); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | messages.add(ERR_TRUSTSTORE_PIN_FILE_CANNOT_CREATE.get(newPINFile, configEntryDN)); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ERR_TRUSTSTORE_PIN_FILE_CANNOT_CREATE.get(newPINFile, configEntryDN)); |
| | | } |
| | | } |
| | | else |
| | |
| | | } |
| | | catch (IOException ioe) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | messages.add(ERR_TRUSTSTORE_PIN_FILE_CANNOT_READ.get( |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ERR_TRUSTSTORE_PIN_FILE_CANNOT_READ.get( |
| | | newPINFile, configEntryDN, getExceptionMessage(ioe))); |
| | | } |
| | | finally |
| | |
| | | |
| | | if (pinStr == null) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | messages.add(ERR_TRUSTSTORE_PIN_FILE_EMPTY.get(newPINFile, configEntryDN)); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ERR_TRUSTSTORE_PIN_FILE_EMPTY.get(newPINFile, configEntryDN)); |
| | | } |
| | | else |
| | | { |
| | |
| | | String pinStr = System.getenv(newPINEnVar); |
| | | if (pinStr == null) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | messages.add(ERR_TRUSTSTORE_PIN_ENVAR_NOT_SET.get(newPINEnVar, configEntryDN)); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ERR_TRUSTSTORE_PIN_ENVAR_NOT_SET.get(newPINEnVar, configEntryDN)); |
| | | } |
| | | else |
| | | { |
| | |
| | | String pinStr = System.getProperty(newPINProperty); |
| | | if (pinStr == null) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | messages.add(ERR_TRUSTSTORE_PIN_PROPERTY_NOT_SET.get(newPINProperty, configEntryDN)); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ERR_TRUSTSTORE_PIN_PROPERTY_NOT_SET.get(newPINProperty, configEntryDN)); |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | trustStoreFile = newTrustStoreFile; |
| | | trustStoreType = newTrustStoreType; |
| | |
| | | new String(trustStorePIN)); |
| | | } |
| | | |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | package org.opends.server.backends.jeb; |
| | | |
| | | import static org.opends.messages.JebMessages.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.io.Closeable; |
| | | import java.util.*; |
| | | import java.util.concurrent.atomic.AtomicBoolean; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | |
| | | import org.forgerock.opendj.ldap.ByteSequence; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.schema.MatchingRule; |
| | | import org.forgerock.opendj.ldap.spi.IndexQueryFactory; |
| | | import org.forgerock.opendj.ldap.spi.IndexingOptions; |
| | |
| | | |
| | | import com.sleepycat.je.DatabaseException; |
| | | |
| | | import static org.opends.messages.JebMessages.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | /** |
| | | * Class representing an attribute index. |
| | | * We have a separate database for each type of indexing, which makes it easy |
| | |
| | | @Override |
| | | public synchronized ConfigChangeResult applyConfigurationChange(LocalDBIndexCfg cfg) |
| | | { |
| | | // this method is not perf sensitive, using an AtomicBoolean will not hurt |
| | | AtomicBoolean adminActionRequired = new AtomicBoolean(false); |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | try |
| | | { |
| | | applyChangeToPresenceIndex(cfg, adminActionRequired, messages); |
| | | applyChangeToIndex(IndexType.EQUALITY, cfg, adminActionRequired, messages); |
| | | applyChangeToIndex(IndexType.SUBSTRING, cfg, adminActionRequired, messages); |
| | | applyChangeToIndex(IndexType.ORDERING, cfg, adminActionRequired, messages); |
| | | applyChangeToIndex(IndexType.APPROXIMATE, cfg, adminActionRequired, messages); |
| | | applyChangeToExtensibleIndexes(cfg, adminActionRequired, messages); |
| | | applyChangeToPresenceIndex(cfg, ccr); |
| | | applyChangeToIndex(IndexType.EQUALITY, cfg, ccr); |
| | | applyChangeToIndex(IndexType.SUBSTRING, cfg, ccr); |
| | | applyChangeToIndex(IndexType.ORDERING, cfg, ccr); |
| | | applyChangeToIndex(IndexType.APPROXIMATE, cfg, ccr); |
| | | applyChangeToExtensibleIndexes(cfg, ccr); |
| | | |
| | | extensibleIndexesMapping = computeExtensibleIndexesMapping(); |
| | | indexConfig = cfg; |
| | | |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, adminActionRequired.get(), messages); |
| | | return ccr; |
| | | } |
| | | catch(Exception e) |
| | | { |
| | | messages.add(LocalizableMessage.raw(StaticUtils.stackTraceToSingleLineString(e))); |
| | | return new ConfigChangeResult( |
| | | DirectoryServer.getServerErrorResultCode(), adminActionRequired.get(), messages); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(LocalizableMessage.raw(StaticUtils.stackTraceToSingleLineString(e))); |
| | | return ccr; |
| | | } |
| | | } |
| | | |
| | | private void applyChangeToExtensibleIndexes(LocalDBIndexCfg cfg, |
| | | AtomicBoolean adminActionRequired, ArrayList<LocalizableMessage> messages) |
| | | private void applyChangeToExtensibleIndexes(LocalDBIndexCfg cfg, final ConfigChangeResult ccr) |
| | | { |
| | | final AttributeType attrType = cfg.getAttribute(); |
| | | if (!cfg.getIndexType().contains(IndexType.EXTENSIBLE)) |
| | |
| | | if (!nameToIndexes.containsKey(indexId)) |
| | | { |
| | | Index index = newAttributeIndex(cfg, indexer); |
| | | openIndex(index, adminActionRequired, messages); |
| | | openIndex(index, ccr); |
| | | nameToIndexes.put(indexId, index); |
| | | } |
| | | else |
| | |
| | | Index index = nameToIndexes.get(indexId); |
| | | if (index.setIndexEntryLimit(indexEntryLimit)) |
| | | { |
| | | adminActionRequired.set(true); |
| | | messages.add(NOTE_JEB_CONFIG_INDEX_ENTRY_LIMIT_REQUIRES_REBUILD.get(index.getName())); |
| | | ccr.setAdminActionRequired(true); |
| | | ccr.addMessage(NOTE_JEB_CONFIG_INDEX_ENTRY_LIMIT_REQUIRES_REBUILD.get(index.getName())); |
| | | } |
| | | if (indexConfig.getSubstringLength() != cfg.getSubstringLength()) |
| | | { |
| | |
| | | return rules; |
| | | } |
| | | |
| | | private void applyChangeToIndex(IndexType indexType, LocalDBIndexCfg cfg, |
| | | AtomicBoolean adminActionRequired, ArrayList<LocalizableMessage> messages) |
| | | private void applyChangeToIndex(IndexType indexType, LocalDBIndexCfg cfg, final ConfigChangeResult ccr) |
| | | { |
| | | String indexId = indexType.toString(); |
| | | Index index = nameToIndexes.get(indexId); |
| | |
| | | for (org.forgerock.opendj.ldap.spi.Indexer indexer : matchingRule.getIndexers()) |
| | | { |
| | | index = newAttributeIndex(cfg, indexer); |
| | | openIndex(index, adminActionRequired, messages); |
| | | openIndex(index, ccr); |
| | | nameToIndexes.put(indexId, index); |
| | | } |
| | | } |
| | |
| | | // already exists. Just update index entry limit. |
| | | if (index.setIndexEntryLimit(cfg.getIndexEntryLimit())) |
| | | { |
| | | adminActionRequired.set(true); |
| | | messages.add(NOTE_JEB_CONFIG_INDEX_ENTRY_LIMIT_REQUIRES_REBUILD.get(index.getName())); |
| | | ccr.setAdminActionRequired(true); |
| | | ccr.addMessage(NOTE_JEB_CONFIG_INDEX_ENTRY_LIMIT_REQUIRES_REBUILD.get(index.getName())); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void applyChangeToPresenceIndex(LocalDBIndexCfg cfg, AtomicBoolean adminActionRequired, |
| | | ArrayList<LocalizableMessage> messages) |
| | | private void applyChangeToPresenceIndex(LocalDBIndexCfg cfg, final ConfigChangeResult ccr) |
| | | { |
| | | final IndexType indexType = IndexType.PRESENCE; |
| | | final String indexID = indexType.toString(); |
| | |
| | | if (index == null) |
| | | { |
| | | index = newPresenceIndex(cfg); |
| | | openIndex(index, adminActionRequired, messages); |
| | | openIndex(index, ccr); |
| | | nameToIndexes.put(indexID, index); |
| | | } |
| | | else |
| | |
| | | // already exists. Just update index entry limit. |
| | | if (index.setIndexEntryLimit(cfg.getIndexEntryLimit())) |
| | | { |
| | | adminActionRequired.set(true); |
| | | messages.add(NOTE_JEB_CONFIG_INDEX_ENTRY_LIMIT_REQUIRES_REBUILD.get(index.getName())); |
| | | ccr.setAdminActionRequired(true); |
| | | ccr.addMessage(NOTE_JEB_CONFIG_INDEX_ENTRY_LIMIT_REQUIRES_REBUILD.get(index.getName())); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | private void openIndex(Index index, AtomicBoolean adminActionRequired, ArrayList<LocalizableMessage> messages) |
| | | private void openIndex(Index index, final ConfigChangeResult ccr) |
| | | { |
| | | index.open(); |
| | | |
| | | if (!index.isTrusted()) |
| | | { |
| | | adminActionRequired.set(true); |
| | | messages.add(NOTE_JEB_INDEX_ADD_REQUIRES_REBUILD.get(index.getName())); |
| | | ccr.setAdminActionRequired(true); |
| | | ccr.addMessage(NOTE_JEB_INDEX_ADD_REQUIRES_REBUILD.get(index.getName())); |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | package org.opends.server.backends.jeb; |
| | | |
| | | import static com.sleepycat.je.EnvironmentConfig.*; |
| | | |
| | | import static org.opends.messages.BackendMessages.*; |
| | | import static org.opends.messages.JebMessages.*; |
| | | import static org.opends.server.backends.jeb.ConfigurableEnvironment.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.util.*; |
| | |
| | | import com.sleepycat.je.EnvironmentConfig; |
| | | import com.sleepycat.je.EnvironmentFailureException; |
| | | |
| | | import static com.sleepycat.je.EnvironmentConfig.*; |
| | | |
| | | import static org.opends.messages.BackendMessages.*; |
| | | import static org.opends.messages.JebMessages.*; |
| | | import static org.opends.server.backends.jeb.ConfigurableEnvironment.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | /** |
| | | * This is an implementation of a Directory Server Backend which stores entries |
| | | * locally in a Berkeley DB JE database. |
| | |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange(LocalDBBackendCfg newCfg) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | try |
| | | { |
| | |
| | | |
| | | // Check for changes to the base DNs. |
| | | removeDeletedBaseDNs(newBaseDNs); |
| | | ConfigChangeResult failure = createNewBaseDNs(newBaseDNsArray, messages); |
| | | ConfigChangeResult failure = createNewBaseDNs(newBaseDNsArray, ccr); |
| | | if (failure != null) |
| | | { |
| | | return failure; |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | messages.add(LocalizableMessage.raw(stackTraceToSingleLineString(e))); |
| | | return new ConfigChangeResult( |
| | | DirectoryServer.getServerErrorResultCode(), false, messages); |
| | | ccr.addMessage(LocalizableMessage.raw(stackTraceToSingleLineString(e))); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, false, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | private void removeDeletedBaseDNs(SortedSet<DN> newBaseDNs) throws DirectoryException |
| | |
| | | } |
| | | } |
| | | |
| | | private ConfigChangeResult createNewBaseDNs(DN[] newBaseDNsArray, ArrayList<LocalizableMessage> messages) |
| | | private ConfigChangeResult createNewBaseDNs(DN[] newBaseDNsArray, final ConfigChangeResult ccr) |
| | | { |
| | | for (DN baseDN : newBaseDNsArray) |
| | | { |
| | |
| | | { |
| | | logger.traceException(e); |
| | | |
| | | ResultCode resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | messages.add(ERR_BACKEND_CANNOT_REGISTER_BASEDN.get(baseDN, e)); |
| | | return new ConfigChangeResult(resultCode, false, messages); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ERR_BACKEND_CANNOT_REGISTER_BASEDN.get(baseDN, e)); |
| | | return ccr; |
| | | } |
| | | } |
| | | } |
| | |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd(LocalDBIndexCfg cfg) |
| | | { |
| | | boolean adminActionRequired = false; |
| | | List<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | try |
| | | { |
| | |
| | | index.open(); |
| | | if(!index.isTrusted()) |
| | | { |
| | | adminActionRequired = true; |
| | | messages.add(NOTE_JEB_INDEX_ADD_REQUIRES_REBUILD.get( |
| | | cfg.getAttribute().getNameOrOID())); |
| | | ccr.setAdminActionRequired(true); |
| | | ccr.addMessage(NOTE_JEB_INDEX_ADD_REQUIRES_REBUILD.get(cfg.getAttribute().getNameOrOID())); |
| | | } |
| | | attrIndexMap.put(cfg.getAttribute(), index); |
| | | } |
| | | catch(Exception e) |
| | | { |
| | | messages.add(LocalizableMessage.raw(e.getLocalizedMessage())); |
| | | return new ConfigChangeResult( |
| | | DirectoryServer.getServerErrorResultCode(), adminActionRequired, messages); |
| | | ccr.addMessage(LocalizableMessage.raw(e.getLocalizedMessage())); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete(LocalDBIndexCfg cfg) |
| | | { |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | exclusiveLock.lock(); |
| | | try |
| | |
| | | } |
| | | catch(DatabaseException de) |
| | | { |
| | | messages.add(LocalizableMessage.raw(StaticUtils.stackTraceToSingleLineString(de))); |
| | | return new ConfigChangeResult( |
| | | DirectoryServer.getServerErrorResultCode(), adminActionRequired, messages); |
| | | ccr.addMessage(LocalizableMessage.raw(StaticUtils.stackTraceToSingleLineString(de))); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | finally |
| | | { |
| | | exclusiveLock.unlock(); |
| | | } |
| | | |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | } |
| | | |
| | |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd(LocalDBVLVIndexCfg cfg) |
| | | { |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | try |
| | | { |
| | |
| | | vlvIndex.open(); |
| | | if(!vlvIndex.isTrusted()) |
| | | { |
| | | adminActionRequired = true; |
| | | messages.add(NOTE_JEB_INDEX_ADD_REQUIRES_REBUILD.get( |
| | | ccr.setAdminActionRequired(true); |
| | | ccr.addMessage(NOTE_JEB_INDEX_ADD_REQUIRES_REBUILD.get( |
| | | cfg.getName())); |
| | | } |
| | | vlvIndexMap.put(cfg.getName().toLowerCase(), vlvIndex); |
| | | } |
| | | catch(Exception e) |
| | | { |
| | | messages.add(LocalizableMessage.raw(StaticUtils.stackTraceToSingleLineString(e))); |
| | | return new ConfigChangeResult( |
| | | DirectoryServer.getServerErrorResultCode(), adminActionRequired, messages); |
| | | ccr.addMessage(LocalizableMessage.raw(StaticUtils.stackTraceToSingleLineString(e))); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete(LocalDBVLVIndexCfg cfg) |
| | | { |
| | | boolean adminActionRequired = false; |
| | | List<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | exclusiveLock.lock(); |
| | | try |
| | |
| | | } |
| | | catch(DatabaseException de) |
| | | { |
| | | messages.add(LocalizableMessage.raw(StaticUtils.stackTraceToSingleLineString(de))); |
| | | return new ConfigChangeResult( |
| | | DirectoryServer.getServerErrorResultCode(), adminActionRequired, messages); |
| | | ccr.addMessage(LocalizableMessage.raw(StaticUtils.stackTraceToSingleLineString(de))); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | finally |
| | | { |
| | | exclusiveLock.unlock(); |
| | | } |
| | | |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | } |
| | |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange(LocalDBBackendCfg cfg) |
| | | { |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | exclusiveLock.lock(); |
| | | try |
| | |
| | | { |
| | | if (id2children.setIndexEntryLimit(cfg.getIndexEntryLimit())) |
| | | { |
| | | adminActionRequired = true; |
| | | messages.add(NOTE_JEB_CONFIG_INDEX_ENTRY_LIMIT_REQUIRES_REBUILD.get(id2children.getName())); |
| | | ccr.setAdminActionRequired(true); |
| | | ccr.addMessage(NOTE_JEB_CONFIG_INDEX_ENTRY_LIMIT_REQUIRES_REBUILD.get(id2children.getName())); |
| | | } |
| | | |
| | | if (id2subtree.setIndexEntryLimit(cfg.getIndexEntryLimit())) |
| | | { |
| | | adminActionRequired = true; |
| | | messages.add(NOTE_JEB_CONFIG_INDEX_ENTRY_LIMIT_REQUIRES_REBUILD.get(id2subtree.getName())); |
| | | ccr.setAdminActionRequired(true); |
| | | ccr.addMessage(NOTE_JEB_CONFIG_INDEX_ENTRY_LIMIT_REQUIRES_REBUILD.get(id2subtree.getName())); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | catch (DatabaseException e) |
| | | { |
| | | messages.add(LocalizableMessage.raw(stackTraceToSingleLineString(e))); |
| | | return new ConfigChangeResult(DirectoryServer.getServerErrorResultCode(), |
| | | false, messages); |
| | | ccr.addMessage(LocalizableMessage.raw(stackTraceToSingleLineString(e))); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | finally |
| | | { |
| | | exclusiveLock.unlock(); |
| | | } |
| | | |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | /** |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.server.LocalDBBackendCfg; |
| | | import org.opends.server.api.Backend; |
| | |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange(LocalDBBackendCfg cfg) |
| | | { |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | try |
| | | { |
| | |
| | | if (!param.isMutable()) { |
| | | String oldValue = oldEnvConfig.getConfigParam(param.getName()); |
| | | if (!oldValue.equalsIgnoreCase(jePropertyValue)) { |
| | | adminActionRequired = true; |
| | | messages.add(INFO_CONFIG_JE_PROPERTY_REQUIRES_RESTART.get(jePropertyName)); |
| | | ccr.setAdminActionRequired(true); |
| | | ccr.addMessage(INFO_CONFIG_JE_PROPERTY_REQUIRES_RESTART.get(jePropertyName)); |
| | | if(logger.isTraceEnabled()) { |
| | | logger.trace("The change to the following property " + |
| | | "will take effect when the component is restarted: " + |
| | |
| | | String newValue = newEnvConfig.getConfigParam(param.getName()); |
| | | if (!oldValue.equalsIgnoreCase(newValue)) |
| | | { |
| | | adminActionRequired = true; |
| | | ccr.setAdminActionRequired(true); |
| | | String configAttr = ConfigurableEnvironment. |
| | | getAttributeForProperty(param.getName()); |
| | | if (configAttr != null) |
| | | { |
| | | messages.add(NOTE_JEB_CONFIG_ATTR_REQUIRES_RESTART.get(configAttr)); |
| | | ccr.addMessage(NOTE_JEB_CONFIG_ATTR_REQUIRES_RESTART.get(configAttr)); |
| | | } |
| | | else |
| | | { |
| | | messages.add(NOTE_JEB_CONFIG_ATTR_REQUIRES_RESTART.get(param.getName())); |
| | | ccr.addMessage(NOTE_JEB_CONFIG_ATTR_REQUIRES_RESTART.get(param.getName())); |
| | | } |
| | | if(logger.isTraceEnabled()) |
| | | { |
| | |
| | | { |
| | | if(!backendDirectory.mkdirs()) |
| | | { |
| | | messages.add(ERR_JEB_CREATE_FAIL.get(backendDirectory.getPath())); |
| | | return new ConfigChangeResult( |
| | | DirectoryServer.getServerErrorResultCode(), |
| | | adminActionRequired, |
| | | messages); |
| | | ccr.addMessage(ERR_JEB_CREATE_FAIL.get(backendDirectory.getPath())); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | return ccr; |
| | | } |
| | | } |
| | | //Make sure the directory is valid. |
| | | else if (!backendDirectory.isDirectory()) |
| | | { |
| | | messages.add(ERR_JEB_DIRECTORY_INVALID.get(backendDirectory.getPath())); |
| | | return new ConfigChangeResult( |
| | | DirectoryServer.getServerErrorResultCode(), |
| | | adminActionRequired, |
| | | messages); |
| | | ccr.addMessage(ERR_JEB_DIRECTORY_INVALID.get(backendDirectory.getPath())); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | return ccr; |
| | | } |
| | | |
| | | adminActionRequired = true; |
| | | messages.add(NOTE_JEB_CONFIG_DB_DIR_REQUIRES_RESTART.get( |
| | | ccr.setAdminActionRequired(true); |
| | | ccr.addMessage(NOTE_JEB_CONFIG_DB_DIR_REQUIRES_RESTART.get( |
| | | this.config.getDBDirectory(), cfg.getDBDirectory())); |
| | | } |
| | | |
| | |
| | | } |
| | | catch(Exception e) |
| | | { |
| | | messages.add(ERR_CONFIG_BACKEND_MODE_INVALID.get(config.dn())); |
| | | return new ConfigChangeResult( |
| | | DirectoryServer.getServerErrorResultCode(), |
| | | adminActionRequired, |
| | | messages); |
| | | ccr.addMessage(ERR_CONFIG_BACKEND_MODE_INVALID.get(config.dn())); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | return ccr; |
| | | } |
| | | |
| | | //Make sure the mode will allow the server itself access to |
| | |
| | | !backendPermission.isOwnerReadable() || |
| | | !backendPermission.isOwnerExecutable()) |
| | | { |
| | | messages.add(ERR_CONFIG_BACKEND_INSANE_MODE.get( |
| | | ccr.addMessage(ERR_CONFIG_BACKEND_INSANE_MODE.get( |
| | | cfg.getDBDirectoryPermissions())); |
| | | return new ConfigChangeResult( |
| | | DirectoryServer.getServerErrorResultCode(), |
| | | adminActionRequired, |
| | | messages); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | return ccr; |
| | | } |
| | | |
| | | // Get the backend database backendDirectory permissions and apply |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | messages.add(LocalizableMessage.raw(stackTraceToSingleLineString(e))); |
| | | return new ConfigChangeResult(DirectoryServer.getServerErrorResultCode(), |
| | | adminActionRequired, |
| | | messages); |
| | | ccr.addMessage(LocalizableMessage.raw(stackTraceToSingleLineString(e))); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | return ccr; |
| | | } |
| | | |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | package org.opends.server.backends.jeb; |
| | | |
| | | import java.util.*; |
| | | import static org.opends.messages.JebMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.util.Iterator; |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | import java.util.TreeSet; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | |
| | | |
| | | import com.sleepycat.je.*; |
| | | |
| | | import static org.opends.messages.JebMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | /** |
| | | * This class represents a VLV index. Each database record is a sorted list |
| | | * of entry IDs followed by sets of attribute values used to sort the entries. |
| | |
| | | public synchronized ConfigChangeResult applyConfigurationChange( |
| | | LocalDBVLVIndexCfg cfg) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | // Update base DN only if changed.. |
| | | if(!config.getBaseDN().equals(cfg.getBaseDN())) |
| | | { |
| | | this.baseDN = cfg.getBaseDN(); |
| | | adminActionRequired = true; |
| | | ccr.setAdminActionRequired(true); |
| | | } |
| | | |
| | | // Update scope only if changed. |
| | | if(!config.getScope().equals(cfg.getScope())) |
| | | { |
| | | this.scope = SearchScope.valueOf(cfg.getScope().name()); |
| | | adminActionRequired = true; |
| | | ccr.setAdminActionRequired(true); |
| | | } |
| | | |
| | | // Update sort set capacity only if changed. |
| | |
| | | // we will lazyly update the sorted sets. |
| | | if (config.getMaxBlockSize() < cfg.getMaxBlockSize()) |
| | | { |
| | | adminActionRequired = true; |
| | | ccr.setAdminActionRequired(true); |
| | | } |
| | | } |
| | | |
| | |
| | | try |
| | | { |
| | | this.filter = SearchFilter.createFilterFromString(cfg.getFilter()); |
| | | adminActionRequired = true; |
| | | ccr.setAdminActionRequired(true); |
| | | } |
| | | catch(Exception e) |
| | | { |
| | | LocalizableMessage msg = ERR_JEB_CONFIG_VLV_INDEX_BAD_FILTER.get( |
| | | config.getFilter(), name, |
| | | stackTraceToSingleLineString(e)); |
| | | messages.add(msg); |
| | | if(resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = ResultCode.INVALID_ATTRIBUTE_SYNTAX; |
| | | } |
| | | ccr.addMessage(ERR_JEB_CONFIG_VLV_INDEX_BAD_FILTER.get( |
| | | config.getFilter(), name, stackTraceToSingleLineString(e))); |
| | | ccr.setResultCodeIfSuccess(ResultCode.INVALID_ATTRIBUTE_SYNTAX); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | catch(Exception e) |
| | | { |
| | | messages.add(ERR_JEB_CONFIG_VLV_INDEX_UNDEFINED_ATTR.get(sortKeys[i], name)); |
| | | if(resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = ResultCode.INVALID_ATTRIBUTE_SYNTAX; |
| | | } |
| | | ccr.addMessage(ERR_JEB_CONFIG_VLV_INDEX_UNDEFINED_ATTR.get(sortKeys[i], name)); |
| | | ccr.setResultCodeIfSuccess(ResultCode.INVALID_ATTRIBUTE_SYNTAX); |
| | | } |
| | | |
| | | AttributeType attrType = |
| | | DirectoryServer.getAttributeType(sortAttrs[i].toLowerCase()); |
| | | if(attrType == null) |
| | | { |
| | | messages.add(ERR_JEB_CONFIG_VLV_INDEX_UNDEFINED_ATTR.get(sortKeys[i], name)); |
| | | if(resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = ResultCode.INVALID_ATTRIBUTE_SYNTAX; |
| | | } |
| | | ccr.addMessage(ERR_JEB_CONFIG_VLV_INDEX_UNDEFINED_ATTR.get(sortKeys[i], name)); |
| | | ccr.setResultCodeIfSuccess(ResultCode.INVALID_ATTRIBUTE_SYNTAX); |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | catch(DatabaseException de) |
| | | { |
| | | messages.add(LocalizableMessage.raw(StaticUtils.stackTraceToSingleLineString(de))); |
| | | if(resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | } |
| | | ccr.addMessage(LocalizableMessage.raw(StaticUtils.stackTraceToSingleLineString(de))); |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | finally |
| | | { |
| | | entryContainer.exclusiveLock.unlock(); |
| | | } |
| | | |
| | | adminActionRequired = true; |
| | | ccr.setAdminActionRequired(true); |
| | | } |
| | | |
| | | |
| | | if(adminActionRequired) |
| | | if (ccr.adminActionRequired()) |
| | | { |
| | | trusted = false; |
| | | messages.add(NOTE_JEB_INDEX_ADD_REQUIRES_REBUILD.get(name)); |
| | | ccr.addMessage(NOTE_JEB_INDEX_ADD_REQUIRES_REBUILD.get(name)); |
| | | try |
| | | { |
| | | state.putIndexTrustState(null, this, false); |
| | | } |
| | | catch(DatabaseException de) |
| | | { |
| | | messages.add(LocalizableMessage.raw(StaticUtils.stackTraceToSingleLineString(de))); |
| | | if(resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | } |
| | | ccr.addMessage(LocalizableMessage.raw(StaticUtils.stackTraceToSingleLineString(de))); |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | } |
| | | |
| | | this.config = cfg; |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | } |
| | |
| | | catch (StorageRuntimeException de) |
| | | { |
| | | ccr.addMessage(LocalizableMessage.raw(StaticUtils.stackTraceToSingleLineString(de))); |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | finally |
| | | { |
| | |
| | | catch(StorageRuntimeException de) |
| | | { |
| | | ccr.addMessage(LocalizableMessage.raw(StaticUtils.stackTraceToSingleLineString(de))); |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | package org.opends.server.backends.task; |
| | | |
| | | import static org.opends.messages.BackendMessages.*; |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.io.*; |
| | | import java.net.InetAddress; |
| | | import java.security.MessageDigest; |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ConditionResult; |
| | | import org.forgerock.opendj.ldap.ModificationType; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.forgerock.util.Reject; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.server.TaskBackendCfg; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.config.ConfigEntry; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.core.*; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.util.DynamicConstants; |
| | | import org.opends.server.util.LDIFException; |
| | | import org.opends.server.util.LDIFReader; |
| | | import org.opends.server.util.LDIFWriter; |
| | | |
| | | import static org.opends.messages.BackendMessages.*; |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | /** |
| | | * This class provides an implementation of a Directory Server backend that may |
| | | * be used to execute various kinds of administrative tasks on a one-time or |
| | |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange(TaskBackendCfg configEntry) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | String tmpBackingFile = taskBackingFile; |
| | |
| | | File f = getFileForPath(tmpBackingFile); |
| | | if (f.exists()) |
| | | { |
| | | messages.add(ERR_TASKBE_BACKING_FILE_EXISTS.get(tmpBackingFile)); |
| | | resultCode = ResultCode.CONSTRAINT_VIOLATION; |
| | | ccr.addMessage(ERR_TASKBE_BACKING_FILE_EXISTS.get(tmpBackingFile)); |
| | | ccr.setResultCode(ResultCode.CONSTRAINT_VIOLATION); |
| | | } |
| | | else |
| | | { |
| | | File p = f.getParentFile(); |
| | | if (p == null) |
| | | { |
| | | messages.add(ERR_TASKBE_INVALID_BACKING_FILE_PATH.get( |
| | | tmpBackingFile)); |
| | | resultCode = ResultCode.CONSTRAINT_VIOLATION; |
| | | ccr.addMessage(ERR_TASKBE_INVALID_BACKING_FILE_PATH.get(tmpBackingFile)); |
| | | ccr.setResultCode(ResultCode.CONSTRAINT_VIOLATION); |
| | | } |
| | | else if (! p.exists()) |
| | | { |
| | | messages.add(ERR_TASKBE_BACKING_FILE_MISSING_PARENT.get(p, tmpBackingFile)); |
| | | resultCode = ResultCode.CONSTRAINT_VIOLATION; |
| | | ccr.addMessage(ERR_TASKBE_BACKING_FILE_MISSING_PARENT.get(p, tmpBackingFile)); |
| | | ccr.setResultCode(ResultCode.CONSTRAINT_VIOLATION); |
| | | } |
| | | else if (! p.isDirectory()) |
| | | { |
| | | messages.add(ERR_TASKBE_BACKING_FILE_PARENT_NOT_DIRECTORY.get(p, tmpBackingFile)); |
| | | resultCode = ResultCode.CONSTRAINT_VIOLATION; |
| | | ccr.addMessage(ERR_TASKBE_BACKING_FILE_PARENT_NOT_DIRECTORY.get(p, tmpBackingFile)); |
| | | ccr.setResultCode(ResultCode.CONSTRAINT_VIOLATION); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | logger.traceException(e); |
| | | |
| | | messages.add(ERR_TASKBE_ERROR_GETTING_BACKING_FILE.get( |
| | | getExceptionMessage(e))); |
| | | |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.addMessage(ERR_TASKBE_ERROR_GETTING_BACKING_FILE.get(getExceptionMessage(e))); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | |
| | | |
| | | long tmpRetentionTime = configEntry.getTaskRetentionTime(); |
| | | |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | // Everything looks OK, so apply the changes. |
| | | if (retentionTime != tmpRetentionTime) |
| | | { |
| | | retentionTime = tmpRetentionTime; |
| | | |
| | | messages.add(INFO_TASKBE_UPDATED_RETENTION_TIME.get(retentionTime)); |
| | | ccr.addMessage(INFO_TASKBE_UPDATED_RETENTION_TIME.get(retentionTime)); |
| | | } |
| | | |
| | | |
| | |
| | | taskBackingFile = tmpBackingFile; |
| | | taskScheduler.writeState(); |
| | | |
| | | messages.add(INFO_TASKBE_UPDATED_BACKING_FILE.get(taskBackingFile)); |
| | | ccr.addMessage(INFO_TASKBE_UPDATED_BACKING_FILE.get(taskBackingFile)); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | currentConfig = configEntry; |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.util.Utils; |
| | | import org.opends.server.admin.ClassPropertyDefinition; |
| | |
| | | import org.opends.server.admin.std.server.RootCfg; |
| | | import org.opends.server.api.AccessControlHandler; |
| | | import org.opends.server.api.AlertGenerator; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.InitializationException; |
| | | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | /** |
| | | * This class manages the application-wide access-control configuration. |
| | | * <p> |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | AccessControlHandlerCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | try |
| | | { |
| | |
| | | } |
| | | catch (ConfigException e) |
| | | { |
| | | messages.add(e.getMessageObject()); |
| | | resultCode = ResultCode.CONSTRAINT_VIOLATION; |
| | | ccr.addMessage(e.getMessageObject()); |
| | | ccr.setResultCode(ResultCode.CONSTRAINT_VIOLATION); |
| | | } |
| | | catch (InitializationException e) |
| | | { |
| | | messages.add(e.getMessageObject()); |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.addMessage(e.getMessageObject()); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, false, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.util.Utils; |
| | | import org.opends.server.admin.ClassPropertyDefinition; |
| | | import org.opends.server.admin.server.ConfigurationAddListener; |
| | |
| | | import org.opends.server.admin.std.server.AccountStatusNotificationHandlerCfg; |
| | | import org.opends.server.admin.std.server.RootCfg; |
| | | import org.opends.server.api.AccountStatusNotificationHandler; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.InitializationException; |
| | | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | /** |
| | | * This class defines a utility that will be used to manage the set of account |
| | | * status notification handlers defined in the Directory Server. It will |
| | |
| | | AccountStatusNotificationHandlerCfg configuration |
| | | ) |
| | | { |
| | | // Returned result. |
| | | ConfigChangeResult changeResult = new ConfigChangeResult( |
| | | ResultCode.SUCCESS, false, new ArrayList<LocalizableMessage>() |
| | | ); |
| | | final ConfigChangeResult changeResult = new ConfigChangeResult(); |
| | | |
| | | // Get the configuration entry DN and the associated handler class. |
| | | DN configEntryDN = configuration.dn(); |
| | | AccountStatusNotificationHandler handler = notificationHandlers.get( |
| | | configEntryDN |
| | | ); |
| | | AccountStatusNotificationHandler handler = notificationHandlers.get(configEntryDN); |
| | | |
| | | // If the new configuration has the notification handler disabled, |
| | | // then remove it from the mapping list and clean it. |
| | |
| | | AccountStatusNotificationHandlerCfg configuration |
| | | ) |
| | | { |
| | | // Returned result. |
| | | ConfigChangeResult changeResult = new ConfigChangeResult( |
| | | ResultCode.SUCCESS, false, new ArrayList<LocalizableMessage>() |
| | | ); |
| | | final ConfigChangeResult changeResult = new ConfigChangeResult(); |
| | | |
| | | // Register a change listener with it so we can be notified of changes |
| | | // to it over time. |
| | |
| | | AccountStatusNotificationHandlerCfg configuration |
| | | ) |
| | | { |
| | | // Returned result. |
| | | ConfigChangeResult changeResult = new ConfigChangeResult( |
| | | ResultCode.SUCCESS, false, new ArrayList<LocalizableMessage>() |
| | | ); |
| | | |
| | | uninstallNotificationHandler (configuration.dn()); |
| | | |
| | | return changeResult; |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd(AlertHandlerCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | configuration.addChangeListener(this); |
| | | |
| | | if (! configuration.isEnabled()) |
| | | { |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | AlertHandler alertHandler = null; |
| | |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ie.getMessageObject()); |
| | | } |
| | | |
| | | messages.add(ie.getMessageObject()); |
| | | } |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | alertHandlers.put(configuration.dn(), alertHandler); |
| | | DirectoryServer.registerAlertHandler(alertHandler); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | AlertHandlerCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | AlertHandler alertHandler = alertHandlers.remove(configuration.dn()); |
| | | if (alertHandler != null) |
| | |
| | | alertHandler.finalizeAlertHandler(); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | AlertHandlerCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // Get the existing alert handler if it's already enabled. |
| | |
| | | } |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | if (! className.equals(existingHandler.getClass().getName())) |
| | | { |
| | | adminActionRequired = true; |
| | | ccr.setAdminActionRequired(true); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | AlertHandler alertHandler = null; |
| | |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ie.getMessageObject()); |
| | | } |
| | | |
| | | messages.add(ie.getMessageObject()); |
| | | } |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | alertHandlers.put(configuration.dn(), alertHandler); |
| | | DirectoryServer.registerAlertHandler(alertHandler); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.util.Utils; |
| | | import org.opends.server.admin.ClassPropertyDefinition; |
| | | import org.opends.server.admin.server.ConfigurationAddListener; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.server.ConfigurationDeleteListener; |
| | | import org.opends.server.admin.server.ServerManagementContext; |
| | | import org.opends.server.admin.std.meta.AttributeSyntaxCfgDefn; |
| | | import org.opends.server.admin.std.server.AttributeSyntaxCfg; |
| | | import org.opends.server.admin.std.server.RootCfg; |
| | | import org.opends.server.admin.server.ServerManagementContext; |
| | | import org.opends.server.api.AttributeSyntax; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.util.Utils; |
| | | import org.opends.server.types.AttributeType; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | /** |
| | | * This class defines a utility that will be used to manage the set of attribute |
| | | * syntaxes defined in the Directory Server. It wil initialize the syntaxes |
| | | * syntaxes defined in the Directory Server. It will initialize the syntaxes |
| | | * when the server starts, and then will manage any additions, removals, or |
| | | * modifications to any syntaxes while the server is running. |
| | | */ |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isConfigurationAddAcceptable( |
| | | AttributeSyntaxCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | AttributeSyntaxCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | configuration.addChangeListener(this); |
| | | |
| | | if (! configuration.isEnabled()) |
| | | { |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | AttributeSyntax syntax = null; |
| | |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | messages.add(WARN_CONFIG_SCHEMA_SYNTAX_CONFLICTING_SYNTAX.get( |
| | | ccr.addMessage(WARN_CONFIG_SCHEMA_SYNTAX_CONFLICTING_SYNTAX.get( |
| | | configuration.dn(), de.getMessageObject())); |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | } |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ie.getMessageObject()); |
| | | } |
| | | |
| | | messages.add(ie.getMessageObject()); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isConfigurationDeleteAcceptable( |
| | | AttributeSyntaxCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | AttributeSyntaxCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | AttributeSyntax syntax = syntaxes.remove(configuration.dn()); |
| | | if (syntax != null) |
| | |
| | | syntax.finalizeSyntax(); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | AttributeSyntaxCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | AttributeSyntaxCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // Get the existing syntax if it's already enabled. |
| | |
| | | } |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | if (! className.equals(existingSyntax.getClass().getName())) |
| | | { |
| | | adminActionRequired = true; |
| | | ccr.setAdminActionRequired(true); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | AttributeSyntax syntax = null; |
| | |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | messages.add(WARN_CONFIG_SCHEMA_SYNTAX_CONFLICTING_SYNTAX.get( |
| | | ccr.addMessage(WARN_CONFIG_SCHEMA_SYNTAX_CONFLICTING_SYNTAX.get( |
| | | configuration.dn(), de.getMessageObject())); |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | } |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ie.getMessageObject()); |
| | | } |
| | | |
| | | messages.add(ie.getMessageObject()); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.util.Utils; |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.util.Utils; |
| | | import org.opends.server.admin.ClassPropertyDefinition; |
| | | import org.opends.server.admin.server.ConfigurationAddListener; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.server.ConfigurationDeleteListener; |
| | | import org.opends.server.admin.server.ServerManagementContext; |
| | | import org.opends.server.admin.std.meta.CertificateMapperCfgDefn; |
| | | import org.opends.server.admin.std.server.CertificateMapperCfg; |
| | | import org.opends.server.admin.std.server.RootCfg; |
| | | import org.opends.server.admin.server.ServerManagementContext; |
| | | import org.opends.server.api.CertificateMapper; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | /** |
| | | * This class defines a utility that will be used to manage the set of |
| | |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | // A mapping between the DNs of the config entries and the associated |
| | | // certificate mappers. |
| | | /** |
| | | * A mapping between the DNs of the config entries and the associated |
| | | * certificate mappers. |
| | | */ |
| | | private ConcurrentHashMap<DN,CertificateMapper> certificateMappers; |
| | | |
| | | private final ServerContext serverContext; |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAddAcceptable( |
| | | CertificateMapperCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | CertificateMapperCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | configuration.addChangeListener(this); |
| | | |
| | | if (! configuration.isEnabled()) |
| | | { |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | CertificateMapper certificateMapper = null; |
| | |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ie.getMessageObject()); |
| | | } |
| | | |
| | | messages.add(ie.getMessageObject()); |
| | | } |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | certificateMappers.put(configuration.dn(), certificateMapper); |
| | | DirectoryServer.registerCertificateMapper(configuration.dn(), |
| | | certificateMapper); |
| | | DirectoryServer.registerCertificateMapper(configuration.dn(), certificateMapper); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationDeleteAcceptable( |
| | | CertificateMapperCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | CertificateMapperCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | DirectoryServer.deregisterCertificateMapper(configuration.dn()); |
| | | |
| | |
| | | certificateMapper.finalizeCertificateMapper(); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | CertificateMapperCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | CertificateMapperCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // Get the existing mapper if it's already enabled. |
| | |
| | | } |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | if (! className.equals(existingMapper.getClass().getName())) |
| | | { |
| | | adminActionRequired = true; |
| | | ccr.setAdminActionRequired(true); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | CertificateMapper certificateMapper = null; |
| | |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ie.getMessageObject()); |
| | | } |
| | | |
| | | messages.add(ie.getMessageObject()); |
| | | } |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | certificateMappers.put(configuration.dn(), certificateMapper); |
| | | DirectoryServer.registerCertificateMapper(configuration.dn(), |
| | | certificateMapper); |
| | | DirectoryServer.registerCertificateMapper(configuration.dn(), certificateMapper); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | | import java.util.ArrayList; |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.messages.CoreMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.admin.AdministrationConnector; |
| | | import org.opends.server.admin.ClassPropertyDefinition; |
| | | import org.opends.server.admin.server.ConfigurationAddListener; |
| | |
| | | import org.opends.server.admin.std.server.ConnectionHandlerCfg; |
| | | import org.opends.server.admin.std.server.RootCfg; |
| | | import org.opends.server.api.ConnectionHandler; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.protocols.ldap.LDAPConnectionHandler; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.InitializationException; |
| | | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.messages.CoreMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | /** |
| | | * This class defines a utility that will be used to manage the |
| | | * configuration for the set of connection handlers defined in the |
| | |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | ConnectionHandlerCfg configuration) { |
| | | // Default result code. |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | // Register as a change listener for this connection handler entry |
| | | // so that we will be notified of any changes that may be made to |
| | | // it. |
| | | // so that we will be notified of any changes that may be made to it. |
| | | configuration.addChangeListener(this); |
| | | |
| | | // Ignore this connection handler if it is disabled. |
| | |
| | | } catch (ConfigException e) { |
| | | logger.traceException(e); |
| | | |
| | | messages.add(e.getMessageObject()); |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.addMessage(e.getMessageObject()); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } catch (Exception e) { |
| | | logger.traceException(e); |
| | | messages.add(ERR_CONFIG_CONNHANDLER_CANNOT_INITIALIZE.get( |
| | | ccr.addMessage(ERR_CONFIG_CONNHANDLER_CANNOT_INITIALIZE.get( |
| | | configuration.getJavaClass(), dn, stackTraceToSingleLineString(e))); |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | } |
| | | |
| | | // Return the configuration result. |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | DN dn = configuration.dn(); |
| | | ConnectionHandler<?> connectionHandler = connectionHandlers.get(dn); |
| | | |
| | | // Default result code. |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | // See whether the connection handler should be enabled. |
| | | if (connectionHandler == null) { |
| | |
| | | } catch (ConfigException e) { |
| | | logger.traceException(e); |
| | | |
| | | messages.add(e.getMessageObject()); |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(e.getMessageObject()); |
| | | } catch (Exception e) { |
| | | logger.traceException(e); |
| | | |
| | | messages.add(ERR_CONFIG_CONNHANDLER_CANNOT_INITIALIZE.get( |
| | | ccr.addMessage(ERR_CONFIG_CONNHANDLER_CANNOT_INITIALIZE.get( |
| | | configuration.getJavaClass(), dn, stackTraceToSingleLineString(e))); |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | } |
| | | } else { |
| | |
| | | // change to take effect. |
| | | String className = configuration.getJavaClass(); |
| | | if (!className.equals(connectionHandler.getClass().getName())) { |
| | | adminActionRequired = true; |
| | | ccr.setAdminActionRequired(true); |
| | | } |
| | | } else { |
| | | // We need to disable the connection handler. |
| | |
| | | } |
| | | } |
| | | |
| | | // Return the configuration result. |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, |
| | | messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | ConnectionHandlerCfg configuration) { |
| | | |
| | | // Default result code. |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | // See if the entry is registered as a connection handler. If so, |
| | | // deregister and stop it. We'll try to leave any established |
| | |
| | | INFO_CONNHANDLER_CLOSED_BY_DELETE.get()); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange(GlobalCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | List<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | applyGlobalConfiguration(configuration); |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.util.Utils; |
| | | import org.opends.server.admin.ClassPropertyDefinition; |
| | | import org.opends.server.admin.server.ConfigurationAddListener; |
| | |
| | | } |
| | | } |
| | | |
| | | // Returned result. |
| | | ConfigChangeResult changeResult = new ConfigChangeResult( |
| | | ResultCode.SUCCESS, false, new ArrayList<LocalizableMessage>() |
| | | ); |
| | | final ConfigChangeResult changeResult = new ConfigChangeResult(); |
| | | |
| | | // If an entry cache was installed then remove it. |
| | | if (!configuration.isEnabled()) |
| | |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | EntryCacheCfg configuration |
| | | ) |
| | | public ConfigChangeResult applyConfigurationAdd(EntryCacheCfg configuration) |
| | | { |
| | | // Returned result. |
| | | ConfigChangeResult changeResult = new ConfigChangeResult( |
| | | ResultCode.SUCCESS, false, new ArrayList<LocalizableMessage>() |
| | | ); |
| | | final ConfigChangeResult changeResult = new ConfigChangeResult(); |
| | | |
| | | // Register a change listener with it so we can be notified of changes |
| | | // to it over time. |
| | |
| | | entryCache = cacheOrderMap.get(configuration.getCacheLevel()); |
| | | } |
| | | |
| | | // Returned result. |
| | | ConfigChangeResult changeResult = new ConfigChangeResult( |
| | | ResultCode.SUCCESS, false, new ArrayList<LocalizableMessage>() |
| | | ); |
| | | final ConfigChangeResult changeResult = new ConfigChangeResult(); |
| | | |
| | | // If the entry cache was installed then remove it. |
| | | if (entryCache != null) |
| | |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | | import java.util.ArrayList; |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.admin.ClassPropertyDefinition; |
| | | import org.opends.server.admin.server.ConfigurationAddListener; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | |
| | | import org.opends.server.admin.std.server.ExtendedOperationHandlerCfg; |
| | | import org.opends.server.admin.std.server.RootCfg; |
| | | import org.opends.server.api.ExtendedOperationHandler; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.InitializationException; |
| | | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | /** |
| | | * This class defines a utility that will be used to manage the set of extended |
| | | * operation handlers defined in the Directory Server. It will initialize the |
| | |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | ExtendedOperationHandlerCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | |
| | | |
| | | // See if the entry is registered as an extended operation handler. If so, |
| | | // deregister it and finalize the handler. |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | // See if the entry is registered as an extended operation handler. |
| | | // If so, deregister it and finalize the handler. |
| | | ExtendedOperationHandler handler = handlers.remove(configuration.dn()); |
| | | if (handler != null) |
| | | { |
| | | handler.finalizeExtendedOperationHandler(); |
| | | } |
| | | |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired); |
| | | return ccr; |
| | | } |
| | | |
| | | /** |
| | |
| | | DN dn = configuration.dn(); |
| | | ExtendedOperationHandler handler = handlers.get(dn); |
| | | |
| | | // Default result code. |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | // See whether the handler should be enabled. |
| | | if (handler == null) { |
| | |
| | | } catch (ConfigException e) { |
| | | logger.traceException(e); |
| | | |
| | | messages.add(e.getMessageObject()); |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.addMessage(e.getMessageObject()); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } catch (Exception e) { |
| | | logger.traceException(e); |
| | | |
| | | messages.add(ERR_CONFIG_EXTOP_INITIALIZATION_FAILED.get( |
| | | ccr.addMessage(ERR_CONFIG_EXTOP_INITIALIZATION_FAILED.get( |
| | | configuration.getJavaClass(), dn, stackTraceToSingleLineString(e))); |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | } |
| | | } else { |
| | |
| | | // change to take effect. |
| | | String className = configuration.getJavaClass(); |
| | | if (!className.equals(handler.getClass().getName())) { |
| | | adminActionRequired = true; |
| | | ccr.setAdminActionRequired(true); |
| | | } |
| | | } else { |
| | | // We need to disable the connection handler. |
| | |
| | | } |
| | | } |
| | | |
| | | // Return the configuration result. |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, |
| | | messages); |
| | | return ccr; |
| | | } |
| | | |
| | | /** |
| | |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | ExtendedOperationHandlerCfg configuration) |
| | | { |
| | | // Default result code. |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | // Register as a change listener for this connection handler entry |
| | | // so that we will be notified of any changes that may be made to |
| | |
| | | { |
| | | logger.traceException(e); |
| | | |
| | | messages.add(e.getMessageObject()); |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.addMessage(e.getMessageObject()); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | logger.traceException(e); |
| | | |
| | | messages.add(ERR_CONFIG_EXTOP_INITIALIZATION_FAILED.get( |
| | | ccr.addMessage(ERR_CONFIG_EXTOP_INITIALIZATION_FAILED.get( |
| | | configuration.getJavaClass(), dn, stackTraceToSingleLineString(e))); |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | } |
| | | |
| | | // Return the configuration result. |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, |
| | | messages); |
| | | return ccr; |
| | | } |
| | | |
| | | /** |
| | |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | GroupImplementationCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | List<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | configuration.addChangeListener(this); |
| | | |
| | | if (! configuration.isEnabled()) |
| | | { |
| | | return new ConfigChangeResult(resultCode, false, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | Group<?> group = null; |
| | |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | messages.add(ie.getMessageObject()); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ie.getMessageObject()); |
| | | } |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | groupImplementations.put(configuration.dn(), group); |
| | | } |
| | | |
| | | // FIXME -- We need to make sure to find all groups of this type in the |
| | | // server before returning. |
| | | return new ConfigChangeResult(resultCode, false, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | GroupImplementationCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | List<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | Group<?> group = groupImplementations.remove(configuration.dn()); |
| | | if (group != null) |
| | |
| | | group.finalizeGroupImplementation(); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, false, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | GroupImplementationCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | List<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | // Get the existing group implementation if it's already enabled. |
| | | Group<?> existingGroup = groupImplementations.get(configuration.dn()); |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | if (! className.equals(existingGroup.getClass().getName())) |
| | | { |
| | | adminActionRequired = true; |
| | | ccr.setAdminActionRequired(true); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | Group<?> group = null; |
| | |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | messages.add(ie.getMessageObject()); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ie.getMessageObject()); |
| | | } |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | groupImplementations.put(configuration.dn(), group); |
| | | } |
| | | |
| | | // FIXME -- We need to make sure to find all groups of this type in the |
| | | // server before returning. |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.util.Utils; |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.util.Utils; |
| | | import org.opends.server.admin.ClassPropertyDefinition; |
| | | import org.opends.server.admin.server.ConfigurationAddListener; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.server.ConfigurationDeleteListener; |
| | | import org.opends.server.admin.server.ServerManagementContext; |
| | | import org.opends.server.admin.std.meta.IdentityMapperCfgDefn; |
| | | import org.opends.server.admin.std.server.IdentityMapperCfg; |
| | | import org.opends.server.admin.std.server.RootCfg; |
| | | import org.opends.server.admin.server.ServerManagementContext; |
| | | import org.opends.server.api.IdentityMapper; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | /** |
| | | * This class defines a utility that will be used to manage the set of identity |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isConfigurationAddAcceptable( |
| | | IdentityMapperCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | IdentityMapperCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | configuration.addChangeListener(this); |
| | | |
| | | if (! configuration.isEnabled()) |
| | | { |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | IdentityMapper identityMapper = null; |
| | |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ie.getMessageObject()); |
| | | } |
| | | |
| | | messages.add(ie.getMessageObject()); |
| | | } |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | identityMappers.put(configuration.dn(), identityMapper); |
| | | DirectoryServer.registerIdentityMapper(configuration.dn(), |
| | | identityMapper); |
| | | DirectoryServer.registerIdentityMapper(configuration.dn(), identityMapper); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isConfigurationDeleteAcceptable( |
| | | IdentityMapperCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | IdentityMapperCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | DirectoryServer.deregisterIdentityMapper(configuration.dn()); |
| | | |
| | |
| | | identityMapper.finalizeIdentityMapper(); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | IdentityMapperCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | IdentityMapperCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // Get the existing mapper if it's already enabled. |
| | |
| | | } |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | if (! className.equals(existingMapper.getClass().getName())) |
| | | { |
| | | adminActionRequired = true; |
| | | ccr.setAdminActionRequired(true); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | IdentityMapper identityMapper = null; |
| | |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ie.getMessageObject()); |
| | | } |
| | | |
| | | messages.add(ie.getMessageObject()); |
| | | } |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | identityMappers.put(configuration.dn(), identityMapper); |
| | | DirectoryServer.registerIdentityMapper(configuration.dn(), |
| | | identityMapper); |
| | | DirectoryServer.registerIdentityMapper(configuration.dn(), identityMapper); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | KeyManagerProviderCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | configuration.addChangeListener(this); |
| | | |
| | | if (! configuration.isEnabled()) |
| | | { |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | KeyManagerProvider provider = null; |
| | |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ie.getMessageObject()); |
| | | } |
| | | |
| | | messages.add(ie.getMessageObject()); |
| | | } |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | providers.put(configuration.dn(), provider); |
| | | DirectoryServer.registerKeyManagerProvider(configuration.dn(), provider); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | KeyManagerProviderCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | DirectoryServer.deregisterKeyManagerProvider(configuration.dn()); |
| | | |
| | |
| | | provider.finalizeKeyManagerProvider(); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | KeyManagerProviderCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // Get the existing provider if it's already enabled. |
| | |
| | | } |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | if (! className.equals(existingProvider.getClass().getName())) |
| | | { |
| | | adminActionRequired = true; |
| | | ccr.setAdminActionRequired(true); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | KeyManagerProvider provider = null; |
| | |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ie.getMessageObject()); |
| | | } |
| | | |
| | | messages.add(ie.getMessageObject()); |
| | | } |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | providers.put(configuration.dn(), provider); |
| | | DirectoryServer.registerKeyManagerProvider(configuration.dn(), provider); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import org.opends.server.admin.std.server.LogRetentionPolicyCfg; |
| | |
| | | import org.opends.server.admin.std.meta.LogRetentionPolicyCfgDefn; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.admin.server.ConfigurationAddListener; |
| | | import org.opends.server.admin.server.ServerManagementContext; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd(LogRetentionPolicyCfg config) |
| | | { |
| | | // Default result code. |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | try |
| | | { |
| | |
| | | } |
| | | catch (ConfigException e) { |
| | | logger.traceException(e); |
| | | messages.add(e.getMessageObject()); |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.addMessage(e.getMessageObject()); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } catch (Exception e) { |
| | | logger.traceException(e); |
| | | |
| | | messages.add(ERR_CONFIG_RETENTION_POLICY_CANNOT_CREATE_POLICY.get( |
| | | ccr.addMessage(ERR_CONFIG_RETENTION_POLICY_CANNOT_CREATE_POLICY.get( |
| | | config.dn(),stackTraceToSingleLineString(e))); |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | /** |
| | |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | LogRetentionPolicyCfg config) |
| | | { |
| | | // Default result code. |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | RetentionPolicy policy = DirectoryServer.getRetentionPolicy(config.dn()); |
| | | if(policy != null) |
| | |
| | | else |
| | | { |
| | | // TODO: Add message and check for usage |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | /** |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | LogRetentionPolicyCfg configuration) |
| | | { |
| | | // Default result code. |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | RetentionPolicy policy = |
| | | DirectoryServer.getRetentionPolicy(configuration.dn()); |
| | | String className = configuration.getJavaClass(); |
| | | if(!className.equals(policy.getClass().getName())) |
| | | { |
| | | adminActionRequired = true; |
| | | ccr.setAdminActionRequired(true); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | private boolean isJavaClassAcceptable(LogRetentionPolicyCfg config, |
| | |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.loggers.RotationPolicy; |
| | | import org.opends.server.admin.server.ConfigurationAddListener; |
| | | import org.opends.server.admin.server.ConfigurationDeleteListener; |
| | |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd(LogRotationPolicyCfg config) |
| | | { |
| | | // Default result code. |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | try |
| | | { |
| | |
| | | } |
| | | catch (ConfigException e) { |
| | | logger.traceException(e); |
| | | messages.add(e.getMessageObject()); |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.addMessage(e.getMessageObject()); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } catch (Exception e) { |
| | | logger.traceException(e); |
| | | |
| | | messages.add(ERR_CONFIG_ROTATION_POLICY_CANNOT_CREATE_POLICY.get(config.dn(), |
| | | ccr.addMessage(ERR_CONFIG_ROTATION_POLICY_CANNOT_CREATE_POLICY.get(config.dn(), |
| | | stackTraceToSingleLineString(e))); |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | /** |
| | |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | LogRotationPolicyCfg config) |
| | | { |
| | | // Default result code. |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | RotationPolicy policy = DirectoryServer.getRotationPolicy(config.dn()); |
| | | if(policy != null) |
| | |
| | | else |
| | | { |
| | | // TODO: Add message and check for usage |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | /** |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | LogRotationPolicyCfg configuration) |
| | | { |
| | | // Default result code. |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | RotationPolicy policy = |
| | | DirectoryServer.getRotationPolicy(configuration.dn()); |
| | | String className = configuration.getJavaClass(); |
| | | if(!className.equals(policy.getClass().getName())) |
| | | { |
| | | adminActionRequired = true; |
| | | ccr.setAdminActionRequired(true); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | private boolean isJavaClassAcceptable(LogRotationPolicyCfg config, |
| | |
| | | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.admin.server.ConfigurationAddListener; |
| | | import org.opends.server.admin.server.ConfigurationDeleteListener; |
| | | import org.opends.server.admin.server.ServerManagementContext; |
| | |
| | | import org.opends.server.admin.std.server.HTTPAccessLogPublisherCfg; |
| | | import org.opends.server.admin.std.server.LogPublisherCfg; |
| | | import org.opends.server.admin.std.server.RootCfg; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.loggers.AbstractLogger; |
| | | import org.opends.server.loggers.AccessLogger; |
| | | import org.opends.server.loggers.DebugLogger; |
| | |
| | | import org.opends.server.loggers.HTTPAccessLogger; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | |
| | | |
| | | /** |
| | | * This class defines a utility that will be used to manage the set of loggers |
| | |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | |
| | | private final ServerContext serverContext; |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAddAcceptable(LogPublisherCfg config, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | | { |
| | | AbstractLogger instance = getLoggerInstance(config, unacceptableReasons); |
| | | if (instance != null) |
| | | { |
| | | return instance.isConfigurationAddAcceptable(config, unacceptableReasons); |
| | | } |
| | | return false; |
| | | return instance != null |
| | | && instance.isConfigurationAddAcceptable(config, unacceptableReasons); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd(LogPublisherCfg config) |
| | | { |
| | | List<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(1); |
| | | AbstractLogger instance = getLoggerInstance(config, messages); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | AbstractLogger instance = getLoggerInstance(config, ccr.getMessages()); |
| | | if (instance != null) |
| | | { |
| | | return instance.applyConfigurationAdd(config); |
| | | } |
| | | else |
| | | { |
| | | boolean adminActionRequired = false; |
| | | ResultCode resultCode = ResultCode.UNWILLING_TO_PERFORM; |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | ccr.setResultCode(ResultCode.UNWILLING_TO_PERFORM); |
| | | return ccr; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationDeleteAcceptable(LogPublisherCfg config, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | | { |
| | | AbstractLogger instance = getLoggerInstance(config, unacceptableReasons); |
| | | if (instance != null) |
| | | { |
| | | return instance.isConfigurationDeleteAcceptable(config, |
| | | unacceptableReasons); |
| | | } |
| | | return false; |
| | | return instance != null |
| | | && instance.isConfigurationDeleteAcceptable(config, unacceptableReasons); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete(LogPublisherCfg config) |
| | | { |
| | | List<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(1); |
| | | AbstractLogger instance = getLoggerInstance(config, messages); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | AbstractLogger instance = getLoggerInstance(config, ccr.getMessages()); |
| | | if (instance != null) |
| | | { |
| | | return instance.applyConfigurationDelete(config); |
| | | } |
| | | else |
| | | { |
| | | boolean adminActionRequired = false; |
| | | ResultCode resultCode = ResultCode.UNWILLING_TO_PERFORM; |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | ccr.setResultCode(ResultCode.UNWILLING_TO_PERFORM); |
| | | return ccr; |
| | | } |
| | | } |
| | | } |
| | |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.schema.MatchingRule; |
| | | import org.forgerock.util.Utils; |
| | | import org.opends.server.admin.ClassPropertyDefinition; |
| | |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.types.MatchingRuleUse; |
| | | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | /** |
| | | * This class defines a utility that will be used to manage the set of matching |
| | | * rules defined in the Directory Server. It wil initialize the rules when the |
| | |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd(MatchingRuleCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | configuration.addChangeListener(this); |
| | | |
| | | if (! configuration.isEnabled()) |
| | | { |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | MatchingRuleFactory<?> factory = null; |
| | |
| | | { |
| | | factory = loadMatchingRuleFactory(className, configuration, true); |
| | | |
| | | try |
| | | { |
| | | for(MatchingRule matchingRule: factory.getMatchingRules()) |
| | | { |
| | | DirectoryServer.registerMatchingRule(matchingRule, false); |
| | |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | messages.add(WARN_CONFIG_SCHEMA_MR_CONFLICTING_MR.get( |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(WARN_CONFIG_SCHEMA_MR_CONFLICTING_MR.get( |
| | | configuration.dn(), de.getMessageObject())); |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | } |
| | | } |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ie.getMessageObject()); |
| | | } |
| | | |
| | | messages.add(ie.getMessageObject()); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete(MatchingRuleCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | MatchingRuleFactory<?> factory = matchingRuleFactories.remove(configuration.dn()); |
| | | if (factory != null) |
| | |
| | | factory.finalizeMatchingRule(); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | MatchingRuleCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // Get the existing matching rule factory if it's already enabled. |
| | |
| | | matchingRuleFactories.remove(configuration.dn()); |
| | | existingFactory.finalizeMatchingRule(); |
| | | } |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | if (! className.equals(existingFactory.getClass().getName())) |
| | | { |
| | | adminActionRequired = true; |
| | | ccr.setAdminActionRequired(true); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | MatchingRuleFactory<?> factory = null; |
| | |
| | | { |
| | | factory = loadMatchingRuleFactory(className, configuration, true); |
| | | |
| | | try |
| | | { |
| | | for(MatchingRule matchingRule: factory.getMatchingRules()) |
| | | { |
| | | DirectoryServer.registerMatchingRule(matchingRule, false); |
| | |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | messages.add(WARN_CONFIG_SCHEMA_MR_CONFLICTING_MR.get(configuration.dn(), de.getMessageObject())); |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | } |
| | | } |
| | | ccr.addMessage(WARN_CONFIG_SCHEMA_MR_CONFLICTING_MR.get(configuration.dn(), de.getMessageObject())); |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ie.getMessageObject()); |
| | | } |
| | | |
| | | messages.add(ie.getMessageObject()); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.admin.ClassPropertyDefinition; |
| | | import org.opends.server.admin.server.ConfigurationAddListener; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.server.ConfigurationDeleteListener; |
| | | import org.opends.server.admin.server.ServerManagementContext; |
| | | import org.opends.server.admin.std.meta.MonitorProviderCfgDefn; |
| | | import org.opends.server.admin.std.server.MonitorProviderCfg; |
| | | import org.opends.server.admin.std.server.RootCfg; |
| | | import org.opends.server.admin.server.ServerManagementContext; |
| | | import org.opends.server.api.MonitorProvider; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class defines a utility that will be used to manage the set of monitor |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isConfigurationAddAcceptable( |
| | | MonitorProviderCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | MonitorProviderCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | configuration.addChangeListener(this); |
| | | |
| | | if (! configuration.isEnabled()) |
| | | { |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | MonitorProvider<? extends MonitorProviderCfg> monitor = null; |
| | |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ie.getMessageObject()); |
| | | } |
| | | |
| | | messages.add(ie.getMessageObject()); |
| | | } |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | monitors.put(configuration.dn(), monitor); |
| | | DirectoryServer.registerMonitorProvider(monitor); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isConfigurationDeleteAcceptable( |
| | | MonitorProviderCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | MonitorProviderCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | MonitorProvider<?> monitor = monitors.remove(configuration.dn()); |
| | | if (monitor != null) |
| | |
| | | monitor.finalizeMonitorProvider(); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | MonitorProviderCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | MonitorProviderCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | // Get the existing monitor provider if it's already enabled. |
| | | MonitorProvider<?> existingMonitor = monitors.get(configuration.dn()); |
| | |
| | | } |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | if (! className.equals(existingMonitor.getClass().getName())) |
| | | { |
| | | adminActionRequired = true; |
| | | ccr.setAdminActionRequired(true); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | MonitorProvider<? extends MonitorProviderCfg> monitor = null; |
| | |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ie.getMessageObject()); |
| | | } |
| | | |
| | | messages.add(ie.getMessageObject()); |
| | | } |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | monitors.put(configuration.dn(), monitor); |
| | | DirectoryServer.registerMonitorProvider(monitor); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.util.Utils; |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.util.Utils; |
| | | import org.opends.server.admin.ClassPropertyDefinition; |
| | | import org.opends.server.admin.server.ConfigurationAddListener; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | |
| | | import org.opends.server.admin.std.server.PasswordGeneratorCfg; |
| | | import org.opends.server.admin.std.server.RootCfg; |
| | | import org.opends.server.api.PasswordGenerator; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | /** |
| | | * This class defines a utility that will be used to manage the set of password |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | PasswordGeneratorCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | PasswordGeneratorCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // Get the existing generator if it's already enabled. |
| | |
| | | } |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | if (! className.equals(existingGenerator.getClass().getName())) |
| | | { |
| | | adminActionRequired = true; |
| | | ccr.setAdminActionRequired(true); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | PasswordGenerator<? extends PasswordGeneratorCfg> |
| | |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ie.getMessageObject()); |
| | | } |
| | | |
| | | messages.add(ie.getMessageObject()); |
| | | } |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | passwordGenerators.put(configuration.dn(), passwordGenerator); |
| | | DirectoryServer.registerPasswordGenerator(configuration.dn(), |
| | | passwordGenerator); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isConfigurationAddAcceptable( |
| | | PasswordGeneratorCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | PasswordGeneratorCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | configuration.addChangeListener(this); |
| | | |
| | | if (! configuration.isEnabled()) |
| | | { |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | PasswordGenerator<? extends PasswordGeneratorCfg> |
| | |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ie.getMessageObject()); |
| | | } |
| | | |
| | | messages.add(ie.getMessageObject()); |
| | | } |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | passwordGenerators.put(configuration.dn(), passwordGenerator); |
| | | DirectoryServer.registerPasswordGenerator(configuration.dn(), |
| | | passwordGenerator); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isConfigurationDeleteAcceptable( |
| | | PasswordGeneratorCfg configuration, List<LocalizableMessage> unacceptableReasons) |
| | | { |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | PasswordGeneratorCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // See if the entry is registered as a password generator. If so, |
| | | // deregister it and stop the generator. |
| | | // See if the entry is registered as a password generator. |
| | | // If so, deregister it and stop the generator. |
| | | PasswordGenerator generator = passwordGenerators.remove(configuration.dn()); |
| | | if (generator != null) |
| | | { |
| | |
| | | generator.finalizePasswordGenerator(); |
| | | } |
| | | |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired); |
| | | return ccr; |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.lang.reflect.InvocationTargetException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.admin.ClassPropertyDefinition; |
| | | import org.opends.server.admin.server.ConfigurationAddListener; |
| | |
| | | import org.opends.server.api.AuthenticationPolicy; |
| | | import org.opends.server.api.AuthenticationPolicyFactory; |
| | | import org.opends.server.api.SubentryChangeListener; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.types.*; |
| | | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | /** |
| | | * This class defines a utility that will be used to manage the set of password |
| | | * policies defined in the Directory Server. It will initialize the policies |
| | |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | AuthenticationPolicyCfg configuration) |
| | | public ConfigChangeResult applyConfigurationAdd(AuthenticationPolicyCfg configuration) |
| | | { |
| | | // See if we can create a password policy from the provided configuration |
| | | // entry. If so, then register it with the Directory Server. |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | try |
| | | { |
| | | createAuthenticationPolicy(configuration); |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false, messages); |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | messages.add(ERR_CONFIG_PWPOLICY_INVALID_POLICY_CONFIG.get(configuration.dn(), ce.getMessage())); |
| | | return new ConfigChangeResult(ResultCode.CONSTRAINT_VIOLATION, false, messages); |
| | | ccr.setResultCode(ResultCode.CONSTRAINT_VIOLATION); |
| | | ccr.addMessage(ERR_CONFIG_PWPOLICY_INVALID_POLICY_CONFIG.get(configuration.dn(), ce.getMessage())); |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | messages.add(ERR_CONFIG_PWPOLICY_INVALID_POLICY_CONFIG.get(configuration.dn(), ie.getMessage())); |
| | | return new ConfigChangeResult(DirectoryServer.getServerErrorResultCode(), false, messages); |
| | | ccr.addMessage(ERR_CONFIG_PWPOLICY_INVALID_POLICY_CONFIG.get(configuration.dn(), ie.getMessage())); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | messages.add(ERR_CONFIG_PWPOLICY_INVALID_POLICY_CONFIG.get(configuration.dn(), stackTraceToSingleLineString(e))); |
| | | return new ConfigChangeResult(DirectoryServer.getServerErrorResultCode(), false, messages); |
| | | ccr.addMessage(ERR_CONFIG_PWPOLICY_INVALID_POLICY_CONFIG.get( |
| | | configuration.dn(), stackTraceToSingleLineString(e))); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | // a policy is not removed when referenced by a user entry (either |
| | | // directly or via a virtual attribute). |
| | | DN defaultPolicyDN = DirectoryServer.getDefaultPasswordPolicyDN(); |
| | | if ((defaultPolicyDN != null) && defaultPolicyDN.equals(configuration.dn())) |
| | | if (defaultPolicyDN != null && defaultPolicyDN.equals(configuration.dn())) |
| | | { |
| | | unacceptableReason.add(WARN_CONFIG_PWPOLICY_CANNOT_DELETE_DEFAULT_POLICY.get(defaultPolicyDN)); |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | AuthenticationPolicyCfg configuration) |
| | | public ConfigChangeResult applyConfigurationDelete(AuthenticationPolicyCfg configuration) |
| | | { |
| | | // We'll allow the policy to be removed as long as it isn't the default. |
| | | // FIXME: something like a referential integrity check is needed to ensure |
| | | // a policy is not removed when referenced by a user entry (either |
| | | // directly or via a virtual attribute). |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(1); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | DN policyDN = configuration.dn(); |
| | | DN defaultPolicyDN = DirectoryServer.getDefaultPasswordPolicyDN(); |
| | | if ((defaultPolicyDN != null) && defaultPolicyDN.equals(policyDN)) |
| | | if (defaultPolicyDN != null && defaultPolicyDN.equals(policyDN)) |
| | | { |
| | | messages.add(WARN_CONFIG_PWPOLICY_CANNOT_DELETE_DEFAULT_POLICY.get(defaultPolicyDN)); |
| | | return new ConfigChangeResult(ResultCode.CONSTRAINT_VIOLATION, false, messages); |
| | | ccr.setResultCode(ResultCode.CONSTRAINT_VIOLATION); |
| | | ccr.addMessage(WARN_CONFIG_PWPOLICY_CANNOT_DELETE_DEFAULT_POLICY.get(defaultPolicyDN)); |
| | | return ccr; |
| | | } |
| | | DirectoryServer.deregisterAuthenticationPolicy(policyDN); |
| | | messages.add(INFO_CONFIG_PWPOLICY_REMOVED_POLICY.get(policyDN)); |
| | | |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false, messages); |
| | | ccr.addMessage(INFO_CONFIG_PWPOLICY_REMOVED_POLICY.get(policyDN)); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | import static org.opends.messages.CoreMessages.*; |
| | | import static org.opends.server.schema.SchemaConstants.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.getExceptionMessage; |
| | | import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString; |
| | | import static org.opends.server.util.StaticUtils.toLowerCase; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.meta.PasswordPolicyCfgDefn.*; |
| | | import org.opends.server.admin.std.server.PasswordPolicyCfg; |
| | | import org.opends.server.api.*; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.GeneralizedTime; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | |
| | | |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.meta.PasswordPolicyCfgDefn.StateUpdateFailurePolicy; |
| | | import org.opends.server.admin.std.server.PasswordPolicyCfg; |
| | | import org.opends.server.api.*; |
| | | import org.opends.server.types.*; |
| | | |
| | | /** |
| | | * This class is the interface between the password policy configurable |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void finalizeAuthenticationPolicy() |
| | | { |
| | | configuration.removePasswordPolicyChangeListener(this); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | PasswordPolicyCfg configuration) |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange(PasswordPolicyCfg configuration) |
| | | { |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | try |
| | | { |
| | | updateConfiguration(configuration, true); |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false, messages); |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | messages.add(ERR_CONFIG_PWPOLICY_INVALID_POLICY_CONFIG.get(configuration.dn(), ce.getMessage())); |
| | | return new ConfigChangeResult(ResultCode.CONSTRAINT_VIOLATION, false, messages); |
| | | ccr.setResultCode(ResultCode.CONSTRAINT_VIOLATION); |
| | | ccr.addMessage(ERR_CONFIG_PWPOLICY_INVALID_POLICY_CONFIG.get(configuration.dn(), ce.getMessage())); |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | messages.add(ERR_CONFIG_PWPOLICY_INVALID_POLICY_CONFIG.get( |
| | | ccr.addMessage(ERR_CONFIG_PWPOLICY_INVALID_POLICY_CONFIG.get( |
| | | configuration.dn(), ie.getMessage())); |
| | | return new ConfigChangeResult( |
| | | DirectoryServer.getServerErrorResultCode(), false, messages); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | messages.add(ERR_CONFIG_PWPOLICY_INVALID_POLICY_CONFIG.get( |
| | | ccr.addMessage(ERR_CONFIG_PWPOLICY_INVALID_POLICY_CONFIG.get( |
| | | configuration.dn(), stackTraceToSingleLineString(e))); |
| | | return new ConfigChangeResult( |
| | | DirectoryServer.getServerErrorResultCode(), false, messages); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | PasswordPolicyCfg configuration, List<LocalizableMessage> unacceptableReasons) |
| | | { |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public Set<String> getDeprecatedPasswordStorageSchemes() |
| | | { |
| | | return deprecatedStorageSchemes; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public DN getDN() |
| | | { |
| | | return configuration.dn(); |
| | |
| | | * |
| | | * @return A string representation of this password policy. |
| | | */ |
| | | @Override |
| | | public String toString() |
| | | { |
| | | StringBuilder buffer = new StringBuilder(); |
| | |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.util.Utils; |
| | | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | |
| | | import java.util.List; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.util.Utils; |
| | | import org.opends.server.admin.ClassPropertyDefinition; |
| | | import org.opends.server.admin.server.ConfigurationAddListener; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | |
| | | import org.opends.server.admin.std.server.PasswordStorageSchemeCfg; |
| | | import org.opends.server.admin.std.server.RootCfg; |
| | | import org.opends.server.api.PasswordStorageScheme; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | |
| | | /** |
| | | * This class defines a utility that will be used to manage the set of password |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | PasswordStorageSchemeCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | PasswordStorageSchemeCfg configuration |
| | | ) |
| | | { |
| | | // Returned result. |
| | | ConfigChangeResult changeResult = new ConfigChangeResult( |
| | | ResultCode.SUCCESS, false, new ArrayList<LocalizableMessage>() |
| | | ); |
| | | final ConfigChangeResult changeResult = new ConfigChangeResult(); |
| | | |
| | | // Get the configuration entry DN and the associated |
| | | // password storage scheme class. |
| | | DN configEntryDN = configuration.dn(); |
| | | PasswordStorageScheme storageScheme = storageSchemes.get( |
| | | configEntryDN |
| | | ); |
| | | PasswordStorageScheme storageScheme = storageSchemes.get(configEntryDN); |
| | | |
| | | // If the new configuration has the password storage scheme disabled, |
| | | // then remove it from the mapping list and clean it. |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isConfigurationAddAcceptable( |
| | | PasswordStorageSchemeCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | PasswordStorageSchemeCfg configuration |
| | | ) |
| | | { |
| | | // Returned result. |
| | | ConfigChangeResult changeResult = new ConfigChangeResult( |
| | | ResultCode.SUCCESS, false, new ArrayList<LocalizableMessage>() |
| | | ); |
| | | final ConfigChangeResult changeResult = new ConfigChangeResult(); |
| | | |
| | | // Register a change listener with it so we can be notified of changes |
| | | // to it over time. |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isConfigurationDeleteAcceptable( |
| | | PasswordStorageSchemeCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | PasswordStorageSchemeCfg configuration |
| | | ) |
| | | { |
| | | // Returned result. |
| | | ConfigChangeResult changeResult = new ConfigChangeResult( |
| | | ResultCode.SUCCESS, false, new ArrayList<LocalizableMessage>() |
| | | ); |
| | | final ConfigChangeResult changeResult = new ConfigChangeResult(); |
| | | |
| | | uninstallPasswordStorageScheme (configuration.dn()); |
| | | |
| | |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.util.Utils; |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.util.Utils; |
| | | import org.opends.server.admin.ClassPropertyDefinition; |
| | | import org.opends.server.admin.server.ConfigurationAddListener; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.server.ConfigurationDeleteListener; |
| | | import org.opends.server.admin.server.ServerManagementContext; |
| | | import org.opends.server.admin.std.meta.PasswordValidatorCfgDefn; |
| | | import org.opends.server.admin.std.server.PasswordValidatorCfg; |
| | | import org.opends.server.admin.std.server.RootCfg; |
| | | import org.opends.server.admin.server.ServerManagementContext; |
| | | import org.opends.server.api.PasswordValidator; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | /** |
| | | * This class defines a utility that will be used to manage the set of |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isConfigurationAddAcceptable( |
| | | PasswordValidatorCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | PasswordValidatorCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | configuration.addChangeListener(this); |
| | | |
| | | if (! configuration.isEnabled()) |
| | | { |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | PasswordValidator<? extends PasswordValidatorCfg> |
| | |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ie.getMessageObject()); |
| | | } |
| | | |
| | | messages.add(ie.getMessageObject()); |
| | | } |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | passwordValidators.put(configuration.dn(), passwordValidator); |
| | | DirectoryServer.registerPasswordValidator(configuration.dn(), |
| | | passwordValidator); |
| | | DirectoryServer.registerPasswordValidator(configuration.dn(), passwordValidator); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isConfigurationDeleteAcceptable( |
| | | PasswordValidatorCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | PasswordValidatorCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | DirectoryServer.deregisterPasswordValidator(configuration.dn()); |
| | | |
| | |
| | | passwordValidator.finalizePasswordValidator(); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | PasswordValidatorCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | PasswordValidatorCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // Get the existing validator if it's already enabled. |
| | |
| | | } |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | if (! className.equals(existingValidator.getClass().getName())) |
| | | { |
| | | adminActionRequired = true; |
| | | ccr.setAdminActionRequired(true); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | PasswordValidator<? extends PasswordValidatorCfg> |
| | |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ie.getMessageObject()); |
| | | } |
| | | |
| | | messages.add(ie.getMessageObject()); |
| | | } |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | passwordValidators.put(configuration.dn(), passwordValidator); |
| | | DirectoryServer.registerPasswordValidator(configuration.dn(), |
| | | passwordValidator); |
| | | DirectoryServer.registerPasswordValidator(configuration.dn(), passwordValidator); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.messages.PluginMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.util.*; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | import java.util.concurrent.locks.ReentrantLock; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.util.Utils; |
| | | import org.opends.server.admin.ClassPropertyDefinition; |
| | | import org.opends.server.admin.server.ConfigurationAddListener; |
| | |
| | | import org.opends.server.api.plugin.InternalDirectoryServerPlugin; |
| | | import org.opends.server.api.plugin.PluginResult; |
| | | import org.opends.server.api.plugin.PluginType; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.types.operation.*; |
| | | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.messages.PluginMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | /** |
| | | * This class defines a utility that will be used to manage the configuration |
| | | * for the set of plugins defined in the Directory Server. It will perform the |
| | |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | PluginCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | configuration.addChangeListener(this); |
| | | |
| | | if (! configuration.isEnabled()) |
| | | { |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | // Create a set of plugin types for the plugin. |
| | |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ie.getMessageObject()); |
| | | } |
| | | |
| | | messages.add(ie.getMessageObject()); |
| | | } |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | registerPlugin(plugin, configuration.dn(), pluginTypes); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | PluginCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | deregisterPlugin(configuration.dn()); |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | PluginCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // Get the existing plugin if it's already enabled. |
| | |
| | | deregisterPlugin(configuration.dn()); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | if (! className.equals(existingPlugin.getClass().getName())) |
| | | { |
| | | adminActionRequired = true; |
| | | ccr.setAdminActionRequired(true); |
| | | } |
| | | |
| | | existingPlugin.setInvokeForInternalOperations( |
| | | configuration.isInvokeForInternalOperations()); |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | // Create a set of plugin types for the plugin. |
| | |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ie.getMessageObject()); |
| | | } |
| | | |
| | | messages.add(ie.getMessageObject()); |
| | | } |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | registerPlugin(plugin, configuration.dn(), pluginTypes); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | private void registerSkippedPreOperationPlugins(int i, |
| | |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.admin.server.ConfigurationAddListener; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.server.ConfigurationDeleteListener; |
| | | import org.opends.server.admin.server.ServerManagementContext; |
| | | import org.opends.server.admin.std.server.RootCfg; |
| | | import org.opends.server.admin.std.server.RootDNCfg; |
| | | import org.opends.server.admin.std.server.RootDNUserCfg; |
| | | import org.opends.server.admin.server.ServerManagementContext; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.types.Privilege; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class defines a utility that will be used to manage the set of root |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isConfigurationAddAcceptable(RootDNUserCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | | { |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd(RootDNUserCfg configuration) |
| | | { |
| | | configuration.addChangeListener(this); |
| | | |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | HashSet<DN> altBindDNs = new HashSet<DN>(); |
| | | for (DN altBindDN : configuration.getAlternateBindDN()) |
| | |
| | | { |
| | | // This shouldn't happen, since the set of DNs should have already been |
| | | // validated. |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | messages.add(de.getMessageObject()); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(de.getMessageObject()); |
| | | |
| | | for (DN dn : altBindDNs) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | DirectoryServer.registerRootDN(configuration.dn()); |
| | | alternateBindDNs.put(configuration.dn(), altBindDNs); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isConfigurationDeleteAcceptable(RootDNUserCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | | { |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | RootDNUserCfg configuration) |
| | | { |
| | | DirectoryServer.deregisterRootDN(configuration.dn()); |
| | | configuration.removeChangeListener(this); |
| | | |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | HashSet<DN> altBindDNs = alternateBindDNs.remove(configuration.dn()); |
| | | if (altBindDNs != null) |
| | |
| | | } |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable(RootDNUserCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | | { |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | RootDNUserCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | HashSet<DN> setDNs = new HashSet<DN>(); |
| | | HashSet<DN> addDNs = new HashSet<DN>(); |
| | |
| | | { |
| | | // This shouldn't happen, since the set of DNs should have already been |
| | | // validated. |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | messages.add(de.getMessageObject()); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(de.getMessageObject()); |
| | | |
| | | for (DN addedDN : addedDNs) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | alternateBindDNs.put(configuration.dn(), setDNs); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | } |
| | | |
| | |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | |
| | | |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.meta.RootDNCfgDefn; |
| | | import org.opends.server.admin.std.server.RootDNCfg; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.Privilege; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class defines a data structure that is used to handle changes to the set |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable(RootDNCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | | { |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange(RootDNCfg configuration) |
| | | { |
| | | setDefaultRootPrivileges(configuration); |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the set of privileges that will be automatically granted to root |
| | | * users. |
| | |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.util.Utils; |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.util.Utils; |
| | | import org.opends.server.admin.ClassPropertyDefinition; |
| | | import org.opends.server.admin.server.ConfigurationAddListener; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.server.ConfigurationDeleteListener; |
| | | import org.opends.server.admin.std.meta.SASLMechanismHandlerCfgDefn; |
| | | import org.opends.server.admin.std.server.SASLMechanismHandlerCfg; |
| | | import org.opends.server.admin.std.server.RootCfg; |
| | | import org.opends.server.admin.server.ServerManagementContext; |
| | | import org.opends.server.admin.std.meta.SASLMechanismHandlerCfgDefn; |
| | | import org.opends.server.admin.std.server.RootCfg; |
| | | import org.opends.server.admin.std.server.SASLMechanismHandlerCfg; |
| | | import org.opends.server.api.SASLMechanismHandler; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | /** |
| | | * This class defines a utility that will be used to manage the set of SASL |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isConfigurationAddAcceptable( |
| | | SASLMechanismHandlerCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | SASLMechanismHandlerCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | configuration.addChangeListener(this); |
| | | |
| | | if (! configuration.isEnabled()) |
| | | { |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | SASLMechanismHandler handler = null; |
| | |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ie.getMessageObject()); |
| | | } |
| | | |
| | | messages.add(ie.getMessageObject()); |
| | | } |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | handlers.put(configuration.dn(), handler); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isConfigurationDeleteAcceptable( |
| | | SASLMechanismHandlerCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | SASLMechanismHandlerCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | SASLMechanismHandler handler = handlers.remove(configuration.dn()); |
| | | if (handler != null) |
| | |
| | | handler.finalizeSASLMechanismHandler(); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | SASLMechanismHandlerCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | SASLMechanismHandlerCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // Get the existing handler if it's already enabled. |
| | |
| | | } |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | if (! className.equals(existingHandler.getClass().getName())) |
| | | { |
| | | adminActionRequired = true; |
| | | ccr.setAdminActionRequired(true); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | SASLMechanismHandler handler = null; |
| | |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ie.getMessageObject()); |
| | | } |
| | | |
| | | messages.add(ie.getMessageObject()); |
| | | } |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | handlers.put(configuration.dn(), handler); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | | import java.util.ArrayList; |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.admin.ClassPropertyDefinition; |
| | | import org.opends.server.admin.server.ConfigurationAddListener; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | |
| | | import org.opends.server.admin.std.server.RootCfg; |
| | | import org.opends.server.admin.std.server.SynchronizationProviderCfg; |
| | | import org.opends.server.api.SynchronizationProvider; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.InitializationException; |
| | | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | /** |
| | | * This class defines a utility that will be used to manage the configuration |
| | | * for the set of synchronization providers configured in the Directory Server. |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | SynchronizationProviderCfg configuration) |
| | | { |
| | | // Default result code. |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | // Attempt to get the existing synchronization provider. This will only |
| | | // succeed if it is currently enabled. |
| | |
| | | if (logger.isTraceEnabled()) |
| | | { |
| | | logger.traceException(e); |
| | | messages.add(e.getMessageObject()); |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.addMessage(e.getMessageObject()); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | logger.traceException(e); |
| | | |
| | | messages.add(ERR_CONFIG_SYNCH_ERROR_INITIALIZING_PROVIDER.get( |
| | | ccr.addMessage(ERR_CONFIG_SYNCH_ERROR_INITIALIZING_PROVIDER.get( |
| | | configuration.getJavaClass(), configuration.dn())); |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | } |
| | | } |
| | |
| | | String className = configuration.getJavaClass(); |
| | | if (!className.equals(provider.getClass().getName())) |
| | | { |
| | | adminActionRequired = true; |
| | | ccr.setAdminActionRequired(true); |
| | | } |
| | | } |
| | | else |
| | |
| | | registeredProviders.remove(dn); |
| | | } |
| | | } |
| | | // Return the configuration result. |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, |
| | | messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | SynchronizationProviderCfg configuration) |
| | | { |
| | | // Default result code. |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | // Register as a change listener for this synchronization provider entry |
| | | // so that we will be notified if when it is disabled or enabled. |
| | |
| | | if (logger.isTraceEnabled()) |
| | | { |
| | | logger.traceException(e); |
| | | messages.add(e.getMessageObject()); |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.addMessage(e.getMessageObject()); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | logger.traceException(e); |
| | | |
| | | messages.add(ERR_CONFIG_SYNCH_ERROR_INITIALIZING_PROVIDER.get( |
| | | ccr.addMessage(ERR_CONFIG_SYNCH_ERROR_INITIALIZING_PROVIDER.get( |
| | | configuration.getJavaClass(), configuration.dn())); |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | } |
| | | |
| | | // Return the configuration result. |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, |
| | | messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | SynchronizationProviderCfg configuration) |
| | | { |
| | | // Default result code. |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | // See if the entry is registered as a synchronization provider. If so, |
| | | // deregister and stop it. |
| | |
| | | DirectoryServer.deregisterSynchronizationProvider(provider); |
| | | provider.finalizeSynchronizationProvider(); |
| | | } |
| | | return new ConfigChangeResult(resultCode, adminActionRequired); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | TrustManagerProviderCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | configuration.addChangeListener(this); |
| | | |
| | | if (! configuration.isEnabled()) |
| | | { |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | TrustManagerProvider provider = null; |
| | |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ie.getMessageObject()); |
| | | } |
| | | |
| | | messages.add(ie.getMessageObject()); |
| | | } |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | providers.put(configuration.dn(), provider); |
| | | DirectoryServer.registerTrustManagerProvider(configuration.dn(), |
| | | provider); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | TrustManagerProviderCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | DirectoryServer.deregisterTrustManagerProvider(configuration.dn()); |
| | | |
| | |
| | | provider.finalizeTrustManagerProvider(); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | TrustManagerProviderCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // Get the existing provider if it's already enabled. |
| | |
| | | } |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | if (! className.equals(existingProvider.getClass().getName())) |
| | | { |
| | | adminActionRequired = true; |
| | | ccr.setAdminActionRequired(true); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | TrustManagerProvider provider = null; |
| | |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ie.getMessageObject()); |
| | | } |
| | | |
| | | messages.add(ie.getMessageObject()); |
| | | } |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | providers.put(configuration.dn(), provider); |
| | | DirectoryServer.registerTrustManagerProvider(configuration.dn(), |
| | | provider); |
| | | DirectoryServer.registerTrustManagerProvider(configuration.dn(), provider); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | | import static org.forgerock.opendj.adapter.server3x.Converters.*; |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.util.*; |
| | | import java.util.Map.Entry; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.util.Utils; |
| | | import org.opends.server.admin.ClassPropertyDefinition; |
| | | import org.opends.server.admin.server.ConfigurationAddListener; |
| | |
| | | import org.opends.server.admin.std.server.RootCfg; |
| | | import org.opends.server.admin.std.server.VirtualAttributeCfg; |
| | | import org.opends.server.api.VirtualAttributeProvider; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static org.forgerock.opendj.adapter.server3x.Converters.from; |
| | | |
| | | /** |
| | | * This class defines a utility that will be used to manage the set of |
| | |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | VirtualAttributeCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | List<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | configuration.addChangeListener(this); |
| | | |
| | | if (! configuration.isEnabled()) |
| | | { |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | // Make sure that we can parse all of the search filters. |
| | |
| | | Set<SearchFilter> filters = buildFilters(configuration, reasons); |
| | | if (!reasons.isEmpty()) |
| | | { |
| | | messages.addAll(reasons.keySet()); |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = ResultCode.INVALID_ATTRIBUTE_SYNTAX; |
| | | } |
| | | ccr.getMessages().addAll(reasons.keySet()); |
| | | ccr.setResultCodeIfSuccess(ResultCode.INVALID_ATTRIBUTE_SYNTAX); |
| | | } |
| | | |
| | | // Get the name of the class and make sure we can instantiate it as a |
| | | // certificate mapper. |
| | | VirtualAttributeProvider<? extends VirtualAttributeCfg> provider = null; |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | String className = configuration.getJavaClass(); |
| | | try |
| | |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | messages.add(ie.getMessageObject()); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ie.getMessageObject()); |
| | | } |
| | | } |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | VirtualAttributeRule rule = createRule(configuration, provider, filters); |
| | | rules.put(configuration.dn(), rule); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | VirtualAttributeCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | List<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | VirtualAttributeRule rule = rules.remove(configuration.dn()); |
| | | if (rule != null) |
| | |
| | | rule.getProvider().finalizeVirtualAttributeProvider(); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | VirtualAttributeCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | List<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // Get the existing rule if it's already enabled. |
| | |
| | | existingRule.getProvider().finalizeVirtualAttributeProvider(); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | Set<SearchFilter> filters = buildFilters(configuration, reasons); |
| | | if (!reasons.isEmpty()) |
| | | { |
| | | messages.addAll(reasons.keySet()); |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = ResultCode.INVALID_ATTRIBUTE_SYNTAX; |
| | | } |
| | | ccr.getMessages().addAll(reasons.keySet()); |
| | | ccr.setResultCodeIfSuccess(ResultCode.INVALID_ATTRIBUTE_SYNTAX); |
| | | } |
| | | |
| | | // Get the name of the class and make sure we can instantiate it as a |
| | | // certificate mapper. |
| | | VirtualAttributeProvider<? extends VirtualAttributeCfg> provider = null; |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | String className = configuration.getJavaClass(); |
| | | try |
| | |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | messages.add(ie.getMessageObject()); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ie.getMessageObject()); |
| | | } |
| | | } |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | VirtualAttributeRule rule = createRule(configuration, provider, filters); |
| | | rules.put(configuration.dn(), rule); |
| | |
| | | } |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.admin.ClassPropertyDefinition; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.server.ServerManagementContext; |
| | |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange(WorkQueueCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | // If the work queue class has been changed, then we should warn the user |
| | | // that it won't take effect until the server is restarted. |
| | |
| | | String workQueueClass = configuration.getJavaClass(); |
| | | if (! workQueueClass.equals(workQueue.getClass().getName())) |
| | | { |
| | | messages.add(INFO_CONFIG_WORK_QUEUE_CLASS_CHANGE_REQUIRES_RESTART.get( |
| | | workQueue.getClass().getName(), |
| | | workQueueClass)); |
| | | |
| | | adminActionRequired = true; |
| | | ccr.addMessage(INFO_CONFIG_WORK_QUEUE_CLASS_CHANGE_REQUIRES_RESTART.get( |
| | | workQueue.getClass().getName(), workQueueClass)); |
| | | ccr.setAdminActionRequired(true); |
| | | } |
| | | |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | } |
| | | |
| | |
| | | preferredCipherTransformation = cfg.getCipherTransformation(); |
| | | preferredCipherTransformationKeyLengthBits = cfg.getCipherKeyLength(); |
| | | preferredKeyWrappingTransformation = cfg.getKeyWrappingTransformation(); |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false, |
| | | new ArrayList<LocalizableMessage>()); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | |
| | | private TrustStoreBackend getTrustStoreBackend() |
| | | throws ConfigException |
| | | { |
| | | Backend b = DirectoryServer.getBackend( |
| | | ConfigConstants.ID_ADS_TRUST_STORE_BACKEND); |
| | | Backend<?> b = DirectoryServer.getBackend(ConfigConstants.ID_ADS_TRUST_STORE_BACKEND); |
| | | if (b == null) |
| | | { |
| | | LocalizableMessage msg = |
| | | ERR_CRYPTOMGR_ADS_TRUST_STORE_BACKEND_NOT_ENABLED.get( |
| | | ConfigConstants.ID_ADS_TRUST_STORE_BACKEND); |
| | | throw new ConfigException(msg); |
| | | throw new ConfigException(ERR_CRYPTOMGR_ADS_TRUST_STORE_BACKEND_NOT_ENABLED.get( |
| | | ConfigConstants.ID_ADS_TRUST_STORE_BACKEND)); |
| | | } |
| | | if (!(b instanceof TrustStoreBackend)) |
| | | { |
| | | LocalizableMessage msg = |
| | | ERR_CRYPTOMGR_ADS_TRUST_STORE_BACKEND_WRONG_CLASS.get( |
| | | ConfigConstants.ID_ADS_TRUST_STORE_BACKEND); |
| | | throw new ConfigException(msg); |
| | | throw new ConfigException(ERR_CRYPTOMGR_ADS_TRUST_STORE_BACKEND_WRONG_CLASS.get( |
| | | ConfigConstants.ID_ADS_TRUST_STORE_BACKEND)); |
| | | } |
| | | return (TrustStoreBackend)b; |
| | | } |
| | |
| | | * Portions Copyright 2012-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | |
| | | import org.opends.server.admin.std.server.PasswordValidatorCfg; |
| | | import org.opends.server.api.PasswordValidator; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | |
| | | |
| | | /** |
| | | * This class provides an OpenDS password validator that may be used to ensure |
| | | * that proposed passwords are not contained in another attribute in the user's |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | AttributeValuePasswordValidatorCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | |
| | | |
| | | currentConfig = configuration; |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | } |
| | | |
| | |
| | | import java.security.MessageDigest; |
| | | import java.security.SecureRandom; |
| | | import java.text.ParseException; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.concurrent.locks.Lock; |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | CramMD5SASLMechanismHandlerCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | DN identityMapperDN = configuration.getIdentityMapperDN(); |
| | | identityMapper = DirectoryServer.getIdentityMapper(identityMapperDN); |
| | | currentConfig = configuration; |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | } |
| | | |
| | |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.server.CharacterSetPasswordValidatorCfg; |
| | | import org.opends.server.admin.std.server.PasswordValidatorCfg; |
| | | import org.opends.server.api.PasswordValidator; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.DirectoryConfig; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.Operation; |
| | | |
| | | /** |
| | | * This class provides an OpenDJ password validator that may be used to ensure |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | CharacterSetPasswordValidatorCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | CharacterSetPasswordValidatorCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | // Make sure that we can process the defined character sets. If so, then |
| | | // activate the new configuration. |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | resultCode = DirectoryConfig.getServerErrorResultCode(); |
| | | messages.add(getExceptionMessage(e)); |
| | | ccr.setResultCode(DirectoryConfig.getServerErrorResultCode()); |
| | | ccr.addMessage(getExceptionMessage(e)); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Random; |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | CryptPasswordStorageSchemeCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | List<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | |
| | | |
| | | currentConfig = configuration; |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | } |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.SortedMap; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.server.EntryCacheCfg; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.BackendInitializationListener; |
| | | import org.opends.server.api.EntryCache; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | |
| | | /** |
| | | * This class defines the default entry cache which acts as an arbiter for |
| | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | |
| | | // The entry cache order array reflects all currently configured and |
| | | // active entry cache implementations in cache level specific order. |
| | | /** |
| | | * The entry cache order array reflects all currently configured and |
| | | * active entry cache implementations in cache level specific order. |
| | | */ |
| | | private static EntryCache<? extends EntryCacheCfg>[] cacheOrder = |
| | | new EntryCache<?>[0]; |
| | | |
| | |
| | | DirectoryServer.registerBackendInitializationListener(this); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeEntryCache(EntryCacheCfg configEntry) |
| | | throws ConfigException, InitializationException |
| | |
| | | // No implementation required. |
| | | } |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void finalizeEntryCache() |
| | | { |
| | |
| | | cacheOrder = new EntryCache<?>[0]; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean containsEntry(DN entryDN) |
| | | { |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Entry getEntry(Backend backend, long entryID) |
| | | { |
| | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Entry getEntry(DN entryDN) |
| | | { |
| | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public long getEntryID(DN entryDN) |
| | | { |
| | |
| | | return -1; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN getEntryDN(Backend backend, long entryID) |
| | | { |
| | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void putEntry(Entry entry, Backend backend, long entryID) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean putEntryIfAbsent(Entry entry, Backend backend, long entryID) |
| | | { |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void removeEntry(DN entryDN) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void clear() |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void clearBackend(Backend backend) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void clearSubtree(DN baseDN) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void handleLowMemory() |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | EntryCacheCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | EntryCacheCfg configuration |
| | | ) |
| | | public ConfigChangeResult applyConfigurationChange(EntryCacheCfg configuration) |
| | | { |
| | | // No implementation required. |
| | | ConfigChangeResult changeResult = new ConfigChangeResult( |
| | | ResultCode.SUCCESS, false, new ArrayList<LocalizableMessage>() |
| | | ); |
| | | |
| | | return changeResult; |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ArrayList<Attribute> getMonitorData() |
| | | { |
| | | ArrayList<Attribute> attrs = new ArrayList<Attribute>(); |
| | | |
| | | // The sum of cache hits of all active entry cache |
| | | // implementations. |
| | | Long entryCacheHits = new Long(0); |
| | | // The sum of cache hits of all active entry cache implementations. |
| | | long entryCacheHits = 0; |
| | | // Common for all active entry cache implementations. |
| | | Long entryCacheMisses = new Long(cacheMisses.longValue()); |
| | | // The sum of cache counts of all active entry cache |
| | | // implementations. |
| | | Long currentEntryCacheCount = new Long(0); |
| | | long entryCacheMisses = cacheMisses.longValue(); |
| | | // The sum of cache counts of all active entry cache implementations. |
| | | long currentEntryCacheCount = 0; |
| | | |
| | | for (EntryCache<?> entryCache : cacheOrder) { |
| | | // Get cache hits and counts from every active cache. |
| | |
| | | return attrs; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Long getCacheCount() |
| | | { |
| | | Long cacheCount = new Long(0); |
| | | |
| | | long cacheCount = 0; |
| | | for (EntryCache<?> entryCache : cacheOrder) { |
| | | cacheCount += entryCache.getCacheCount(); |
| | | } |
| | | |
| | | return cacheCount; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toVerboseString() |
| | | { |
| | | StringBuilder sb = new StringBuilder(); |
| | |
| | | } |
| | | } |
| | | String verboseString = sb.toString(); |
| | | return (verboseString.length() > 0 ? verboseString : null); |
| | | return verboseString.length() > 0 ? verboseString : null; |
| | | } |
| | | |
| | | |
| | |
| | | public void performBackendFinalizationProcessing(Backend backend) |
| | | { |
| | | // Do not clear any backends if the server is shutting down. |
| | | if ( !(DirectoryServer.getInstance().isShuttingDown()) ) { |
| | | if (!DirectoryServer.getInstance().isShuttingDown()) |
| | | { |
| | | clearBackend(backend); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.File; |
| | | import java.io.FileReader; |
| | | import java.util.ArrayList; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.server.DictionaryPasswordValidatorCfg; |
| | | import org.opends.server.admin.std.server.PasswordValidatorCfg; |
| | | import org.opends.server.api.PasswordValidator; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class provides an OpenDS password validator that may be used to ensure |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | DictionaryPasswordValidatorCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | DictionaryPasswordValidatorCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | |
| | | |
| | | // Make sure we can load the dictionary. If we can, then activate the new |
| | | // configuration. |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | try |
| | | { |
| | | dictionary = loadDictionary(configuration); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | resultCode = DirectoryConfig.getServerErrorResultCode(); |
| | | messages.add(getExceptionMessage(e)); |
| | | ccr.setResultCode(DirectoryConfig.getServerErrorResultCode()); |
| | | ccr.addMessage(getExceptionMessage(e)); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | private boolean isDictionaryBased(String password, |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.net.InetAddress; |
| | | import java.net.UnknownHostException; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | import javax.security.sasl.*; |
| | | import javax.security.sasl.Sasl; |
| | | import javax.security.sasl.SaslException; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.meta.DigestMD5SASLMechanismHandlerCfgDefn.*; |
| | | import org.opends.server.admin.std.meta.DigestMD5SASLMechanismHandlerCfgDefn.QualityOfProtection; |
| | | import org.opends.server.admin.std.server.DigestMD5SASLMechanismHandlerCfg; |
| | | import org.opends.server.admin.std.server.SASLMechanismHandlerCfg; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.api.IdentityMapper; |
| | | import org.opends.server.api.SASLMechanismHandler; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.core.BindOperation; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | |
| | | /** |
| | | * This class provides an implementation of a SASL mechanism that authenticates |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | DigestMD5SASLMechanismHandlerCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | DigestMD5SASLMechanismHandlerCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | try { |
| | | DN identityMapperDN = configuration.getIdentityMapperDN(); |
| | | identityMapper = DirectoryServer.getIdentityMapper(identityMapperDN); |
| | |
| | | this.configuration = configuration; |
| | | } catch (UnknownHostException unhe) { |
| | | logger.traceException(unhe); |
| | | resultCode = ResultCode.OPERATIONS_ERROR; |
| | | messages.add(ERR_SASL_CANNOT_GET_SERVER_FQDN.get(configEntryDN, getExceptionMessage(unhe))); |
| | | return new ConfigChangeResult(resultCode,adminActionRequired, messages); |
| | | ccr.setResultCode(ResultCode.OPERATIONS_ERROR); |
| | | ccr.addMessage(ERR_SASL_CANNOT_GET_SERVER_FQDN.get(configEntryDN, getExceptionMessage(unhe))); |
| | | } |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | final EntityTagVirtualAttributeCfg configuration) |
| | | { |
| | | this.config = configuration; |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | |
| | | |
| | | |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | |
| | |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class defines an account status notification handler that will write |
| | |
| | | ErrorLogAccountStatusNotificationHandlerCfg configuration |
| | | ) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | ConfigChangeResult changeResult = new ConfigChangeResult( |
| | | resultCode, adminActionRequired, messages |
| | | ); |
| | | |
| | | // Initialize the set of notification types that should generate log |
| | | // messages. |
| | | // Initialize the set of notification types that should generate log messages. |
| | | boolean applyChanges = false; |
| | | processNotificationHandlerConfig ( |
| | | configuration, applyChanges |
| | | ); |
| | | processNotificationHandlerConfig (configuration, applyChanges); |
| | | |
| | | return changeResult; |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | ExactMatchIdentityMapperCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | attributeTypes = |
| | | configuration.getMatchAttribute().toArray(new AttributeType[0]); |
| | | currentConfig = configuration; |
| | | |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | } |
| | | |
| | |
| | | package org.opends.server.extensions; |
| | | |
| | | import java.security.cert.Certificate; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | ExternalSASLMechanismHandlerCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // See if we should attempt to validate client certificates against those in |
| | |
| | | } |
| | | |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | validationPolicy = newValidationPolicy; |
| | | certificateAttributeType = newCertificateType; |
| | | currentConfig = configuration; |
| | | } |
| | | |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | } |
| | | |
| | |
| | | import java.io.IOException; |
| | | import java.security.KeyStore; |
| | | import java.security.KeyStoreException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import javax.net.ssl.KeyManager; |
| | | import javax.net.ssl.KeyManagerFactory; |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | FileBasedKeyManagerProviderCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // Get the path to the key store file. |
| | |
| | | File f = getFileForPath(newKeyStoreFile); |
| | | if (!(f.exists() && f.isFile())) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | |
| | | messages.add(ERR_FILE_KEYMANAGER_NO_SUCH_FILE.get( |
| | | newKeyStoreFile, configEntryDN)); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ERR_FILE_KEYMANAGER_NO_SUCH_FILE.get(newKeyStoreFile, configEntryDN)); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | logger.traceException(e); |
| | | |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | |
| | | messages.add(ERR_FILE_KEYMANAGER_CANNOT_DETERMINE_FILE.get( |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ERR_FILE_KEYMANAGER_CANNOT_DETERMINE_FILE.get( |
| | | configEntryDN, getExceptionMessage(e))); |
| | | } |
| | | |
| | |
| | | { |
| | | logger.traceException(kse); |
| | | |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | |
| | | messages.add(ERR_FILE_KEYMANAGER_INVALID_TYPE.get( |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ERR_FILE_KEYMANAGER_INVALID_TYPE.get( |
| | | configuration.getKeyStoreType(), configEntryDN, getExceptionMessage(kse))); |
| | | } |
| | | } |
| | |
| | | |
| | | if (pinStr == null) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | |
| | | messages.add(ERR_FILE_KEYMANAGER_PIN_PROPERTY_NOT_SET.get( |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ERR_FILE_KEYMANAGER_PIN_PROPERTY_NOT_SET.get( |
| | | propertyName, configEntryDN)); |
| | | } |
| | | else |
| | |
| | | |
| | | if (pinStr == null) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | |
| | | messages.add(ERR_FILE_KEYMANAGER_PIN_ENVAR_NOT_SET.get( |
| | | enVarName, configEntryDN)); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ERR_FILE_KEYMANAGER_PIN_ENVAR_NOT_SET.get(enVarName, configEntryDN)); |
| | | } |
| | | else |
| | | { |
| | |
| | | |
| | | if (!pinFile.exists()) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | |
| | | messages.add(ERR_FILE_KEYMANAGER_PIN_NO_SUCH_FILE.get( |
| | | fileName, configEntryDN)); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ERR_FILE_KEYMANAGER_PIN_NO_SUCH_FILE.get(fileName, configEntryDN)); |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | catch (IOException ioe) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | |
| | | messages.add(ERR_FILE_KEYMANAGER_PIN_FILE_CANNOT_READ.get( |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ERR_FILE_KEYMANAGER_PIN_FILE_CANNOT_READ.get( |
| | | fileName, configEntryDN, getExceptionMessage(ioe))); |
| | | } |
| | | finally |
| | |
| | | |
| | | if (pinStr == null) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | |
| | | messages.add(ERR_FILE_KEYMANAGER_PIN_FILE_EMPTY.get( |
| | | fileName, configEntryDN)); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ERR_FILE_KEYMANAGER_PIN_FILE_EMPTY.get(fileName, configEntryDN)); |
| | | } |
| | | else |
| | | { |
| | |
| | | newPIN = configuration.getKeyStorePin().toCharArray(); |
| | | } |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | currentConfig = configuration; |
| | | keyStorePIN = newPIN; |
| | |
| | | keyStoreType = newKeyStoreType; |
| | | } |
| | | |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | } |
| | | |
| | |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | |
| | | |
| | | import java.util.ArrayList; |
| | | import java.io.BufferedReader; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class defines a trust manager provider that will reference certificates |
| | | * stored in a file located on the Directory Server filesystem. |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | FileBasedTrustManagerProviderCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // Get the path to the trust store file. |
| | |
| | | File f = getFileForPath(newTrustStoreFile); |
| | | if (! (f.exists() && f.isFile())) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | |
| | | messages.add(ERR_FILE_TRUSTMANAGER_NO_SUCH_FILE.get(newTrustStoreFile, configEntryDN)); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ERR_FILE_TRUSTMANAGER_NO_SUCH_FILE.get(newTrustStoreFile, configEntryDN)); |
| | | } |
| | | |
| | | |
| | | // Get the trust store type. If none is specified, then use the default |
| | | // type. |
| | | // Get the trust store type. If none is specified, then use the default type. |
| | | String newTrustStoreType = configuration.getTrustStoreType(); |
| | | if (newTrustStoreType == null) |
| | | { |
| | |
| | | { |
| | | logger.traceException(kse); |
| | | |
| | | messages.add(ERR_FILE_TRUSTMANAGER_INVALID_TYPE.get(newTrustStoreType, configEntryDN, getExceptionMessage(kse))); |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.addMessage(ERR_FILE_TRUSTMANAGER_INVALID_TYPE.get( |
| | | newTrustStoreType, configEntryDN, getExceptionMessage(kse))); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | |
| | | |
| | |
| | | File pinFile = getFileForPath(newPINFile); |
| | | if (! pinFile.exists()) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | |
| | | messages.add(ERR_FILE_TRUSTMANAGER_PIN_NO_SUCH_FILE.get(newPINFile, configEntryDN)); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ERR_FILE_TRUSTMANAGER_PIN_NO_SUCH_FILE.get(newPINFile, configEntryDN)); |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | catch (IOException ioe) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | messages.add(ERR_FILE_TRUSTMANAGER_PIN_FILE_CANNOT_READ.get( |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ERR_FILE_TRUSTMANAGER_PIN_FILE_CANNOT_READ.get( |
| | | newPINFile, configEntryDN, getExceptionMessage(ioe))); |
| | | } |
| | | finally |
| | |
| | | |
| | | if (pinStr == null) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | |
| | | messages.add(ERR_FILE_TRUSTMANAGER_PIN_FILE_EMPTY.get(newPINFile, configEntryDN)); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ERR_FILE_TRUSTMANAGER_PIN_FILE_EMPTY.get(newPINFile, configEntryDN)); |
| | | } |
| | | else |
| | | { |
| | |
| | | String pinStr = System.getenv(newPINEnVar); |
| | | if (pinStr == null) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | |
| | | messages.add(ERR_FILE_TRUSTMANAGER_PIN_ENVAR_NOT_SET.get(newPINEnVar, configEntryDN)); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ERR_FILE_TRUSTMANAGER_PIN_ENVAR_NOT_SET.get(newPINEnVar, configEntryDN)); |
| | | } |
| | | else |
| | | { |
| | |
| | | String pinStr = System.getProperty(newPINProperty); |
| | | if (pinStr == null) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | |
| | | messages.add(ERR_FILE_TRUSTMANAGER_PIN_PROPERTY_NOT_SET.get(newPINProperty, configEntryDN)); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ERR_FILE_TRUSTMANAGER_PIN_PROPERTY_NOT_SET.get(newPINProperty, configEntryDN)); |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | trustStoreFile = newTrustStoreFile; |
| | | trustStoreType = newTrustStoreType; |
| | |
| | | currentConfig = configuration; |
| | | } |
| | | |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | } |
| | | |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | FingerprintCertificateMapperCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // Get the algorithm that will be used to generate the fingerprint. |
| | |
| | | } |
| | | |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | fingerprintAlgorithm = newFingerprintAlgorithm; |
| | | currentConfig = configuration; |
| | |
| | | { |
| | | LocalizableMessage message = WARN_SATUACM_ATTR_UNINDEXED.get( |
| | | configuration.dn(), t.getNameOrOID(), b.getBackendID()); |
| | | messages.add(message); |
| | | ccr.addMessage(message); |
| | | logger.error(message); |
| | | } |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | import static org.opends.server.config.ConfigConstants.CONFIG_DIR_NAME; |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | |
| | | import java.io.IOException; |
| | | import java.net.InetAddress; |
| | | import java.net.UnknownHostException; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | |
| | | import javax.security.sasl.Sasl; |
| | | import javax.security.sasl.SaslException; |
| | | |
| | | import org.ietf.jgss.GSSException; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.ietf.jgss.GSSException; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.meta. |
| | | GSSAPISASLMechanismHandlerCfgDefn.QualityOfProtection; |
| | | import org.opends.server.admin.std.meta.GSSAPISASLMechanismHandlerCfgDefn.QualityOfProtection; |
| | | import org.opends.server.admin.std.server.GSSAPISASLMechanismHandlerCfg; |
| | | import org.opends.server.admin.std.server.SASLMechanismHandlerCfg; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.api.IdentityMapper; |
| | | import org.opends.server.api.SASLMechanismHandler; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.core.BindOperation; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class provides an implementation of a SASL mechanism that |
| | |
| | | * @throws UnsupportedCallbackException |
| | | * if an error occurs. |
| | | */ |
| | | @Override |
| | | public void handle(Callback[] callbacks) throws UnsupportedCallbackException |
| | | { |
| | | } |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | GSSAPISASLMechanismHandlerCfg newConfiguration, |
| | | List<LocalizableMessage> unacceptableReasons) { |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | GSSAPISASLMechanismHandlerCfg newConfiguration) { |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange(GSSAPISASLMechanismHandlerCfg newConfiguration) |
| | | { |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | try |
| | | { |
| | | logout(); |
| | |
| | | } |
| | | catch (InitializationException ex) { |
| | | logger.traceException(ex); |
| | | messages.add(ex.getMessageObject()); |
| | | ccr.addMessage(ex.getMessageObject()); |
| | | clearProperties(); |
| | | resultCode = ResultCode.OTHER; |
| | | ccr.setResultCode(ResultCode.OTHER); |
| | | } catch (UnknownHostException ex) { |
| | | logger.traceException(ex); |
| | | messages.add(ERR_SASL_CANNOT_GET_SERVER_FQDN.get(configEntryDN, getExceptionMessage(ex))); |
| | | ccr.addMessage(ERR_SASL_CANNOT_GET_SERVER_FQDN.get(configEntryDN, getExceptionMessage(ex))); |
| | | clearProperties(); |
| | | resultCode = ResultCode.OTHER; |
| | | ccr.setResultCode(ResultCode.OTHER); |
| | | } catch (IOException ex) { |
| | | logger.traceException(ex); |
| | | messages.add(ERR_SASLGSSAPI_CANNOT_CREATE_JAAS_CONFIG.get(getExceptionMessage(ex))); |
| | | ccr.addMessage(ERR_SASLGSSAPI_CANNOT_CREATE_JAAS_CONFIG.get(getExceptionMessage(ex))); |
| | | clearProperties(); |
| | | resultCode = ResultCode.OTHER; |
| | | ccr.setResultCode(ResultCode.OTHER); |
| | | } |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | /** |
| | |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class provides an implementation of a Directory Server alert handler |
| | | * that will send alerts using JMX notifications. |
| | |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * The fully-qualified name of this class. |
| | | */ |
| | | /** The fully-qualified name of this class. */ |
| | | private static final String CLASS_NAME = |
| | | "org.opends.server.extensions.JMXAlertHandler"; |
| | | |
| | |
| | | JMXAlertHandlerCfg configuration) |
| | | { |
| | | currentConfig = configuration; |
| | | |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | exclusiveLock.unlock(); |
| | | } |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | |
| | | |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | |
| | | import org.opends.server.api.PasswordValidator; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | |
| | | |
| | | /** |
| | | * This class provides a password validator that can ensure that the provided |
| | | * password meets minimum and/or maximum length requirements. |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | LengthBasedPasswordValidatorCfg configuration) |
| | | { |
| | | // We will always accept the proposed configuration if it's gotten to this |
| | | // point. |
| | | currentConfig = configuration; |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | } |
| | | |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | MemberVirtualAttributeCfg configuration) |
| | | { |
| | | // Just accept the new configuration as-is. |
| | | currentConfig = configuration; |
| | | |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | } |
| | | |
| | |
| | | PBKDF2PasswordStorageSchemeCfg configuration) |
| | | { |
| | | this.config = configuration; |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | |
| | | import java.io.FileReader; |
| | | import java.io.IOException; |
| | | import java.security.KeyStore; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import javax.net.ssl.KeyManager; |
| | | import javax.net.ssl.KeyManagerFactory; |
| | |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class defines a key manager provider that will access keys stored on a |
| | | * PKCS#11 device. It will use the Java PKCS#11 interface, which may need to be |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | PKCS11KeyManagerProviderCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | // Get the PIN needed to access the contents of the keystore file. |
| | | // |
| | |
| | | |
| | | if (pinStr == null) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | |
| | | messages.add(ERR_PKCS11_KEYMANAGER_PIN_PROPERTY_NOT_SET.get(propertyName, configEntryDN)); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ERR_PKCS11_KEYMANAGER_PIN_PROPERTY_NOT_SET.get(propertyName, configEntryDN)); |
| | | } |
| | | else |
| | | { |
| | |
| | | |
| | | if (pinStr == null) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | |
| | | messages.add(ERR_PKCS11_KEYMANAGER_PIN_ENVAR_NOT_SET.get(enVarName, configEntryDN)); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ERR_PKCS11_KEYMANAGER_PIN_ENVAR_NOT_SET.get(enVarName, configEntryDN)); |
| | | } |
| | | else |
| | | { |
| | |
| | | |
| | | if (!pinFile.exists()) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | |
| | | messages.add(ERR_PKCS11_KEYMANAGER_PIN_NO_SUCH_FILE.get(fileName, configEntryDN)); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ERR_PKCS11_KEYMANAGER_PIN_NO_SUCH_FILE.get(fileName, configEntryDN)); |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | catch (IOException ioe) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | messages.add(ERR_PKCS11_KEYMANAGER_PIN_FILE_CANNOT_READ.get( |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ERR_PKCS11_KEYMANAGER_PIN_FILE_CANNOT_READ.get( |
| | | fileName, configEntryDN, getExceptionMessage(ioe))); |
| | | } |
| | | finally |
| | |
| | | |
| | | if (pinStr == null) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | messages.add(ERR_PKCS11_KEYMANAGER_PIN_FILE_EMPTY.get(fileName, configEntryDN)); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ERR_PKCS11_KEYMANAGER_PIN_FILE_EMPTY.get(fileName, configEntryDN)); |
| | | } |
| | | else |
| | | { |
| | |
| | | newPIN = configuration.getKeyStorePin().toCharArray(); |
| | | } |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | currentConfig = configuration; |
| | | keyStorePIN = newPIN; |
| | | } |
| | | |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.messages.CoreMessages.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.concurrent.ConcurrentLinkedQueue; |
| | |
| | | import java.util.concurrent.atomic.AtomicLong; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.server.ParallelWorkQueueCfg; |
| | | import org.opends.server.api.WorkQueue; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.monitors.ParallelWorkQueueMonitor; |
| | | import org.opends.server.types.CancelRequest; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.types.Operation; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class defines a data structure for storing and interacting with the |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | ParallelWorkQueueCfg configuration) |
| | | { |
| | | ArrayList<LocalizableMessage> resultMessages = new ArrayList<LocalizableMessage>(); |
| | | int newNumThreads = |
| | | computeNumWorkerThreads(configuration.getNumWorkerThreads()); |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false, resultMessages); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | import static org.opends.messages.CoreMessages.*; |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | import static org.opends.server.extensions.ExtensionsConstants.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.*; |
| | | import java.util.concurrent.locks.Lock; |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | | import org.forgerock.opendj.ldap.ModificationType; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.server.ExtendedOperationHandlerCfg; |
| | | import org.opends.server.admin.std.server.PasswordModifyExtendedOperationHandlerCfg; |
| | | import org.opends.server.api.*; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.controls.PasswordPolicyErrorType; |
| | | import org.opends.server.controls.PasswordPolicyResponseControl; |
| | | import org.opends.server.controls.PasswordPolicyWarningType; |
| | |
| | | import org.opends.server.schema.AuthPasswordSyntax; |
| | | import org.opends.server.schema.UserPasswordSyntax; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | |
| | | import static org.opends.messages.CoreMessages.*; |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | import static org.opends.server.extensions.ExtensionsConstants.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | /** |
| | | * This class implements the password modify extended operation defined in RFC |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | PasswordModifyExtendedOperationHandlerCfg config) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | List<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // Make sure that the specified identity mapper is OK. |
| | |
| | | mapper = DirectoryServer.getIdentityMapper(mapperDN); |
| | | if (mapper == null) |
| | | { |
| | | resultCode = ResultCode.CONSTRAINT_VIOLATION; |
| | | |
| | | messages.add(ERR_EXTOP_PASSMOD_NO_SUCH_ID_MAPPER.get(mapperDN, config.dn())); |
| | | ccr.setResultCode(ResultCode.CONSTRAINT_VIOLATION); |
| | | ccr.addMessage(ERR_EXTOP_PASSMOD_NO_SUCH_ID_MAPPER.get(mapperDN, config.dn())); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | logger.traceException(e); |
| | | |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | |
| | | messages.add(ERR_EXTOP_PASSMOD_CANNOT_DETERMINE_ID_MAPPER.get(config.dn(), getExceptionMessage(e))); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ERR_EXTOP_PASSMOD_CANNOT_DETERMINE_ID_MAPPER.get(config.dn(), getExceptionMessage(e))); |
| | | } |
| | | |
| | | |
| | | // If all of the changes were acceptable, then apply them. |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | if (! identityMapperDN.equals(mapperDN)) |
| | | { |
| | |
| | | // Save this configuration for future reference. |
| | | currentConfig = config; |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.concurrent.locks.Lock; |
| | | |
| | |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class provides an implementation of a SASL mechanism that uses |
| | | * plain-text authentication. It is based on the proposal defined in |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | PlainSASLMechanismHandlerCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | // Get the identity mapper that should be used to find users. |
| | | DN identityMapperDN = configuration.getIdentityMapperDN(); |
| | | identityMapper = DirectoryServer.getIdentityMapper(identityMapperDN); |
| | | currentConfig = configuration; |
| | | |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | |
| | | import java.util.StringTokenizer; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.server.PasswordGeneratorCfg; |
| | | import org.opends.server.admin.std.server.RandomPasswordGeneratorCfg; |
| | | import org.opends.server.api.PasswordGenerator; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class provides an implementation of a Directory Server password |
| | |
| | | * @throws DirectoryException If a problem occurs while attempting to |
| | | * generate the password. |
| | | */ |
| | | @Override |
| | | public ByteString generatePassword(Entry userEntry) |
| | | throws DirectoryException |
| | | { |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | RandomPasswordGeneratorCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | RandomPasswordGeneratorCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // Get the character sets for use in generating the password. At least one |
| | |
| | | newEncodedCharacterSets = configuration.getPasswordCharacterSet(); |
| | | if (newEncodedCharacterSets.size() == 0) |
| | | { |
| | | messages.add(ERR_RANDOMPWGEN_NO_CHARSETS.get(configEntryDN)); |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = ResultCode.OBJECTCLASS_VIOLATION; |
| | | } |
| | | ccr.addMessage(ERR_RANDOMPWGEN_NO_CHARSETS.get(configEntryDN)); |
| | | ccr.setResultCodeIfSuccess(ResultCode.OBJECTCLASS_VIOLATION); |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | if (charsets.containsKey(s.getName())) |
| | | { |
| | | messages.add(ERR_RANDOMPWGEN_CHARSET_NAME_CONFLICT.get(configEntryDN, s.getName())); |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = ResultCode.CONSTRAINT_VIOLATION; |
| | | } |
| | | ccr.addMessage(ERR_RANDOMPWGEN_CHARSET_NAME_CONFLICT.get(configEntryDN, s.getName())); |
| | | ccr.setResultCodeIfSuccess(ResultCode.CONSTRAINT_VIOLATION); |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | messages.add(ce.getMessageObject()); |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = ResultCode.INVALID_ATTRIBUTE_SYNTAX; |
| | | } |
| | | ccr.addMessage(ce.getMessageObject()); |
| | | ccr.setResultCodeIfSuccess(ResultCode.INVALID_ATTRIBUTE_SYNTAX); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | logger.traceException(e); |
| | | |
| | | messages.add(ERR_RANDOMPWGEN_CANNOT_DETERMINE_CHARSETS.get( |
| | | getExceptionMessage(e))); |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | } |
| | | ccr.addMessage(ERR_RANDOMPWGEN_CANNOT_DETERMINE_CHARSETS.get(getExceptionMessage(e))); |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | |
| | | |
| | |
| | | NamedCharacterSet charset = charsets.get(name); |
| | | if (charset == null) |
| | | { |
| | | messages.add(ERR_RANDOMPWGEN_UNKNOWN_CHARSET.get(newFormatString, name)); |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = ResultCode.CONSTRAINT_VIOLATION; |
| | | } |
| | | ccr.addMessage(ERR_RANDOMPWGEN_UNKNOWN_CHARSET.get(newFormatString, name)); |
| | | ccr.setResultCodeIfSuccess(ResultCode.CONSTRAINT_VIOLATION); |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | logger.traceException(e); |
| | | |
| | | messages.add(ERR_RANDOMPWGEN_INVALID_PWFORMAT.get(newFormatString)); |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | } |
| | | ccr.addMessage(ERR_RANDOMPWGEN_INVALID_PWFORMAT.get(newFormatString)); |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | logger.traceException(e); |
| | | |
| | | messages.add(ERR_RANDOMPWGEN_CANNOT_DETERMINE_PWFORMAT.get( |
| | | getExceptionMessage(e))); |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | } |
| | | ccr.addMessage(ERR_RANDOMPWGEN_CANNOT_DETERMINE_PWFORMAT.get(getExceptionMessage(e))); |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | |
| | | |
| | | // If everything looks OK, then apply the changes. |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | synchronized (generatorLock) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.opends.server.protocols.internal.Requests.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.Iterator; |
| | |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.protocols.internal.InternalSearchOperation; |
| | | import org.opends.server.protocols.internal.SearchRequest; |
| | | import static org.opends.server.protocols.internal.Requests.*; |
| | | import org.opends.server.types.*; |
| | | |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | |
| | | /** |
| | | * This class provides an implementation of a Directory Server identity mapper |
| | | * that uses a regular expression to process the provided ID string, and then |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | RegularExpressionIdentityMapperCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | Pattern newMatchPattern = null; |
| | | try |
| | |
| | | } |
| | | catch (PatternSyntaxException pse) |
| | | { |
| | | LocalizableMessage message = ERR_REGEXMAP_INVALID_MATCH_PATTERN.get( |
| | | configuration.getMatchPattern(), |
| | | pse.getMessage()); |
| | | messages.add(message); |
| | | resultCode = ResultCode.CONSTRAINT_VIOLATION; |
| | | ccr.addMessage(ERR_REGEXMAP_INVALID_MATCH_PATTERN.get(configuration.getMatchPattern(), pse.getMessage())); |
| | | ccr.setResultCode(ResultCode.CONSTRAINT_VIOLATION); |
| | | } |
| | | |
| | | String newReplacePattern = configuration.getReplacePattern(); |
| | |
| | | configuration.getMatchAttribute().toArray(new AttributeType[0]); |
| | | |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | attributeTypes = newAttributeTypes; |
| | | currentConfig = configuration; |
| | |
| | | replacePattern = newReplacePattern; |
| | | } |
| | | |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | |
| | | RepeatedCharactersPasswordValidatorCfg; |
| | | import org.opends.server.api.PasswordValidator; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | RepeatedCharactersPasswordValidatorCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | |
| | | // For this password validator, we will always be able to successfully apply |
| | | // the new configuration. |
| | | currentConfig = configuration; |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.File; |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.util.Utils; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.server.AccountStatusNotificationHandlerCfg; |
| | | import org.opends.server.admin.std.server. |
| | | SMTPAccountStatusNotificationHandlerCfg; |
| | | import org.opends.server.admin.std.server.SMTPAccountStatusNotificationHandlerCfg; |
| | | import org.opends.server.api.AccountStatusNotificationHandler; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.util.Utils; |
| | | import org.opends.server.types.AccountStatusNotification; |
| | | import org.opends.server.types.AccountStatusNotificationProperty; |
| | | import org.opends.server.types.AccountStatusNotificationType; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.AttributeType; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.util.EMailMessage; |
| | | |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class provides an implementation of an account status notification |
| | | * handler that can send e-mail messages via SMTP to end users and/or |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void initializeStatusNotificationHandler( |
| | | SMTPAccountStatusNotificationHandlerCfg configuration) |
| | | throws ConfigException, InitializationException |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isConfigurationAcceptable( |
| | | AccountStatusNotificationHandlerCfg |
| | | configuration, |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void handleStatusNotification(AccountStatusNotification notification) |
| | | { |
| | | SMTPAccountStatusNotificationHandlerCfg config = currentConfig; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | SMTPAccountStatusNotificationHandlerCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | SMTPAccountStatusNotificationHandlerCfg configuration) |
| | | { |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | try |
| | | { |
| | | HashMap<AccountStatusNotificationType,String> subjects = |
| | |
| | | currentConfig = configuration; |
| | | subjectMap = subjects; |
| | | templateMap = templates; |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | logger.traceException(ce); |
| | | |
| | | LinkedList<LocalizableMessage> messageList = new LinkedList<LocalizableMessage>(); |
| | | messageList.add(ce.getMessageObject()); |
| | | |
| | | return new ConfigChangeResult(ResultCode.UNWILLING_TO_PERFORM, false, |
| | | messageList); |
| | | ccr.setResultCode(ResultCode.UNWILLING_TO_PERFORM); |
| | | ccr.addMessage(ce.getMessageObject()); |
| | | } |
| | | return ccr; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.server.AlertHandlerCfg; |
| | | import org.opends.server.admin.std.server.SMTPAlertHandlerCfg; |
| | |
| | | SMTPAlertHandlerCfg configuration) |
| | | { |
| | | currentConfig = configuration; |
| | | |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | } |
| | | |
| | |
| | | import org.opends.server.api.PasswordValidator; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.util.LevenshteinDistance; |
| | | import org.opends.server.admin.std.server.SimilarityBasedPasswordValidatorCfg; |
| | |
| | | SimilarityBasedPasswordValidatorCfg configuration) |
| | | { |
| | | currentConfig = configuration; |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.opends.server.protocols.internal.Requests.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.security.cert.Certificate; |
| | | import java.security.cert.X509Certificate; |
| | | import java.util.*; |
| | | import java.util.Collection; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.LinkedHashSet; |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | import javax.security.auth.x500.X500Principal; |
| | | |
| | |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.protocols.internal.InternalSearchOperation; |
| | | import org.opends.server.protocols.internal.SearchRequest; |
| | | import static org.opends.server.protocols.internal.Requests.*; |
| | | import org.opends.server.types.*; |
| | | |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import org.opends.server.types.AttributeType; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.IndexType; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.types.RDN; |
| | | import org.opends.server.types.SearchFilter; |
| | | import org.opends.server.types.SearchResultEntry; |
| | | |
| | | /** |
| | | * This class implements a very simple Directory Server certificate mapper that |
| | |
| | | SubjectAttributeToUserAttributeCertificateMapperCfg |
| | | configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // Get and validate the subject attribute to user attribute mappings. |
| | |
| | | int colonPos = lowerMap.indexOf(':'); |
| | | if (colonPos <= 0) |
| | | { |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = ResultCode.CONSTRAINT_VIOLATION; |
| | | } |
| | | ccr.setResultCodeIfSuccess(ResultCode.CONSTRAINT_VIOLATION); |
| | | |
| | | |
| | | messages.add(ERR_SATUACM_INVALID_MAP_FORMAT.get(configEntryDN, mapStr)); |
| | | ccr.addMessage(ERR_SATUACM_INVALID_MAP_FORMAT.get(configEntryDN, mapStr)); |
| | | break; |
| | | } |
| | | |
| | |
| | | String userAttrName = lowerMap.substring(colonPos+1).trim(); |
| | | if ((certAttrName.length() == 0) || (userAttrName.length() == 0)) |
| | | { |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = ResultCode.CONSTRAINT_VIOLATION; |
| | | } |
| | | ccr.setResultCodeIfSuccess(ResultCode.CONSTRAINT_VIOLATION); |
| | | |
| | | |
| | | messages.add(ERR_SATUACM_INVALID_MAP_FORMAT.get(configEntryDN, mapStr)); |
| | | ccr.addMessage(ERR_SATUACM_INVALID_MAP_FORMAT.get(configEntryDN, mapStr)); |
| | | break; |
| | | } |
| | | |
| | |
| | | |
| | | if (newAttributeMap.containsKey(certAttrName)) |
| | | { |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = ResultCode.CONSTRAINT_VIOLATION; |
| | | } |
| | | |
| | | |
| | | messages.add(ERR_SATUACM_DUPLICATE_CERT_ATTR.get(configEntryDN, certAttrName)); |
| | | ccr.setResultCodeIfSuccess(ResultCode.CONSTRAINT_VIOLATION); |
| | | ccr.addMessage(ERR_SATUACM_DUPLICATE_CERT_ATTR.get(configEntryDN, certAttrName)); |
| | | break; |
| | | } |
| | | |
| | |
| | | DirectoryServer.getAttributeType(userAttrName, false); |
| | | if (userAttrType == null) |
| | | { |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = ResultCode.CONSTRAINT_VIOLATION; |
| | | } |
| | | |
| | | |
| | | messages.add(ERR_SATUACM_NO_SUCH_ATTR.get(mapStr, configEntryDN, userAttrName)); |
| | | ccr.setResultCodeIfSuccess(ResultCode.CONSTRAINT_VIOLATION); |
| | | ccr.addMessage(ERR_SATUACM_NO_SUCH_ATTR.get(mapStr, configEntryDN, userAttrName)); |
| | | break; |
| | | } |
| | | |
| | |
| | | { |
| | | if (attrType.equals(userAttrType)) |
| | | { |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | { |
| | | resultCode = ResultCode.CONSTRAINT_VIOLATION; |
| | | } |
| | | ccr.setResultCodeIfSuccess(ResultCode.CONSTRAINT_VIOLATION); |
| | | |
| | | |
| | | messages.add(ERR_SATUACM_DUPLICATE_USER_ATTR.get(configEntryDN, attrType.getNameOrOID())); |
| | | ccr.addMessage(ERR_SATUACM_DUPLICATE_USER_ATTR.get(configEntryDN, attrType.getNameOrOID())); |
| | | break mapLoop; |
| | | } |
| | | } |
| | |
| | | { |
| | | LocalizableMessage message = WARN_SATUACM_ATTR_UNINDEXED.get( |
| | | configuration.dn(), t.getNameOrOID(), b.getBackendID()); |
| | | messages.add(message); |
| | | ccr.addMessage(message); |
| | | logger.error(message); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | attributeMap = newAttributeMap; |
| | | currentConfig = configuration; |
| | | } |
| | | |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | configuration) |
| | | { |
| | | currentConfig = configuration; |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.messages.CoreMessages.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.concurrent.LinkedBlockingQueue; |
| | |
| | | import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.server.TraditionalWorkQueueCfg; |
| | | import org.opends.server.api.WorkQueue; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.monitors.TraditionalWorkQueueMonitor; |
| | | import org.opends.server.types.CancelRequest; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.types.Operation; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | |
| | | |
| | | |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | TraditionalWorkQueueCfg configuration) |
| | | { |
| | | ArrayList<LocalizableMessage> resultMessages = new ArrayList<LocalizableMessage>(); |
| | | int newNumThreads = |
| | | computeNumWorkerThreads(configuration.getNumWorkerThreads()); |
| | | int newMaxCapacity = configuration.getMaxWorkQueueCapacity(); |
| | |
| | | } |
| | | } |
| | | |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false, resultMessages); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | |
| | | import org.opends.server.admin.std.server.UniqueCharactersPasswordValidatorCfg; |
| | | import org.opends.server.api.PasswordValidator; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | UniqueCharactersPasswordValidatorCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | // For this password validator, we will always be able to successfully apply |
| | | // the new configuration. |
| | | currentConfig = configuration; |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | } |
| | | |
| | |
| | | // Just accept the new configuration as-is. |
| | | currentConfig = configuration; |
| | | |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | } |
| | | |
| | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.concurrent.CopyOnWriteArrayList; |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizableMessageDescriptor.Arg3; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.admin.ClassPropertyDefinition; |
| | | import org.opends.server.admin.server.ConfigurationAddListener; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.server.ConfigurationDeleteListener; |
| | | import org.opends.server.admin.std.server.LogPublisherCfg; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.ServerContext; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.util.StaticUtils; |
| | | |
| | | /** |
| | |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd(C config) |
| | | { |
| | | // Default result code. |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | config.addChangeListener((ConfigurationChangeListener) this); |
| | | |
| | |
| | | catch(ConfigException e) |
| | | { |
| | | LocalizedLogger.getLoggerForThisClass().traceException(e); |
| | | messages.add(e.getMessageObject()); |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.addMessage(e.getMessageObject()); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | LocalizedLogger.getLoggerForThisClass().traceException(e); |
| | | messages.add(ERR_CONFIG_LOGGER_CANNOT_CREATE_LOGGER.get( |
| | | ccr.addMessage(ERR_CONFIG_LOGGER_CANNOT_CREATE_LOGGER.get( |
| | | config.dn(), stackTraceToSingleLineString(e))); |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | } |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | private P findLogPublisher(DN dn) |
| | |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange(C config) |
| | | { |
| | | // Default result code. |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | P logPublisher = findLogPublisher(config.dn()); |
| | | if(logPublisher == null) |
| | |
| | | String className = config.getJavaClass(); |
| | | if(!className.equals(logPublisher.getClass().getName())) |
| | | { |
| | | adminActionRequired = true; |
| | | ccr.setAdminActionRequired(true); |
| | | } |
| | | } |
| | | else |
| | |
| | | } |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | /** |
| | |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete(C config) |
| | | { |
| | | // Default result code. |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | P logPublisher = findLogPublisher(config.dn()); |
| | | if(logPublisher != null) |
| | |
| | | } |
| | | else |
| | | { |
| | | resultCode = ResultCode.NO_SUCH_OBJECT; |
| | | ccr.setResultCode(ResultCode.NO_SUCH_OBJECT); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired); |
| | | return ccr; |
| | | } |
| | | |
| | | private boolean isJavaClassAcceptable(C config, |
| | |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.core.*; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.AddressMask; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | |
| | |
| | | // Rebuild the filter using the new configuration and criteria. |
| | | buildFilters(); |
| | | |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | |
| | | // Rebuild the filter using the new configuration and criteria. |
| | | buildFilters(); |
| | | configuration.addChangeListener(this); |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | // Rebuild the filter using the new configuration and criteria. |
| | | buildFilters(); |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | // Rebuild the filter using the new configuration and criteria. |
| | | buildFilters(); |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | |
| | | |
| | | /** |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | FileCountLogRetentionPolicyCfg config) |
| | | { |
| | | // Default result code. |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | |
| | | this.numFiles = config.getNumberOfFiles(); |
| | | this.config = config; |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.loggers; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Calendar; |
| | | import java.util.List; |
| | |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.server.FixedTimeLogRotationPolicyCfg; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.util.TimeThread; |
| | | |
| | | |
| | | /** |
| | | * This class implements a rotation policy based on fixed |
| | | * day/time of day. |
| | | * This class implements a rotation policy based on fixed day/time of day. |
| | | */ |
| | | public class FixedTimeRotationPolicy implements |
| | | RotationPolicy<FixedTimeLogRotationPolicyCfg>, |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | FixedTimeLogRotationPolicyCfg config) |
| | | { |
| | | // Default result code. |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | rotationTimes = new int[config.getTimeOfDay().size()]; |
| | | |
| | |
| | | |
| | | Arrays.sort(rotationTimes); |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | /** |
| | |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | |
| | | /** |
| | | * This class implements a retention policy based on the free disk space |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | FreeDiskSpaceLogRetentionPolicyCfg config) |
| | | { |
| | | // Default result code. |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | |
| | | this.freeDiskSpace = config.getFreeDiskSpace(); |
| | | this.config = config; |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | /** |
| | |
| | | package org.opends.server.loggers; |
| | | |
| | | |
| | | import org.opends.server.api.DirectoryThread; |
| | | import org.opends.server.api.ServerShutdownListener; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.types.FilePermission; |
| | | import org.opends.server.admin.std.server.SizeLimitLogRotationPolicyCfg; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.util.TimeThread; |
| | | |
| | | import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString; |
| | | import static org.opends.messages.LoggerMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.io.BufferedWriter; |
| | | import java.io.File; |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.OutputStreamWriter; |
| | | import java.util.ArrayList; |
| | | import java.util.Calendar; |
| | | import java.util.List; |
| | | import java.util.concurrent.CopyOnWriteArrayList; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | |
| | | import java.io.*; |
| | | import java.util.concurrent.CopyOnWriteArrayList; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Calendar; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.server.SizeLimitLogRotationPolicyCfg; |
| | | import org.opends.server.api.DirectoryThread; |
| | | import org.opends.server.api.ServerShutdownListener; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.FilePermission; |
| | | import org.opends.server.util.TimeThread; |
| | | |
| | | /** |
| | | * A MultiFileTextWriter is a specialized TextWriter which supports publishing |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | SizeLimitLogRotationPolicyCfg config, List<LocalizableMessage> unacceptableReasons) |
| | | { |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | SizeLimitLogRotationPolicyCfg config) |
| | | { |
| | |
| | | |
| | | sizeLimit = newSizeLimit; |
| | | |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false, |
| | | new ArrayList<LocalizableMessage>()); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * the run method of the rotaterThread. It wakes up periodically and checks |
| | | * whether the file needs to be rotated based on the rotation policy. |
| | | */ |
| | | @Override |
| | | public void run() |
| | | { |
| | | while(!isShuttingDown()) |
| | |
| | | * |
| | | * @return The human-readable name for this shutdown listener. |
| | | */ |
| | | @Override |
| | | public String getShutdownListenerName() |
| | | { |
| | | return "MultifileTextWriter Thread " + name; |
| | |
| | | * |
| | | * @param reason The human-readable reason for the shutdown. |
| | | */ |
| | | @Override |
| | | public void processServerShutdown(LocalizableMessage reason) |
| | | { |
| | | stopRequested = true; |
| | |
| | | /** |
| | | * Shutdown the text writer. |
| | | */ |
| | | @Override |
| | | public void shutdown() |
| | | { |
| | | processServerShutdown(null); |
| | |
| | | * |
| | | * @param record the log record to write. |
| | | */ |
| | | @Override |
| | | public void writeRecord(String record) |
| | | { |
| | | // Assume each character is 1 byte ASCII |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void flush() |
| | | { |
| | | try |
| | |
| | | import static org.opends.messages.LoggerMessages.*; |
| | | |
| | | import java.io.File; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | |
| | | /** |
| | | * This class implements a retention policy based on the amount of |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void initializeLogRetentionPolicy( |
| | | SizeLimitLogRetentionPolicyCfg config) |
| | | { |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | SizeLimitLogRetentionPolicyCfg config, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | SizeLimitLogRetentionPolicyCfg config) |
| | | { |
| | | // Default result code. |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | |
| | | this.size = config.getDiskSpaceUsed(); |
| | | this.config = config; |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public File[] deleteFiles(FileNamingPolicy fileNamingPolicy) |
| | | throws DirectoryException |
| | | { |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String toString() |
| | | { |
| | | return "Size Based Retention Policy " + config.dn().toString(); |
| | |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | |
| | | |
| | | import java.util.List; |
| | | import java.util.ArrayList; |
| | | |
| | | /** |
| | | * This class implements a rotation policy based on the size of the |
| | | * file. |
| | | * This class implements a rotation policy based on the size of the file. |
| | | */ |
| | | public class SizeBasedRotationPolicy implements |
| | | RotationPolicy<SizeLimitLogRotationPolicyCfg>, |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | SizeLimitLogRotationPolicyCfg config) |
| | | { |
| | | // Default result code. |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | |
| | | sizeLimit = config.getFileSizeLimit(); |
| | | |
| | | currentConfig = config; |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | /** |
| | |
| | | public boolean rotateFile(RotatableLogFile writer) |
| | | { |
| | | long fileSize = writer.getBytesWritten(); |
| | | |
| | | return fileSize >= sizeLimit; |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | */ |
| | | package org.opends.server.loggers; |
| | | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.meta.FileBasedAccessLogPublisherCfgDefn.*; |
| | | import org.opends.server.admin.std.meta.FileBasedAccessLogPublisherCfgDefn.LogFormat; |
| | | import org.opends.server.admin.std.server.FileBasedAccessLogPublisherCfg; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.api.ExtendedOperationHandler; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.core.*; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.util.TimeThread; |
| | | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | /** |
| | | * This class provides the implementation of the access logger used by the |
| | | * directory server. |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | final FileBasedAccessLogPublisherCfg config) |
| | | { |
| | | // Default result code. |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | final List<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | final File logFile = getFileForPath(config.getLogFile()); |
| | | final FileNamingPolicy fnPolicy = new TimeStampNaming(logFile); |
| | |
| | | if ((cfg.isAsynchronous() && config.isAsynchronous()) |
| | | && (cfg.getQueueSize() != config.getQueueSize())) |
| | | { |
| | | adminActionRequired = true; |
| | | ccr.setAdminActionRequired(true); |
| | | } |
| | | |
| | | if (!config.getLogRecordTimeFormat().equals(timeStampFormat)) |
| | |
| | | } |
| | | catch (final Exception e) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | messages.add(ERR_CONFIG_LOGGING_CANNOT_CREATE_WRITER.get( |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ERR_CONFIG_LOGGING_CANNOT_CREATE_WRITER.get( |
| | | config.dn(), stackTraceToSingleLineString(e))); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteSequence; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.util.Base64; |
| | | import org.opends.server.util.StaticUtils; |
| | | import org.opends.server.util.TimeThread; |
| | |
| | | { |
| | | |
| | | private TextWriter writer; |
| | | |
| | | private FileBasedAuditLogPublisherCfg cfg; |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | FileBasedAuditLogPublisherCfg config) |
| | | { |
| | | // Default result code. |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | File logFile = getFileForPath(config.getLogFile()); |
| | | FileNamingPolicy fnPolicy = new TimeStampNaming(logFile); |
| | |
| | | if ((cfg.isAsynchronous() && config.isAsynchronous()) |
| | | && (cfg.getQueueSize() != config.getQueueSize())) |
| | | { |
| | | adminActionRequired = true; |
| | | ccr.setAdminActionRequired(true); |
| | | } |
| | | |
| | | cfg = config; |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | messages.add(ERR_CONFIG_LOGGING_CANNOT_CREATE_WRITER.get( |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ERR_CONFIG_LOGGING_CANNOT_CREATE_WRITER.get( |
| | | config.dn(), stackTraceToSingleLineString(e))); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.FilePermission; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.util.TimeThread; |
| | | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | FileBasedDebugLogPublisherCfg config) |
| | | { |
| | | // Default result code. |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | List<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | addTraceSettings(null, getDefaultSettings(config)); |
| | | DebugLogger.updateTracerSettings(); |
| | |
| | | if((currentConfig.isAsynchronous() && config.isAsynchronous()) && |
| | | (currentConfig.getQueueSize() != config.getQueueSize())) |
| | | { |
| | | adminActionRequired = true; |
| | | ccr.setAdminActionRequired(true); |
| | | } |
| | | |
| | | currentConfig = config; |
| | |
| | | } |
| | | catch(Exception e) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | messages.add(ERR_CONFIG_LOGGING_CANNOT_CREATE_WRITER.get( |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ERR_CONFIG_LOGGING_CANNOT_CREATE_WRITER.get( |
| | | config.dn(), stackTraceToSingleLineString(e))); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | private TraceSettings getDefaultSettings(FileBasedDebugLogPublisherCfg config) |
| | |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd(DebugTargetCfg config) |
| | | { |
| | | // Default result code. |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | List<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | |
| | | addTraceSettings(config.getDebugScope(), new TraceSettings(config)); |
| | | |
| | | DebugLogger.updateTracerSettings(); |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete(DebugTargetCfg config) |
| | | { |
| | | // Default result code. |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | List<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | |
| | | removeTraceSettings(config.getDebugScope()); |
| | | |
| | | DebugLogger.updateTracerSettings(); |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.messages.Severity; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.meta.ErrorLogPublisherCfgDefn; |
| | |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange(FileBasedErrorLogPublisherCfg config) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | List<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | setDefaultSeverities(config.getDefaultSeverity()); |
| | | |
| | |
| | | int equalPos = overrideSeverity.indexOf('='); |
| | | if (equalPos < 0) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | messages.add(WARN_ERROR_LOGGER_INVALID_OVERRIDE_SEVERITY.get(overrideSeverity)); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(WARN_ERROR_LOGGER_INVALID_OVERRIDE_SEVERITY.get(overrideSeverity)); |
| | | } else |
| | | { |
| | | String category = overrideSeverity.substring(0, equalPos); |
| | |
| | | } |
| | | catch(Exception e) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | messages.add(WARN_ERROR_LOGGER_INVALID_CATEGORY.get(category)); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(WARN_ERROR_LOGGER_INVALID_CATEGORY.get(category)); |
| | | } |
| | | } |
| | | } |
| | |
| | | && config.isAsynchronous() |
| | | && currentConfig.getQueueSize() != config.getQueueSize()) |
| | | { |
| | | adminActionRequired = true; |
| | | ccr.setAdminActionRequired(true); |
| | | } |
| | | |
| | | currentConfig = config; |
| | |
| | | } |
| | | catch(Exception e) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | messages.add(ERR_CONFIG_LOGGING_CANNOT_CREATE_WRITER.get( |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ERR_CONFIG_LOGGING_CANNOT_CREATE_WRITER.get( |
| | | config.dn(), stackTraceToSingleLineString(e))); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | private void setDefaultSeverities(Set<ErrorLogPublisherCfgDefn.DefaultSeverity> defSevs) |
| | |
| | | import java.util.Set; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.util.Utils; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.server.FileBasedHTTPAccessLogPublisherCfg; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.ServerContext; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.FilePermission; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.util.TimeThread; |
| | | |
| | | /** |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | final FileBasedHTTPAccessLogPublisherCfg config) |
| | | { |
| | | // Default result code. |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | final List<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | final File logFile = getFileForPath(config.getLogFile()); |
| | | final FileNamingPolicy fnPolicy = new TimeStampNaming(logFile); |
| | |
| | | if (cfg.isAsynchronous() && config.isAsynchronous() |
| | | && cfg.getQueueSize() != config.getQueueSize()) |
| | | { |
| | | adminActionRequired = true; |
| | | ccr.setAdminActionRequired(true); |
| | | } |
| | | |
| | | if (!config.getLogRecordTimeFormat().equals(timeStampFormat)) |
| | |
| | | LocalizableMessage errorMessage = validateLogFormat(logFormatFields); |
| | | if (errorMessage != null) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | adminActionRequired = true; |
| | | messages.add(errorMessage); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.setAdminActionRequired(true); |
| | | ccr.addMessage(errorMessage); |
| | | } |
| | | } |
| | | } |
| | | catch (final Exception e) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | messages.add(ERR_CONFIG_LOGGING_CANNOT_CREATE_WRITER.get( |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ERR_CONFIG_LOGGING_CANNOT_CREATE_WRITER.get( |
| | | config.dn(), stackTraceToSingleLineString(e))); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | import org.opends.server.admin.std.server.TimeLimitLogRotationPolicyCfg; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | |
| | | |
| | | import java.util.List; |
| | | import java.util.ArrayList; |
| | | |
| | | /** |
| | | * This class implements a fixed time based rotation policy. |
| | |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | TimeLimitLogRotationPolicyCfg config) |
| | | { |
| | | // Default result code. |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | |
| | | timeInterval = config.getRotationInterval(); |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | |
| | | * This method indicates if the log file should be |
| | | * rotated or not. |
| | | * |
| | | * @param writer The mutli file text writer written the log file. |
| | | * @param writer The multi file text writer written the log file. |
| | | * @return true if the file should be rotated, false otherwise. |
| | | */ |
| | | public boolean rotateFile(RotatableLogFile writer) |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | package org.opends.server.loggers; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.server.DebugTargetCfg; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | |
| | | /** |
| | | * This class encapsulates the trace settings in effect at a given traceing |
| | | * scope. |
| | | * This class encapsulates the trace settings in effect at a given tracing scope. |
| | | */ |
| | | public class TraceSettings implements |
| | | ConfigurationChangeListener<DebugTargetCfg> |
| | |
| | | */ |
| | | public ConfigChangeResult applyConfigurationChange(DebugTargetCfg config) |
| | | { |
| | | // Default result code. |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = |
| | | new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | // We can assume that the target scope did not change since its the |
| | | // naming attribute. Changing it would result in a modify DN. |
| | |
| | | |
| | | this.currentConfig = config; |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /* Update was successful, no restart required. */ |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | finally |
| | | { |
| | |
| | | import org.opends.server.replication.protocol.OperationContext; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.Control; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.types.operation.PostOperationAddOperation; |
| | | import org.opends.server.types.operation.PostOperationDeleteOperation; |
| | | import org.opends.server.types.operation.PostOperationModifyDNOperation; |
| | |
| | | ChangeNumberControlPluginCfg configuration) |
| | | { |
| | | currentConfig = configuration; |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | /** |
| | |
| | | import org.opends.server.api.plugin.PluginType; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.types.operation.PreOperationAddOperation; |
| | | |
| | | import static org.opends.messages.PluginMessages.*; |
| | |
| | | EntryUUIDPluginCfg configuration) |
| | | { |
| | | currentConfig = configuration; |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | } |
| | | |
| | |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.DirectoryConfig; |
| | | import org.opends.server.types.ObjectClass; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.types.operation.PreParseSearchOperation; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | |
| | | configuration) |
| | | { |
| | | currentConfig = configuration; |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | } |
| | | |
| | |
| | | import org.opends.server.api.plugin.PluginType; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.types.operation.PreOperationAddOperation; |
| | | import org.opends.server.types.operation.PreOperationModifyDNOperation; |
| | | import org.opends.server.types.operation.PreOperationModifyOperation; |
| | |
| | | LastModPluginCfg configuration) |
| | | { |
| | | currentConfig = configuration; |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | } |
| | | |
| | |
| | | import static org.opends.server.schema.SchemaConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | PasswordPolicyImportPluginCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | // Get the set of default password storage schemes for auth password |
| | | // attributes. |
| | |
| | | AUTH_PASSWORD_SCHEME_NAME_SALTED_SHA_1); |
| | | if (defaultAuthSchemes[0] == null) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | |
| | | messages.add(ERR_PLUGIN_PWIMPORT_NO_DEFAULT_AUTH_SCHEMES.get( |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ERR_PLUGIN_PWIMPORT_NO_DEFAULT_AUTH_SCHEMES.get( |
| | | AUTH_PASSWORD_SCHEME_NAME_SALTED_SHA_1)); |
| | | } |
| | | } |
| | |
| | | DirectoryServer.getPasswordStorageScheme(schemeDN); |
| | | if (defaultAuthSchemes[i] == null) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | messages.add(ERR_PLUGIN_PWIMPORT_NO_SUCH_DEFAULT_AUTH_SCHEME.get(schemeDN)); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ERR_PLUGIN_PWIMPORT_NO_SUCH_DEFAULT_AUTH_SCHEME.get(schemeDN)); |
| | | } |
| | | else if (! defaultAuthSchemes[i].supportsAuthPasswordSyntax()) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | messages.add(ERR_PLUGIN_PWIMPORT_INVALID_DEFAULT_AUTH_SCHEME.get(schemeDN)); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ERR_PLUGIN_PWIMPORT_INVALID_DEFAULT_AUTH_SCHEME.get(schemeDN)); |
| | | } |
| | | i++; |
| | | } |
| | |
| | | toLowerCase(STORAGE_SCHEME_NAME_SALTED_SHA_1)); |
| | | if (defaultUserSchemes[0] == null) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | |
| | | messages.add(ERR_PLUGIN_PWIMPORT_NO_DEFAULT_USER_SCHEMES.get( |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ERR_PLUGIN_PWIMPORT_NO_DEFAULT_USER_SCHEMES.get( |
| | | STORAGE_SCHEME_NAME_SALTED_SHA_1)); |
| | | } |
| | | } |
| | |
| | | DirectoryServer.getPasswordStorageScheme(schemeDN); |
| | | if (defaultUserSchemes[i] == null) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | messages.add(ERR_PLUGIN_PWIMPORT_INVALID_DEFAULT_USER_SCHEME.get(schemeDN)); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(ERR_PLUGIN_PWIMPORT_INVALID_DEFAULT_USER_SCHEME.get(schemeDN)); |
| | | } |
| | | i++; |
| | | } |
| | | } |
| | | |
| | | if (resultCode == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | defaultAuthPasswordSchemes = defaultAuthSchemes; |
| | | defaultUserPasswordSchemes = defaultUserSchemes; |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | package org.opends.server.plugins; |
| | | |
| | | import static org.opends.messages.PluginMessages.*; |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.opends.server.protocols.internal.Requests.*; |
| | | import static org.opends.server.schema.SchemaConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.BufferedWriter; |
| | | import java.io.File; |
| | | import java.io.FileReader; |
| | | import java.io.FileWriter; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.HashSet; |
| | | import java.util.LinkedHashMap; |
| | |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.protocols.internal.InternalSearchOperation; |
| | | import org.opends.server.protocols.internal.SearchRequest; |
| | | import static org.opends.server.protocols.internal.Requests.*; |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.types.operation.PostOperationDeleteOperation; |
| | | import org.opends.server.types.operation.PostOperationModifyDNOperation; |
| | |
| | | import org.opends.server.types.operation.PreOperationModifyOperation; |
| | | import org.opends.server.types.operation.SubordinateModifyDNOperation; |
| | | |
| | | import static org.opends.messages.PluginMessages.*; |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.opends.server.schema.SchemaConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | /** |
| | | * This class implements a Directory Server post operation plugin that performs |
| | | * Referential Integrity processing on successful delete and modify DN |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | ReferentialIntegrityPluginCfg newConfiguration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | //Load base DNs from new configuration. |
| | | LinkedHashSet<DN> newConfiguredBaseDNs = new LinkedHashSet<DN>(); |
| | |
| | | String newLogFileName=newConfiguration.getLogFile(); |
| | | if(logFileName != null && !logFileName.equals(newLogFileName)) |
| | | { |
| | | adminActionRequired=true; |
| | | messages.add( |
| | | INFO_PLUGIN_REFERENT_LOGFILE_CHANGE_REQUIRES_RESTART.get(logFileName, |
| | | newLogFileName)); |
| | | ccr.setAdminActionRequired(true); |
| | | ccr.addMessage(INFO_PLUGIN_REFERENT_LOGFILE_CHANGE_REQUIRES_RESTART.get(logFileName, newLogFileName)); |
| | | } |
| | | |
| | | //Switch to the new lists. |
| | |
| | | //change. The change might start or stop the background processing thread. |
| | | long newInterval=newConfiguration.getUpdateInterval(); |
| | | if(newConfiguration.isEnabled() && newInterval != interval) |
| | | processIntervalChange(newInterval, messages); |
| | | { |
| | | processIntervalChange(newInterval, ccr.getMessages()); |
| | | } |
| | | |
| | | currentConfiguration = newConfiguration; |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * Process the specifed new interval value. This processing depends on what |
| | | * Process the specified new interval value. This processing depends on what |
| | | * the current interval value is and new value will be. The values have been |
| | | * checked for equality at this point and are not equal. |
| | | * |
| | |
| | | * |
| | | * @param msgs An array list of messages that thread stop and start messages |
| | | * can be added to. |
| | | * |
| | | */ |
| | | private void processIntervalChange(long newInterval, |
| | | ArrayList<LocalizableMessage> msgs) { |
| | | private void processIntervalChange(long newInterval, List<LocalizableMessage> msgs) |
| | | { |
| | | if(interval == 0) { |
| | | DirectoryServer.registerShutdownListener(this); |
| | | interval=newInterval; |
| | |
| | | // No validation required and no restart required. |
| | | config = newConfig; |
| | | |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | |
| | | SevenBitCleanPluginCfg configuration) |
| | | { |
| | | currentConfig = configuration; |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | } |
| | | |
| | |
| | | UniqueAttributePluginCfg newConfiguration) |
| | | { |
| | | currentConfiguration = newConfiguration; |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.plugins.profiler; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | |
| | | import static org.opends.messages.PluginMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.io.File; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.meta.PluginCfgDefn; |
| | | import org.opends.server.admin.std.server.PluginCfg; |
| | | import org.opends.server.admin.std.server.ProfilerPluginCfg; |
| | | import org.opends.server.api.plugin.DirectoryServerPlugin; |
| | | import org.opends.server.api.plugin.PluginType; |
| | | import org.opends.server.api.plugin.PluginResult; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.api.plugin.PluginType; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.DirectoryConfig; |
| | | import org.opends.server.types.DN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.types.DirectoryConfig; |
| | | import org.opends.server.util.TimeThread; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import static org.opends.messages.PluginMessages.*; |
| | | |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class defines a Directory Server startup plugin that will register |
| | | * itself as a configurable component that can allow for a simple sample-based |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | ProfilerPluginCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | * @return Returns information about the result of changing the |
| | | * configuration. |
| | | */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | ProfilerPluginCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | currentConfig = configuration; |
| | | |
| | |
| | | new ProfilerThread(configuration.getProfileSampleInterval()); |
| | | profilerThread.start(); |
| | | |
| | | messages.add(INFO_PLUGIN_PROFILER_STARTED_PROFILING.get(configEntryDN)); |
| | | ccr.addMessage(INFO_PLUGIN_PROFILER_STARTED_PROFILING.get(configEntryDN)); |
| | | } |
| | | else |
| | | { |
| | | messages.add(INFO_PLUGIN_PROFILER_ALREADY_PROFILING.get(configEntryDN)); |
| | | ccr.addMessage(INFO_PLUGIN_PROFILER_ALREADY_PROFILING.get(configEntryDN)); |
| | | } |
| | | } |
| | | break; |
| | |
| | | { |
| | | if (profilerThread == null) |
| | | { |
| | | messages.add(INFO_PLUGIN_PROFILER_NOT_RUNNING.get(configEntryDN)); |
| | | ccr.addMessage(INFO_PLUGIN_PROFILER_NOT_RUNNING.get(configEntryDN)); |
| | | } |
| | | else |
| | | { |
| | | profilerThread.stopProfiling(); |
| | | |
| | | messages.add(INFO_PLUGIN_PROFILER_STOPPED_PROFILING.get(configEntryDN)); |
| | | ccr.addMessage(INFO_PLUGIN_PROFILER_STOPPED_PROFILING.get(configEntryDN)); |
| | | |
| | | String filename = |
| | | getFileForPath( |
| | |
| | | { |
| | | profilerThread.writeCaptureData(filename); |
| | | |
| | | messages.add(INFO_PLUGIN_PROFILER_WROTE_PROFILE_DATA.get(configEntryDN, filename)); |
| | | ccr.addMessage(INFO_PLUGIN_PROFILER_WROTE_PROFILE_DATA.get(configEntryDN, filename)); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | logger.traceException(e); |
| | | |
| | | messages.add(ERR_PLUGIN_PROFILER_CANNOT_WRITE_PROFILE_DATA.get(configEntryDN, filename, |
| | | stackTraceToSingleLineString(e))); |
| | | |
| | | resultCode = DirectoryConfig.getServerErrorResultCode(); |
| | | ccr.addMessage(ERR_PLUGIN_PROFILER_CANNOT_WRITE_PROFILE_DATA.get( |
| | | configEntryDN, filename, stackTraceToSingleLineString(e))); |
| | | ccr.setResultCode(DirectoryConfig.getServerErrorResultCode()); |
| | | } |
| | | |
| | | profilerThread = null; |
| | |
| | | { |
| | | if (profilerThread == null) |
| | | { |
| | | messages.add(INFO_PLUGIN_PROFILER_NOT_RUNNING.get(configEntryDN)); |
| | | ccr.addMessage(INFO_PLUGIN_PROFILER_NOT_RUNNING.get(configEntryDN)); |
| | | } |
| | | else |
| | | { |
| | | profilerThread.stopProfiling(); |
| | | |
| | | messages.add(INFO_PLUGIN_PROFILER_STOPPED_PROFILING.get(configEntryDN)); |
| | | ccr.addMessage(INFO_PLUGIN_PROFILER_STOPPED_PROFILING.get(configEntryDN)); |
| | | |
| | | profilerThread = null; |
| | | } |
| | |
| | | break; |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | } |
| | | |
| | |
| | | import org.opends.server.types.LDIFExportConfig; |
| | | import org.opends.server.types.LDIFImportConfig; |
| | | import org.opends.server.types.Operation; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.util.AddChangeRecordEntry; |
| | | import org.opends.server.util.ChangeRecordEntry; |
| | | import org.opends.server.util.DeleteChangeRecordEntry; |
| | |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class defines an LDIF connection handler, which can be used to watch for |
| | | * new LDIF files to be placed in a specified directory. If a new LDIF file is |
| | |
| | | implements ConfigurationChangeListener<LDIFConnectionHandlerCfg>, |
| | | AlertGenerator |
| | | { |
| | | /** |
| | | * The debug log tracer for this class. |
| | | */ |
| | | /** The debug log tracer for this class. */ |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | |
| | |
| | | File newLDIFDirectory = new File(configuration.getLDIFDirectory()); |
| | | this.ldifDirectory = newLDIFDirectory; |
| | | currentConfig = configuration; |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | package org.opends.server.protocols.http; |
| | | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.messages.ProtocolMessages.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.net.InetAddress; |
| | |
| | | import org.forgerock.json.resource.Resources; |
| | | import org.forgerock.json.resource.Router; |
| | | import org.forgerock.json.resource.servlet.HttpServlet; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.forgerock.opendj.rest2ldap.AuthorizationPolicy; |
| | | import org.forgerock.opendj.rest2ldap.Rest2LDAP; |
| | |
| | | import org.opends.server.admin.std.server.ConnectionHandlerCfg; |
| | | import org.opends.server.admin.std.server.HTTPConnectionHandlerCfg; |
| | | import org.opends.server.api.*; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.extensions.NullKeyManagerProvider; |
| | | import org.opends.server.extensions.NullTrustManagerProvider; |
| | | import org.opends.server.loggers.HTTPAccessLogger; |
| | | import org.opends.server.monitors.ClientConnectionMonitorProvider; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.util.SelectableCertificateKeyManager; |
| | | import org.opends.server.util.StaticUtils; |
| | | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.messages.ProtocolMessages.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | /** |
| | | * This class defines a connection handler that will be used for communicating |
| | | * with clients over HTTP. The connection handler is responsible for |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | HTTPConnectionHandlerCfg config) |
| | | { |
| | | // Create variables to include in the response. |
| | | boolean adminActionRequired = false; |
| | | List<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | if (anyChangeRequiresRestart(config)) |
| | | { |
| | | adminActionRequired = true; |
| | | messages.add(ERR_CONNHANDLER_CONFIG_CHANGES_REQUIRE_RESTART.get("HTTP")); |
| | | ccr.setAdminActionRequired(true); |
| | | ccr.addMessage(ERR_CONNHANDLER_CONFIG_CHANGES_REQUIRE_RESTART.get("HTTP")); |
| | | } |
| | | |
| | | // Reconfigure SSL if needed. |
| | |
| | | catch (DirectoryException e) |
| | | { |
| | | logger.traceException(e); |
| | | messages.add(e.getMessageObject()); |
| | | return new ConfigChangeResult(e.getResultCode(), adminActionRequired, |
| | | messages); |
| | | ccr.setResultCode(e.getResultCode()); |
| | | ccr.addMessage(e.getMessageObject()); |
| | | return ccr; |
| | | } |
| | | |
| | | if (config.isEnabled() && this.currentConfig.isEnabled() && isListening()) |
| | |
| | | this.currentConfig = config; |
| | | this.enabled = this.currentConfig.isEnabled(); |
| | | |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, adminActionRequired, |
| | | messages); |
| | | return ccr; |
| | | } |
| | | |
| | | private boolean anyChangeRequiresRestart(HTTPConnectionHandlerCfg newCfg) |
| | |
| | | */ |
| | | package org.opends.server.protocols.jmx; |
| | | |
| | | import static org.opends.messages.ProtocolMessages.*; |
| | | import static org.opends.server.types.HostPort.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.net.InetSocketAddress; |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.server.ConnectionHandlerCfg; |
| | | import org.opends.server.admin.std.server.JMXConnectionHandlerCfg; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.api.ConnectionHandler; |
| | | import org.opends.server.api.ServerShutdownListener; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.HostPort; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.util.StaticUtils; |
| | | |
| | | import static org.opends.messages.ProtocolMessages.*; |
| | | import static org.opends.server.types.HostPort.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | /** |
| | | * This class defines a connection handler that will be used for |
| | | * communicating with administrative clients over JMX. The connection |
| | |
| | | public static final String TRUST_MANAGER_ARRAY_KEY = |
| | | "org.opends.server.protocol.jmx.ssl.trust.manager.array"; |
| | | |
| | | /** The fully-qualified name of this class. */ |
| | | private static final String CLASS_NAME = |
| | | "org.opends.server.protocols.jmx.JMXConnectionHandler"; |
| | | |
| | | /** The list of active client connection. */ |
| | | private final List<ClientConnection> connectionList; |
| | | |
| | |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | JMXConnectionHandlerCfg config) { |
| | | // Create variables to include in the response. |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | final List<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | // Determine whether or not the RMI connection needs restarting. |
| | | boolean rmiConnectorRestart = false; |
| | |
| | | } |
| | | catch (RuntimeException e) |
| | | { |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | messages.add(LocalizableMessage.raw(e.getMessage())); |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | ccr.addMessage(LocalizableMessage.raw(e.getMessage())); |
| | | } |
| | | } |
| | | |
| | |
| | | System.setProperty(key, value); |
| | | } |
| | | |
| | | // Return configuration result. |
| | | return new ConfigChangeResult(resultCode, false, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | |
| | | import javax.net.ssl.SSLEngine; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.AddressMask; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.server.ConnectionHandlerCfg; |
| | | import org.opends.server.admin.std.server.LDAPConnectionHandlerCfg; |
| | | import org.opends.server.api.*; |
| | | import org.opends.server.api.plugin.PluginResult; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.PluginConfigManager; |
| | | import org.opends.server.core.QueueingStrategy; |
| | |
| | | import org.opends.server.extensions.NullKeyManagerProvider; |
| | | import org.opends.server.extensions.NullTrustManagerProvider; |
| | | import org.opends.server.extensions.TLSByteChannel; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.monitors.ClientConnectionMonitorProvider; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.util.SelectableCertificateKeyManager; |
| | | import org.opends.server.util.StaticUtils; |
| | | |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | LDAPConnectionHandlerCfg config) |
| | | { |
| | | // Create variables to include in the response. |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | // Note that the following properties cannot be modified: |
| | | // |
| | |
| | | catch (DirectoryException e) |
| | | { |
| | | logger.traceException(e); |
| | | messages.add(e.getMessageObject()); |
| | | return new ConfigChangeResult(e.getResultCode(), adminActionRequired, |
| | | messages); |
| | | ccr.setResultCode(e.getResultCode()); |
| | | ccr.addMessage(e.getMessageObject()); |
| | | return ccr; |
| | | } |
| | | |
| | | if (config.isAllowLDAPV2()) |
| | |
| | | DirectoryServer.deregisterSupportedLDAPVersion(2, this); |
| | | } |
| | | |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | private void configureSSL(LDAPConnectionHandlerCfg config) |
| | |
| | | domain.setEclIncludes(domain.getServerId(), |
| | | configuration.getECLInclude(), |
| | | configuration.getECLIncludeForDeletes()); |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | |
| | | this.isEnabled = configuration.isEnabled(); |
| | | domain.changeConfig(configuration.getECLInclude(), |
| | | configuration.getECLIncludeForDeletes()); |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | private ConfigChangeResult setDomain(ExternalChangelogDomainCfg configuration) |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return new ConfigChangeResult(ResultCode.CONSTRAINT_VIOLATION, false); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | ccr.setResultCode(ResultCode.CONSTRAINT_VIOLATION); |
| | | return ccr; |
| | | } |
| | | } |
| | | |
| | |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | ExternalChangelogDomainCfg configuration) |
| | | { |
| | | // nothing to do |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | /** |
| | |
| | | import org.opends.server.replication.plugin.LDAPReplicationDomain.*; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import static org.opends.messages.ReplicationMessages.*; |
| | | import static org.opends.server.replication.plugin.LDAPReplicationDomain.*; |
| | | |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | FractionalLDIFImportPluginCfg configuration) |
| | | { |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | } |
| | |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | | import static org.forgerock.opendj.ldap.ResultCode.*; |
| | | import static org.opends.messages.ReplicationMessages.*; |
| | | import static org.opends.messages.ToolMessages.*; |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.opends.server.protocols.internal.Requests.*; |
| | | import static org.opends.server.replication.plugin.EntryHistorical.*; |
| | | import static org.opends.server.replication.protocol.OperationContext.*; |
| | | import static org.opends.server.replication.service.ReplicationMonitor.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.io.File; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | |
| | | import org.opends.server.util.TimeThread; |
| | | import org.opends.server.workflowelement.localbackend.LocalBackendModifyOperation; |
| | | |
| | | import static org.forgerock.opendj.ldap.ResultCode.*; |
| | | import static org.opends.messages.ReplicationMessages.*; |
| | | import static org.opends.messages.ToolMessages.*; |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.opends.server.protocols.internal.Requests.*; |
| | | import static org.opends.server.replication.plugin.EntryHistorical.*; |
| | | import static org.opends.server.replication.protocol.OperationContext.*; |
| | | import static org.opends.server.replication.service.ReplicationMonitor.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | /** |
| | | * This class implements the bulk part of the Directory Server side |
| | | * of the replication code. |
| | |
| | | |
| | | solveConflictFlag = isSolveConflict(configuration); |
| | | |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | try |
| | | { |
| | | storeECLConfiguration(configuration); |
| | | } |
| | | catch(Exception e) |
| | | { |
| | | return new ConfigChangeResult(ResultCode.OTHER, false); |
| | | ccr.setResultCode(ResultCode.OTHER); |
| | | } |
| | | |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return ccr; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | | import static org.opends.messages.ReplicationMessages.*; |
| | | import static org.opends.server.replication.plugin.ReplicationRepairRequestControl.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashSet; |
| | | import java.util.Iterator; |
| | |
| | | import org.opends.server.types.operation.PreOperationModifyDNOperation; |
| | | import org.opends.server.types.operation.PreOperationModifyOperation; |
| | | |
| | | import static org.opends.messages.ReplicationMessages.*; |
| | | import static org.opends.server.replication.plugin.ReplicationRepairRequestControl.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | /** |
| | | * This class is used to load the Replication code inside the JVM |
| | | * and to trigger initialization of the replication. |
| | |
| | | private static int replayThreadNumber = 10; |
| | | |
| | | /** |
| | | * enum that symbolizes the state of the multimaster replication. |
| | | * Enum that symbolizes the state of the multimaster replication. |
| | | */ |
| | | private static enum State |
| | | { |
| | |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | ReplicationDomainCfg configuration) |
| | | { |
| | | ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | try |
| | | { |
| | | LDAPReplicationDomain rd = createNewDomain(configuration); |
| | |
| | | rd.shutdown(); |
| | | } |
| | | } |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | } catch (ConfigException e) |
| | | { |
| | | // we should never get to this point because the configEntry has |
| | | // already been validated in isConfigurationAddAcceptable() |
| | | return new ConfigChangeResult(ResultCode.CONSTRAINT_VIOLATION, false); |
| | | ccr.setResultCode(ResultCode.CONSTRAINT_VIOLATION); |
| | | } |
| | | return ccr; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | |
| | | { |
| | | deleteDomain(configuration.getBaseDN()); |
| | | |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | |
| | | connectionTimeoutMS = (int) Math.min(configuration.getConnectionTimeout(), |
| | | Integer.MAX_VALUE); |
| | | |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | |
| | | } |
| | | } |
| | | // if state is STOPPING, then we need to return from this method |
| | | final LDAPReplicationDomain domain = getDomain(baseDN); |
| | | return domain != null && domain.isECLEnabled(); |
| | | } |
| | | |
| | | private static LDAPReplicationDomain getDomain(DN baseDN) |
| | | { |
| | | for (LDAPReplicationDomain domain : domains.values()) |
| | | { |
| | | if (domain.isECLEnabled() && domain.getBaseDN().equals(baseDN)) |
| | | if (domain.getBaseDN().equals(baseDN)) |
| | | { |
| | | return true; |
| | | return domain; |
| | | } |
| | | } |
| | | return false; |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | |
| | | import org.opends.server.admin.server.ConfigurationAddListener; |
| | | import org.opends.server.admin.server.ConfigurationDeleteListener; |
| | | import org.opends.server.admin.std.server.ReplicationServerCfg; |
| | |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd(ReplicationServerCfg cfg) |
| | | { |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | try |
| | | { |
| | | replicationServer = new ReplicationServer(cfg, dsrsShutdownSync); |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | } |
| | | catch (ConfigException e) |
| | | { |
| | | // we should never get to this point because the configEntry has |
| | | // already been validated in configAddisAcceptable |
| | | return new ConfigChangeResult(ResultCode.CONSTRAINT_VIOLATION, false); |
| | | ccr.setResultCode(ResultCode.CONSTRAINT_VIOLATION); |
| | | } |
| | | return ccr; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | |
| | | { |
| | | replicationServer.remove(); |
| | | } |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | |
| | | */ |
| | | package org.opends.server.replication.server; |
| | | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.messages.ReplicationMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.net.*; |
| | | import java.util.*; |
| | |
| | | import org.opends.server.replication.service.DSRSShutdownSync; |
| | | import org.opends.server.types.*; |
| | | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.messages.ReplicationMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | /** |
| | | * ReplicationServer Listener. This singleton is the main object of the |
| | | * replication server. It waits for the incoming connections and create listener |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | ReplicationServerCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | // Some of those properties change don't need specific code. |
| | | // They will be applied for next connections. Some others have immediate |
| | | // effect |
| | | // They will be applied for next connections. Some others have immediate effect |
| | | final Set<HostPort> oldRSAddresses = getConfiguredRSAddresses(); |
| | | |
| | | final ReplicationServerCfg oldConfig = this.config; |
| | |
| | | catch (ChangelogException e) |
| | | { |
| | | logger.traceException(e); |
| | | resultCode = ResultCode.OPERATIONS_ERROR; |
| | | ccr.setResultCode(ResultCode.OPERATIONS_ERROR); |
| | | } |
| | | } |
| | | |
| | |
| | | final String newDir = config.getReplicationDBDirectory(); |
| | | if (newDir != null && !newDir.equals(oldConfig.getReplicationDBDirectory())) |
| | | { |
| | | adminActionRequired = true; |
| | | ccr.setAdminActionRequired(true); |
| | | } |
| | | return new ConfigChangeResult(resultCode, adminActionRequired); |
| | | return ccr; |
| | | } |
| | | |
| | | /** |
| | |
| | | currentConfig = configuration; |
| | | stripMinimumUpperBound = configuration.isStripSyntaxMinUpperBound(); |
| | | |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | /** |
| | | * Boolean that indicates that the minimum upper bound value should be |
| | | * stripped from the Attrbute Type Syntax Description. |
| | | * stripped from the Attribute Type Syntax Description. |
| | | * |
| | | * @return True if the minimum upper bound value should be stripped. |
| | | */ |
| | |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.forgerock.opendj.ldap.ByteSequence; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | |
| | | CertificateAttributeSyntaxCfg configuration) |
| | | { |
| | | this.config = configuration; |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.schema.CoreSchema; |
| | | import org.forgerock.opendj.ldap.schema.MatchingRule; |
| | | import org.forgerock.opendj.ldap.schema.Schema; |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | CollationMatchingRuleCfg configuration) |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<LocalizableMessage> messages = new ArrayList<LocalizableMessage>(); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | if (!configuration.isEnabled() |
| | | || currentConfig.isEnabled() != configuration.isEnabled()) |
| | |
| | | // 2. There is a change in the enable status |
| | | // i.e. (disable->enable or enable->disable). In this case, the |
| | | // ConfigManager will have already created the new Factory object. |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | // Since we have come here it means that this Factory is enabled and |
| | |
| | | { |
| | | LocalizableMessage message = |
| | | WARN_CONFIG_SCHEMA_MR_CONFLICTING_MR.get(configuration.dn(), de.getMessageObject()); |
| | | adminActionRequired = true; |
| | | messages.add(message); |
| | | ccr.setAdminActionRequired(true); |
| | | ccr.addMessage(message); |
| | | } |
| | | currentConfig = configuration; |
| | | return new ConfigChangeResult(resultCode, adminActionRequired, messages); |
| | | return ccr; |
| | | } |
| | | |
| | | /** |
| | |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.forgerock.opendj.ldap.ByteSequence; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | |
| | | |
| | | import static org.opends.messages.SchemaMessages.*; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import static org.opends.server.schema.PrintableString.*; |
| | | import static org.opends.server.schema.SchemaConstants.*; |
| | | |
| | | |
| | | /** |
| | | * This class defines the country string attribute syntax, which should be a |
| | | * two-character ISO 3166 country code. However, for maintainability, it will |
| | |
| | | CountryStringAttributeSyntaxCfg configuration) |
| | | { |
| | | this.config = configuration; |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ByteSequence; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.server.DirectoryStringAttributeSyntaxCfg; |
| | | import org.forgerock.opendj.ldap.schema.MatchingRule; |
| | |
| | | currentConfig = configuration; |
| | | allowZeroLengthValues = configuration.isAllowZeroLengthValues(); |
| | | |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.forgerock.opendj.ldap.ByteSequence; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | |
| | | |
| | | import static org.opends.messages.SchemaMessages.*; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | |
| | | JPEGAttributeSyntaxCfg configuration) |
| | | { |
| | | this.config = configuration; |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | |
| | | |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.ByteSequence; |
| | | |
| | | import static org.opends.messages.SchemaMessages.*; |
| | |
| | | currentConfig = configuration; |
| | | strictMode = configuration.isStrictFormat(); |
| | | |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * Creates a new config change result object with the provided information. |
| | | * |
| | | * @param resultCode The result code for this config change result. |
| | | * @param adminActionRequired Indicates whether administrative |
| | | * action is required for one or more |
| | | * of the changes to take effect. |
| | | */ |
| | | public ConfigChangeResult(ResultCode resultCode, |
| | | boolean adminActionRequired) |
| | | { |
| | | this(resultCode, adminActionRequired, new ArrayList<LocalizableMessage>()); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new config change result object with the provided |
| | | * information. |
| | | * |
| | |
| | | return resultCode; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Specifies the result code for this config change result. |
| | | * |
| | | * @param resultCode The result code for this config change |
| | | * result. |
| | | * @param resultCode The result code for this config change result. |
| | | */ |
| | | public void setResultCode(ResultCode resultCode) |
| | | { |
| | |
| | | } |
| | | |
| | | /** |
| | | * Sets the provided result code for this config change result if the current result code is |
| | | * success. |
| | | * |
| | | * @param newResultCode |
| | | * The new result code for this config change result. |
| | | */ |
| | | public void setResultCodeIfSuccess(ResultCode newResultCode) |
| | | { |
| | | if (getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | setResultCode(newResultCode); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether administrative action is required before one or |
| | | * more of the changes will take effect. |
| | | * |
| | |
| | | * |
| | | * @param adminActionRequired Specifies whether administrative |
| | | * action is required before one or |
| | | * more of the changes will take |
| | | * effect. |
| | | * more of the changes will take effect. |
| | | */ |
| | | public void setAdminActionRequired(boolean adminActionRequired) |
| | | { |
| | |
| | | import org.opends.server.admin.std.server.SNMPConnectionHandlerCfg; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.util.StaticUtils; |
| | | import org.forgerock.util.Reject; |
| | | |
| | |
| | | logger.traceException(ex); |
| | | } |
| | | |
| | | // Check if the security file |
| | | // If security file have changed, changeConfiguration not |
| | | // Supported. |
| | | |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | // If security file have changed, changeConfiguration not supported. |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | /** |
| | |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.testng.Assert; |
| | | import org.testng.annotations.AfterClass; |
| | | import org.testng.annotations.BeforeClass; |
| | |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | TestChildCfg configuration) { |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | TestChildCfg configuration) { |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd(TestChildCfg configuration) { |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | TestChildCfg configuration) { |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | TestChildCfg configuration) { |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.DN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.testng.Assert; |
| | | import org.testng.annotations.AfterClass; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.Test; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Test cases for default behavior on the server-side. |
| | | */ |
| | |
| | | * {@inheritDoc} |
| | | */ |
| | | public ConfigChangeResult applyConfigurationAdd(TestChildCfg configuration) { |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | TestChildCfg configuration) { |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | public ConfigChangeResult applyConfigurationChange(TestChildCfg configuration) { |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import java.util.List; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.server.AlertHandlerCfg; |
| | | import org.opends.server.api.AlertGenerator; |
| | | import org.opends.server.api.AlertHandler; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | |
| | | /** |
| | | * This class implements a Directory Server alert handler that only provides a |
| | |
| | | implements AlertHandler<AlertHandlerCfg>, |
| | | ConfigurationChangeListener<AlertHandlerCfg> |
| | | { |
| | | // The current configuration for this alert handler. |
| | | /** The current configuration for this alert handler. */ |
| | | private AlertHandlerCfg currentConfig; |
| | | |
| | | // The number of times this alert handler has been invoked. |
| | | /** The number of times this alert handler has been invoked. */ |
| | | private static AtomicInteger alertCount = new AtomicInteger(0); |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this SMTP alert handler. |
| | | */ |
| | | /** Creates a new instance of this SMTP alert handler. */ |
| | | public DummyAlertHandler() |
| | | { |
| | | super(); |
| | | |
| | | // All initialization should be done in the initializeAlertHandler method. |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeAlertHandler(AlertHandlerCfg configuration) |
| | | throws ConfigException, InitializationException |
| | | { |
| | |
| | | currentConfig = configuration; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public AlertHandlerCfg getAlertHandlerConfiguration() |
| | | { |
| | | return currentConfig; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAcceptable(AlertHandlerCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void finalizeAlertHandler() |
| | | { |
| | | // No action is required. |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void sendAlertNotification(AlertGenerator generator, String alertType, |
| | | LocalizableMessage alertMessage) |
| | | { |
| | | alertCount.incrementAndGet(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the number of times that this alert handler has been invoked. |
| | | * |
| | |
| | | return alertCount.get(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable(AlertHandlerCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | AlertHandlerCfg configuration) |
| | | { |
| | | currentConfig = configuration; |
| | | |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | } |
| | | |