OPENDJ-1727 CR-6350 db-cache-percent default values in persistit backend probably too aggressive
Follow-up tp r11944, passing serverContext as parameter instead of setting a field, hence removing setServerContext() and related field.
| | |
| | | new ConcurrentLinkedQueue<PersistentSearch>(); |
| | | |
| | | /** |
| | | * Temporarily sets up the server context for the first phase of add of a new configuration entry. |
| | | * Needed for checking storage parameters before committing the change in configuration. |
| | | * |
| | | * @param context the server context for this instance |
| | | */ |
| | | public void setServerContext(ServerContext context) |
| | | { |
| | | } |
| | | |
| | | /** |
| | | * Configure this backend based on the information in the provided |
| | | * configuration. |
| | | * |
| | |
| | | * @param unacceptableReasons A list that may be used to hold the |
| | | * reasons that the provided |
| | | * configuration is not acceptable. |
| | | * |
| | | * @param serverContext this Directory Server instance's server context |
| | | * |
| | | * @return {@code true} if the provided configuration is acceptable |
| | | * for this backend, or {@code false} if not. |
| | | */ |
| | | public boolean isConfigurationAcceptable( |
| | | C configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | | List<LocalizableMessage> unacceptableReasons, ServerContext serverContext) |
| | | { |
| | | // This default implementation does not perform any special |
| | | // validation. It should be overridden by backend implementations |
| | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAcceptable(RootDSEBackendCfg config, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | | List<LocalizableMessage> unacceptableReasons, |
| | | ServerContext serverContext) |
| | | { |
| | | return isConfigurationChangeAcceptable(config, unacceptableReasons); |
| | | } |
| | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAcceptable(LocalDBBackendCfg config, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | | List<LocalizableMessage> unacceptableReasons, |
| | | ServerContext serverContext) |
| | | { |
| | | return isConfigurationChangeAcceptable(config, unacceptableReasons); |
| | | } |
| | |
| | | import org.opends.server.admin.std.server.PersistitBackendCfg; |
| | | import org.opends.server.backends.pluggable.BackendImpl; |
| | | import org.opends.server.backends.pluggable.spi.Storage; |
| | | import org.opends.server.core.ServerContext; |
| | | |
| | | /** |
| | | * Class defined in the configuration for this backend type. |
| | |
| | | public final class PitBackend extends BackendImpl<PersistitBackendCfg> |
| | | { |
| | | @Override |
| | | public boolean isConfigurationAcceptable(PersistitBackendCfg cfg, List<LocalizableMessage> unacceptableReasons) |
| | | public boolean isConfigurationAcceptable(PersistitBackendCfg cfg, List<LocalizableMessage> unacceptableReasons, |
| | | ServerContext serverContext) |
| | | { |
| | | return PersistItStorage.isConfigurationAcceptable(cfg, unacceptableReasons, serverContext); |
| | | } |
| | | |
| | | @Override |
| | | protected Storage configureStorage(PersistitBackendCfg cfg) throws ConfigException |
| | | protected Storage configureStorage(PersistitBackendCfg cfg, ServerContext serverContext) throws ConfigException |
| | | { |
| | | return new PersistItStorage(cfg, serverContext); |
| | | } |
| | |
| | | OID_SERVER_SIDE_SORT_REQUEST_CONTROL, |
| | | OID_VLV_REQUEST_CONTROL)); |
| | | |
| | | /** The server context for this directory server. */ |
| | | protected ServerContext serverContext; |
| | | |
| | | /** |
| | | * Begin a Backend API method that accesses the database and returns the <code>EntryContainer</code> for |
| | | * <code>entryDN</code>. |
| | |
| | | Reject.ifNull(cfg); |
| | | |
| | | this.cfg = cfg; |
| | | this.serverContext = serverContext; |
| | | baseDNs = this.cfg.getBaseDN().toArray(new DN[0]); |
| | | storage = new TracedStorage(configureStorage(cfg), cfg.getBackendId()); |
| | | storage = new TracedStorage(configureStorage(cfg, serverContext), cfg.getBackendId()); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | |
| | | * |
| | | * @param cfg |
| | | * the configuration object |
| | | * @param serverContext |
| | | * this Directory Server intsance's server context |
| | | * @return The storage engine to be used by this pluggable backend. |
| | | * @throws ConfigException |
| | | * If there is an error in the configuration. |
| | | */ |
| | | protected abstract Storage configureStorage(C cfg) throws ConfigException; |
| | | protected abstract Storage configureStorage(C cfg, ServerContext serverContext) throws ConfigException; |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setServerContext(ServerContext context) |
| | | { |
| | | this.serverContext = context; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAcceptable(C config, List<LocalizableMessage> unacceptableReasons) |
| | | public boolean isConfigurationAcceptable(C config, List<LocalizableMessage> unacceptableReasons, |
| | | ServerContext serverContext) |
| | | { |
| | | return isConfigurationChangeAcceptable(config, unacceptableReasons); |
| | | } |
| | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAcceptable(TaskBackendCfg config, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | | List<LocalizableMessage> unacceptableReasons, |
| | | ServerContext serverContext) |
| | | { |
| | | return isConfigAcceptable(config, unacceptableReasons, null); |
| | | } |
| | |
| | | } |
| | | |
| | | Backend b = backendClass.newInstance(); |
| | | if (! b.isConfigurationAcceptable(configEntry, unacceptableReason)) |
| | | if (! b.isConfigurationAcceptable(configEntry, unacceptableReason, serverContext)) |
| | | { |
| | | return false; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | backend.setServerContext(serverContext); |
| | | if (!backend.isConfigurationAcceptable(configEntry, unacceptableReason)) |
| | | if (!backend.isConfigurationAcceptable(configEntry, unacceptableReason, serverContext)) |
| | | { |
| | | return false; |
| | | } |