From b892b0038d7dc619ee4fac7058189736d2d73f0d Mon Sep 17 00:00:00 2001
From: Ludovic Poitou <ludovic.poitou@forgerock.com>
Date: Thu, 07 Apr 2011 12:41:00 +0000
Subject: [PATCH] Fix OPENDJ-112 - The Changelog virtual attribute appears in al entries, should only apply to rootDSE. The changes introduce a scope in the VirtualAttributeRule. The default is Whole_Subtree. The changelog virtual attributes are now registered with a BASE_OBJECT scope and "" base DNs, meaning the rootDSE only. Also each virtual attribute provider override the hasValue() method for optimization and avoiding computing the values and throwing them away.
---
opends/src/server/org/opends/server/replication/common/ChangelogBaseDNVirtualAttributeProvider.java | 24 +++++++++++++++---------
1 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/opends/src/server/org/opends/server/replication/common/ChangelogBaseDNVirtualAttributeProvider.java b/opends/src/server/org/opends/server/replication/common/ChangelogBaseDNVirtualAttributeProvider.java
index 1f899e6..1129459 100644
--- a/opends/src/server/org/opends/server/replication/common/ChangelogBaseDNVirtualAttributeProvider.java
+++ b/opends/src/server/org/opends/server/replication/common/ChangelogBaseDNVirtualAttributeProvider.java
@@ -23,11 +23,11 @@
*
*
* Copyright 2009 Sun Microsystems, Inc.
+ * Portions Copyright 2011 ForgeRock AS
*/
package org.opends.server.replication.common;
import java.util.Collections;
-import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -57,6 +57,15 @@
extends VirtualAttributeProvider<UserDefinedVirtualAttributeCfg>
implements ConfigurationChangeListener<UserDefinedVirtualAttributeCfg>
{
+
+ /*
+ * The base DN of the changelog is a constant.
+ * TODO: This shouldn't be a virtual attribute, but directly
+ * registered in the RootDSE.
+ */
+ private final Set<AttributeValue> values;
+
+
/**
* Creates a new instance of this member virtual attribute provider.
*/
@@ -64,8 +73,11 @@
{
super();
- // All initialization should be performed in the
- // initializeVirtualAttributeProvider method.
+ AttributeValue value =
+ AttributeValues.create(
+ ByteString.valueOf(ServerConstants.DN_EXTERNAL_CHANGELOG_ROOT),
+ ByteString.valueOf(ServerConstants.DN_EXTERNAL_CHANGELOG_ROOT));
+ values=Collections.singleton(value);
}
@@ -111,12 +123,6 @@
@Override()
public Set<AttributeValue> getValues(Entry entry,VirtualAttributeRule rule)
{
- Set<AttributeValue> values = new HashSet<AttributeValue>();
- AttributeValue value =
- AttributeValues.create(
- ByteString.valueOf(ServerConstants.DN_EXTERNAL_CHANGELOG_ROOT),
- ByteString.valueOf(ServerConstants.DN_EXTERNAL_CHANGELOG_ROOT));
- values=Collections.singleton(value);
return values;
}
--
Gitblit v1.10.0