From 3360705577c8bb82d31e593cc5890aebeca063c1 Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Wed, 05 Sep 2007 22:57:40 +0000
Subject: [PATCH] Improvements to the server-side constraint violation APIs. Now there are just two server-side constraint enforcement call-backs: isUsable and isDeleteAllowed. The first is invoked whenever a managed object is decoded (except in the case where it's about to be deleted). The second is invoked whenever a managed object is about to be deleted. With this change we will now detect constraint violations during server initialization, not just when config change/add/delete events occur.
---
opends/src/server/org/opends/server/admin/server/ConfigExceptionFactory.java | 26 ++++++++++++++++++++++----
1 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/opends/src/server/org/opends/server/admin/server/ConfigExceptionFactory.java b/opends/src/server/org/opends/server/admin/server/ConfigExceptionFactory.java
index 4faf5d7..b319a74 100644
--- a/opends/src/server/org/opends/server/admin/server/ConfigExceptionFactory.java
+++ b/opends/src/server/org/opends/server/admin/server/ConfigExceptionFactory.java
@@ -96,7 +96,6 @@
public ConfigException createDecodingExceptionAdaptor(
ServerManagedObjectDecodingException e) {
-
DN dn = e.getPartialManagedObject().getDN();
Message message =
AdminMessages.ERR_ADMIN_MANAGED_OBJECT_DECODING_PROBLEM.get(
@@ -108,13 +107,32 @@
/**
- * Create an exception that describes a problem that occurred when attempting
- * to load and instantiate a class.
+ * Create a configuration exception from a constraints violation
+ * decoding exception.
+ *
+ * @param e
+ * The constraints violation decoding exception.
+ * @return Returns the configuration exception.
+ */
+ public ConfigException createDecodingExceptionAdaptor(
+ ConstraintViolationException e) {
+ DN dn = e.getManagedObject().getDN();
+ Message message = AdminMessages.ERR_ADMIN_MANAGED_OBJECT_DECODING_PROBLEM
+ .get(String.valueOf(dn), stackTraceToSingleLineString(e));
+ return new ConfigException(message, e);
+ }
+
+
+
+ /**
+ * Create an exception that describes a problem that occurred when
+ * attempting to load and instantiate a class.
*
* @param dn
* The dn of the configuration entry was being processed.
* @param className
- * The name of the class that could not be loaded or instantiated.
+ * The name of the class that could not be loaded or
+ * instantiated.
* @param e
* The exception that occurred.
* @return Returns the configuration exception.
--
Gitblit v1.10.0