mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

abobrov
09.02.2009 619d5d46a827a46b26ef2f71673e89d34b2cec05
- get rid of JE DatabaseException ruse and prepare for JE4 drop-in.
6 files modified
88 ■■■■■ changed files
opends/src/messages/messages/jeb.properties 2 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/jeb/Index.java 4 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/jeb/JECompressedSchema.java 24 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/jeb/JebException.java 12 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/jeb/RootContainer.java 42 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/jeb/importLDIF/Importer.java 4 ●●● patch | view | raw | blame | history
opends/src/messages/messages/jeb.properties
@@ -69,6 +69,8 @@
SEVERE_ERR_JEB_ENTRY_DATABASE_CORRUPT_12=The entry database does not contain \
 a valid record for ID %s
SEVERE_ERR_JEB_DATABASE_EXCEPTION_14=Database exception: %s
SEVERE_ERR_JEB_ENTRY_CONTAINER_ALREADY_REGISTERED_15=An entry container named \
 '%s' is alreadly registered for base DN '%s'
SEVERE_ERR_CONFIG_INDEX_TYPE_NEEDS_MATCHING_RULE_26=The attribute '%s' cannot \
 have indexing of type '%s' because it does not have a corresponding matching \
 rule
opends/src/server/org/opends/server/backends/jeb/Index.java
@@ -329,7 +329,7 @@
      }
    } else {
      //Should never happen -- the keys should always be there.
      throw new DatabaseException();
      throw new RuntimeException();
    }
  }
@@ -354,7 +354,7 @@
      put(null, key, data);
    } else {
      //Should never happen during import.
      throw new DatabaseException();
      throw new RuntimeException();
    }
  }
opends/src/server/org/opends/server/backends/jeb/JECompressedSchema.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2008 Sun Microsystems, Inc.
 *      Copyright 2008-2009 Sun Microsystems, Inc.
 */
