From 95df5cfdba474acb03076953e992b898fbb277a8 Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Mon, 02 Feb 2009 23:37:54 +0000
Subject: [PATCH] Fix issue 3734 - Make network group policies extensible.
---
opends/src/server/org/opends/server/admin/client/ldap/LDAPNameBuilder.java | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 53 insertions(+), 5 deletions(-)
diff --git a/opends/src/server/org/opends/server/admin/client/ldap/LDAPNameBuilder.java b/opends/src/server/org/opends/server/admin/client/ldap/LDAPNameBuilder.java
index a943e3a..0bbc756 100644
--- a/opends/src/server/org/opends/server/admin/client/ldap/LDAPNameBuilder.java
+++ b/opends/src/server/org/opends/server/admin/client/ldap/LDAPNameBuilder.java
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Copyright 2008 Sun Microsystems, Inc.
+ * Copyright 2008-2009 Sun Microsystems, Inc.
*/
package org.opends.server.admin.client.ldap;
@@ -44,6 +44,7 @@
import org.opends.server.admin.ManagedObjectPathSerializer;
import org.opends.server.admin.OptionalRelationDefinition;
import org.opends.server.admin.RelationDefinition;
+import org.opends.server.admin.SetRelationDefinition;
import org.opends.server.admin.SingletonRelationDefinition;
@@ -96,6 +97,30 @@
return builder.getInstance();
}
+
+
+ /**
+ * Creates a new LDAP name representing the specified managed object
+ * path and set relation.
+ *
+ * @param path
+ * The managed object path.
+ * @param relation
+ * The child set relation.
+ * @param profile
+ * The LDAP profile which should be used to construct LDAP
+ * names.
+ * @return Returns a new LDAP name representing the specified
+ * managed object path and set relation.
+ */
+ public static LdapName create(ManagedObjectPath<?, ?> path,
+ SetRelationDefinition<?, ?> relation, LDAPProfile profile) {
+ LDAPNameBuilder builder = new LDAPNameBuilder(profile);
+ path.serialize(builder);
+ builder.appendManagedObjectPathElement(relation);
+ return builder.getInstance();
+ }
+
// The list of RDNs in big-endian order.
private final LinkedList<Rdn> rdns;
@@ -126,10 +151,10 @@
InstantiableRelationDefinition<? super C, ? super S> r,
AbstractManagedObjectDefinition<C, S> d, String name) {
// Add the RDN sequence representing the relation.
- appendManagedObjectPathElement((RelationDefinition<?, ?>) r);
+ appendManagedObjectPathElement(r);
// Now add the single RDN representing the named instance.
- String type = profile.getInstantiableRelationChildRDNType(r);
+ String type = profile.getRelationChildRDNType(r);
try {
Rdn rdn = new Rdn(type, name.trim());
rdns.add(rdn);
@@ -168,7 +193,7 @@
OptionalRelationDefinition<? super C, ? super S> r,
AbstractManagedObjectDefinition<C, S> d) {
// Add the RDN sequence representing the relation.
- appendManagedObjectPathElement((RelationDefinition<?, ?>) r);
+ appendManagedObjectPathElement(r);
}
@@ -181,7 +206,30 @@
SingletonRelationDefinition<? super C, ? super S> r,
AbstractManagedObjectDefinition<C, S> d) {
// Add the RDN sequence representing the relation.
- appendManagedObjectPathElement((RelationDefinition<?, ?>) r);
+ appendManagedObjectPathElement(r);
+ }
+
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public <C extends ConfigurationClient, S extends Configuration>
+ void appendManagedObjectPathElement(
+ SetRelationDefinition<? super C, ? super S> r,
+ AbstractManagedObjectDefinition<C, S> d) {
+ // Add the RDN sequence representing the relation.
+ appendManagedObjectPathElement(r);
+
+ // Now add the single RDN representing the named instance.
+ String type = profile.getRelationChildRDNType(r);
+ try {
+ Rdn rdn = new Rdn(type, d.getName());
+ rdns.add(rdn);
+ } catch (InvalidNameException e1) {
+ // Should not happen.
+ throw new RuntimeException(e1);
+ }
}
--
Gitblit v1.10.0