From 994aade8f6eee89d18ed76128feb18447f797ce4 Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Sun, 02 Sep 2007 16:30:55 +0000
Subject: [PATCH] Minor refactoring of the admin driver API. Remove the hasManagedObject methods and replace them with a single managedObjectExists method. This will be more useful and more simple for dependency call-backs.
---
opendj-sdk/opends/src/server/org/opends/server/admin/client/spi/Driver.java | 114 ++++++++++++--------------------------------------------
1 files changed, 25 insertions(+), 89 deletions(-)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/admin/client/spi/Driver.java b/opendj-sdk/opends/src/server/org/opends/server/admin/client/spi/Driver.java
index d26004d..354f2aa 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/admin/client/spi/Driver.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/admin/client/spi/Driver.java
@@ -29,8 +29,6 @@
-import static org.opends.server.util.StaticUtils.*;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -509,93 +507,6 @@
/**
- * Determines whether or not the named parent managed object has the
- * named instantiable child managed object.
- *
- * @param <C>
- * The type of client managed object configuration that the
- * relation definition refers to.
- * @param <S>
- * The type of server managed object configuration that the
- * relation definition refers to.
- * @param parent
- * The path of the parent managed object.
- * @param rd
- * The instantiable relation definition.
- * @param name
- * The name of the child managed object.
- * @return Returns <code>true</code> if the named instantiable
- * child managed object exists, <code>false</code>
- * otherwise.
- * @throws IllegalArgumentException
- * If the relation definition is not associated with the
- * parent managed object's definition.
- * @throws ManagedObjectNotFoundException
- * If the parent managed object could not be found.
- * @throws AuthorizationException
- * If the server refuses to make the determination because
- * the client does not have the correct privileges.
- * @throws CommunicationException
- * If the client cannot contact the server due to an
- * underlying communication problem.
- */
- public final <C extends ConfigurationClient, S extends Configuration>
- boolean hasManagedObject(
- ManagedObjectPath<?, ?> parent, InstantiableRelationDefinition<C, S> rd,
- String name) throws IllegalArgumentException,
- ManagedObjectNotFoundException, AuthorizationException,
- CommunicationException {
- // FIXME: use naming properties for comparison where available.
- String[] children = listManagedObjects(parent, rd);
- String nname = toLowerCase(name.trim().replaceAll(" +", " "));
- for (String child : children) {
- if (nname.equals(toLowerCase(child.trim().replaceAll(" +", " ")))) {
- return true;
- }
- }
-
- return false;
- }
-
-
-
- /**
- * Determines whether or not the named parent managed object has an
- * optional child managed object.
- *
- * @param <C>
- * The type of client managed object configuration that the
- * relation definition refers to.
- * @param <S>
- * The type of server managed object configuration that the
- * relation definition refers to.
- * @param parent
- * The path of the parent managed object.
- * @param rd
- * The optional relation definition.
- * @return Returns <code>true</code> if the optional child managed
- * object exists, <code>false</code> otherwise.
- * @throws IllegalArgumentException
- * If the relation definition is not associated with the
- * parent managed object's definition.
- * @throws ManagedObjectNotFoundException
- * If the parent managed object could not be found.
- * @throws AuthorizationException
- * If the server refuses to make the determination because
- * the client does not have the correct privileges.
- * @throws CommunicationException
- * If the client cannot contact the server due to an
- * underlying communication problem.
- */
- public abstract <C extends ConfigurationClient, S extends Configuration>
- boolean hasManagedObject(
- ManagedObjectPath<?, ?> parent, OptionalRelationDefinition<C, S> rd)
- throws IllegalArgumentException, ManagedObjectNotFoundException,
- AuthorizationException, CommunicationException;
-
-
-
- /**
* Lists the child managed objects of the named parent managed
* object.
*
@@ -675,6 +586,31 @@
/**
+ * Determines whether or not the named managed object exists.
+ * <p>
+ * Implementations should always return <code>true</code> when the
+ * provided path is empty.
+ *
+ * @param path
+ * The path of the named managed object.
+ * @return Returns <code>true</code> if the named managed object
+ * exists, <code>false</code> otherwise.
+ * @throws ManagedObjectNotFoundException
+ * If the parent managed object could not be found.
+ * @throws AuthorizationException
+ * If the server refuses to make the determination because
+ * the client does not have the correct privileges.
+ * @throws CommunicationException
+ * If the client cannot contact the server due to an
+ * underlying communication problem.
+ */
+ public abstract boolean managedObjectExists(ManagedObjectPath<?, ?> path)
+ throws ManagedObjectNotFoundException, AuthorizationException,
+ CommunicationException;
+
+
+
+ /**
* Gets the default values for the specified property.
*
* @param <PD>
--
Gitblit v1.10.0