| | |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Collections; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.SortedSet; |
| | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigChangeResult; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ConditionResult; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.util.Reject; |
| | | import org.forgerock.opendj.config.server.ConfigurationChangeListener; |
| | | import org.forgerock.opendj.ldap.ConditionResult; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.server.config.server.PluggableBackendCfg; |
| | | import org.forgerock.util.Reject; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.MonitorProvider; |
| | | import org.opends.server.backends.RebuildConfig; |
| | |
| | | import org.opends.server.core.ModifyOperation; |
| | | import org.opends.server.core.SearchOperation; |
| | | import org.opends.server.core.ServerContext; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.types.BackupConfig; |
| | | import org.opends.server.types.BackupDirectory; |
| | | import org.opends.server.types.CanceledOperationException; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.IndexType; |
| | |
| | | /** A count of the total operation threads currently in the backend. */ |
| | | private final AtomicInteger threadTotalCount = new AtomicInteger(0); |
| | | /** The base DNs defined for this backend instance. */ |
| | | private DN[] baseDNs; |
| | | private Set<DN> baseDNs; |
| | | |
| | | private MonitorProvider<?> rootContainerMonitor; |
| | | |
| | |
| | | |
| | | this.cfg = cfg; |
| | | this.serverContext = serverContext; |
| | | baseDNs = this.cfg.getBaseDN().toArray(new DN[0]); |
| | | baseDNs = new HashSet<>(cfg.getBaseDN()); |
| | | storage = new TracedStorage(configureStorage(cfg, serverContext), cfg.getBackendId()); |
| | | } |
| | | |
| | |
| | | logger.info(NOTE_BACKEND_OFFLINE, cfg.getBackendId()); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isIndexed(AttributeType attributeType, IndexType indexType) |
| | | { |
| | | try |
| | | { |
| | | EntryContainer ec = rootContainer.getEntryContainer(baseDNs[0]); |
| | | EntryContainer ec = rootContainer.getEntryContainer(baseDNs.iterator().next()); |
| | | AttributeIndex ai = ec.getAttributeIndex(attributeType); |
| | | return ai != null ? ai.isIndexed(indexType) : false; |
| | | } |
| | |
| | | return supportedControls; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN[] getBaseDNs() |
| | | public Set<DN> getBaseDNs() |
| | | { |
| | | return baseDNs; |
| | | } |
| | |
| | | public void run(WriteableTransaction txn) throws Exception |
| | | { |
| | | SortedSet<DN> newBaseDNs = newCfg.getBaseDN(); |
| | | DN[] newBaseDNsArray = newBaseDNs.toArray(new DN[newBaseDNs.size()]); |
| | | |
| | | // Check for changes to the base DNs. |
| | | removeDeletedBaseDNs(newBaseDNs, txn); |
| | | if (!createNewBaseDNs(newBaseDNsArray, ccr, txn)) |
| | | if (!createNewBaseDNs(newBaseDNs, ccr, txn)) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | baseDNs = newBaseDNsArray; |
| | | baseDNs = new HashSet<>(newBaseDNs); |
| | | |
| | | // Put the new configuration in place. |
| | | cfg = newCfg; |
| | |
| | | } |
| | | } |
| | | |
| | | private boolean createNewBaseDNs(DN[] newBaseDNsArray, ConfigChangeResult ccr, WriteableTransaction txn) |
| | | private boolean createNewBaseDNs(Set<DN> newBaseDNs, ConfigChangeResult ccr, WriteableTransaction txn) |
| | | { |
| | | for (DN baseDN : newBaseDNsArray) |
| | | for (DN baseDN : newBaseDNs) |
| | | { |
| | | if (!rootContainer.getBaseDNs().contains(baseDN)) |
| | | { |