org.opends.server.backends.jeb
Class RootContainer

java.lang.Object
  extended by org.opends.server.backends.jeb.RootContainer
All Implemented Interfaces:
ConfigurationChangeListener<LocalDBBackendCfg>

public class RootContainer
extends java.lang.Object
implements ConfigurationChangeListener<LocalDBBackendCfg>

Wrapper class for the JE environment. Root container holds all the entry containers for each base DN. It also maintains all the openings and closings of the entry containers.


Constructor Summary
RootContainer(Backend backend, LocalDBBackendCfg config)
          Creates a new RootContainer object.
 
Method Summary
 ConfigChangeResult applyConfigurationChange(LocalDBBackendCfg cfg)
          Applies the configuration changes to this change listener.
 int cleanedLogFiles()
          Run the cleaner and return the number of files cleaned.
 void close()
          Close the root entryContainer.
 java.util.Set<DN> getBaseDNs()
          Returns all the baseDNs this root container stores.
 JECompressedSchema getCompressedSchema()
          Retrieves the compressed schema manager for this backend.
 LocalDBBackendCfg getConfiguration()
          Get the backend configuration used by this root container.
 EntryContainer getEntryContainer(DN baseDN)
          Return the entry container for a specific base DN.
 java.util.Collection<EntryContainer> getEntryContainers()
          Return all the entry containers in this root container.
 long getEntryCount()
          Get the total number of entries in this root container.
 com.sleepycat.je.EnvironmentConfig getEnvironmentConfig()
          Get the environment config of the JE environment used in this root container.
 com.sleepycat.je.LockStats getEnvironmentLockStats(com.sleepycat.je.StatsConfig statsConfig)
          Get the environment lock stats of the JE environment used in this root container.
 com.sleepycat.je.EnvironmentStats getEnvironmentStats(com.sleepycat.je.StatsConfig statsConfig)
          Get the environment stats of the JE environment used in this root container.
 com.sleepycat.je.TransactionStats getEnvironmentTransactionStats(com.sleepycat.je.StatsConfig statsConfig)
          Get the environment transaction stats of the JE environment used in this root container.
 java.lang.Long getHighestEntryID()
          Return the highest entry ID assigned.
 java.lang.Long getLowestEntryID()
          Return the lowest entry ID assigned.
 DatabaseEnvironmentMonitor getMonitorProvider()
          Get the DatabaseEnvironmentMonitor object for JE environment used by this root container.
 EntryID getNextEntryID()
          Assign the next entry ID.
 void importForceCheckPoint()
          Force a checkpoint.
 boolean isConfigurationChangeAcceptable(LocalDBBackendCfg cfg, java.util.List<Message> unacceptableReasons)
          Indicates whether the proposed change to the configuration is acceptable to this change listener.
 void open(com.sleepycat.je.EnvironmentConfig envConfig)
          Opens the root container using the JE configuration object provided.
 EntryContainer openEntryContainer(DN baseDN, java.lang.String name)
          Opens the entry container for a base DN.
 void preload(long timeLimit)
          Preload the database cache.
 void registerEntryContainer(DN baseDN, EntryContainer entryContainer)
          Registeres the entry container for a base DN.
 void resetNextEntryID()
          Resets the next entry ID counter to zero.
 EntryContainer unregisterEntryContainer(DN baseDN)
          Unregisteres the entry container for a base DN.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RootContainer

public RootContainer(Backend backend,
                     LocalDBBackendCfg config)
Creates a new RootContainer object. Each root container represents a JE environment.

Parameters:
config - The configuration of the JE backend.
backend - A reference to the JE back end that is creating this root container.
Method Detail

open

public void open(com.sleepycat.je.EnvironmentConfig envConfig)
          throws com.sleepycat.je.DatabaseException,
                 ConfigException
Opens the root container using the JE configuration object provided.

Parameters:
envConfig - The JE environment configuration.
Throws:
com.sleepycat.je.DatabaseException - If an error occurs when creating the environment.
ConfigException - If an configuration error occurs while creating the enviornment.

openEntryContainer

public EntryContainer openEntryContainer(DN baseDN,
                                         java.lang.String name)
                                  throws com.sleepycat.je.DatabaseException,
                                         ConfigException
Opens the entry container for a base DN. If the entry container does not exist for the base DN, it will be created. The entry container will be opened with the same mode as the root container. Any entry containers opened in a read only root container will also be read only. Any entry containers opened in a non transactional root container will also be non transactional.

Parameters:
baseDN - The base DN of the entry container to open.
name - The name of the entry container or NULL to open the default entry container for the given base DN.
Returns:
The opened entry container.
Throws:
com.sleepycat.je.DatabaseException - If an error occurs while opening the entry container.
ConfigException - If an configuration error occurs while opening the entry container.

registerEntryContainer

public void registerEntryContainer(DN baseDN,
                                   EntryContainer entryContainer)
                            throws com.sleepycat.je.DatabaseException
Registeres the entry container for a base DN.

Parameters:
baseDN - The base DN of the entry container to close.
entryContainer - The entry container to register for the baseDN.
Throws:
com.sleepycat.je.DatabaseException - If an error occurs while opening the entry container.

unregisterEntryContainer

public EntryContainer unregisterEntryContainer(DN baseDN)
Unregisteres the entry container for a base DN.

Parameters:
baseDN - The base DN of the entry container to close.
Returns:
The entry container that was unregistered or NULL if a entry container for the base DN was not registered.

getCompressedSchema

