From 619d5d46a827a46b26ef2f71673e89d34b2cec05 Mon Sep 17 00:00:00 2001
From: abobrov <abobrov@localhost>
Date: Fri, 09 Oct 2009 01:02:11 +0000
Subject: [PATCH] - get rid of JE DatabaseException ruse and prepare for JE4 drop-in.
---
opends/src/server/org/opends/server/backends/jeb/RootContainer.java | 50 +++++++++++++++++++++++++++-----------------------
1 files changed, 27 insertions(+), 23 deletions(-)
diff --git a/opends/src/server/org/opends/server/backends/jeb/RootContainer.java b/opends/src/server/org/opends/server/backends/jeb/RootContainer.java
index 2c34783..3d2e316 100644
--- a/opends/src/server/org/opends/server/backends/jeb/RootContainer.java
+++ b/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.*;
@@ -134,13 +131,16 @@
/**
* 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.
+ * @param envConfig The JE environment configuration.
+ * @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);
+ 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 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;
--
Gitblit v1.10.0