package org.opends.server.backends.jeb;
@@ -133,12 +133,15 @@
   * @param  environment  A reference to the database environment in which the
   *                      databases will be held.
   *
   * @throws  DatabaseException  If a problem occurs while loading the
   *                             compressed schema definitions from the
   * @throws DatabaseException       If a database problem occurs while loading
   *                                 the compressed schema definitions from the
   *                             database.
   * @throws InitializationException If an error occurs while loading and
   *                                 processing the compressed schema
   *                                 definitions.
   */
  public JECompressedSchema(Environment environment)
         throws DatabaseException
         throws DatabaseException, InitializationException
  {
    this.environment = environment;
@@ -165,11 +168,14 @@
  /**
   * Loads the compressed schema information from the database.
   *
   * @throws  DatabaseException  If a problem occurs while loading the
   *                             definitions from the database.
   * @throws DatabaseException       If a database error occurs while
   *                                 loading the definitions from the
   *                                 database.
   * @throws InitializationException If an error occurs while loading
   *                                 and processing the definitions.
   */
  private void load()
          throws DatabaseException
          throws DatabaseException, InitializationException
  {
    DatabaseConfig dbConfig = new DatabaseConfig();
@@ -242,7 +248,7 @@
      Message m =
           ERR_JEB_COMPSCHEMA_CANNOT_DECODE_OC_TOKEN.get(ae.getMessage());
      throw new DatabaseException(m.toString(), ae);
      throw new InitializationException(m, ae);
    }
    finally
    {
@@ -314,7 +320,7 @@
      Message m =
           ERR_JEB_COMPSCHEMA_CANNOT_DECODE_AD_TOKEN.get(ae.getMessage());
      throw new DatabaseException(m.toString(), ae);
      throw new InitializationException(m, ae);
    }
    finally
    {
opends/src/server/org/opends/server/backends/jeb/JebException.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2006-2008 Sun Microsystems, Inc.
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 */
package org.opends.server.backends.jeb;
@@ -51,6 +51,16 @@
  /**
   * Creates a new JE backend exception.
   */
  public JebException()
  {
    super();
  }
  /**
   * Creates a new JE backend exception with the provided message.
   *
   * @param  message    The message that explains the problem that occurred.
opends/src/server/org/opends/server/backends/jeb/RootContainer.java
@@ -48,11 +48,8 @@
import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.loggers.debug.DebugLogger.*;
import org.opends.server.loggers.debug.DebugTracer;
import org.opends.server.types.InitializationException;
import static org.opends.messages.JebMessages.*;
import static org.opends.messages.ConfigMessages.
    ERR_CONFIG_BACKEND_MODE_INVALID;
import static org.opends.messages.ConfigMessages.
    ERR_CONFIG_BACKEND_INSANE_MODE;
import static org.opends.server.util.StaticUtils.*;
import static org.opends.messages.ConfigMessages.*;
@@ -135,12 +132,15 @@
   * Opens the root container using the JE configuration object provided.
   *
   * @param envConfig The JE environment configuration.
   * @throws DatabaseException If an error occurs when creating the environment.
   * @throws ConfigException If an configuration error occurs while creating
   * the enviornment.
   * @throws DatabaseException       If a database error occurs when creating
   *                                 the environment.
   * @throws InitializationException If an initialization error occurs while
   *                                 creating the enviornment.
   * @throws ConfigException         If an configuration error occurs while
   *                                 creating the enviornment.
   */
  public void open(EnvironmentConfig envConfig)
      throws DatabaseException, ConfigException
      throws DatabaseException, InitializationException, ConfigException
  {
    // Determine the backend database directory.
    File parentDirectory = getFileForPath(config.getDBDirectory());
@@ -282,21 +282,23 @@
   *
   * @param baseDN The base DN of the entry container to close.
   * @param entryContainer The entry container to register for the baseDN.
   * @throws DatabaseException If an error occurs while opening the entry
   *                           container.
   * @throws InitializationException If an error occurs while opening the
   *                                 entry container.
   */
  public void registerEntryContainer(DN baseDN,
                                     EntryContainer entryContainer)
      throws DatabaseException
      throws InitializationException
  {
    EntryContainer ec1=this.entryContainers.get(baseDN);
    //If an entry container for this baseDN is already open we don't allow
    //another to be opened.
    if (ec1 != null)
      throw new DatabaseException("An entry container named " +
          ec1.getDatabasePrefix() + " is alreadly registered for base DN " +
          baseDN.toString());
    {
      Message m = ERR_JEB_ENTRY_CONTAINER_ALREADY_REGISTERED.get(
        ec1.getDatabasePrefix(), baseDN.toString());
      throw new InitializationException(m);
    }
    this.entryContainers.put(baseDN, entryContainer);
  }
@@ -305,13 +307,15 @@
   * Opens the entry containers for multiple base DNs.
   *
   * @param baseDNs The base DNs of the entry containers to open.
   * @throws DatabaseException If an error occurs while opening the entry
   *                           container.
   * @throws ConfigException if a configuration error occurs while opening the
   *                         container.
   * @throws DatabaseException       If a database error occurs while opening
   *                                 the entry container.
   * @throws InitializationException If an initialization error occurs while
   *                                 opening the entry container.
   * @throws ConfigException         If a configuration error occurs while
   *                                 opening the entry container.
   */
  private void openAndRegisterEntryContainers(Set<DN> baseDNs)
      throws DatabaseException, ConfigException
      throws DatabaseException, InitializationException, ConfigException
  {
    EntryID id;
    EntryID highestID = null;
opends/src/server/org/opends/server/backends/jeb/importLDIF/Importer.java
@@ -644,7 +644,9 @@
  }
  private void switchContainers() throws DatabaseException, JebException {
  private void switchContainers()
    throws DatabaseException, JebException, InitializationException
  {
     for(Suffix suffix : dnSuffixMap.values()) {
       DN baseDN = suffix.getBaseDN();