From 2a52b482ba335b393356c00fac36d9ae597c8441 Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Fri, 20 Jul 2007 08:43:07 +0000
Subject: [PATCH] Fix issues 1966 and 1792.
---
opends/src/server/org/opends/server/admin/SingletonRelationDefinition.java | 78 ++++++++++++++++++++++++++++----------
1 files changed, 57 insertions(+), 21 deletions(-)
diff --git a/opends/src/server/org/opends/server/admin/SingletonRelationDefinition.java b/opends/src/server/org/opends/server/admin/SingletonRelationDefinition.java
index c0638bc..a2eccaa 100644
--- a/opends/src/server/org/opends/server/admin/SingletonRelationDefinition.java
+++ b/opends/src/server/org/opends/server/admin/SingletonRelationDefinition.java
@@ -31,7 +31,7 @@
/**
* A managed object composite relationship definition which represents
- * a compososition of a single managed object (i.e. the managed object
+ * a composition of a single managed object (i.e. the managed object
* must be present).
*
* @param <C>
@@ -46,18 +46,64 @@
extends RelationDefinition<C, S> {
/**
- * Create a new singleton managed object relation definition.
+ * An interface for incrementally constructing singleton relation
+ * definitions.
*
- * @param pd
- * The parent managed object definition.
- * @param name
- * The name of the relation.
- * @param cd
- * The child managed object definition.
+ * @param <C>
+ * The type of client managed object configuration that
+ * this relation definition refers to.
+ * @param <S>
+ * The type of server managed object configuration that
+ * this relation definition refers to.
*/
- public SingletonRelationDefinition(AbstractManagedObjectDefinition<?, ?> pd,
- String name, AbstractManagedObjectDefinition<C, S> cd) {
- super(pd, name, cd);
+ public static class Builder
+ <C extends ConfigurationClient, S extends Configuration>
+ extends AbstractBuilder<C, S, SingletonRelationDefinition<C, S>> {
+
+ /**
+ * Creates a new builder which can be used to incrementally build
+ * an singleton relation definition.
+ *
+ * @param pd
+ * The parent managed object definition.
+ * @param name
+ * The name of the relation.
+ * @param cd
+ * The child managed object definition.
+ */
+ public Builder(AbstractManagedObjectDefinition<?, ?> pd, String name,
+ AbstractManagedObjectDefinition<C, S> cd) {
+ super(pd, name, cd);
+ }
+
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected SingletonRelationDefinition<C, S> buildInstance(
+ Common<C, S> common) {
+ return new SingletonRelationDefinition<C, S>(common);
+ }
+
+ }
+
+
+
+ // Private constructor.
+ private SingletonRelationDefinition(Common<C, S> common) {
+ super(common);
+ }
+
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public <R, P> R accept(RelationDefinitionVisitor<R, P> v, P p) {
+ return v.visitSingleton(this, p);
}
@@ -76,14 +122,4 @@
builder.append(" minOccurs=1 maxOccurs=1");
}
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- public <R, P> R accept(RelationDefinitionVisitor<R, P> v, P p) {
- return v.visitSingleton(this, p);
- }
-
}
--
Gitblit v1.10.0