| | |
| | | EnvironmentConfig envConfig = |
| | | ConfigurableEnvironment.parseConfigEntry(cfg); |
| | | |
| | | initializeRootContainer(envConfig); |
| | | rootContainer = initializeRootContainer(envConfig); |
| | | } |
| | | |
| | | // Preload the database cache. |
| | |
| | | return -1; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public ConditionResult hasSubordinates(DN entryDN) throws DirectoryException |
| | | { |
| | | long ret = numSubordinates(entryDN); |
| | | if(ret < 0) |
| | | { |
| | | return ConditionResult.UNDEFINED; |
| | | } |
| | | else if(ret == 0) |
| | | { |
| | | return ConditionResult.FALSE; |
| | | } |
| | | else |
| | | { |
| | | return ConditionResult.TRUE; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public long numSubordinates(DN entryDN) throws DirectoryException |
| | | { |
| | | EntryContainer ec = rootContainer.getEntryContainer(entryDN); |
| | | if(ec == null) |
| | | { |
| | | return -1; |
| | | } |
| | | |
| | | readerBegin(); |
| | | ec.sharedLock.lock(); |
| | | try |
| | | { |
| | | long count = ec.getNumSubordinates(entryDN); |
| | | if(count == Long.MAX_VALUE) |
| | | { |
| | | // The index entry limit has exceeded and there is no count maintained. |
| | | return -1; |
| | | } |
| | | return count; |
| | | } |
| | | catch (DatabaseException e) |
| | | { |
| | | if (debugEnabled()) |
| | | { |
| | | TRACER.debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | throw createDirectoryException(e); |
| | | } |
| | | finally |
| | | { |
| | | ec.sharedLock.unlock(); |
| | | readerEnd(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the requested entry from this backend. Note that the caller must |
| | |
| | | envConfig.setConfigParam("je.env.isLocking", "true"); |
| | | envConfig.setConfigParam("je.env.runCheckpointer", "true"); |
| | | |
| | | initializeRootContainer(envConfig); |
| | | rootContainer = initializeRootContainer(envConfig); |
| | | } |
| | | |
| | | |
| | |
| | | envConfig.setConfigParam("je.env.runCheckpointer", "false"); |
| | | } |
| | | |
| | | initializeRootContainer(envConfig); |
| | | rootContainer = initializeRootContainer(envConfig); |
| | | |
| | | ImportJob importJob = new ImportJob(importConfig); |
| | | return importJob.importLDIF(rootContainer); |
| | |
| | | envConfig.setConfigParam("je.env.isLocking", "true"); |
| | | envConfig.setConfigParam("je.env.runCheckpointer", "true"); |
| | | |
| | | initializeRootContainer(envConfig); |
| | | rootContainer = initializeRootContainer(envConfig); |
| | | } |
| | | |
| | | VerifyJob verifyJob = new VerifyJob(verifyConfig); |
| | |
| | | EnvironmentConfig envConfig = |
| | | ConfigurableEnvironment.parseConfigEntry(cfg); |
| | | |
| | | initializeRootContainer(envConfig); |
| | | rootContainer = initializeRootContainer(envConfig); |
| | | } |
| | | |
| | | RebuildJob rebuildJob = new RebuildJob(rebuildConfig); |
| | |
| | | } |
| | | |
| | | /** |
| | | * Returns a new read-only handle to the JE root container for this backend. |
| | | * The caller is responsible for closing the root container after use. |
| | | * |
| | | * @return The read-only RootContainer object for this backend. |
| | | * |
| | | * @throws ConfigException If an unrecoverable problem arises during |
| | | * initialization. |
| | | * @throws InitializationException If a problem occurs during initialization |
| | | * that is not related to the server |
| | | * configuration. |
| | | */ |
| | | public RootContainer getReadOnlyRootContainer() |
| | | throws ConfigException, InitializationException |
| | | { |
| | | EnvironmentConfig envConfig = |
| | | ConfigurableEnvironment.parseConfigEntry(cfg); |
| | | |
| | | envConfig.setReadOnly(true); |
| | | envConfig.setAllowCreate(false); |
| | | envConfig.setTransactional(false); |
| | | envConfig.setTxnNoSync(false); |
| | | envConfig.setConfigParam("je.env.isLocking", "true"); |
| | | envConfig.setConfigParam("je.env.runCheckpointer", "true"); |
| | | |
| | | return initializeRootContainer(envConfig); |
| | | } |
| | | |
| | | /** |
| | | * Clears all the entries from the backend. This method is for test cases |
| | | * that use the JE backend. |
| | | * |
| | |
| | | return cfg.dn(); |
| | | } |
| | | |
| | | private void initializeRootContainer(EnvironmentConfig envConfig) |
| | | private RootContainer initializeRootContainer(EnvironmentConfig envConfig) |
| | | throws ConfigException, InitializationException |
| | | { |
| | | // Open the database environment |
| | | try |
| | | { |
| | | rootContainer = new RootContainer(this, cfg); |
| | | rootContainer.open(envConfig); |
| | | RootContainer rc = new RootContainer(this, cfg); |
| | | rc.open(envConfig); |
| | | return rc; |
| | | } |
| | | catch (DatabaseException e) |
| | | { |