OPENDJ-3417 Rename Backend to LocalBackend
76 files modified
1 files renamed
| | |
| | | * @param backend The backend that has been initialized and is |
| | | * about to be put into service. |
| | | */ |
| | | void performBackendPreInitializationProcessing(Backend<?> backend); |
| | | void performBackendPreInitializationProcessing(LocalBackend<?> backend); |
| | | |
| | | /** |
| | | * Performs any processing that may be required |
| | |
| | | * @param backend The backend that has been initialized and has been |
| | | * put into service. |
| | | */ |
| | | void performBackendPostInitializationProcessing(Backend<?> backend); |
| | | void performBackendPostInitializationProcessing(LocalBackend<?> backend); |
| | | |
| | | /** |
| | | * Performs any processing that may be required before starting |
| | |
| | | * |
| | | * @param backend The backend that is about to be finalized. |
| | | */ |
| | | void performBackendPreFinalizationProcessing(Backend<?> backend); |
| | | void performBackendPreFinalizationProcessing(LocalBackend<?> backend); |
| | | |
| | | /** |
| | | * Performs any processing that may be required whenever a backend |
| | |
| | | * @param backend The backend that has been taken out of service |
| | | * and is about to be finalized. |
| | | */ |
| | | void performBackendPostFinalizationProcessing(Backend<?> backend); |
| | | void performBackendPostFinalizationProcessing(LocalBackend<?> backend); |
| | | |
| | | } |
| | | |
| | |
| | | * @param config Configuration information about the backup to be |
| | | * performed. |
| | | */ |
| | | void processBackupBegin(Backend<?> backend, BackupConfig config); |
| | | void processBackupBegin(LocalBackend<?> backend, BackupConfig config); |
| | | |
| | | /** |
| | | * Performs any processing that might be necessary after the server |
| | |
| | | * @param successful Indicates whether the backup operation |
| | | * completed successfully. |
| | | */ |
| | | void processBackupEnd(Backend<?> backend, BackupConfig config, boolean successful); |
| | | void processBackupEnd(LocalBackend<?> backend, BackupConfig config, boolean successful); |
| | | } |
| | |
| | | * @param config Configuration information about the LDIF export |
| | | * to be performed. |
| | | */ |
| | | void processExportBegin(Backend<?> backend, LDIFExportConfig config); |
| | | void processExportBegin(LocalBackend<?> backend, LDIFExportConfig config); |
| | | |
| | | /** |
| | | * Performs any processing that might be necessary after the server |
| | |
| | | * @param successful Indicates whether the export operation |
| | | * completed successfully. |
| | | */ |
| | | void processExportEnd(Backend<?> backend, LDIFExportConfig config, boolean successful); |
| | | void processExportEnd(LocalBackend<?> backend, LDIFExportConfig config, boolean successful); |
| | | } |
| | |
| | | * @param config Configuration information about the LDIF import |
| | | * to be performed. |
| | | */ |
| | | void processImportBegin(Backend<?> backend, LDIFImportConfig config); |
| | | void processImportBegin(LocalBackend<?> backend, LDIFImportConfig config); |
| | | |
| | | /** |
| | | * Performs any processing that might be necessary after the server |
| | |
| | | * @param successful Indicates whether the import operation |
| | | * completed successfully. |
| | | */ |
| | | void processImportEnd(Backend<?> backend, LDIFImportConfig config, boolean successful); |
| | | void processImportEnd(LocalBackend<?> backend, LDIFImportConfig config, boolean successful); |
| | | } |
| File was renamed from opendj-server-legacy/src/main/java/org/opends/server/api/Backend.java |
| | |
| | | mayInstantiate=false, |
| | | mayExtend=true, |
| | | mayInvoke=false) |
| | | public abstract class Backend<C extends Configuration> |
| | | public abstract class LocalBackend<C extends Configuration> |
| | | // should have been BackendCfg instead of Configuration |
| | | { |
| | | /** |
| | | * The backend that holds a portion of the DIT that is hierarchically above |
| | | * the information in this backend. |
| | | */ |
| | | private Backend<?> parentBackend; |
| | | private LocalBackend<?> parentBackend; |
| | | |
| | | /** |
| | | * The set of backends that hold portions of the DIT that are hierarchically |
| | | * below the information in this backend. |
| | | */ |
| | | private Backend<?>[] subordinateBackends = new Backend[0]; |
| | | private LocalBackend<?>[] subordinateBackends = new LocalBackend[0]; |
| | | |
| | | /** The backend monitor associated with this backend. */ |
| | | private BackendMonitor backendMonitor; |
| | |
| | | * @return The parent backend for this backend, or {@code null} if |
| | | * there is none. |
| | | */ |
| | | public final Backend<?> getParentBackend() |
| | | public final LocalBackend<?> getParentBackend() |
| | | { |
| | | return parentBackend; |
| | | } |
| | |
| | | * |
| | | * @param parentBackend The parent backend for this backend. |
| | | */ |
| | | public final synchronized void setParentBackend(Backend<?> parentBackend) |
| | | public final synchronized void setParentBackend(LocalBackend<?> parentBackend) |
| | | { |
| | | this.parentBackend = parentBackend; |
| | | } |
| | |
| | | * @return The set of subordinate backends for this backend, or an |
| | | * empty array if none exist. |
| | | */ |
| | | public final Backend<?>[] getSubordinateBackends() |
| | | public final LocalBackend<?>[] getSubordinateBackends() |
| | | { |
| | | return subordinateBackends; |
| | | } |
| | |
| | | * subordinate backends for this |
| | | * backend. |
| | | */ |
| | | public final synchronized void addSubordinateBackend(Backend<?> subordinateBackend) |
| | | public final synchronized void addSubordinateBackend(LocalBackend<?> subordinateBackend) |
| | | { |
| | | LinkedHashSet<Backend<?>> backendSet = new LinkedHashSet<>(); |
| | | LinkedHashSet<LocalBackend<?>> backendSet = new LinkedHashSet<>(); |
| | | Collections.addAll(backendSet, subordinateBackends); |
| | | |
| | | if (backendSet.add(subordinateBackend)) |
| | | { |
| | | subordinateBackends = backendSet.toArray(new Backend[backendSet.size()]); |
| | | subordinateBackends = backendSet.toArray(new LocalBackend[backendSet.size()]); |
| | | } |
| | | } |
| | | |
| | |
| | | * subordinate backends for this |
| | | * backend. |
| | | */ |
| | | public final synchronized void removeSubordinateBackend(Backend<?> subordinateBackend) |
| | | public final synchronized void removeSubordinateBackend(LocalBackend<?> subordinateBackend) |
| | | { |
| | | ArrayList<Backend<?>> backendList = new ArrayList<>(subordinateBackends.length); |
| | | ArrayList<LocalBackend<?>> backendList = new ArrayList<>(subordinateBackends.length); |
| | | |
| | | boolean found = false; |
| | | for (Backend<?> b : subordinateBackends) |
| | | for (LocalBackend<?> b : subordinateBackends) |
| | | { |
| | | if (b.equals(subordinateBackend)) |
| | | { |
| | |
| | | |
| | | if (found) |
| | | { |
| | | subordinateBackends = backendList.toArray(new Backend[backendList.size()]); |
| | | subordinateBackends = backendList.toArray(new LocalBackend[backendList.size()]); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | if (entryDN.isSubordinateOrEqualTo(dn)) |
| | | { |
| | | for (Backend<?> b : subordinateBackends) |
| | | for (LocalBackend<?> b : subordinateBackends) |
| | | { |
| | | if (b.handlesEntry(entryDN)) |
| | | { |
| | |
| | | * @param config Configuration information about the restore to |
| | | * be performed. |
| | | */ |
| | | void processRestoreBegin(Backend<?> backend, RestoreConfig config); |
| | | void processRestoreBegin(LocalBackend<?> backend, RestoreConfig config); |
| | | |
| | | /** |
| | | * Performs any processing that might be necessary after the server |
| | |
| | | * @param successful Indicates whether the restore operation |
| | | * completed successfully. |
| | | */ |
| | | void processRestoreEnd(Backend<?> backend, RestoreConfig config, boolean successful); |
| | | void processRestoreEnd(LocalBackend<?> backend, RestoreConfig config, boolean successful); |
| | | } |
| | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.DITCacheMap; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.Entry; |
| | |
| | | * @param backend The backend to check if each DN is handled by that |
| | | * backend. |
| | | */ |
| | | public void removeAci(Backend<?> backend) { |
| | | public void removeAci(LocalBackend<?> backend) { |
| | | |
| | | lock.writeLock().lock(); |
| | | try |
| | |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.api.AlertGenerator; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.BackendInitializationListener; |
| | | import org.opends.server.api.plugin.InternalDirectoryServerPlugin; |
| | | import org.opends.server.api.plugin.PluginResult; |
| | |
| | | this.plugin = new AciChangeListenerPlugin(); |
| | | |
| | | // Process ACI from already registered backends. |
| | | for (Backend<?> backend : DirectoryServer.getBackends()) |
| | | for (LocalBackend<?> backend : DirectoryServer.getBackends()) |
| | | { |
| | | performBackendPreInitializationProcessing(backend); |
| | | } |
| | |
| | | * that it may contain and add them to the ACI list. |
| | | */ |
| | | @Override |
| | | public void performBackendPreInitializationProcessing(Backend<?> backend) |
| | | public void performBackendPreInitializationProcessing(LocalBackend<?> backend) |
| | | { |
| | | // Check to make sure that the backend has a presence index defined |
| | | // for the ACI attribute. If it does not, then log a warning message |
| | |
| | | * the provided backend. |
| | | */ |
| | | @Override |
| | | public void performBackendPostFinalizationProcessing(Backend<?> backend) |
| | | public void performBackendPostFinalizationProcessing(LocalBackend<?> backend) |
| | | { |
| | | aciList.removeAci(backend); |
| | | } |
| | | |
| | | @Override |
| | | public void performBackendPostInitializationProcessing(Backend<?> backend) { |
| | | public void performBackendPostInitializationProcessing(LocalBackend<?> backend) { |
| | | // Nothing to do. |
| | | } |
| | | |
| | | @Override |
| | | public void performBackendPreFinalizationProcessing(Backend<?> backend) { |
| | | public void performBackendPreFinalizationProcessing(LocalBackend<?> backend) { |
| | | // nothing to do. |
| | | } |
| | | |
| | |
| | | import org.forgerock.opendj.ldap.schema.CoreSchema; |
| | | import org.forgerock.opendj.ldap.schema.ObjectClass; |
| | | import org.forgerock.opendj.server.config.server.BackupBackendCfg; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.core.DeleteOperation; |
| | | import org.opends.server.core.DirectoryServer; |
| | |
| | | * unknown backup directory is included in the base DN. |
| | | */ |
| | | public class BackupBackend |
| | | extends Backend<BackupBackendCfg> |
| | | extends LocalBackend<BackupBackendCfg> |
| | | implements ConfigurationChangeListener<BackupBackendCfg> |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.ldap.schema.CoreSchema; |
| | | import org.forgerock.opendj.ldap.schema.ObjectClass; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.controls.EntryChangelogNotificationControl; |
| | | import org.opends.server.controls.ExternalChangelogRequestControl; |
| | | import org.opends.server.core.AddOperation; |
| | |
| | | * |
| | | * @see ReplicationServer |
| | | */ |
| | | public class ChangelogBackend extends Backend<Configuration> |
| | | public class ChangelogBackend extends LocalBackend<Configuration> |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.server.config.meta.BackendCfgDefn.WritabilityMode; |
| | | import org.forgerock.opendj.server.config.server.BackendCfg; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.Backupable; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.backends.ConfigurationBackend.ConfigurationBackendCfg; |
| | |
| | | import org.opends.server.util.StaticUtils; |
| | | |
| | | /** Back-end responsible for management of configuration entries. */ |
| | | public class ConfigurationBackend extends Backend<ConfigurationBackendCfg> implements Backupable |
| | | public class ConfigurationBackend extends LocalBackend<ConfigurationBackendCfg> implements Backupable |
| | | { |
| | | /** |
| | | * Dummy {@link BackendCfg} implementation for the {@link ConfigurationBackend}. No config is |
| | |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.server.config.server.LDIFBackendCfg; |
| | | import org.opends.server.api.AlertGenerator; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.controls.SubtreeDeleteControl; |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.core.DeleteOperation; |
| | |
| | | * re-written on disk. |
| | | */ |
| | | public class LDIFBackend |
| | | extends Backend<LDIFBackendCfg> |
| | | extends LocalBackend<LDIFBackendCfg> |
| | | implements ConfigurationChangeListener<LDIFBackendCfg>, AlertGenerator |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.server.config.server.MemoryBackendCfg; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.controls.SubtreeDeleteControl; |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.core.DeleteOperation; |
| | |
| | | * entry has any children (which must not be the case for delete operations). |
| | | */ |
| | | public class MemoryBackend |
| | | extends Backend<MemoryBackendCfg> |
| | | extends LocalBackend<MemoryBackendCfg> |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | |
| | | import org.forgerock.opendj.ldap.schema.ObjectClass; |
| | | import org.forgerock.opendj.server.config.server.MonitorBackendCfg; |
| | | import org.forgerock.util.Reject; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.MonitorData; |
| | | import org.opends.server.api.MonitorProvider; |
| | | import org.opends.server.core.AddOperation; |
| | |
| | | * requested monitor and dynamically generate the associated entry. It will also |
| | | * construct a base monitor entry with some useful server-wide data. |
| | | */ |
| | | public class MonitorBackend extends Backend<MonitorBackendCfg> implements |
| | | public class MonitorBackend extends LocalBackend<MonitorBackendCfg> implements |
| | | ConfigurationChangeListener<MonitorBackendCfg> |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | |
| | | import org.forgerock.opendj.ldap.schema.ObjectClass; |
| | | import org.forgerock.opendj.ldap.schema.SchemaBuilder; |
| | | import org.forgerock.opendj.server.config.server.BackendCfg; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.controls.PagedResultsControl; |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.core.DeleteOperation; |
| | |
| | | * not represent a complete and stable API, should be considered private |
| | | * and subject to change without notice. |
| | | */ |
| | | public class NullBackend extends Backend<BackendCfg> |
| | | public class NullBackend extends LocalBackend<BackendCfg> |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | |
| | | import org.forgerock.opendj.server.config.server.RootDSEBackendCfg; |
| | | import org.forgerock.util.Reject; |
| | | import org.forgerock.util.Utils; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.core.DeleteOperation; |
| | |
| | | * with the other backends. |
| | | */ |
| | | public class RootDSEBackend |
| | | extends Backend<RootDSEBackendCfg> |
| | | extends LocalBackend<RootDSEBackendCfg> |
| | | implements ConfigurationChangeListener<RootDSEBackendCfg> |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | |
| | | * The set of subordinate base DNs and their associated backends that will be |
| | | * used for non-base searches. |
| | | */ |
| | | private ConcurrentHashMap<DN, Backend<?>> subordinateBaseDNs; |
| | | private ConcurrentHashMap<DN, LocalBackend<?>> subordinateBaseDNs; |
| | | |
| | | /** |
| | | * Creates a new backend with the provided information. All backend |
| | |
| | | subordinateBaseDNs = new ConcurrentHashMap<>(); |
| | | for (DN baseDN : subDNs) |
| | | { |
| | | Backend<?> backend = DirectoryServer.getBackend(baseDN); |
| | | LocalBackend<?> backend = DirectoryServer.getBackend(baseDN); |
| | | if (backend != null) |
| | | { |
| | | subordinateBaseDNs.put(baseDN, backend); |
| | |
| | | } |
| | | |
| | | long count = 1; |
| | | for (Map.Entry<DN, Backend<?>> entry : getSubordinateBaseDNs().entrySet()) |
| | | for (Map.Entry<DN, LocalBackend<?>> entry : getSubordinateBaseDNs().entrySet()) |
| | | { |
| | | DN subBase = entry.getKey(); |
| | | Backend<?> b = entry.getValue(); |
| | | LocalBackend<?> b = entry.getValue(); |
| | | Entry subBaseEntry = b.getEntry(subBase); |
| | | if (subBaseEntry != null) |
| | | { |
| | |
| | | |
| | | long count = 0; |
| | | |
| | | for (Map.Entry<DN, Backend<?>> entry : getSubordinateBaseDNs().entrySet()) |
| | | for (Map.Entry<DN, LocalBackend<?>> entry : getSubordinateBaseDNs().entrySet()) |
| | | { |
| | | DN subBase = entry.getKey(); |
| | | Entry subBaseEntry = entry.getValue().getEntry(subBase); |
| | |
| | | // specified. |
| | | if (subordinateBaseDNs != null) |
| | | { |
| | | for (Backend<?> b : subordinateBaseDNs.values()) |
| | | for (LocalBackend<?> b : subordinateBaseDNs.values()) |
| | | { |
| | | if (b.handlesEntry(entryDN)) |
| | | { |
| | |
| | | Map<AttributeType, List<Attribute>> dseUserAttrs = new HashMap<>(); |
| | | Map<AttributeType, List<Attribute>> dseOperationalAttrs = new HashMap<>(); |
| | | |
| | | Map<DN, Backend<?>> publicNamingContexts = showSubordinatesNamingContexts ? |
| | | Map<DN, LocalBackend<?>> publicNamingContexts = showSubordinatesNamingContexts ? |
| | | DirectoryServer.getAllPublicNamingContexts() : |
| | | DirectoryServer.getPublicNamingContexts(); |
| | | Attribute publicNamingContextAttr = createAttribute(ATTR_NAMING_CONTEXTS, publicNamingContexts.keySet()); |
| | |
| | | |
| | | // If it was not the null DN, then iterate through the associated |
| | | // subordinate backends to make the determination. |
| | | for (Map.Entry<DN, Backend<?>> entry : getSubordinateBaseDNs().entrySet()) |
| | | for (Map.Entry<DN, LocalBackend<?>> entry : getSubordinateBaseDNs().entrySet()) |
| | | { |
| | | DN baseDN = entry.getKey(); |
| | | if (entryDN.isSubordinateOrEqualTo(baseDN)) |
| | | { |
| | | Backend<?> b = entry.getValue(); |
| | | LocalBackend<?> b = entry.getValue(); |
| | | if (b.entryExists(entryDN)) |
| | | { |
| | | return true; |
| | |
| | | break; |
| | | |
| | | case SINGLE_LEVEL: |
| | | for (Map.Entry<DN, Backend<?>> entry : getSubordinateBaseDNs().entrySet()) |
| | | for (Map.Entry<DN, LocalBackend<?>> entry : getSubordinateBaseDNs().entrySet()) |
| | | { |
| | | searchOperation.checkIfCanceled(false); |
| | | |
| | | DN subBase = entry.getKey(); |
| | | Backend<?> b = entry.getValue(); |
| | | LocalBackend<?> b = entry.getValue(); |
| | | Entry subBaseEntry = b.getEntry(subBase); |
| | | if (subBaseEntry != null && filter.matchesEntry(subBaseEntry)) |
| | | { |
| | |
| | | case SUBORDINATES: |
| | | try |
| | | { |
| | | for (Map.Entry<DN, Backend<?>> entry : getSubordinateBaseDNs().entrySet()) |
| | | for (Map.Entry<DN, LocalBackend<?>> entry : getSubordinateBaseDNs().entrySet()) |
| | | { |
| | | searchOperation.checkIfCanceled(false); |
| | | |
| | | DN subBase = entry.getKey(); |
| | | Backend<?> b = entry.getValue(); |
| | | LocalBackend<?> b = entry.getValue(); |
| | | |
| | | searchOperation.setBaseDN(subBase); |
| | | try |
| | |
| | | * @return the subordinate base DNs of the root DSE |
| | | */ |
| | | @SuppressWarnings({ "unchecked", "rawtypes" }) |
| | | public Map<DN, Backend<?>> getSubordinateBaseDNs() |
| | | public Map<DN, LocalBackend<?>> getSubordinateBaseDNs() |
| | | { |
| | | if (subordinateBaseDNs != null) |
| | | { |
| | |
| | | { |
| | | for (DN baseDN : subDNs) |
| | | { |
| | | Backend<?> backend = DirectoryServer.getBackend(baseDN); |
| | | LocalBackend<?> backend = DirectoryServer.getBackend(baseDN); |
| | | if (backend == null) |
| | | { |
| | | unacceptableReasons.add(WARN_ROOTDSE_NO_BACKEND_FOR_SUBORDINATE_BASE.get(baseDN)); |
| | |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | // Check to see if we should apply a new set of base DNs. |
| | | ConcurrentHashMap<DN, Backend<?>> subBases; |
| | | ConcurrentHashMap<DN, LocalBackend<?>> subBases; |
| | | try |
| | | { |
| | | Set<DN> subDNs = cfg.getSubordinateBaseDN(); |
| | |
| | | subBases = new ConcurrentHashMap<>(); |
| | | for (DN baseDN : subDNs) |
| | | { |
| | | Backend<?> backend = DirectoryServer.getBackend(baseDN); |
| | | LocalBackend<?> backend = DirectoryServer.getBackend(baseDN); |
| | | if (backend == null) |
| | | { |
| | | // This is not fine. We can't use a suffix that doesn't exist. |
| | |
| | | import org.forgerock.opendj.server.config.server.SchemaBackendCfg; |
| | | import org.forgerock.util.Reject; |
| | | import org.opends.server.api.AlertGenerator; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.Backupable; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.core.AddOperation; |
| | |
| | | * It is a kind of meta-backend in that it doesn't actually hold any data but |
| | | * rather dynamically generates the schema entry whenever it is requested. |
| | | */ |
| | | public class SchemaBackend extends Backend<SchemaBackendCfg> |
| | | public class SchemaBackend extends LocalBackend<SchemaBackendCfg> |
| | | implements ConfigurationChangeListener<SchemaBackendCfg>, AlertGenerator, Backupable |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | |
| | | import org.forgerock.opendj.ldap.schema.ObjectClass; |
| | | import org.forgerock.opendj.server.config.server.TrustStoreBackendCfg; |
| | | import org.forgerock.util.Reject; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.core.DeleteOperation; |
| | | import org.opends.server.core.DirectoryServer; |
| | |
| | | * This class defines a backend used to provide an LDAP view of public keys |
| | | * stored in a key store. |
| | | */ |
| | | public class TrustStoreBackend extends Backend<TrustStoreBackendCfg> |
| | | public class TrustStoreBackend extends LocalBackend<TrustStoreBackendCfg> |
| | | implements ConfigurationChangeListener<TrustStoreBackendCfg> |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | |
| | | 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.LocalBackend; |
| | | import org.opends.server.api.MonitorProvider; |
| | | import org.opends.server.backends.RebuildConfig; |
| | | import org.opends.server.backends.VerifyConfig; |
| | |
| | | * @param <C> |
| | | * the type of the BackendCfg for the current backend |
| | | */ |
| | | public abstract class BackendImpl<C extends PluggableBackendCfg> extends Backend<C> implements |
| | | public abstract class BackendImpl<C extends PluggableBackendCfg> extends LocalBackend<C> implements |
| | | ConfigurationChangeListener<PluggableBackendCfg> |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | |
| | | import org.forgerock.opendj.server.config.server.PluggableBackendCfg; |
| | | import org.forgerock.util.Option; |
| | | import org.forgerock.util.Options; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.backends.pluggable.spi.Cursor; |
| | | import org.opends.server.backends.pluggable.spi.ReadOperation; |
| | | import org.opends.server.backends.pluggable.spi.ReadableTransaction; |
| | |
| | | |
| | | private static Map<PluggableBackendCfg, BackendImpl<?>> getPluggableBackends() |
| | | { |
| | | List<Backend<?>> backendList = new ArrayList<>(); |
| | | List<LocalBackend<?>> backendList = new ArrayList<>(); |
| | | List<BackendCfg> entryList = new ArrayList<>(); |
| | | List<List<DN>> dnList = new ArrayList<>(); |
| | | BackendToolUtils.getBackends(backendList, entryList, dnList); |
| | |
| | | final Map<PluggableBackendCfg, BackendImpl<?>> pluggableBackends = new LinkedHashMap<>(); |
| | | for (int i = 0; i < backendList.size(); i++) |
| | | { |
| | | Backend<?> backend = backendList.get(i); |
| | | LocalBackend<?> backend = backendList.get(i); |
| | | if (backend instanceof BackendImpl) |
| | | { |
| | | pluggableBackends.put((PluggableBackendCfg) entryList.get(i), (BackendImpl<?>) backend); |
| | |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.server.config.server.TaskBackendCfg; |
| | | import org.forgerock.util.Reject; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.Backupable; |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.core.DeleteOperation; |
| | |
| | | * recurring basis. |
| | | */ |
| | | public class TaskBackend |
| | | extends Backend<TaskBackendCfg> |
| | | extends LocalBackend<TaskBackendCfg> |
| | | implements ConfigurationChangeListener<TaskBackendCfg>, Backupable |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | |
| | | import org.forgerock.opendj.server.config.meta.BackendCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.BackendCfg; |
| | | import org.forgerock.opendj.server.config.server.RootCfg; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.BackendInitializationListener; |
| | | import org.opends.server.backends.ConfigurationBackend; |
| | | import org.opends.server.config.ConfigConstants; |
| | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** The mapping between configuration entry DNs and their corresponding backend implementations. */ |
| | | private final ConcurrentHashMap<DN, Backend<? extends BackendCfg>> registeredBackends = new ConcurrentHashMap<>(); |
| | | private final ConcurrentHashMap<DN, LocalBackend<? extends BackendCfg>> registeredBackends = new ConcurrentHashMap<>(); |
| | | private final ServerContext serverContext; |
| | | |
| | | /** |
| | |
| | | // contain a valid backend implementation, then log an error and skip it. |
| | | String className = backendCfg.getJavaClass(); |
| | | |
| | | Backend<? extends BackendCfg> backend; |
| | | LocalBackend<? extends BackendCfg> backend; |
| | | try |
| | | { |
| | | backend = loadBackendClass(className).newInstance(); |
| | |
| | | initializeBackend(configBackend, configBackend.getBackendCfg()); |
| | | } |
| | | |
| | | private void initializeBackend(Backend<? extends BackendCfg> backend, BackendCfg backendCfg) |
| | | private void initializeBackend(LocalBackend<? extends BackendCfg> backend, BackendCfg backendCfg) |
| | | { |
| | | ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | initializeBackend(backend, backendCfg, ccr); |
| | |
| | | } |
| | | } |
| | | |
| | | private void initializeBackend(Backend<? extends BackendCfg> backend, BackendCfg backendCfg, ConfigChangeResult ccr) |
| | | private void initializeBackend(LocalBackend<? extends BackendCfg> backend, BackendCfg backendCfg, ConfigChangeResult ccr) |
| | | { |
| | | backend.setBackendID(backendCfg.getBackendId()); |
| | | backend.setWritabilityMode(toWritabilityMode(backendCfg.getWritabilityMode())); |
| | |
| | | * Acquire a shared lock on this backend. This will prevent operations like LDIF import or restore |
| | | * from occurring while the backend is active. |
| | | */ |
| | | private boolean acquireSharedLock(Backend<?> backend, String backendID, final ConfigChangeResult ccr) |
| | | private boolean acquireSharedLock(LocalBackend<?> backend, String backendID, final ConfigChangeResult ccr) |
| | | { |
| | | try |
| | | { |
| | |
| | | ccr.addMessage(message); |
| | | } |
| | | |
| | | private void releaseSharedLock(Backend<?> backend, String backendID) |
| | | private void releaseSharedLock(LocalBackend<?> backend, String backendID) |
| | | { |
| | | try |
| | | { |
| | |
| | | |
| | | // See if the backend is registered with the server. If it is, then |
| | | // see what's changed and whether those changes are acceptable. |
| | | Backend<?> backend = registeredBackends.get(backendDN); |
| | | LocalBackend<?> backend = registeredBackends.get(backendDN); |
| | | if (backend != null) |
| | | { |
| | | LinkedHashSet<DN> removedDNs = new LinkedHashSet<>(backend.getBaseDNs()); |
| | |
| | | String className = configEntry.getJavaClass(); |
| | | try |
| | | { |
| | | Class<Backend<BackendCfg>> backendClass = loadBackendClass(className); |
| | | if (! Backend.class.isAssignableFrom(backendClass)) |
| | | Class<LocalBackend<BackendCfg>> backendClass = loadBackendClass(className); |
| | | if (! LocalBackend.class.isAssignableFrom(backendClass)) |
| | | { |
| | | unacceptableReason.add(ERR_CONFIG_BACKEND_CLASS_NOT_BACKEND.get(className, backendDN)); |
| | | return false; |
| | | } |
| | | |
| | | Backend<BackendCfg> b = backendClass.newInstance(); |
| | | LocalBackend<BackendCfg> b = backendClass.newInstance(); |
| | | if (! b.isConfigurationAcceptable(configEntry, unacceptableReason, serverContext)) |
| | | { |
| | | return false; |
| | |
| | | public ConfigChangeResult applyConfigurationChange(BackendCfg cfg) |
| | | { |
| | | DN backendDN = cfg.dn(); |
| | | Backend<? extends BackendCfg> backend = registeredBackends.get(backendDN); |
| | | LocalBackend<? extends BackendCfg> backend = registeredBackends.get(backendDN); |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | // See if the entry contains an attribute that indicates whether the |
| | |
| | | try |
| | | { |
| | | Class<?> backendClass = DirectoryServer.loadClass(className); |
| | | if (Backend.class.isAssignableFrom(backendClass)) |
| | | if (LocalBackend.class.isAssignableFrom(backendClass)) |
| | | { |
| | | // It appears to be a valid backend class. We'll return that the |
| | | // change is successful, but indicate that some administrative |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | private boolean registerBackend(Backend<? extends BackendCfg> backend, BackendCfg backendCfg, ConfigChangeResult ccr) |
| | | private boolean registerBackend(LocalBackend<? extends BackendCfg> backend, BackendCfg backendCfg, ConfigChangeResult ccr) |
| | | { |
| | | for (BackendInitializationListener listener : getBackendInitializationListeners()) |
| | | { |
| | |
| | | // backend implementation, then log an error and skip it. |
| | | String className = configEntry.getJavaClass(); |
| | | |
| | | Backend<BackendCfg> backend; |
| | | LocalBackend<BackendCfg> backend; |
| | | try |
| | | { |
| | | backend = loadBackendClass(className).newInstance(); |
| | |
| | | // backend implementation, then log an error and skip it. |
| | | String className = cfg.getJavaClass(); |
| | | |
| | | Backend<? extends BackendCfg> backend; |
| | | LocalBackend<? extends BackendCfg> backend; |
| | | try |
| | | { |
| | | backend = loadBackendClass(className).newInstance(); |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | private boolean configureAndOpenBackend(Backend<?> backend, BackendCfg cfg, ConfigChangeResult ccr) |
| | | private boolean configureAndOpenBackend(LocalBackend<?> backend, BackendCfg cfg, ConfigChangeResult ccr) |
| | | { |
| | | try |
| | | { |
| | |
| | | } |
| | | |
| | | @SuppressWarnings({ "unchecked", "rawtypes" }) |
| | | private void configureAndOpenBackend(Backend backend, BackendCfg cfg) throws ConfigException, InitializationException |
| | | private void configureAndOpenBackend(LocalBackend backend, BackendCfg cfg) throws ConfigException, InitializationException |
| | | { |
| | | backend.configureBackend(cfg, serverContext); |
| | | backend.openBackend(); |
| | | } |
| | | |
| | | @SuppressWarnings("unchecked") |
| | | private Class<Backend<BackendCfg>> loadBackendClass(String className) throws Exception |
| | | private Class<LocalBackend<BackendCfg>> loadBackendClass(String className) throws Exception |
| | | { |
| | | return (Class<Backend<BackendCfg>>) DirectoryServer.loadClass(className); |
| | | return (Class<LocalBackend<BackendCfg>>) DirectoryServer.loadClass(className); |
| | | } |
| | | |
| | | private WritabilityMode toWritabilityMode(BackendCfgDefn.WritabilityMode writabilityMode) |
| | |
| | | // provided DN. If not, then we don't care if the entry is deleted. If we |
| | | // do know about it, then that means that it is enabled and we will not |
| | | // allow removing a backend that is enabled. |
| | | Backend<?> backend = registeredBackends.get(backendDN); |
| | | LocalBackend<?> backend = registeredBackends.get(backendDN); |
| | | if (backend == null) |
| | | { |
| | | return true; |
| | |
| | | |
| | | // See if the backend has any subordinate backends. If so, then it is not |
| | | // acceptable to remove it. Otherwise, it should be fine. |
| | | Backend<?>[] subBackends = backend.getSubordinateBackends(); |
| | | LocalBackend<?>[] subBackends = backend.getSubordinateBackends(); |
| | | if (subBackends != null && subBackends.length != 0) |
| | | { |
| | | unacceptableReason.add(NOTE_CONFIG_BACKEND_CANNOT_REMOVE_BACKEND_WITH_SUBORDINATES.get(backendDN)); |
| | |
| | | |
| | | // See if this backend config manager has a backend registered with the |
| | | // provided DN. If not, then we don't care if the entry is deleted. |
| | | Backend<?> backend = registeredBackends.get(backendDN); |
| | | LocalBackend<?> backend = registeredBackends.get(backendDN); |
| | | if (backend == null) |
| | | { |
| | | return ccr; |
| | |
| | | |
| | | // See if the backend has any subordinate backends. If so, then it is not |
| | | // acceptable to remove it. Otherwise, it should be fine. |
| | | Backend<?>[] subBackends = backend.getSubordinateBackends(); |
| | | LocalBackend<?>[] subBackends = backend.getSubordinateBackends(); |
| | | if (subBackends != null && subBackends.length > 0) |
| | | { |
| | | ccr.setResultCode(UNWILLING_TO_PERFORM); |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | private void deregisterBackend(DN backendDN, Backend<?> backend) |
| | | private void deregisterBackend(DN backendDN, LocalBackend<?> backend) |
| | | { |
| | | for (BackendInitializationListener listener : getBackendInitializationListeners()) |
| | | { |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.types.DirectoryException; |
| | | |
| | | /** |
| | |
| | | */ |
| | | public class BaseDnRegistry { |
| | | /** The set of base DNs registered with the server. */ |
| | | private final TreeMap<DN, Backend<?>> baseDNs = new TreeMap<>(); |
| | | private final TreeMap<DN, LocalBackend<?>> baseDNs = new TreeMap<>(); |
| | | /** The set of private naming contexts registered with the server. */ |
| | | private final TreeMap<DN, Backend<?>> privateNamingContexts = new TreeMap<>(); |
| | | private final TreeMap<DN, LocalBackend<?>> privateNamingContexts = new TreeMap<>(); |
| | | /** The set of public naming contexts registered with the server. */ |
| | | private final TreeMap<DN, Backend<?>> publicNamingContexts = new TreeMap<>(); |
| | | private final TreeMap<DN, LocalBackend<?>> publicNamingContexts = new TreeMap<>(); |
| | | /** The set of public naming contexts, including sub-suffixes, registered with the server. */ |
| | | private final TreeMap<DN, Backend<?>> allPublicNamingContexts = new TreeMap<>(); |
| | | private final TreeMap<DN, LocalBackend<?>> allPublicNamingContexts = new TreeMap<>(); |
| | | |
| | | /** |
| | | * Indicates whether this base DN registry is in test mode. |
| | |
| | | * committed to the server |
| | | * @throws DirectoryException if the base DN cannot be registered |
| | | */ |
| | | public List<LocalizableMessage> registerBaseDN(DN baseDN, Backend<?> backend, boolean isPrivate) |
| | | public List<LocalizableMessage> registerBaseDN(DN baseDN, LocalBackend<?> backend, boolean isPrivate) |
| | | throws DirectoryException |
| | | { |
| | | // Check to see if the base DN is already registered with the server. |
| | | Backend<?> existingBackend = baseDNs.get(baseDN); |
| | | LocalBackend<?> existingBackend = baseDNs.get(baseDN); |
| | | if (existingBackend != null) |
| | | { |
| | | LocalizableMessage message = ERR_REGISTER_BASEDN_ALREADY_EXISTS. |
| | |
| | | LinkedList<DN> otherBaseDNs = new LinkedList<>(); |
| | | for (DN dn : baseDNs.keySet()) |
| | | { |
| | | Backend<?> b = baseDNs.get(dn); |
| | | LocalBackend<?> b = baseDNs.get(dn); |
| | | if (b.equals(backend)) |
| | | { |
| | | otherBaseDNs.add(dn); |
| | |
| | | // Check to see if the new base DN is subordinate to any other base DN |
| | | // already defined. If it is, then any other base DN(s) for the same |
| | | // backend must also be subordinate to the same base DN. |
| | | final Backend<?> superiorBackend = getSuperiorBackend(baseDN, otherBaseDNs, backend.getBackendID()); |
| | | final LocalBackend<?> superiorBackend = getSuperiorBackend(baseDN, otherBaseDNs, backend.getBackendID()); |
| | | if (superiorBackend == null && backend.getParentBackend() != null) |
| | | { |
| | | LocalizableMessage message = ERR_REGISTER_BASEDN_NEW_BASE_NOT_SUBORDINATE. |
| | |
| | | |
| | | // Check to see if the new base DN should be the superior base DN for any |
| | | // other base DN(s) already defined. |
| | | LinkedList<Backend<?>> subordinateBackends = new LinkedList<>(); |
| | | LinkedList<LocalBackend<?>> subordinateBackends = new LinkedList<>(); |
| | | LinkedList<DN> subordinateBaseDNs = new LinkedList<>(); |
| | | for (DN dn : baseDNs.keySet()) |
| | | { |
| | | Backend<?> b = baseDNs.get(dn); |
| | | LocalBackend<?> b = baseDNs.get(dn); |
| | | DN parentDN = dn.parent(); |
| | | while (parentDN != null) |
| | | { |
| | |
| | | |
| | | if (!testOnly) |
| | | { |
| | | for (Backend<?> b : subordinateBackends) |
| | | for (LocalBackend<?> b : subordinateBackends) |
| | | { |
| | | Backend<?> oldParentBackend = b.getParentBackend(); |
| | | LocalBackend<?> oldParentBackend = b.getParentBackend(); |
| | | if (oldParentBackend != null) |
| | | { |
| | | oldParentBackend.removeSubordinateBackend(b); |
| | |
| | | return errors; |
| | | } |
| | | |
| | | private Backend<?> getSuperiorBackend(DN baseDN, LinkedList<DN> otherBaseDNs, String backendID) |
| | | private LocalBackend<?> getSuperiorBackend(DN baseDN, LinkedList<DN> otherBaseDNs, String backendID) |
| | | throws DirectoryException |
| | | { |
| | | Backend<?> superiorBackend = null; |
| | | LocalBackend<?> superiorBackend = null; |
| | | DN parentDN = baseDN.parent(); |
| | | while (parentDN != null) |
| | | { |
| | |
| | | |
| | | // Make sure that the Directory Server actually contains a backend with |
| | | // the specified base DN. |
| | | Backend<?> backend = baseDNs.get(baseDN); |
| | | LocalBackend<?> backend = baseDNs.get(baseDN); |
| | | if (backend == null) |
| | | { |
| | | LocalizableMessage message = |
| | |
| | | |
| | | // Check to see if the backend has a parent backend, and whether it has |
| | | // any subordinates with base DNs that are below the base DN to remove. |
| | | Backend<?> superiorBackend = backend.getParentBackend(); |
| | | LinkedList<Backend<?>> subordinateBackends = new LinkedList<>(); |
| | | LocalBackend<?> superiorBackend = backend.getParentBackend(); |
| | | LinkedList<LocalBackend<?>> subordinateBackends = new LinkedList<>(); |
| | | if (backend.getSubordinateBackends() != null) |
| | | { |
| | | for (Backend<?> b : backend.getSubordinateBackends()) |
| | | for (LocalBackend<?> b : backend.getSubordinateBackends()) |
| | | { |
| | | for (DN dn : b.getBaseDNs()) |
| | | { |
| | |
| | | continue; |
| | | } |
| | | |
| | | Backend<?> b = baseDNs.get(dn); |
| | | LocalBackend<?> b = baseDNs.get(dn); |
| | | if (backend.equals(b)) |
| | | { |
| | | otherBaseDNs.add(dn); |
| | |
| | | { |
| | | // If there were any subordinate backends, then all of their base DNs |
| | | // will now be promoted to naming contexts. |
| | | for (Backend<?> b : subordinateBackends) |
| | | for (LocalBackend<?> b : subordinateBackends) |
| | | { |
| | | if (!testOnly) |
| | | { |
| | |
| | | |
| | | if (!testOnly) |
| | | { |
| | | for (Backend<?> b : subordinateBackends) |
| | | for (LocalBackend<?> b : subordinateBackends) |
| | | { |
| | | backend.removeSubordinateBackend(b); |
| | | superiorBackend.addSubordinateBackend(b); |
| | |
| | | * |
| | | * @return mapping from base DN to backend |
| | | */ |
| | | Map<DN, Backend<?>> getBaseDnMap() |
| | | Map<DN, LocalBackend<?>> getBaseDnMap() |
| | | { |
| | | return this.baseDNs; |
| | | } |
| | |
| | | * |
| | | * @return mapping from naming context to backend |
| | | */ |
| | | Map<DN, Backend<?>> getPublicNamingContextsMap() |
| | | Map<DN, LocalBackend<?>> getPublicNamingContextsMap() |
| | | { |
| | | return this.publicNamingContexts; |
| | | } |
| | |
| | | * |
| | | * @return mapping from naming context to backend |
| | | */ |
| | | Map<DN, Backend<?>> getAllPublicNamingContextsMap() |
| | | Map<DN, LocalBackend<?>> getAllPublicNamingContextsMap() |
| | | { |
| | | return this.allPublicNamingContexts; |
| | | } |
| | |
| | | * |
| | | * @return mapping from naming context to backend |
| | | */ |
| | | Map<DN, Backend<?>> getPrivateNamingContextsMap() |
| | | Map<DN, LocalBackend<?>> getPrivateNamingContextsMap() |
| | | { |
| | | return this.privateNamingContexts; |
| | | } |
| | |
| | | import org.opends.server.api.AlertGenerator; |
| | | import org.opends.server.api.AlertHandler; |
| | | import org.opends.server.api.AuthenticationPolicy; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.BackendInitializationListener; |
| | | import org.opends.server.api.BackupTaskListener; |
| | | import org.opends.server.api.CertificateMapper; |
| | |
| | | private BaseDnRegistry baseDnRegistry; |
| | | |
| | | /** The set of backends registered with the server. */ |
| | | private TreeMap<String, Backend<?>> backends; |
| | | private TreeMap<String, LocalBackend<?>> backends; |
| | | |
| | | /** The set of supported controls registered with the Directory Server. */ |
| | | private final TreeSet<String> supportedControls = newTreeSet( |
| | |
| | | return directoryServer.compressedSchema; |
| | | } |
| | | |
| | | private Backend<?> getConfigurationBackend() |
| | | private LocalBackend<?> getConfigurationBackend() |
| | | { |
| | | return getBackend(ConfigurationBackend.CONFIG_BACKEND_ID); |
| | | } |
| | |
| | | * workflow conflicts with the workflow |
| | | * ID of an existing workflow. |
| | | */ |
| | | private static void createAndRegisterWorkflows(Backend<?> backend) throws DirectoryException |
| | | private static void createAndRegisterWorkflows(LocalBackend<?> backend) throws DirectoryException |
| | | { |
| | | // Create a workflow for each backend base DN and register the workflow |
| | | // with the default/internal/admin network group. |
| | |
| | | * workflow conflicts with the workflow |
| | | * ID of an existing workflow. |
| | | */ |
| | | private static void createWorkflow(DN baseDN, Backend<?> backend) throws DirectoryException |
| | | private static void createWorkflow(DN baseDN, LocalBackend<?> backend) throws DirectoryException |
| | | { |
| | | LocalBackendWorkflowElement.createAndRegister(baseDN, backend); |
| | | } |
| | |
| | | * @return The set of backends that have been registered with the Directory |
| | | * Server. |
| | | */ |
| | | public static Collection<Backend<?>> getBackends() |
| | | public static Collection<LocalBackend<?>> getBackends() |
| | | { |
| | | return new ArrayList<>(directoryServer.backends.values()); |
| | | } |
| | |
| | | * @return The backend with the specified backend ID, or {@code null} if |
| | | * there is none. |
| | | */ |
| | | public static Backend<?> getBackend(String backendID) |
| | | public static LocalBackend<?> getBackend(String backendID) |
| | | { |
| | | return directoryServer.backends.get(backendID); |
| | | } |
| | |
| | | * conflicts with the backend ID of an existing |
| | | * backend. |
| | | */ |
| | | public static void registerBackend(Backend<?> backend) throws DirectoryException |
| | | public static void registerBackend(LocalBackend<?> backend) throws DirectoryException |
| | | { |
| | | ifNull(backend); |
| | | |
| | |
| | | |
| | | synchronized (directoryServer) |
| | | { |
| | | TreeMap<String, Backend<?>> newBackends = new TreeMap<>(directoryServer.backends); |
| | | TreeMap<String, LocalBackend<?>> newBackends = new TreeMap<>(directoryServer.backends); |
| | | if (newBackends.containsKey(backendID)) |
| | | { |
| | | LocalizableMessage message = ERR_REGISTER_BACKEND_ALREADY_EXISTS.get(backendID); |
| | |
| | | * @param backend The backend to deregister with the server. It must not be |
| | | * {@code null}. |
| | | */ |
| | | public static void deregisterBackend(Backend<?> backend) |
| | | public static void deregisterBackend(LocalBackend<?> backend) |
| | | { |
| | | ifNull(backend); |
| | | |
| | | synchronized (directoryServer) |
| | | { |
| | | TreeMap<String, Backend<?>> newBackends = new TreeMap<>(directoryServer.backends); |
| | | TreeMap<String, LocalBackend<?>> newBackends = new TreeMap<>(directoryServer.backends); |
| | | newBackends.remove(backend.getBackendID()); |
| | | |
| | | directoryServer.backends = newBackends; |
| | |
| | | * @return The backend with the specified base DN, or {@code null} if there |
| | | * is no backend registered with the specified base DN. |
| | | */ |
| | | public static Backend<?> getBackendWithBaseDN(DN baseDN) |
| | | public static LocalBackend<?> getBackendWithBaseDN(DN baseDN) |
| | | { |
| | | return directoryServer.baseDnRegistry.getBaseDnMap().get(baseDN); |
| | | } |
| | |
| | | * specified entry, or {@code null} if no appropriate backend is |
| | | * registered with the server. |
| | | */ |
| | | public static Backend<?> getBackend(DN entryDN) |
| | | public static LocalBackend<?> getBackend(DN entryDN) |
| | | { |
| | | if (entryDN.isRootDN()) |
| | | { |
| | | return directoryServer.rootDSEBackend; |
| | | } |
| | | |
| | | Map<DN, Backend<?>> baseDNs = directoryServer.baseDnRegistry.getBaseDnMap(); |
| | | Backend<?> b = baseDNs.get(entryDN); |
| | | Map<DN, LocalBackend<?>> baseDNs = directoryServer.baseDnRegistry.getBaseDnMap(); |
| | | LocalBackend<?> b = baseDNs.get(entryDN); |
| | | while (b == null) |
| | | { |
| | | entryDN = entryDN.parent(); |
| | |
| | | * Obtains a copy of the server's base DN registry. The copy can be used |
| | | * to test registration/deregistration of base DNs but cannot be used to |
| | | * modify the backends. To modify the server's live base DN to backend |
| | | * mappings use {@link #registerBaseDN(DN, Backend, boolean)} and |
| | | * mappings use {@link #registerBaseDN(DN, LocalBackend, boolean)} and |
| | | * {@link #deregisterBaseDN(DN)}. |
| | | * |
| | | * @return copy of the base DN registry |
| | |
| | | * @throws DirectoryException If a problem occurs while attempting to |
| | | * register the provided base DN. |
| | | */ |
| | | public static void registerBaseDN(DN baseDN, Backend<?> backend, boolean isPrivate) |
| | | public static void registerBaseDN(DN baseDN, LocalBackend<?> backend, boolean isPrivate) |
| | | throws DirectoryException |
| | | { |
| | | ifNull(baseDN, backend); |
| | |
| | | * |
| | | * @return The set of public naming contexts defined in the Directory Server. |
| | | */ |
| | | public static Map<DN, Backend<?>> getPublicNamingContexts() |
| | | public static Map<DN, LocalBackend<?>> getPublicNamingContexts() |
| | | { |
| | | return directoryServer.baseDnRegistry.getPublicNamingContextsMap(); |
| | | } |
| | |
| | | * |
| | | * @return The set of public naming contexts defined in the Directory Server. |
| | | */ |
| | | public static Map<DN, Backend<?>> getAllPublicNamingContexts() |
| | | public static Map<DN, LocalBackend<?>> getAllPublicNamingContexts() |
| | | { |
| | | return directoryServer.baseDnRegistry.getAllPublicNamingContextsMap(); |
| | | } |
| | |
| | | * @return The set of private naming contexts defined in the Directory |
| | | * Server. |
| | | */ |
| | | public static Map<DN, Backend<?>> getPrivateNamingContexts() |
| | | public static Map<DN, LocalBackend<?>> getPrivateNamingContexts() |
| | | { |
| | | return directoryServer.baseDnRegistry.getPrivateNamingContextsMap(); |
| | | } |
| | |
| | | { |
| | | return directoryServer.rootDSEBackend.getRootDSE(); |
| | | } |
| | | final Backend<?> backend = getBackend(entryDN); |
| | | final LocalBackend<?> backend = getBackend(entryDN); |
| | | return backend != null ? backend.getEntry(entryDN) : null; |
| | | } |
| | | |
| | |
| | | |
| | | // Ask the appropriate backend if the entry exists. |
| | | // If it is not appropriate for any backend, then return false. |
| | | Backend<?> backend = getBackend(entryDN); |
| | | LocalBackend<?> backend = getBackend(entryDN); |
| | | return backend != null && backend.entryExists(entryDN); |
| | | } |
| | | |
| | |
| | | * @param backend The backend in which the backup is to be performed. |
| | | * @param config The configuration for the backup to be performed. |
| | | */ |
| | | public static void notifyBackupBeginning(Backend<?> backend, BackupConfig config) |
| | | public static void notifyBackupBeginning(LocalBackend<?> backend, BackupConfig config) |
| | | { |
| | | for (BackupTaskListener listener : directoryServer.backupTaskListeners) |
| | | { |
| | |
| | | * @param config The configuration for the backup that was performed. |
| | | * @param successful Indicates whether the backup completed successfully. |
| | | */ |
| | | public static void notifyBackupEnded(Backend<?> backend, BackupConfig config, boolean successful) |
| | | public static void notifyBackupEnded(LocalBackend<?> backend, BackupConfig config, boolean successful) |
| | | { |
| | | for (BackupTaskListener listener : directoryServer.backupTaskListeners) |
| | | { |
| | |
| | | * @param backend The backend in which the restore is to be performed. |
| | | * @param config The configuration for the restore to be performed. |
| | | */ |
| | | public static void notifyRestoreBeginning(Backend<?> backend, RestoreConfig config) |
| | | public static void notifyRestoreBeginning(LocalBackend<?> backend, RestoreConfig config) |
| | | { |
| | | for (RestoreTaskListener listener : directoryServer.restoreTaskListeners) |
| | | { |
| | |
| | | * @param config The configuration for the restore that was performed. |
| | | * @param successful Indicates whether the restore completed successfully. |
| | | */ |
| | | public static void notifyRestoreEnded(Backend<?> backend, RestoreConfig config, boolean successful) |
| | | public static void notifyRestoreEnded(LocalBackend<?> backend, RestoreConfig config, boolean successful) |
| | | { |
| | | for (RestoreTaskListener listener : directoryServer.restoreTaskListeners) |
| | | { |
| | |
| | | * @param backend The backend in which the export is to be performed. |
| | | * @param config The configuration for the export to be performed. |
| | | */ |
| | | public static void notifyExportBeginning(Backend<?> backend, LDIFExportConfig config) |
| | | public static void notifyExportBeginning(LocalBackend<?> backend, LDIFExportConfig config) |
| | | { |
| | | for (ExportTaskListener listener : directoryServer.exportTaskListeners) |
| | | { |
| | |
| | | * @param config The configuration for the export that was performed. |
| | | * @param successful Indicates whether the export completed successfully. |
| | | */ |
| | | public static void notifyExportEnded(Backend<?> backend, LDIFExportConfig config, boolean successful) |
| | | public static void notifyExportEnded(LocalBackend<?> backend, LDIFExportConfig config, boolean successful) |
| | | { |
| | | for (ExportTaskListener listener : directoryServer.exportTaskListeners) |
| | | { |
| | |
| | | * @param backend The backend in which the import is to be performed. |
| | | * @param config The configuration for the import to be performed. |
| | | */ |
| | | public static void notifyImportBeginning(Backend<?> backend, LDIFImportConfig config) |
| | | public static void notifyImportBeginning(LocalBackend<?> backend, LDIFImportConfig config) |
| | | { |
| | | for (ImportTaskListener listener : directoryServer.importTaskListeners) |
| | | { |
| | |
| | | * @param config The configuration for the import that was performed. |
| | | * @param successful Indicates whether the import completed successfully. |
| | | */ |
| | | public static void notifyImportEnded(Backend<?> backend, LDIFImportConfig config, boolean successful) |
| | | public static void notifyImportEnded(LocalBackend<?> backend, LDIFImportConfig config, boolean successful) |
| | | { |
| | | for (ImportTaskListener listener : directoryServer.importTaskListeners) |
| | | { |
| | |
| | | /** Shutdown directory server backends. */ |
| | | public static void shutdownBackends() |
| | | { |
| | | for (Backend<?> backend : directoryServer.backends.values()) |
| | | for (LocalBackend<?> backend : directoryServer.backends.values()) |
| | | { |
| | | try |
| | | { |
| | |
| | | import org.forgerock.opendj.server.config.meta.GroupImplementationCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.GroupImplementationCfg; |
| | | import org.forgerock.opendj.server.config.server.RootCfg; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.BackendInitializationListener; |
| | | import org.opends.server.api.DITCacheMap; |
| | | import org.opends.server.api.Group; |
| | |
| | | * manager. |
| | | */ |
| | | @Override |
| | | public void performBackendPreInitializationProcessing(Backend<?> backend) |
| | | public void performBackendPreInitializationProcessing(LocalBackend<?> backend) |
| | | { |
| | | InternalClientConnection conn = getRootConnection(); |
| | | |
| | |
| | | * instances associated with entries in the provided backend. |
| | | */ |
| | | @Override |
| | | public void performBackendPostFinalizationProcessing(Backend<?> backend) |
| | | public void performBackendPostFinalizationProcessing(LocalBackend<?> backend) |
| | | { |
| | | lock.writeLock().lock(); |
| | | try |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void performBackendPostInitializationProcessing(Backend<?> backend) { |
| | | public void performBackendPostInitializationProcessing(LocalBackend<?> backend) { |
| | | // Nothing to do. |
| | | } |
| | | |
| | | @Override |
| | | public void performBackendPreFinalizationProcessing(Backend<?> backend) { |
| | | public void performBackendPreFinalizationProcessing(LocalBackend<?> backend) { |
| | | // Nothing to do. |
| | | } |
| | | |
| | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | |
| | | import static org.opends.messages.CoreMessages.*; |
| | |
| | | * @return The filename that should be used for the lock file for the |
| | | * specified backend. |
| | | */ |
| | | public static String getBackendLockFileName(Backend backend) |
| | | public static String getBackendLockFileName(LocalBackend backend) |
| | | { |
| | | StringBuilder buffer = new StringBuilder(); |
| | | buffer.append(getLockDirectoryPath()); |
| | |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.BackendInitializationListener; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.api.DITCacheMap; |
| | |
| | | * all subentries that it may contain and register them with this manager. |
| | | */ |
| | | @Override |
| | | public void performBackendPreInitializationProcessing(Backend<?> backend) |
| | | public void performBackendPreInitializationProcessing(LocalBackend<?> backend) |
| | | { |
| | | InternalClientConnection conn = getRootConnection(); |
| | | SubentriesControl control = new SubentriesControl(true, true); |
| | |
| | | * all subentries associated with the provided backend. |
| | | */ |
| | | @Override |
| | | public void performBackendPostFinalizationProcessing(Backend<?> backend) |
| | | public void performBackendPostFinalizationProcessing(LocalBackend<?> backend) |
| | | { |
| | | lock.writeLock().lock(); |
| | | try |
| | |
| | | } |
| | | } |
| | | |
| | | private void performBackendPostFinalizationProcessing(Map<DN, List<SubEntry>> subEntryMap, Backend<?> backend) |
| | | private void performBackendPostFinalizationProcessing(Map<DN, List<SubEntry>> subEntryMap, LocalBackend<?> backend) |
| | | { |
| | | Iterator<List<SubEntry>> subEntryListsIt = subEntryMap.values().iterator(); |
| | | while (subEntryListsIt.hasNext()) |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void performBackendPostInitializationProcessing(Backend<?> backend) { |
| | | public void performBackendPostInitializationProcessing(LocalBackend<?> backend) { |
| | | // Nothing to do. |
| | | } |
| | | |
| | | @Override |
| | | public void performBackendPreFinalizationProcessing(Backend<?> backend) { |
| | | public void performBackendPreFinalizationProcessing(LocalBackend<?> backend) { |
| | | // Nothing to do. |
| | | } |
| | | |
| | |
| | | import org.forgerock.opendj.server.config.server.CryptoManagerCfg; |
| | | import org.forgerock.util.Reject; |
| | | import org.opends.admin.ads.ADSContext; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.backends.TrustStoreBackend; |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.core.DirectoryServer; |
| | |
| | | private TrustStoreBackend getTrustStoreBackend() |
| | | throws ConfigException |
| | | { |
| | | Backend<?> b = DirectoryServer.getBackend(ID_ADS_TRUST_STORE_BACKEND); |
| | | LocalBackend<?> b = DirectoryServer.getBackend(ID_ADS_TRUST_STORE_BACKEND); |
| | | if (b == null) |
| | | { |
| | | throw new ConfigException(ERR_CRYPTOMGR_ADS_TRUST_STORE_BACKEND_NOT_ENABLED.get(ID_ADS_TRUST_STORE_BACKEND)); |
| | |
| | | import org.forgerock.opendj.ldap.schema.CoreSchema; |
| | | import org.forgerock.opendj.ldap.schema.ObjectClass; |
| | | import org.opends.admin.ads.ADSContext; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.BackendInitializationListener; |
| | | import org.opends.server.api.plugin.InternalDirectoryServerPlugin; |
| | | import org.opends.server.api.plugin.PluginResult.PostResponse; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void performBackendPreInitializationProcessing(Backend<?> backend) |
| | | public void performBackendPreInitializationProcessing(LocalBackend<?> backend) |
| | | { |
| | | for (DN baseDN : backend.getBaseDNs()) |
| | | { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void performBackendPostFinalizationProcessing(Backend<?> backend) |
| | | public void performBackendPostFinalizationProcessing(LocalBackend<?> backend) |
| | | { |
| | | // No implementation required. |
| | | } |
| | | |
| | | @Override |
| | | public void performBackendPostInitializationProcessing(Backend<?> backend) { |
| | | public void performBackendPostInitializationProcessing(LocalBackend<?> backend) { |
| | | // Nothing to do. |
| | | } |
| | | |
| | | @Override |
| | | public void performBackendPreFinalizationProcessing(Backend<?> backend) { |
| | | public void performBackendPreFinalizationProcessing(LocalBackend<?> backend) { |
| | | // Nothing to do. |
| | | } |
| | | |
| | |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.config.server.ConfigurationChangeListener; |
| | | import org.forgerock.opendj.server.config.server.EntryCacheCfg; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.BackendInitializationListener; |
| | | import org.opends.server.api.EntryCache; |
| | | import org.opends.server.api.MonitorData; |
| | |
| | | * about to be put into service. |
| | | */ |
| | | @Override |
| | | public void performBackendPreInitializationProcessing(Backend<?> backend) |
| | | public void performBackendPreInitializationProcessing(LocalBackend<?> backend) |
| | | { |
| | | // Do nothing. |
| | | } |
| | |
| | | * and is about to be finalized. |
| | | */ |
| | | @Override |
| | | public void performBackendPostFinalizationProcessing(Backend<?> backend) |
| | | public void performBackendPostFinalizationProcessing(LocalBackend<?> backend) |
| | | { |
| | | // Do not clear any backends if the server is shutting down. |
| | | if (!DirectoryServer.getInstance().isShuttingDown()) |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void performBackendPostInitializationProcessing(Backend<?> backend) { |
| | | public void performBackendPostInitializationProcessing(LocalBackend<?> backend) { |
| | | // Nothing to do. |
| | | } |
| | | |
| | | @Override |
| | | public void performBackendPreFinalizationProcessing(Backend<?> backend) { |
| | | public void performBackendPreFinalizationProcessing(LocalBackend<?> backend) { |
| | | // Nothing to do. |
| | | } |
| | | } |
| | |
| | | import org.forgerock.opendj.config.server.ConfigurationChangeListener; |
| | | import org.forgerock.opendj.server.config.server.ExactMatchIdentityMapperCfg; |
| | | import org.forgerock.opendj.server.config.server.IdentityMapperCfg; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.IdentityMapper; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | |
| | | { |
| | | for (DN baseDN : cfgBaseDNs) |
| | | { |
| | | Backend b = DirectoryServer.getBackend(baseDN); |
| | | LocalBackend b = DirectoryServer.getBackend(baseDN); |
| | | if (b != null && ! b.isIndexed(t, IndexType.EQUALITY)) |
| | | { |
| | | throw new ConfigException(ERR_EXACTMAP_ATTR_UNINDEXED.get( |
| | |
| | | { |
| | | for (DN baseDN : cfgBaseDNs) |
| | | { |
| | | Backend b = DirectoryServer.getBackend(baseDN); |
| | | LocalBackend b = DirectoryServer.getBackend(baseDN); |
| | | if (b != null && ! b.isIndexed(t, IndexType.EQUALITY)) |
| | | { |
| | | unacceptableReasons.add(ERR_EXACTMAP_ATTR_UNINDEXED.get( |
| | |
| | | import org.forgerock.opendj.config.server.ConfigurationChangeListener; |
| | | import org.forgerock.opendj.server.config.server.EntryCacheCfg; |
| | | import org.forgerock.opendj.server.config.server.FIFOEntryCacheCfg; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.EntryCache; |
| | | import org.opends.server.api.MonitorData; |
| | | import org.opends.server.core.DirectoryServer; |
| | |
| | | { |
| | | // Determine which backend should be used for the provided base DN. If |
| | | // there is none, then we don't need to do anything. |
| | | Backend<?> backend = DirectoryServer.getBackend(baseDN); |
| | | LocalBackend<?> backend = DirectoryServer.getBackend(baseDN); |
| | | if (backend == null) |
| | | { |
| | | return; |
| | |
| | | * @param baseDN The base DN below which all entries should be flushed. |
| | | * @param backend The backend for which to remove the appropriate entries. |
| | | */ |
| | | private void clearSubtree(DN baseDN, Backend<?> backend) |
| | | private void clearSubtree(DN baseDN, LocalBackend<?> backend) |
| | | { |
| | | // See if there are any entries for the provided backend in the cache. If |
| | | // not, then return. |
| | |
| | | |
| | | // See if the backend has any subordinate backends. If so, then process |
| | | // them recursively. |
| | | for (Backend<?> subBackend : backend.getSubordinateBackends()) |
| | | for (LocalBackend<?> subBackend : backend.getSubordinateBackends()) |
| | | { |
| | | boolean isAppropriate = false; |
| | | for (DN subBase : subBackend.getBaseDNs()) |
| | |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.server.config.server.CertificateMapperCfg; |
| | | import org.forgerock.opendj.server.config.server.FingerprintCertificateMapperCfg; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.CertificateMapper; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | |
| | | AttributeType t = configuration.getFingerprintAttribute(); |
| | | for (DN baseDN : cfgBaseDNs) |
| | | { |
| | | Backend<?> b = DirectoryServer.getBackend(baseDN); |
| | | LocalBackend<?> b = DirectoryServer.getBackend(baseDN); |
| | | if (b != null && ! b.isIndexed(t, IndexType.EQUALITY)) |
| | | { |
| | | logger.warn(WARN_SATUACM_ATTR_UNINDEXED, configuration.dn(), |
| | |
| | | AttributeType t = configuration.getFingerprintAttribute(); |
| | | for (DN baseDN : cfgBaseDNs) |
| | | { |
| | | Backend<?> b = DirectoryServer.getBackend(baseDN); |
| | | LocalBackend<?> b = DirectoryServer.getBackend(baseDN); |
| | | if (b != null && ! b.isIndexed(t, IndexType.EQUALITY)) |
| | | { |
| | | LocalizableMessage message = WARN_SATUACM_ATTR_UNINDEXED.get( |
| | |
| | | import org.forgerock.opendj.ldap.ConditionResult; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.server.config.server.HasSubordinatesVirtualAttributeCfg; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.forgerock.opendj.ldap.schema.MatchingRule; |
| | | import org.opends.server.api.VirtualAttributeProvider; |
| | | import org.opends.server.core.DirectoryServer; |
| | |
| | | @Override |
| | | public Attribute getValues(Entry entry, VirtualAttributeRule rule) |
| | | { |
| | | Backend backend = DirectoryServer.getBackend(entry.getName()); |
| | | LocalBackend backend = DirectoryServer.getBackend(entry.getName()); |
| | | |
| | | try |
| | | { |
| | |
| | | @Override |
| | | public boolean hasValue(Entry entry, VirtualAttributeRule rule) |
| | | { |
| | | Backend backend = DirectoryServer.getBackend(entry.getName()); |
| | | LocalBackend backend = DirectoryServer.getBackend(entry.getName()); |
| | | |
| | | try |
| | | { |
| | |
| | | @Override |
| | | public boolean hasValue(Entry entry, VirtualAttributeRule rule, ByteString value) |
| | | { |
| | | Backend backend = DirectoryServer.getBackend(entry.getName()); |
| | | LocalBackend backend = DirectoryServer.getBackend(entry.getName()); |
| | | MatchingRule matchingRule = |
| | | rule.getAttributeType().getEqualityMatchingRule(); |
| | | |
| | |
| | | import org.forgerock.opendj.ldap.ConditionResult; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.server.config.server.NumSubordinatesVirtualAttributeCfg; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.VirtualAttributeProvider; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.SearchOperation; |
| | |
| | | @Override |
| | | public Attribute getValues(Entry entry, VirtualAttributeRule rule) |
| | | { |
| | | Backend backend = DirectoryServer.getBackend(entry.getName()); |
| | | LocalBackend backend = DirectoryServer.getBackend(entry.getName()); |
| | | |
| | | try |
| | | { |
| | |
| | | @Override |
| | | public boolean hasValue(Entry entry, VirtualAttributeRule rule) |
| | | { |
| | | Backend<?> backend = DirectoryServer.getBackend(entry.getName()); |
| | | LocalBackend<?> backend = DirectoryServer.getBackend(entry.getName()); |
| | | |
| | | try |
| | | { |
| | |
| | | @Override |
| | | public boolean hasValue(Entry entry, VirtualAttributeRule rule, ByteString value) |
| | | { |
| | | Backend<?> backend = DirectoryServer.getBackend(entry.getName()); |
| | | LocalBackend<?> backend = DirectoryServer.getBackend(entry.getName()); |
| | | try |
| | | { |
| | | long count = backend.getNumberOfChildren(entry.getName()); |
| | |
| | | import org.forgerock.opendj.config.server.ConfigurationChangeListener; |
| | | import org.forgerock.opendj.server.config.server.IdentityMapperCfg; |
| | | import org.forgerock.opendj.server.config.server.RegularExpressionIdentityMapperCfg; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.IdentityMapper; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | |
| | | { |
| | | for (DN baseDN : cfgBaseDNs) |
| | | { |
| | | Backend b = DirectoryServer.getBackend(baseDN); |
| | | LocalBackend b = DirectoryServer.getBackend(baseDN); |
| | | if (b != null && ! b.isIndexed(t, IndexType.EQUALITY)) |
| | | { |
| | | throw new ConfigException(ERR_REGEXMAP_ATTR_UNINDEXED.get( |
| | |
| | | { |
| | | for (DN baseDN : cfgBaseDNs) |
| | | { |
| | | Backend b = DirectoryServer.getBackend(baseDN); |
| | | LocalBackend b = DirectoryServer.getBackend(baseDN); |
| | | if (b != null && ! b.isIndexed(t, IndexType.EQUALITY)) |
| | | { |
| | | unacceptableReasons.add(ERR_REGEXMAP_ATTR_UNINDEXED.get( |
| | |
| | | import org.forgerock.opendj.config.server.ConfigurationChangeListener; |
| | | import org.forgerock.opendj.server.config.server.EntryCacheCfg; |
| | | import org.forgerock.opendj.server.config.server.SoftReferenceEntryCacheCfg; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.DirectoryThread; |
| | | import org.opends.server.api.EntryCache; |
| | | import org.opends.server.api.MonitorData; |
| | |
| | | public void clearSubtree(DN baseDN) |
| | | { |
| | | // Determine the backend used to hold the specified base DN and clear it. |
| | | Backend<?> backend = DirectoryServer.getBackend(baseDN); |
| | | LocalBackend<?> backend = DirectoryServer.getBackend(baseDN); |
| | | if (backend == null) |
| | | { |
| | | // FIXME -- Should we clear everything just to be safe? |
| | |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.server.config.server.CertificateMapperCfg; |
| | | import org.forgerock.opendj.server.config.server.SubjectAttributeToUserAttributeCertificateMapperCfg; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.CertificateMapper; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | |
| | | { |
| | | for (AttributeType t : attributeMap.values()) |
| | | { |
| | | Backend<?> b = DirectoryServer.getBackend(baseDN); |
| | | LocalBackend<?> b = DirectoryServer.getBackend(baseDN); |
| | | if (b != null && ! b.isIndexed(t, IndexType.EQUALITY)) |
| | | { |
| | | logger.warn(WARN_SATUACM_ATTR_UNINDEXED, configuration.dn(), |
| | |
| | | { |
| | | for (AttributeType t : newAttributeMap.values()) |
| | | { |
| | | Backend<?> b = DirectoryServer.getBackend(baseDN); |
| | | LocalBackend<?> b = DirectoryServer.getBackend(baseDN); |
| | | if (b != null && !b.isIndexed(t, IndexType.EQUALITY)) |
| | | { |
| | | LocalizableMessage message = |
| | |
| | | import org.forgerock.opendj.config.server.ConfigurationChangeListener; |
| | | import org.forgerock.opendj.server.config.server.CertificateMapperCfg; |
| | | import org.forgerock.opendj.server.config.server.SubjectDNToUserAttributeCertificateMapperCfg; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.CertificateMapper; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | |
| | | AttributeType t = configuration.getSubjectAttribute(); |
| | | for (DN baseDN : cfgBaseDNs) |
| | | { |
| | | Backend b = DirectoryServer.getBackend(baseDN); |
| | | LocalBackend b = DirectoryServer.getBackend(baseDN); |
| | | if (b != null && ! b.isIndexed(t, IndexType.EQUALITY)) |
| | | { |
| | | logger.warn(WARN_SATUACM_ATTR_UNINDEXED, configuration.dn(), |
| | |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.schema.ObjectClass; |
| | | import org.forgerock.opendj.server.config.server.MonitorProviderCfg; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.MonitorData; |
| | | import org.opends.server.api.MonitorProvider; |
| | | import org.opends.server.core.DirectoryServer; |
| | |
| | | extends MonitorProvider<MonitorProviderCfg> |
| | | { |
| | | /** The backend with which this monitor is associated. */ |
| | | private Backend<?> backend; |
| | | private LocalBackend<?> backend; |
| | | |
| | | /** The name for this monitor. */ |
| | | private String monitorName; |
| | |
| | | * |
| | | * @param backend The backend with which this monitor is associated. |
| | | */ |
| | | public BackendMonitor(Backend<?> backend) |
| | | public BackendMonitor(LocalBackend<?> backend) |
| | | { |
| | | this.backend = backend; |
| | | } |
| | |
| | | import org.forgerock.opendj.server.config.server.PasswordPolicyImportPluginCfg; |
| | | import org.forgerock.opendj.server.config.server.PluginCfg; |
| | | import org.opends.server.api.AuthenticationPolicy; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.ImportTaskListener; |
| | | import org.opends.server.api.PasswordStorageScheme; |
| | | import org.opends.server.api.plugin.DirectoryServerPlugin; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void processImportBegin(Backend<?> backend, LDIFImportConfig config) |
| | | public void processImportBegin(LocalBackend<?> backend, LDIFImportConfig config) |
| | | { |
| | | // Find the set of attribute types with the auth password and user password |
| | | // syntax defined in the schema. |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void processImportEnd(Backend<?> backend, LDIFImportConfig config, boolean successful) |
| | | public void processImportEnd(LocalBackend<?> backend, LDIFImportConfig config, boolean successful) |
| | | { |
| | | // No implementation is required. |
| | | } |
| | |
| | | import org.forgerock.opendj.server.config.meta.ReferentialIntegrityPluginCfgDefn.CheckReferencesScopeCriteria; |
| | | import org.forgerock.opendj.server.config.server.PluginCfg; |
| | | import org.forgerock.opendj.server.config.server.ReferentialIntegrityPluginCfg; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.DirectoryThread; |
| | | import org.opends.server.api.ServerShutdownListener; |
| | | import org.opends.server.api.plugin.DirectoryServerPlugin; |
| | |
| | | |
| | | for (DN baseDN : cfgBaseDNs) |
| | | { |
| | | Backend<?> b = DirectoryServer.getBackend(baseDN); |
| | | LocalBackend<?> b = DirectoryServer.getBackend(baseDN); |
| | | if (b != null && !b.isIndexed(type, IndexType.EQUALITY)) |
| | | { |
| | | isAcceptable = false; |
| | |
| | | import org.forgerock.opendj.server.config.server.PluginCfg; |
| | | import org.forgerock.opendj.server.config.server.UniqueAttributePluginCfg; |
| | | import org.opends.server.api.AlertGenerator; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.plugin.DirectoryServerPlugin; |
| | | import org.opends.server.api.plugin.PluginResult; |
| | | import org.opends.server.api.plugin.PluginResult.PostOperation; |
| | |
| | | { |
| | | for (DN baseDN : cfgBaseDNs) |
| | | { |
| | | Backend<?> b = DirectoryServer.getBackend(baseDN); |
| | | LocalBackend<?> b = DirectoryServer.getBackend(baseDN); |
| | | if (b != null && ! b.isIndexed(t, IndexType.EQUALITY)) |
| | | { |
| | | throw new ConfigException(ERR_PLUGIN_UNIQUEATTR_ATTR_UNINDEXED.get( |
| | |
| | | { |
| | | for (DN baseDN : cfgBaseDNs) |
| | | { |
| | | Backend<?> b = DirectoryServer.getBackend(baseDN); |
| | | LocalBackend<?> b = DirectoryServer.getBackend(baseDN); |
| | | if (b != null && ! b.isIndexed(t, IndexType.EQUALITY)) |
| | | { |
| | | unacceptableReasons.add(ERR_PLUGIN_UNIQUEATTR_ATTR_UNINDEXED.get( |
| | |
| | | import org.forgerock.opendj.server.config.server.ExternalChangelogDomainCfg; |
| | | import org.forgerock.opendj.server.config.server.ReplicationDomainCfg; |
| | | import org.opends.server.api.AlertGenerator; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.Backend.BackendOperation; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.LocalBackend.BackendOperation; |
| | | import org.opends.server.api.BackendInitializationListener; |
| | | import org.opends.server.api.DirectoryThread; |
| | | import org.opends.server.api.MonitorData; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void performBackendPreInitializationProcessing(Backend<?> backend) { |
| | | public void performBackendPreInitializationProcessing(LocalBackend<?> backend) { |
| | | // Nothing to do |
| | | } |
| | | |
| | | @Override |
| | | public void performBackendPostFinalizationProcessing(Backend<?> backend) { |
| | | public void performBackendPostFinalizationProcessing(LocalBackend<?> backend) { |
| | | // Nothing to do |
| | | } |
| | | |
| | | @Override |
| | | public void performBackendPostInitializationProcessing(Backend<?> backend) { |
| | | public void performBackendPostInitializationProcessing(LocalBackend<?> backend) { |
| | | if (!ignoreBackendInitializationEvent |
| | | && getBackend().getBackendID().equals(backend.getBackendID())) { |
| | | enable(); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void performBackendPreFinalizationProcessing(Backend<?> backend) { |
| | | public void performBackendPreFinalizationProcessing(LocalBackend<?> backend) { |
| | | // Do not disable itself during a shutdown |
| | | // And ignore the event if this replica is the event trigger (e.g. importing). |
| | | if (!ignoreBackendInitializationEvent |
| | |
| | | storeECLConfiguration(configuration); |
| | | solveConflictFlag = isSolveConflict(configuration); |
| | | |
| | | Backend<?> backend = getBackend(); |
| | | LocalBackend<?> backend = getBackend(); |
| | | if (backend == null) |
| | | { |
| | | throw new ConfigException(ERR_SEARCHING_DOMAIN_BACKEND.get(getBaseDN())); |
| | |
| | | private long exportBackend(OutputStream output, boolean checksumOutput) |
| | | throws DirectoryException |
| | | { |
| | | Backend<?> backend = getBackend(); |
| | | LocalBackend<?> backend = getBackend(); |
| | | |
| | | // Acquire a shared lock for the backend. |
| | | try |
| | |
| | | * @throws DirectoryException |
| | | * If the backend could not be disabled or locked exclusively. |
| | | */ |
| | | private void preBackendImport(Backend<?> backend) throws DirectoryException |
| | | private void preBackendImport(LocalBackend<?> backend) throws DirectoryException |
| | | { |
| | | // Prevent the processing of the backend finalisation event as the import will disable the attached backend |
| | | ignoreBackendInitializationEvent = true; |
| | |
| | | @Override |
| | | protected void importBackend(InputStream input) throws DirectoryException |
| | | { |
| | | Backend<?> backend = getBackend(); |
| | | LocalBackend<?> backend = getBackend(); |
| | | |
| | | LDIFImportConfig importConfig = null; |
| | | ImportExportContext ieCtx = getImportExportContext(); |
| | |
| | | * @param backend The backend implied in the import. |
| | | * @exception DirectoryException Thrown when an error occurs. |
| | | */ |
| | | private void closeBackendImport(Backend<?> backend) throws DirectoryException |
| | | private void closeBackendImport(LocalBackend<?> backend) throws DirectoryException |
| | | { |
| | | String lockFile = LockFileManager.getBackendLockFileName(backend); |
| | | StringBuilder failureReason = new StringBuilder(); |
| | |
| | | * Returns the backend associated to this domain. |
| | | * @return The associated backend. |
| | | */ |
| | | private Backend<?> getBackend() |
| | | private LocalBackend<?> getBackend() |
| | | { |
| | | return DirectoryServer.getBackend(getBaseDN()); |
| | | } |
| | |
| | | @Override |
| | | public long countEntries() throws DirectoryException |
| | | { |
| | | Backend<?> backend = getBackend(); |
| | | LocalBackend<?> backend = getBackend(); |
| | | if (!backend.supports(BackendOperation.LDIF_EXPORT)) |
| | | { |
| | | LocalizableMessage msg = ERR_INIT_EXPORT_NOT_SUPPORTED.get(backend.getBackendID()); |
| | |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.server.config.server.ReplicationDomainCfg; |
| | | import org.forgerock.opendj.server.config.server.ReplicationSynchronizationProviderCfg; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.BackupTaskListener; |
| | | import org.opends.server.api.ExportTaskListener; |
| | | import org.opends.server.api.ImportTaskListener; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void processBackupBegin(Backend<?> backend, BackupConfig config) |
| | | public void processBackupBegin(LocalBackend<?> backend, BackupConfig config) |
| | | { |
| | | for (DN dn : backend.getBaseDNs()) |
| | | { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void processBackupEnd(Backend<?> backend, BackupConfig config, boolean successful) |
| | | public void processBackupEnd(LocalBackend<?> backend, BackupConfig config, boolean successful) |
| | | { |
| | | for (DN dn : backend.getBaseDNs()) |
| | | { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void processRestoreBegin(Backend<?> backend, RestoreConfig config) |
| | | public void processRestoreBegin(LocalBackend<?> backend, RestoreConfig config) |
| | | { |
| | | for (DN dn : backend.getBaseDNs()) |
| | | { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void processRestoreEnd(Backend<?> backend, RestoreConfig config, boolean successful) |
| | | public void processRestoreEnd(LocalBackend<?> backend, RestoreConfig config, boolean successful) |
| | | { |
| | | for (DN dn : backend.getBaseDNs()) |
| | | { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void processImportBegin(Backend<?> backend, LDIFImportConfig config) |
| | | public void processImportBegin(LocalBackend<?> backend, LDIFImportConfig config) |
| | | { |
| | | for (DN dn : backend.getBaseDNs()) |
| | | { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void processImportEnd(Backend<?> backend, LDIFImportConfig config, boolean successful) |
| | | public void processImportEnd(LocalBackend<?> backend, LDIFImportConfig config, boolean successful) |
| | | { |
| | | for (DN dn : backend.getBaseDNs()) |
| | | { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void processExportBegin(Backend<?> backend, LDIFExportConfig config) |
| | | public void processExportBegin(LocalBackend<?> backend, LDIFExportConfig config) |
| | | { |
| | | for (DN dn : backend.getBaseDNs()) |
| | | { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void processExportEnd(Backend<?> backend, LDIFExportConfig config, boolean successful) |
| | | public void processExportEnd(LocalBackend<?> backend, LDIFExportConfig config, boolean successful) |
| | | { |
| | | for (DN dn : backend.getBaseDNs()) |
| | | { |
| | |
| | | import org.opends.messages.Severity; |
| | | import org.opends.messages.TaskMessages; |
| | | import org.forgerock.opendj.server.config.server.BackendCfg; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.Backend.BackendOperation; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.LocalBackend.BackendOperation; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.backends.task.Task; |
| | | import org.opends.server.backends.task.TaskState; |
| | |
| | | */ |
| | | private Map<String,Entry> configEntries; |
| | | |
| | | private ArrayList<Backend<?>> backendsToArchive; |
| | | private ArrayList<LocalBackend<?>> backendsToArchive; |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | |
| | | { |
| | | for (Map.Entry<String,Entry> mapEntry : configEntries.entrySet()) |
| | | { |
| | | Backend<?> b = DirectoryServer.getBackend(mapEntry.getKey()); |
| | | LocalBackend<?> b = DirectoryServer.getBackend(mapEntry.getKey()); |
| | | if (b != null && b.supports(BackendOperation.BACKUP)) |
| | | { |
| | | backendsToArchive.add(b); |
| | |
| | | // be used. |
| | | for (String id : backendIDList) |
| | | { |
| | | Backend<?> b = DirectoryServer.getBackend(id); |
| | | LocalBackend<?> b = DirectoryServer.getBackend(id); |
| | | if (b == null || configEntries.get(id) == null) |
| | | { |
| | | logger.error(ERR_BACKUPDB_NO_BACKENDS_FOR_ID, id); |
| | |
| | | * @param backupLocation The backup directory. |
| | | * @return true if the backend was successfully archived. |
| | | */ |
| | | private boolean backupBackend(Backend<?> b, File backupLocation) |
| | | private boolean backupBackend(LocalBackend<?> b, File backupLocation) |
| | | { |
| | | // Get the config entry for this backend. |
| | | BackendCfg cfg = TaskUtils.getConfigEntry(b); |
| | |
| | | * @param b The backend on which the lock is to be acquired. |
| | | * @return true if the lock was successfully acquired. |
| | | */ |
| | | private boolean lockBackend(Backend<?> b) |
| | | private boolean lockBackend(LocalBackend<?> b) |
| | | { |
| | | try |
| | | { |
| | |
| | | * @param b The backend on which the lock is held. |
| | | * @return true if the lock was successfully released. |
| | | */ |
| | | private boolean unlockBackend(Backend<?> b) |
| | | private boolean unlockBackend(LocalBackend<?> b) |
| | | { |
| | | try |
| | | { |
| | |
| | | |
| | | // Iterate through the backends to archive and back them up individually. |
| | | boolean errorsEncountered = false; |
| | | for (Backend<?> b : backendsToArchive) |
| | | for (LocalBackend<?> b : backendsToArchive) |
| | | { |
| | | if (isCancelled()) |
| | | { |
| | |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.messages.Severity; |
| | | import org.opends.messages.TaskMessages; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.Backend.BackendOperation; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.LocalBackend.BackendOperation; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.backends.task.Task; |
| | | import org.opends.server.backends.task.TaskState; |
| | |
| | | |
| | | // Get the backend into which the LDIF should be imported. |
| | | |
| | | Backend<?> backend = DirectoryServer.getBackend(backendID); |
| | | LocalBackend<?> backend = DirectoryServer.getBackend(backendID); |
| | | |
| | | if (backend == null) |
| | | { |
| | |
| | | return TaskState.STOPPED_BY_ERROR; |
| | | } |
| | | |
| | | if (! Backend.handlesEntry(includeBranch, defaultIncludeBranches, |
| | | if (! LocalBackend.handlesEntry(includeBranch, defaultIncludeBranches, |
| | | excludeBranches)) |
| | | { |
| | | logger.error(ERR_LDIFEXPORT_INVALID_INCLUDE_BASE, s, backendID); |
| | |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.messages.Severity; |
| | | import org.opends.messages.TaskMessages; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.Backend.BackendOperation; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.LocalBackend.BackendOperation; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.backends.task.Task; |
| | | import org.opends.server.backends.task.TaskState; |
| | |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); |
| | | } |
| | | |
| | | Backend<?> backend = null; |
| | | LocalBackend<?> backend = null; |
| | | ArrayList<DN> defaultIncludeBranches; |
| | | HashSet<DN> excludeBranches = new HashSet<>(excludeBranchStrings.size()); |
| | | HashSet<DN> includeBranches = new HashSet<>(includeBranchStrings.size()); |
| | |
| | | // Find the backend that includes all the branches. |
| | | for(DN includeBranch : includeBranches) |
| | | { |
| | | Backend<?> locatedBackend = DirectoryServer.getBackend(includeBranch); |
| | | LocalBackend<?> locatedBackend = DirectoryServer.getBackend(includeBranch); |
| | | if(locatedBackend != null) |
| | | { |
| | | if(backend == null) |
| | |
| | | |
| | | for(DN includeBranch : includeBranches) |
| | | { |
| | | if (!Backend.handlesEntry(includeBranch, defaultIncludeBranches, excludeBranches)) |
| | | if (!LocalBackend.handlesEntry(includeBranch, defaultIncludeBranches, excludeBranches)) |
| | | { |
| | | LocalizableMessage message = ERR_LDIFIMPORT_INVALID_INCLUDE_BASE.get( |
| | | includeBranch, backend.getBackendID()); |
| | |
| | | } |
| | | |
| | | // Get the backend into which the LDIF should be imported. |
| | | Backend<?> backend = null; |
| | | LocalBackend<?> backend = null; |
| | | HashSet<DN> defaultIncludeBranches; |
| | | HashSet<DN> excludeBranches = new HashSet<>(excludeBranchStrings.size()); |
| | | HashSet<DN> includeBranches = new HashSet<>(includeBranchStrings.size()); |
| | |
| | | // Find the backend that includes all the branches. |
| | | for(DN includeBranch : includeBranches) |
| | | { |
| | | Backend<?> locatedBackend = DirectoryServer.getBackend(includeBranch); |
| | | LocalBackend<?> locatedBackend = DirectoryServer.getBackend(includeBranch); |
| | | if(locatedBackend != null) |
| | | { |
| | | if(backend == null) |
| | |
| | | |
| | | if (backend.getSubordinateBackends() != null) |
| | | { |
| | | for (Backend<?> subBackend : backend.getSubordinateBackends()) |
| | | for (LocalBackend<?> subBackend : backend.getSubordinateBackends()) |
| | | { |
| | | for (DN baseDN : subBackend.getBaseDNs()) |
| | | { |
| | |
| | | // Make sure the selected backend will handle all the include branches |
| | | for (DN includeBranch : includeBranches) |
| | | { |
| | | if (! Backend.handlesEntry(includeBranch, defaultIncludeBranches, |
| | | if (! LocalBackend.handlesEntry(includeBranch, defaultIncludeBranches, |
| | | excludeBranches)) |
| | | { |
| | | logger.error(ERR_LDIFIMPORT_INVALID_INCLUDE_BASE, includeBranch, backend.getBackendID()); |
| | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.messages.TaskMessages; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.Backend.BackendOperation; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.LocalBackend.BackendOperation; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.backends.RebuildConfig; |
| | | import org.opends.server.backends.RebuildConfig.RebuildMode; |
| | |
| | | rebuildConfig.setTmpDirectory(tmpDirectory); |
| | | rebuildConfig.setRebuildMode(rebuildMode); |
| | | |
| | | final Backend<?> backend = DirectoryServer.getBackendWithBaseDN(rebuildConfig.getBaseDN()); |
| | | final LocalBackend<?> backend = DirectoryServer.getBackendWithBaseDN(rebuildConfig.getBaseDN()); |
| | | if (backend == null) |
| | | { |
| | | logger.error(ERR_NO_BACKENDS_FOR_BASE, baseDN); |
| | |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.messages.Severity; |
| | | import org.opends.messages.TaskMessages; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.Backend.BackendOperation; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.LocalBackend.BackendOperation; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.backends.task.Task; |
| | | import org.opends.server.backends.task.TaskState; |
| | |
| | | * @param backend The backend on which the lock is to be acquired. |
| | | * @return true if the lock was successfully acquired. |
| | | */ |
| | | private boolean lockBackend(Backend<?> backend) |
| | | private boolean lockBackend(LocalBackend<?> backend) |
| | | { |
| | | try |
| | | { |
| | |
| | | * @param backend The backend on which the lock is held. |
| | | * @return true if the lock was successfully released. |
| | | */ |
| | | private boolean unlockBackend(Backend<?> backend) |
| | | private boolean unlockBackend(LocalBackend<?> backend) |
| | | { |
| | | try |
| | | { |
| | |
| | | |
| | | String backendID = TaskUtils.getBackendID(configEntry); |
| | | |
| | | Backend<?> backend = DirectoryServer.getBackend(backendID); |
| | | LocalBackend<?> backend = DirectoryServer.getBackend(backendID); |
| | | if (!backend.supports(BackendOperation.RESTORE)) |
| | | { |
| | | logger.error(ERR_RESTOREDB_CANNOT_RESTORE, backend.getBackendID()); |
| | |
| | | import org.forgerock.opendj.ldap.requests.ModifyRequest; |
| | | import org.forgerock.opendj.server.config.server.BackendCfg; |
| | | import org.forgerock.opendj.server.config.server.RootCfg; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.config.ConfigurationHandler; |
| | | import org.opends.server.core.DirectoryServer; |
| | |
| | | * @return The configuration entry of the backend, or null if it could not |
| | | * be found. |
| | | */ |
| | | public static BackendCfg getConfigEntry(Backend<?> backend) |
| | | public static BackendCfg getConfigEntry(LocalBackend<?> backend) |
| | | { |
| | | try |
| | | { |
| | |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.server.config.server.BackendCfg; |
| | | import org.forgerock.util.Utils; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.Backend.BackendOperation; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.LocalBackend.BackendOperation; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.LockFileManager; |
| | | import org.opends.server.loggers.JDKLogging; |
| | |
| | | |
| | | // Get information about the backends defined in the server, and determine |
| | | // whether we are backing up multiple backends or a single backend. |
| | | List<Backend<?>> backendList = new ArrayList<>(); |
| | | List<LocalBackend<?>> backendList = new ArrayList<>(); |
| | | List<BackendCfg> entryList = new ArrayList<>(); |
| | | List<List<DN>> dnList = new ArrayList<>(); |
| | | BackendToolUtils.getBackends(backendList, entryList, dnList); |
| | | int numBackends = backendList.size(); |
| | | |
| | | boolean multiple; |
| | | List<Backend<?>> backendsToArchive = new ArrayList<>(numBackends); |
| | | List<LocalBackend<?>> backendsToArchive = new ArrayList<>(numBackends); |
| | | Map<String, BackendCfg> configEntries = new HashMap<>(numBackends); |
| | | if (backUpAll.isPresent()) |
| | | { |
| | | for (int i=0; i < numBackends; i++) |
| | | { |
| | | Backend<?> b = backendList.get(i); |
| | | LocalBackend<?> b = backendList.get(i); |
| | | if (b.supports(BackendOperation.BACKUP)) |
| | | { |
| | | backendsToArchive.add(b); |
| | |
| | | HashSet<String> requestedBackends = new HashSet<>(backendID.getValues()); |
| | | for (int i=0; i < numBackends; i++) |
| | | { |
| | | Backend<?> b = backendList.get(i); |
| | | LocalBackend<?> b = backendList.get(i); |
| | | if (requestedBackends.contains(b.getBackendID())) |
| | | { |
| | | if (b.supports(BackendOperation.BACKUP)) |
| | |
| | | |
| | | // Iterate through the backends to archive and back them up individually. |
| | | boolean errorsEncountered = false; |
| | | for (Backend<?> b : backendsToArchive) |
| | | for (LocalBackend<?> b : backendsToArchive) |
| | | { |
| | | if (!acquireSharedLock(b)) |
| | | { |
| | |
| | | return 0; |
| | | } |
| | | |
| | | private boolean acquireSharedLock(Backend<?> b) |
| | | private boolean acquireSharedLock(LocalBackend<?> b) |
| | | { |
| | | try |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | private boolean releaseSharedLock(Backend<?> b) |
| | | private boolean releaseSharedLock(LocalBackend<?> b) |
| | | { |
| | | try |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | private void unlockBackend(Backend<?> b) |
| | | private void unlockBackend(LocalBackend<?> b) |
| | | { |
| | | try |
| | | { |
| | |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.server.config.server.BackendCfg; |
| | | import org.forgerock.opendj.server.config.server.RootCfg; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.config.ConfigurationHandler; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.Attribute; |
| | |
| | | * @return 0 if everything went fine. 1 if an error occurred. |
| | | */ |
| | | @SuppressWarnings({ "unchecked", "rawtypes" }) |
| | | public static int getBackends(final List<Backend<?>> backendList, final List<BackendCfg> entryList, |
| | | public static int getBackends(final List<LocalBackend<?>> backendList, final List<BackendCfg> entryList, |
| | | final List<List<DN>> dnList) |
| | | { |
| | | try |
| | |
| | | } |
| | | |
| | | final Class<?> backendClass = getBackendClass(backendClassName, configEntry); |
| | | final Backend backend; |
| | | final LocalBackend backend; |
| | | final BackendCfg cfg; |
| | | try |
| | | { |
| | | backend = (Backend) backendClass.newInstance(); |
| | | backend = (LocalBackend) backendClass.newInstance(); |
| | | backend.setBackendID(backendID); |
| | | cfg = root.getBackend(backendID); |
| | | backend.configureBackend(cfg, DirectoryServer.getInstance().getServerContext()); |
| | |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.server.config.server.BackendCfg; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.Backend.BackendOperation; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.LocalBackend.BackendOperation; |
| | | import org.opends.server.api.plugin.PluginType; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.LockFileManager; |
| | |
| | | // through them, finding the one backend that should be used for the export, |
| | | // and also finding backends with subordinate base DNs that should be |
| | | // excluded from the export. |
| | | Backend<?> backend = null; |
| | | LocalBackend<?> backend = null; |
| | | List<DN> baseDNList = null; |
| | | List<DN> defaultIncludeBranches = null; |
| | | ArrayList<DN> excludeBranches = null; |
| | | |
| | | List<Backend<?>> backendList = new ArrayList<>(); |
| | | List<LocalBackend<?>> backendList = new ArrayList<>(); |
| | | List<BackendCfg> entryList = new ArrayList<>(); |
| | | List<List<DN>> dnList = new ArrayList<>(); |
| | | BackendToolUtils.getBackends(backendList, entryList, dnList); |
| | |
| | | int numBackends = backendList.size(); |
| | | for (int i=0; i < numBackends; i++) |
| | | { |
| | | Backend<?> b = backendList.get(i); |
| | | LocalBackend<?> b = backendList.get(i); |
| | | if (! backendID.getValue().equals(b.getBackendID())) |
| | | { |
| | | continue; |
| | |
| | | return 1; |
| | | } |
| | | |
| | | if (! Backend.handlesEntry(includeBranch, defaultIncludeBranches, |
| | | if (! LocalBackend.handlesEntry(includeBranch, defaultIncludeBranches, |
| | | excludeBranches)) |
| | | { |
| | | logger.error(ERR_LDIFEXPORT_INVALID_INCLUDE_BASE, s, backendID.getValue()); |
| | |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.server.config.server.BackendCfg; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.Backend.BackendOperation; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.LocalBackend.BackendOperation; |
| | | import org.opends.server.api.plugin.PluginType; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.DirectoryServer.InitializationBuilder; |
| | |
| | | // through them, finding the one backend into which the LDIF should be |
| | | // imported and finding backends with subordinate base DNs that should be |
| | | // excluded from the import. |
| | | Backend<?> backend = null; |
| | | LocalBackend<?> backend = null; |
| | | Set<DN> defaultIncludeBranches = null; |
| | | Set<DN> excludeBranches = new HashSet<>(); |
| | | Set<DN> includeBranches = new HashSet<>(); |
| | |
| | | } |
| | | } |
| | | |
| | | ArrayList<Backend<?>> backendList = new ArrayList<>(); |
| | | ArrayList<LocalBackend<?>> backendList = new ArrayList<>(); |
| | | ArrayList<BackendCfg> entryList = new ArrayList<>(); |
| | | ArrayList<List<DN>> dnList = new ArrayList<>(); |
| | | int code = BackendToolUtils.getBackends(backendList, entryList, dnList); |
| | |
| | | int numBackends = backendList.size(); |
| | | for (int i=0; i < numBackends; i++) |
| | | { |
| | | Backend<?> b = backendList.get(i); |
| | | LocalBackend<?> b = backendList.get(i); |
| | | |
| | | if(backendID.isPresent()) |
| | | { |
| | |
| | | // Make sure the selected backend will handle all the include branches |
| | | for(DN includeBranch : includeBranches) |
| | | { |
| | | if (! Backend.handlesEntry(includeBranch, defaultIncludeBranches, |
| | | if (! LocalBackend.handlesEntry(includeBranch, defaultIncludeBranches, |
| | | excludeBranches)) |
| | | { |
| | | logger.error(ERR_LDIFIMPORT_INVALID_INCLUDE_BASE, includeBranch, backendID.getValue()); |
| | |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.server.config.server.BackendCfg; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.Backend.BackendOperation; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.LocalBackend.BackendOperation; |
| | | import org.opends.server.backends.RebuildConfig; |
| | | import org.opends.server.backends.RebuildConfig.RebuildMode; |
| | | import org.opends.server.core.DirectoryServer; |
| | |
| | | INFO_REBUILDINDEX_TOOL_DESCRIPTION.get()); |
| | | |
| | | private RebuildConfig rebuildConfig = new RebuildConfig(); |
| | | private Backend<?> currentBackend; |
| | | private LocalBackend<?> currentBackend; |
| | | |
| | | /** |
| | | * Processes the command-line arguments and invokes the rebuild process. |
| | |
| | | * process. |
| | | * @return An integer representing the result of the process. |
| | | */ |
| | | private int rebuildIndex(final Backend<?> backend, final RebuildConfig rebuildConfig) |
| | | private int rebuildIndex(final LocalBackend<?> backend, final RebuildConfig rebuildConfig) |
| | | { |
| | | // Acquire an exclusive lock for the backend. |
| | | //TODO: Find a way to do this with the server online. |
| | |
| | | * @throws Exception |
| | | * If an exception occurred during the backend search. |
| | | */ |
| | | private Backend<?> retrieveBackend(final DN selectedDN) throws ConfigException, Exception |
| | | private LocalBackend<?> retrieveBackend(final DN selectedDN) throws ConfigException, Exception |
| | | { |
| | | final List<Backend<?>> backendList = new ArrayList<>(); |
| | | final List<LocalBackend<?>> backendList = new ArrayList<>(); |
| | | final List<BackendCfg> entryList = new ArrayList<>(); |
| | | final List<List<DN>> dnList = new ArrayList<>(); |
| | | BackendToolUtils.getBackends(backendList, entryList, dnList); |
| | | |
| | | Backend<?> backend = null; |
| | | LocalBackend<?> backend = null; |
| | | final int numBackends = backendList.size(); |
| | | for (int i = 0; i < numBackends; i++) |
| | | { |
| | | final Backend<?> b = backendList.get(i); |
| | | final LocalBackend<?> b = backendList.get(i); |
| | | final List<DN> baseDNs = dnList.get(i); |
| | | if (baseDNs.contains(selectedDN)) |
| | | { |
| | |
| | | * |
| | | * @return The current backend. |
| | | */ |
| | | public Backend<?> getCurrentBackend() |
| | | public LocalBackend<?> getCurrentBackend() |
| | | { |
| | | return currentBackend; |
| | | } |
| | |
| | | * @param currentBackend |
| | | * The current backend to set. |
| | | */ |
| | | public void setCurrentBackend(Backend<?> currentBackend) |
| | | public void setCurrentBackend(LocalBackend<?> currentBackend) |
| | | { |
| | | this.currentBackend = currentBackend; |
| | | } |
| | |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.server.config.server.BackendCfg; |
| | | import org.forgerock.util.Utils; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.Backend.BackendOperation; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.LocalBackend.BackendOperation; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.LockFileManager; |
| | | import org.opends.server.loggers.JDKLogging; |
| | |
| | | |
| | | // Get information about the backends defined in the server and determine |
| | | // which to use for the restore. |
| | | List<Backend<?>> backendList = new ArrayList<>(); |
| | | List<LocalBackend<?>> backendList = new ArrayList<>(); |
| | | List<BackendCfg> entryList = new ArrayList<>(); |
| | | List<List<DN>> dnList = new ArrayList<>(); |
| | | BackendToolUtils.getBackends(backendList, entryList, dnList); |
| | | |
| | | |
| | | Backend<?> backend = null; |
| | | LocalBackend<?> backend = null; |
| | | int numBackends = backendList.size(); |
| | | for (int i=0; i < numBackends; i++) |
| | | { |
| | | Backend<?> b = backendList.get(i); |
| | | LocalBackend<?> b = backendList.get(i); |
| | | BackendCfg e = entryList.get(i); |
| | | if (e.dn().equals(configEntryDN)) |
| | | { |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.server.config.server.BackendCfg; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.Backend.BackendOperation; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.LocalBackend.BackendOperation; |
| | | import org.opends.server.backends.VerifyConfig; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.DirectoryServer.DirectoryServerVersionHandler; |
| | |
| | | |
| | | // Get information about the backends defined in the server. Iterate |
| | | // through them, finding the one backend to be verified. |
| | | List<Backend<?>> backendList = new ArrayList<>(); |
| | | List<LocalBackend<?>> backendList = new ArrayList<>(); |
| | | List<BackendCfg> entryList = new ArrayList<>(); |
| | | List<List<DN>> dnList = new ArrayList<>(); |
| | | BackendToolUtils.getBackends(backendList, entryList, dnList); |
| | | |
| | | Backend<?> backend = null; |
| | | LocalBackend<?> backend = null; |
| | | int numBackends = backendList.size(); |
| | | for (int i=0; i < numBackends; i++) |
| | | { |
| | | Backend<?> b = backendList.get(i); |
| | | LocalBackend<?> b = backendList.get(i); |
| | | List<DN> baseDNs = dnList.get(i); |
| | | |
| | | if (baseDNs.contains(verifyBaseDN)) |
| | |
| | | import org.forgerock.opendj.ldap.schema.Syntax; |
| | | import org.opends.server.api.AccessControlHandler; |
| | | import org.opends.server.api.AuthenticationPolicy; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.api.PasswordStorageScheme; |
| | | import org.opends.server.api.PasswordValidator; |
| | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** The backend in which the entry is to be added. */ |
| | | private Backend<?> backend; |
| | | private LocalBackend<?> backend; |
| | | |
| | | /** Indicates whether the request includes the LDAP no-op control. */ |
| | | private boolean noOp; |
| | |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.server.config.meta.PasswordPolicyCfgDefn; |
| | | import org.opends.server.api.AuthenticationPolicyState; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.api.SASLMechanismHandler; |
| | | import org.opends.server.controls.*; |
| | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** The backend in which the bind operation should be processed. */ |
| | | private Backend<?> backend; |
| | | private LocalBackend<?> backend; |
| | | |
| | | /** |
| | | * Indicates whether the bind response should include the first warning |
| | |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.api.AccessControlHandler; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.backends.ConfigurationBackend; |
| | | import org.opends.server.controls.LDAPAssertionRequestControl; |
| | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** The backend in which the comparison is to be performed. */ |
| | | private Backend<?> backend; |
| | | private LocalBackend<?> backend; |
| | | /** The client connection for this operation. */ |
| | | private ClientConnection clientConnection; |
| | | /** The DN of the entry to compare. */ |
| | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.api.AccessControlHandler; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.api.SynchronizationProvider; |
| | | import org.opends.server.controls.LDAPAssertionRequestControl; |
| | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** The backend in which the operation is to be processed. */ |
| | | private Backend<?> backend; |
| | | private LocalBackend<?> backend; |
| | | |
| | | /** Indicates whether the LDAP no-op control has been requested. */ |
| | | private boolean noOp; |
| | |
| | | // the entry actually exists and does not have any children (or possibly |
| | | // handling a subtree delete). But we will need to check if there are |
| | | // any subordinate backends that should stop us from attempting the delete |
| | | for (Backend<?> b : backend.getSubordinateBackends()) |
| | | for (LocalBackend<?> b : backend.getSubordinateBackends()) |
| | | { |
| | | for (DN dn : b.getBaseDNs()) |
| | | { |
| | |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.api.AccessControlHandler; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.api.SynchronizationProvider; |
| | | import org.opends.server.controls.LDAPAssertionRequestControl; |
| | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** The backend in which the operation is to be processed. */ |
| | | private Backend<?> backend; |
| | | private LocalBackend<?> backend; |
| | | |
| | | /** Indicates whether the no-op control was included in the request. */ |
| | | private boolean noOp; |
| | |
| | | |
| | | // Get the backend for the current entry, and the backend for the new |
| | | // entry. If either is null, or if they are different, then fail. |
| | | Backend<?> currentBackend = backend; |
| | | LocalBackend<?> currentBackend = backend; |
| | | if (currentBackend == null) |
| | | { |
| | | setResultCode(ResultCode.NO_SUCH_OBJECT); |
| | |
| | | return; |
| | | } |
| | | |
| | | Backend<?> newBackend = DirectoryServer.getBackend(newDN); |
| | | LocalBackend<?> newBackend = DirectoryServer.getBackend(newDN); |
| | | if (newBackend == null) |
| | | { |
| | | setResultCode(ResultCode.NO_SUCH_OBJECT); |
| | |
| | | import org.forgerock.util.Utils; |
| | | import org.opends.server.api.AccessControlHandler; |
| | | import org.opends.server.api.AuthenticationPolicy; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.api.PasswordStorageScheme; |
| | | import org.opends.server.api.SynchronizationProvider; |
| | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** The backend in which the target entry exists. */ |
| | | private Backend<?> backend; |
| | | private LocalBackend<?> backend; |
| | | /** The client connection associated with this operation. */ |
| | | private ClientConnection clientConnection; |
| | | private boolean preOperationPluginsExecuted; |
| | |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.api.AccessControlHandler; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.controls.*; |
| | | import org.opends.server.core.*; |
| | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** The backend in which the search is to be performed. */ |
| | | private Backend<?> backend; |
| | | private LocalBackend<?> backend; |
| | | |
| | | /** The client connection for the search operation. */ |
| | | private ClientConnection clientConnection; |
| | |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.opends.server.api.AccessControlHandler; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.backends.RootDSEBackend; |
| | | import org.opends.server.controls.LDAPPostReadRequestControl; |
| | | import org.opends.server.controls.LDAPPostReadResponseControl; |
| | |
| | | private final DN baseDN; |
| | | |
| | | /** The backend associated with the local workflow element. */ |
| | | private final Backend<?> backend; |
| | | private final LocalBackend<?> backend; |
| | | |
| | | /** The set of local backend workflow elements registered with the server. */ |
| | | private static TreeMap<DN, LocalBackendWorkflowElement> registeredLocalBackends = new TreeMap<>(); |
| | |
| | | * @param backend |
| | | * the backend associated to that workflow element |
| | | */ |
| | | private LocalBackendWorkflowElement(DN baseDN, Backend<?> backend) |
| | | private LocalBackendWorkflowElement(DN baseDN, LocalBackend<?> backend) |
| | | { |
| | | this.baseDN = baseDN; |
| | | this.backend = backend; |
| | |
| | | * @return the existing local backend workflow element if it was already |
| | | * created or a newly created local backend workflow element. |
| | | */ |
| | | public static LocalBackendWorkflowElement createAndRegister(DN baseDN, Backend<?> backend) |
| | | public static LocalBackendWorkflowElement createAndRegister(DN baseDN, LocalBackend<?> backend) |
| | | { |
| | | LocalBackendWorkflowElement localBackend = registeredLocalBackends.get(baseDN); |
| | | if (localBackend == null) |
| | |
| | | * @return The backend associated with this local backend workflow |
| | | * element. |
| | | */ |
| | | public Backend<?> getBackend() |
| | | public LocalBackend<?> getBackend() |
| | | { |
| | | return backend; |
| | | } |
| | |
| | | * @throws DirectoryException |
| | | * If the update operation has been rejected. |
| | | */ |
| | | static void checkIfBackendIsWritable(Backend<?> backend, Operation op, |
| | | static void checkIfBackendIsWritable(LocalBackend<?> backend, Operation op, |
| | | DN entryDN, LocalizableMessageDescriptor.Arg1<Object> serverMsg, |
| | | LocalizableMessageDescriptor.Arg1<Object> backendMsg) |
| | | throws DirectoryException |
| | |
| | | private static Collection<LocalBackendWorkflowElement> getSubordinates(LocalBackendWorkflowElement workflow) |
| | | { |
| | | final DN baseDN = workflow.getBaseDN(); |
| | | final Backend<?> backend = workflow.getBackend(); |
| | | final LocalBackend<?> backend = workflow.getBackend(); |
| | | |
| | | final ArrayList<LocalBackendWorkflowElement> results = new ArrayList<>(); |
| | | for (Backend<?> subordinate : backend.getSubordinateBackends()) |
| | | for (LocalBackend<?> subordinate : backend.getSubordinateBackends()) |
| | | { |
| | | for (DN subordinateDN : subordinate.getBaseDNs()) |
| | | { |
| | |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.WorkQueue; |
| | | import org.opends.server.api.plugin.PluginType; |
| | | import org.opends.server.backends.MemoryBackend; |
| | |
| | | |
| | | private static void clearJEBackends() throws Exception |
| | | { |
| | | for (Backend<?> backend : DirectoryServer.getBackends()) |
| | | for (LocalBackend<?> backend : DirectoryServer.getBackends()) |
| | | { |
| | | if (backend instanceof BackendImpl) { |
| | | clearBackend(backend.getBackendID()); |
| | |
| | | */ |
| | | public static void clearBackend(String backendId, String baseDN) throws Exception |
| | | { |
| | | Backend<?> b = DirectoryServer.getBackend(backendId); |
| | | LocalBackend<?> b = DirectoryServer.getBackend(backendId); |
| | | if (clearBackend(b) && baseDN != null) |
| | | { |
| | | Entry e = createEntry(DN.valueOf(baseDN)); |
| | |
| | | } |
| | | } |
| | | |
| | | private static boolean clearBackend(Backend<?> b) |
| | | private static boolean clearBackend(LocalBackend<?> b) |
| | | { |
| | | if (b instanceof BackendImpl) |
| | | { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void processBackupBegin(Backend<?> backend, BackupConfig config) |
| | | public void processBackupBegin(LocalBackend<?> backend, BackupConfig config) |
| | | { |
| | | backupBeginCount.incrementAndGet(); |
| | | } |
| | | |
| | | @Override |
| | | public void processBackupEnd(Backend<?> backend, BackupConfig config, boolean successful) |
| | | public void processBackupEnd(LocalBackend<?> backend, BackupConfig config, boolean successful) |
| | | { |
| | | backupEndCount.incrementAndGet(); |
| | | } |
| | | |
| | | @Override |
| | | public void processRestoreBegin(Backend<?> backend, RestoreConfig config) |
| | | public void processRestoreBegin(LocalBackend<?> backend, RestoreConfig config) |
| | | { |
| | | restoreBeginCount.incrementAndGet(); |
| | | } |
| | | |
| | | @Override |
| | | public void processRestoreEnd(Backend<?> backend, RestoreConfig config, boolean successful) |
| | | public void processRestoreEnd(LocalBackend<?> backend, RestoreConfig config, boolean successful) |
| | | { |
| | | restoreEndCount.incrementAndGet(); |
| | | } |
| | | |
| | | @Override |
| | | public void processExportBegin(Backend<?> backend, LDIFExportConfig config) |
| | | public void processExportBegin(LocalBackend<?> backend, LDIFExportConfig config) |
| | | { |
| | | exportBeginCount.incrementAndGet(); |
| | | } |
| | | |
| | | @Override |
| | | public void processExportEnd(Backend<?> backend, LDIFExportConfig config, boolean successful) |
| | | public void processExportEnd(LocalBackend<?> backend, LDIFExportConfig config, boolean successful) |
| | | { |
| | | exportEndCount.incrementAndGet(); |
| | | } |
| | | |
| | | @Override |
| | | public void processImportBegin(Backend<?> backend, LDIFImportConfig config) |
| | | public void processImportBegin(LocalBackend<?> backend, LDIFImportConfig config) |
| | | { |
| | | importBeginCount.incrementAndGet(); |
| | | } |
| | | |
| | | @Override |
| | | public void processImportEnd(Backend<?> backend, LDIFImportConfig config, boolean successful) |
| | | public void processImportEnd(LocalBackend<?> backend, LDIFImportConfig config, boolean successful) |
| | | { |
| | | importEndCount.incrementAndGet(); |
| | | } |
| | |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.forgerock.opendj.server.config.server.ExternalChangelogDomainCfg; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.backends.ChangelogBackend.ChangeNumberRange; |
| | | import org.opends.server.controls.EntryChangelogNotificationControl; |
| | | import org.opends.server.controls.ExternalChangelogRequestControl; |
| | |
| | | { |
| | | String test = "CookieTwoSuffixes"; |
| | | debugInfo(test, "Starting test\n\n"); |
| | | Backend<?> backendForSecondSuffix = null; |
| | | LocalBackend<?> backendForSecondSuffix = null; |
| | | try |
| | | { |
| | | backendForSecondSuffix = initializeMemoryBackend(true, TEST_BACKEND_ID2); |
| | |
| | | debugInfo(test, "Starting test"); |
| | | |
| | | // Use o=test3 to avoid collision with o=test2 already used by a previous test |
| | | Backend<?> backend3 = null; |
| | | LocalBackend<?> backend3 = null; |
| | | LDAPReplicationDomain domain2 = null; |
| | | try { |
| | | ReplicationBroker broker = enableReplication(server1); |
| | |
| | | final DN baseDN4 = DN.valueOf("o=" + backendId4); |
| | | final String backendId5 = "test5"; |
| | | final DN baseDN5 = DN.valueOf("o=" + backendId5); |
| | | Backend<?> backend4 = null; |
| | | Backend<?> backend5 = null; |
| | | LocalBackend<?> backend4 = null; |
| | | LocalBackend<?> backend5 = null; |
| | | LDAPReplicationDomain domain4 = null; |
| | | LDAPReplicationDomain domain5 = null; |
| | | LDAPReplicationDomain domain41 = null; |
| | |
| | | } |
| | | |
| | | /** Creates a memory backend, to be used as additional backend in tests. */ |
| | | private static Backend<?> initializeMemoryBackend(boolean createBaseEntry, String backendId) throws Exception |
| | | private static LocalBackend<?> initializeMemoryBackend(boolean createBaseEntry, String backendId) throws Exception |
| | | { |
| | | DN baseDN = DN.valueOf("o=" + backendId); |
| | | |
| | |
| | | return memoryBackend; |
| | | } |
| | | |
| | | private static void removeBackend(Backend<?>... backends) |
| | | private static void removeBackend(LocalBackend<?>... backends) |
| | | { |
| | | for (Backend<?> backend : backends) |
| | | for (LocalBackend<?> backend : backends) |
| | | { |
| | | if (backend != null) |
| | | { |
| | |
| | | |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.Backend.BackendOperation; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.LocalBackend.BackendOperation; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.DataProvider; |
| | |
| | | @DataProvider(name = "backends") |
| | | public Object[][] getBackends() |
| | | { |
| | | List<Backend<?>> backendList = new ArrayList<>(DirectoryServer.getBackends()); |
| | | List<LocalBackend<?>> backendList = new ArrayList<>(DirectoryServer.getBackends()); |
| | | Object[][] objectArray = new Object[backendList.size()][1]; |
| | | for (int i=0; i < objectArray.length; i++) |
| | | { |
| | |
| | | return objectArray; |
| | | } |
| | | |
| | | /** Tests the {@link Backend#getBaseDNs} method for the provided backend. */ |
| | | /** Tests the {@link LocalBackend#getBaseDNs} method for the provided backend. */ |
| | | @Test(dataProvider = "backends") |
| | | public void testGetBaseDNs(Backend<?> b) |
| | | public void testGetBaseDNs(LocalBackend<?> b) |
| | | { |
| | | Set<DN> baseDNs = b.getBaseDNs(); |
| | | assertNotNull(baseDNs); |
| | | assertNotEquals(baseDNs.size(), 0); |
| | | } |
| | | |
| | | /** Tests the {@link Backend#getSupportedControls} method for the provided backend. */ |
| | | /** Tests the {@link LocalBackend#getSupportedControls} method for the provided backend. */ |
| | | @Test(dataProvider = "backends") |
| | | public void testGetSupportedControls(Backend<?> b) |
| | | public void testGetSupportedControls(LocalBackend<?> b) |
| | | { |
| | | assertNotNull(b.getSupportedControls()); |
| | | } |
| | | |
| | | /** Tests the supports control method for the provided backend. */ |
| | | @Test(dataProvider = "backends") |
| | | public void testSupportsControl(Backend<?> b) |
| | | public void testSupportsControl(LocalBackend<?> b) |
| | | { |
| | | assertFalse(b.supportsControl("1.2.3.4")); |
| | | } |
| | | |
| | | /** Tests the {@link Backend#getSupportedFeatures} method for the provided backend. */ |
| | | /** Tests the {@link LocalBackend#getSupportedFeatures} method for the provided backend. */ |
| | | @Test(dataProvider = "backends") |
| | | public void testGetSupportedFeatures(Backend<?> b) |
| | | public void testGetSupportedFeatures(LocalBackend<?> b) |
| | | { |
| | | assertNotNull(b.getSupportedFeatures()); |
| | | b.getSupportedFeatures(); |
| | |
| | | |
| | | /** Tests the supports LDIF export method for the provided backend. */ |
| | | @Test(dataProvider = "backends") |
| | | public void testSupportsLDIFExport(Backend<?> b) |
| | | public void testSupportsLDIFExport(LocalBackend<?> b) |
| | | { |
| | | b.supports(BackendOperation.LDIF_EXPORT); |
| | | } |
| | | |
| | | /** Tests the supports LDIF import method for the provided backend. */ |
| | | @Test(dataProvider = "backends") |
| | | public void testSupportsLDIFImport(Backend<?> b) |
| | | public void testSupportsLDIFImport(LocalBackend<?> b) |
| | | { |
| | | b.supports(BackendOperation.LDIF_IMPORT); |
| | | } |
| | | |
| | | /** Tests the supports Backup method for the provided backend. */ |
| | | @Test(dataProvider = "backends") |
| | | public void testSupportsBackup(Backend<?> b) |
| | | public void testSupportsBackup(LocalBackend<?> b) |
| | | { |
| | | b.supports(BackendOperation.BACKUP); |
| | | } |
| | | |
| | | /** Tests the supports restore method for the provided backend. */ |
| | | @Test(dataProvider = "backends") |
| | | public void testSupportsRestore(Backend<?> b) |
| | | public void testSupportsRestore(LocalBackend<?> b) |
| | | { |
| | | b.supports(BackendOperation.RESTORE); |
| | | } |
| | | |
| | | /** Tests the {@link Backend#getBackendID} method for the provided backend. */ |
| | | /** Tests the {@link LocalBackend#getBackendID} method for the provided backend. */ |
| | | @Test(dataProvider = "backends") |
| | | public void testGetBackendID(Backend<?> b) |
| | | public void testGetBackendID(LocalBackend<?> b) |
| | | { |
| | | assertNotNull(b.getBackendID()); |
| | | assertTrue(b.getBackendID().length() > 0); |
| | | } |
| | | |
| | | /** Tests the {@link Backend#isPrivateBackend} method for the provided backend. */ |
| | | /** Tests the {@link LocalBackend#isPrivateBackend} method for the provided backend. */ |
| | | @Test(dataProvider = "backends") |
| | | public void testIsPrivateBackend(Backend<?> b) |
| | | public void testIsPrivateBackend(LocalBackend<?> b) |
| | | { |
| | | b.isPrivateBackend(); |
| | | } |
| | | |
| | | /** Tests the {@link Backend#getWritabilityMode} method for the provided backend. */ |
| | | /** Tests the {@link LocalBackend#getWritabilityMode} method for the provided backend. */ |
| | | @Test(dataProvider = "backends") |
| | | public void testGetWritabilityMode(Backend<?> b) |
| | | public void testGetWritabilityMode(LocalBackend<?> b) |
| | | { |
| | | assertNotNull(b.getWritabilityMode()); |
| | | } |
| | | |
| | | /** Tests the {@link Backend#getBackendMonitor} method for the provided backend. */ |
| | | /** Tests the {@link LocalBackend#getBackendMonitor} method for the provided backend. */ |
| | | @Test(dataProvider = "backends") |
| | | public void testGetBackendMonitor(Backend<?> b) |
| | | public void testGetBackendMonitor(LocalBackend<?> b) |
| | | { |
| | | assertNotNull(b.getBackendMonitor()); |
| | | } |
| | | |
| | | /** Tests the {@link Backend#getEntryCount} method for the provided backend. */ |
| | | /** Tests the {@link LocalBackend#getEntryCount} method for the provided backend. */ |
| | | @Test(dataProvider = "backends") |
| | | public void testGetEntryCount(Backend<?> b) |
| | | public void testGetEntryCount(LocalBackend<?> b) |
| | | { |
| | | b.getEntryCount(); |
| | | } |
| | | |
| | | /** Tests the {@link Backend#getParentBackend} method for the provided backend. */ |
| | | /** Tests the {@link LocalBackend#getParentBackend} method for the provided backend. */ |
| | | @Test(dataProvider = "backends") |
| | | public void testGetParentBackend(Backend<?> b) |
| | | public void testGetParentBackend(LocalBackend<?> b) |
| | | { |
| | | b.getParentBackend(); |
| | | } |
| | | |
| | | /** Tests the {@link Backend#getSubordinateBackends} method for the provided backend. */ |
| | | /** Tests the {@link LocalBackend#getSubordinateBackends} method for the provided backend. */ |
| | | @Test(dataProvider = "backends") |
| | | public void testGetSubordinateBackends(Backend<?> b) |
| | | public void testGetSubordinateBackends(LocalBackend<?> b) |
| | | { |
| | | assertNotNull(b.getSubordinateBackends()); |
| | | } |
| | | |
| | | /** |
| | | * Tests the {@link Backend#handlesEntry} method for the provided backend for each of the declared |
| | | * Tests the {@link LocalBackend#handlesEntry} method for the provided backend for each of the declared |
| | | * base DNs. |
| | | */ |
| | | @Test(dataProvider = "backends") |
| | | public void testHandlesEntry(Backend<?> b) throws Exception |
| | | public void testHandlesEntry(LocalBackend<?> b) throws Exception |
| | | { |
| | | for (DN baseDN : b.getBaseDNs()) |
| | | { |
| | |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.Backend.BackendOperation; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.LocalBackend.BackendOperation; |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.core.CompareOperation; |
| | | import org.opends.server.core.DeleteOperation; |
| | |
| | | @Test |
| | | public void testHasSubordinates() throws Exception |
| | | { |
| | | Backend<?> b = getLDIFBackend(); |
| | | LocalBackend<?> b = getLDIFBackend(); |
| | | |
| | | assertEquals(b.hasSubordinates(DN.valueOf("o=ldif")), ConditionResult.TRUE); |
| | | assertEquals(b.hasSubordinates(DN.valueOf("uid=user.1,ou=People,o=ldif")), |
| | |
| | | @Test |
| | | public void testNumSubordinates() throws Exception |
| | | { |
| | | Backend<?> b = getLDIFBackend(); |
| | | LocalBackend<?> b = getLDIFBackend(); |
| | | |
| | | assertEquals(b.getNumberOfChildren(DN.valueOf("o=ldif")), 1); |
| | | assertEquals(b.getNumberOfEntriesInBaseDN(DN.valueOf("o=ldif")), 27); |
| | |
| | | @Test |
| | | public void testLDIFExport() throws Exception |
| | | { |
| | | Backend<?> b = getLDIFBackend(); |
| | | LocalBackend<?> b = getLDIFBackend(); |
| | | assertTrue(b.supports(BackendOperation.LDIF_EXPORT)); |
| | | |
| | | String tempFilePath = TestCaseUtils.createTempFile(); |
| | |
| | | |
| | | private LDIFBackend getLDIFBackend() |
| | | { |
| | | Backend<?> b = DirectoryServer.getBackend("ldifRoot"); |
| | | LocalBackend<?> b = DirectoryServer.getBackend("ldifRoot"); |
| | | assertNotNull(b); |
| | | assertTrue(b instanceof LDIFBackend); |
| | | return (LDIFBackend) b; |
| | |
| | | import org.forgerock.opendj.server.config.server.BackendIndexCfg; |
| | | import org.forgerock.opendj.server.config.server.BackendVLVIndexCfg; |
| | | import org.forgerock.opendj.server.config.server.PluggableBackendCfg; |
| | | import org.opends.server.api.Backend.BackendOperation; |
| | | import org.opends.server.api.LocalBackend.BackendOperation; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.backends.RebuildConfig; |
| | | import org.opends.server.backends.RebuildConfig.RebuildMode; |
| | |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.ldap.schema.ObjectClass; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.plugins.DisconnectClientPlugin; |
| | | import org.opends.server.plugins.ShortCircuitPlugin; |
| | | import org.opends.server.plugins.UpdatePreOpPlugin; |
| | |
| | | /** Some of the tests disable the backends, so we reenable them here. */ |
| | | @AfterMethod(alwaysRun=true) |
| | | public void reenableBackend() throws DirectoryException { |
| | | Backend<?> b = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | LocalBackend<?> b = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | b.setWritabilityMode(WritabilityMode.ENABLED); |
| | | } |
| | | |
| | |
| | | "cn: Test User", |
| | | "userPassword: password"); |
| | | |
| | | Backend<?> b = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | LocalBackend<?> b = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | b.setWritabilityMode(WritabilityMode.DISABLED); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(entry); |
| | |
| | | "cn: Test User", |
| | | "userPassword: password"); |
| | | |
| | | Backend<?> b = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | LocalBackend<?> b = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | b.setWritabilityMode(WritabilityMode.INTERNAL_ONLY); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(entry); |
| | |
| | | { |
| | | conn.bind("cn=Directory Manager", "password"); |
| | | |
| | | Backend<?> b = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | LocalBackend<?> b = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | b.setWritabilityMode(WritabilityMode.INTERNAL_ONLY); |
| | | |
| | | long addRequests = ldapStatistics.getAddRequests(); |
| | |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.forgerock.opendj.ldap.requests.ModifyRequest; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.protocols.internal.InternalSearchOperation; |
| | | import org.opends.server.protocols.internal.SearchRequest; |
| | |
| | | |
| | | processAdd(backendEntry); |
| | | |
| | | Backend<?> backend = DirectoryServer.getBackend(backendID); |
| | | LocalBackend<?> backend = DirectoryServer.getBackend(backendID); |
| | | assertBackend(baseDN, backend); |
| | | createEntry(baseDN, backend); |
| | | |
| | |
| | | // Modify the backend to enable it. |
| | | enableBackend(backendEntry, true); |
| | | |
| | | Backend<?> backend = DirectoryServer.getBackend(backendID); |
| | | LocalBackend<?> backend = DirectoryServer.getBackend(backendID); |
| | | assertBackend(baseDN, backend); |
| | | createEntry(baseDN, backend); |
| | | |
| | |
| | | parentBaseDN); |
| | | processAdd(parentBackendEntry); |
| | | |
| | | Backend<?> parentBackend = DirectoryServer.getBackend(parentBackendID); |
| | | LocalBackend<?> parentBackend = DirectoryServer.getBackend(parentBackendID); |
| | | assertBackend(parentBaseDN, parentBackend); |
| | | createEntry(parentBaseDN, parentBackend); |
| | | |
| | |
| | | childBaseDN); |
| | | processAdd(childBackendEntry); |
| | | |
| | | Backend<?> childBackend = DirectoryServer.getBackend(childBackendID); |
| | | LocalBackend<?> childBackend = DirectoryServer.getBackend(childBackendID); |
| | | assertNotNull(childBackend); |
| | | assertEquals(childBackend, |
| | | DirectoryServer.getBackendWithBaseDN(childBaseDN)); |
| | |
| | | childBaseDN); |
| | | processAdd(childBackendEntry); |
| | | |
| | | Backend<?> childBackend = DirectoryServer.getBackend(childBackendID); |
| | | LocalBackend<?> childBackend = DirectoryServer.getBackend(childBackendID); |
| | | assertBackend(childBaseDN, childBackend); |
| | | createEntry(childBaseDN, childBackend); |
| | | assertTrue(DirectoryServer.isNamingContext(childBaseDN)); |
| | |
| | | parentBaseDN); |
| | | processAdd(parentBackendEntry); |
| | | |
| | | Backend<?> parentBackend = DirectoryServer.getBackend(parentBackendID); |
| | | LocalBackend<?> parentBackend = DirectoryServer.getBackend(parentBackendID); |
| | | assertNotNull(parentBackend); |
| | | assertEquals(parentBackend, |
| | | DirectoryServer.getBackendWithBaseDN(parentBaseDN)); |
| | |
| | | assertNull(DirectoryServer.getBackend(parentBackendID)); |
| | | } |
| | | |
| | | private void assertBackend(DN baseDN, Backend<?> backend) throws DirectoryException |
| | | private void assertBackend(DN baseDN, LocalBackend<?> backend) throws DirectoryException |
| | | { |
| | | assertNotNull(backend); |
| | | assertEquals(backend, DirectoryServer.getBackendWithBaseDN(baseDN)); |
| | |
| | | parentBaseDN); |
| | | processAdd(parentBackendEntry); |
| | | |
| | | Backend<?> parentBackend = DirectoryServer.getBackend(parentBackendID); |
| | | LocalBackend<?> parentBackend = DirectoryServer.getBackend(parentBackendID); |
| | | assertBackend(parentBaseDN, parentBackend); |
| | | createEntry(parentBaseDN, parentBackend); |
| | | assertTrue(DirectoryServer.isNamingContext(parentBaseDN)); |
| | |
| | | grandchildBaseDN); |
| | | processAdd(grandchildBackendEntry); |
| | | |
| | | Backend<?> grandchildBackend = DirectoryServer.getBackend(grandchildBackendID); |
| | | LocalBackend<?> grandchildBackend = DirectoryServer.getBackend(grandchildBackendID); |
| | | assertNotNull(grandchildBackend); |
| | | assertEquals(grandchildBackend, |
| | | DirectoryServer.getBackendWithBaseDN(grandchildBaseDN)); |
| | |
| | | childBaseDN); |
| | | processAdd(childBackendEntry); |
| | | |
| | | Backend<?> childBackend = DirectoryServer.getBackend(childBackendID); |
| | | LocalBackend<?> childBackend = DirectoryServer.getBackend(childBackendID); |
| | | createBackend(childBaseDN, childBackend, parentBackend, grandchildBackend); |
| | | createEntry(childBaseDN, childBackend); |
| | | |
| | |
| | | assertEquals(internalSearch.getSearchEntries().size(), expected); |
| | | } |
| | | |
| | | private void createBackend(DN childBaseDN, Backend<?> childBackend, Backend<?> parentBackend, |
| | | Backend<?> grandchildBackend) throws DirectoryException |
| | | private void createBackend(DN childBaseDN, LocalBackend<?> childBackend, LocalBackend<?> parentBackend, |
| | | LocalBackend<?> grandchildBackend) throws DirectoryException |
| | | { |
| | | assertNotNull(childBackend); |
| | | assertEquals(childBackend, DirectoryServer.getBackendWithBaseDN(childBaseDN)); |
| | |
| | | assertEquals(grandchildBackend.getParentBackend(), childBackend); |
| | | } |
| | | |
| | | private void createEntry(DN baseDN, Backend<?> backend) throws DirectoryException |
| | | private void createEntry(DN baseDN, LocalBackend<?> backend) throws DirectoryException |
| | | { |
| | | Entry e = StaticUtils.createEntry(baseDN); |
| | | processAdd(e); |
| | |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.plugins.DisconnectClientPlugin; |
| | | import org.opends.server.plugins.ShortCircuitPlugin; |
| | | import org.opends.server.protocols.ldap.DeleteRequestProtocolOp; |
| | |
| | | /** Some of the tests disable the backends, so we reenable them here. */ |
| | | @AfterMethod(alwaysRun=true) |
| | | public void reenableBackend() throws DirectoryException { |
| | | Backend<?> b = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | LocalBackend<?> b = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | b.setWritabilityMode(WritabilityMode.ENABLED); |
| | | } |
| | | |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Backend<?> backend = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | LocalBackend<?> backend = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | backend.setWritabilityMode(WritabilityMode.DISABLED); |
| | | |
| | | DeleteOperation deleteOperation = processDeleteRaw("o=test"); |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Backend<?> backend = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | LocalBackend<?> backend = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | backend.setWritabilityMode(WritabilityMode.INTERNAL_ONLY); |
| | | |
| | | DeleteOperation deleteOperation = processDeleteRaw("o=test"); |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Backend<?> backend = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | LocalBackend<?> backend = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | backend.setWritabilityMode(WritabilityMode.INTERNAL_ONLY); |
| | | |
| | | String[] args = getArgs("o=test"); |
| | |
| | | import org.forgerock.opendj.ldap.requests.Requests; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.plugins.DisconnectClientPlugin; |
| | | import org.opends.server.plugins.ShortCircuitPlugin; |
| | | import org.opends.server.plugins.UpdatePreOpPlugin; |
| | |
| | | for (Object[] backendBaseDN2 : getBaseDNs()) |
| | | { |
| | | final DN baseDN = DN.valueOf(backendBaseDN2[0].toString()); |
| | | Backend<?> b = DirectoryServer.getBackend(baseDN); |
| | | LocalBackend<?> b = DirectoryServer.getBackend(baseDN); |
| | | b.setWritabilityMode(WritabilityMode.ENABLED); |
| | | } |
| | | } |
| | |
| | | "mail: foo", |
| | | "employeeNumber: 1"); |
| | | |
| | | Backend<?> b = DirectoryServer.getBackend(DN.valueOf(baseDN)); |
| | | LocalBackend<?> b = DirectoryServer.getBackend(DN.valueOf(baseDN)); |
| | | b.setWritabilityMode(WritabilityMode.DISABLED); |
| | | |
| | | RawModification mod = newRawModification(ADD, "objectClass", "extensibleObject"); |
| | |
| | | "mail: foo", |
| | | "employeeNumber: 1"); |
| | | |
| | | Backend<?> b = DirectoryServer.getBackend(DN.valueOf(baseDN)); |
| | | LocalBackend<?> b = DirectoryServer.getBackend(DN.valueOf(baseDN)); |
| | | b.setWritabilityMode(WritabilityMode.INTERNAL_ONLY); |
| | | |
| | | RawModification mod = newRawModification(ADD, "objectClass", "extensibleObject"); |
| | |
| | | "mail: foo", |
| | | "employeeNumber: 1"); |
| | | |
| | | Backend<?> b = DirectoryServer.getBackend(DN.valueOf(baseDN)); |
| | | LocalBackend<?> b = DirectoryServer.getBackend(DN.valueOf(baseDN)); |
| | | b.setWritabilityMode(WritabilityMode.INTERNAL_ONLY); |
| | | |
| | | try (RemoteConnection conn = new RemoteConnection("localhost", TestCaseUtils.getServerLdapPort())) |
| | |
| | | "cn: Test User", |
| | | "userPassword: password", |
| | | "userPassword;deleted: oldpassword"); |
| | | Backend<?> backend = DirectoryServer.getBackend(TEST_BACKEND_ID); |
| | | LocalBackend<?> backend = DirectoryServer.getBackend(TEST_BACKEND_ID); |
| | | backend.addEntry(e, null); // Don't use add operation. |
| | | |
| | | // Constraint violation. |
| | |
| | | "cn: Test User", |
| | | "userPassword: password", |
| | | "userPassword;deleted: oldpassword"); |
| | | Backend<?> backend = DirectoryServer.getBackend(TEST_BACKEND_ID); |
| | | LocalBackend<?> backend = DirectoryServer.getBackend(TEST_BACKEND_ID); |
| | | backend.addEntry(e, null); // Don't use add operation. |
| | | |
| | | // Constraint violation. |
| | |
| | | import org.forgerock.opendj.ldap.requests.AddRequest; |
| | | import org.forgerock.opendj.ldap.requests.Requests; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.protocols.internal.InternalSearchOperation; |
| | | import org.opends.server.protocols.internal.SearchRequest; |
| | |
| | | /** LDIFImportConfig used for importing entries. */ |
| | | private LDIFImportConfig importConfig; |
| | | /** Test Backend. */ |
| | | private Backend<?> backend; |
| | | private LocalBackend<?> backend; |
| | | |
| | | /** Constant value of userCertificate attribute. */ |
| | | private static final String CERT= |