From 12f788c17b8c281179f0819352f02b612b0219e2 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.
---
opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/SubCommandHandlerFactory.java | 62 +++++++++++++++++++++++++++---
1 files changed, 55 insertions(+), 7 deletions(-)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/SubCommandHandlerFactory.java b/opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/SubCommandHandlerFactory.java
index 202bbf9..20d5df9 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/SubCommandHandlerFactory.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/SubCommandHandlerFactory.java
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Copyright 2008 Sun Microsystems, Inc.
+ * Copyright 2009 Sun Microsystems, Inc.
*/
package org.opends.server.tools.dsconfig;
@@ -40,6 +40,7 @@
import org.opends.server.admin.RelationDefinition;
import org.opends.server.admin.RelationDefinitionVisitor;
import org.opends.server.admin.RelationOption;
+import org.opends.server.admin.SetRelationDefinition;
import org.opends.server.admin.SingletonRelationDefinition;
import org.opends.server.util.args.ArgumentException;
import org.opends.server.util.args.SubCommandArgumentParser;
@@ -115,6 +116,32 @@
* {@inheritDoc}
*/
public <C extends ConfigurationClient, S extends Configuration>
+ Void visitSet(
+ SetRelationDefinition<C, S> rd, ManagedObjectPath<?, ?> p) {
+ try {
+ // Create the sub-commands.
+ createHandlers.add(CreateSubCommandHandler.create(parser, p, rd));
+ deleteHandlers.add(DeleteSubCommandHandler.create(parser, p, rd));
+ listHandlers.add(ListSubCommandHandler.create(parser, p, rd));
+ getPropHandlers.add(GetPropSubCommandHandler.create(parser, p, rd));
+ setPropHandlers.add(SetPropSubCommandHandler.create(parser, p, rd));
+
+ // Process the referenced managed object definition and its
+ // sub-types.
+ processRelation(p, rd);
+ } catch (ArgumentException e) {
+ exception = e;
+ }
+
+ return null;
+ }
+
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public <C extends ConfigurationClient, S extends Configuration>
Void visitSingleton(
SingletonRelationDefinition<C, S> rd, ManagedObjectPath<?, ?> p) {
try {
@@ -135,36 +162,36 @@
}
// The set of all available sub-commands.
- private SortedSet<SubCommandHandler> allHandlers =
+ private final SortedSet<SubCommandHandler> allHandlers =
new TreeSet<SubCommandHandler>();
// The set of create-xxx available sub-commands.
- private SortedSet<CreateSubCommandHandler<?, ?>> createHandlers =
+ private final SortedSet<CreateSubCommandHandler<?, ?>> createHandlers =
new TreeSet<CreateSubCommandHandler<?, ?>>();
// The set of delete-xxx available sub-commands.
- private SortedSet<DeleteSubCommandHandler> deleteHandlers =
+ private final SortedSet<DeleteSubCommandHandler> deleteHandlers =
new TreeSet<DeleteSubCommandHandler>();
// Any exception that occurred whilst creating the sub-commands.
private ArgumentException exception = null;
// The set of get-xxx-prop available sub-commands.
- private SortedSet<GetPropSubCommandHandler> getPropHandlers =
+ private final SortedSet<GetPropSubCommandHandler> getPropHandlers =
new TreeSet<GetPropSubCommandHandler>();
// The help sub-command handler.
private HelpSubCommandHandler helpHandler = null;
// The set of list-xxx available sub-commands.
- private SortedSet<ListSubCommandHandler> listHandlers =
+ private final SortedSet<ListSubCommandHandler> listHandlers =
new TreeSet<ListSubCommandHandler>();
// The sub-command argument parser.
private final SubCommandArgumentParser parser;
// The set of set-xxx-prop available sub-commands.
- private SortedSet<SetPropSubCommandHandler> setPropHandlers =
+ private final SortedSet<SetPropSubCommandHandler> setPropHandlers =
new TreeSet<SetPropSubCommandHandler>();
// The relation visitor.
@@ -327,6 +354,27 @@
+ // Process a set relation.
+ private <C extends ConfigurationClient, S extends Configuration>
+ void processRelation(
+ ManagedObjectPath<?, ?> path, SetRelationDefinition<C, S> r) {
+ AbstractManagedObjectDefinition<C, S> d = r.getChildDefinition();
+
+ // Process all relations associated directly with this
+ // definition.
+ helpHandler.registerManagedObjectDefinition(d);
+ processPath(path.child(r, d));
+
+ // Now process relations associated with derived definitions.
+ for (AbstractManagedObjectDefinition<? extends C, ? extends S> c : d
+ .getAllChildren()) {
+ helpHandler.registerManagedObjectDefinition(c);
+ processPath(path.child(r, c));
+ }
+ }
+
+
+
// Process a singleton relation.
private <C extends ConfigurationClient, S extends Configuration>
void processRelation(
--
Gitblit v1.10.0