public JECompressedSchema getCompressedSchema()
Retrieves the compressed schema manager for this backend.

Returns:
The compressed schema manager for this backend.

getMonitorProvider

public DatabaseEnvironmentMonitor getMonitorProvider()
Get the DatabaseEnvironmentMonitor object for JE environment used by this root container.

Returns:
The DatabaseEnvironmentMonito object.

preload

public void preload(long timeLimit)
Preload the database cache. There is no preload if the configured preload time limit is zero.

Parameters:
timeLimit - The time limit for the preload process.

close

public void close()
           throws com.sleepycat.je.DatabaseException
Close the root entryContainer.

Throws:
com.sleepycat.je.DatabaseException - If an error occurs while attempting to close the entryContainer.

getEntryContainers

public java.util.Collection<EntryContainer> getEntryContainers()
Return all the entry containers in this root container.

Returns:
The entry containers in this root container.

getBaseDNs

public java.util.Set<DN> getBaseDNs()
Returns all the baseDNs this root container stores.

Returns:
The set of DNs this root container stores.

getEntryContainer

public EntryContainer getEntryContainer(DN baseDN)
Return the entry container for a specific base DN.

Parameters:
baseDN - The base DN of the entry container to retrive.
Returns:
The entry container for the base DN.

getEnvironmentStats

public com.sleepycat.je.EnvironmentStats getEnvironmentStats(com.sleepycat.je.StatsConfig statsConfig)
                                                      throws com.sleepycat.je.DatabaseException
Get the environment stats of the JE environment used in this root container.

Parameters:
statsConfig - The configuration to use for the EnvironmentStats object.
Returns:
The environment status of the JE environment.
Throws:
com.sleepycat.je.DatabaseException - If an error occurs while retriving the stats object.

getEnvironmentLockStats

public com.sleepycat.je.LockStats getEnvironmentLockStats(com.sleepycat.je.StatsConfig statsConfig)
                                                   throws com.sleepycat.je.DatabaseException
Get the environment lock stats of the JE environment used in this root container.

Parameters:
statsConfig - The configuration to use for the EnvironmentStats object.
Returns:
The environment status of the JE environment.
Throws:
com.sleepycat.je.DatabaseException - If an error occurs while retriving the stats object.

getEnvironmentTransactionStats

public com.sleepycat.je.TransactionStats getEnvironmentTransactionStats(com.sleepycat.je.StatsConfig statsConfig)
                                                                 throws com.sleepycat.je.DatabaseException
Get the environment transaction stats of the JE environment used in this root container.

Parameters:
statsConfig - The configuration to use for the EnvironmentStats object.
Returns:
The environment status of the JE environment.
Throws:
com.sleepycat.je.DatabaseException - If an error occurs while retriving the stats object.

getEnvironmentConfig

public com.sleepycat.je.EnvironmentConfig getEnvironmentConfig()
                                                        throws com.sleepycat.je.DatabaseException
Get the environment config of the JE environment used in this root container.

Returns:
The environment config of the JE environment.
Throws:
com.sleepycat.je.DatabaseException - If an error occurs while retriving the configuration object.

getConfiguration

public LocalDBBackendCfg getConfiguration()
Get the backend configuration used by this root container.

Returns:
The JE backend configuration used by this root container.

getEntryCount

public long getEntryCount()
                   throws com.sleepycat.je.DatabaseException
Get the total number of entries in this root container.

Returns:
The number of entries in this root container
Throws:
com.sleepycat.je.DatabaseException - If an error occurs while retriving the entry count.

getNextEntryID

public EntryID getNextEntryID()
Assign the next entry ID.

Returns:
The assigned entry ID.

getLowestEntryID

public java.lang.Long getLowestEntryID()
Return the lowest entry ID assigned.

Returns:
The lowest entry ID assigned.

getHighestEntryID

public java.lang.Long getHighestEntryID()
Return the highest entry ID assigned.

Returns:
The highest entry ID assigned.

resetNextEntryID

public void resetNextEntryID()
Resets the next entry ID counter to zero. This should only be used after clearing all databases.


isConfigurationChangeAcceptable

public boolean isConfigurationChangeAcceptable(LocalDBBackendCfg cfg,
                                               java.util.List<Message> unacceptableReasons)
Indicates whether the proposed change to the configuration is acceptable to this change listener.

Specified by:
isConfigurationChangeAcceptable in interface ConfigurationChangeListener<LocalDBBackendCfg>
Parameters:
cfg - The new configuration containing the changes.
unacceptableReasons - A list that can be used to hold messages about why the provided configuration is not acceptable.
Returns:
Returns true if the proposed change is acceptable, or false if it is not.

applyConfigurationChange

public ConfigChangeResult applyConfigurationChange(LocalDBBackendCfg cfg)
Applies the configuration changes to this change listener.

Specified by:
applyConfigurationChange in interface ConfigurationChangeListener<LocalDBBackendCfg>
Parameters:
cfg - The new configuration containing the changes.
Returns:
Returns information about the result of changing the configuration.

importForceCheckPoint

public void importForceCheckPoint()
                           throws com.sleepycat.je.DatabaseException
Force a checkpoint.

Throws:
com.sleepycat.je.DatabaseException - If a database error occurs.

cleanedLogFiles

public int cleanedLogFiles()
                    throws com.sleepycat.je.DatabaseException
Run the cleaner and return the number of files cleaned.

Returns:
The number of logs cleaned.
Throws:
com.sleepycat.je.DatabaseException - If a database error occurs.