From aed4a89f2bbdc326f5df33b6d995a38b8a9560a1 Mon Sep 17 00:00:00 2001
From: pgamba <pgamba@localhost>
Date: Mon, 19 Oct 2009 12:45:50 +0000
Subject: [PATCH] Fix#4261 ECL Virtual attributes should be internal only (and removed from config.ldif)

---
 opends/src/server/org/opends/server/replication/common/LastCookieVirtualProvider.java |   37 ++++++++++++++++---------------------
 1 files changed, 16 insertions(+), 21 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/common/LastCookieVirtualProvider.java b/opends/src/server/org/opends/server/replication/common/LastCookieVirtualProvider.java
index 8bf4b39..263691e 100644
--- a/opends/src/server/org/opends/server/replication/common/LastCookieVirtualProvider.java
+++ b/opends/src/server/org/opends/server/replication/common/LastCookieVirtualProvider.java
@@ -62,10 +62,6 @@
    extends VirtualAttributeProvider<UserDefinedVirtualAttributeCfg>
    implements ConfigurationChangeListener<UserDefinedVirtualAttributeCfg>
 {
-  // The current configuration for this virtual attribute provider.
-  private UserDefinedVirtualAttributeCfg currentConfig;
-
-
 
   /**
    * Creates a new instance of this member virtual attribute provider.
@@ -88,8 +84,7 @@
                             UserDefinedVirtualAttributeCfg configuration)
          throws ConfigException, InitializationException
   {
-    this.currentConfig = configuration;
-    configuration.addUserDefinedChangeListener(this);
+    // No initialization required
   }
 
 
@@ -100,10 +95,21 @@
   @Override()
   public void finalizeVirtualAttributeProvider()
   {
-    currentConfig.removeUserDefinedChangeListener(this);
+    //
   }
 
+  /**
+   * {@inheritDoc}
+   */
+  @Override()
+  public boolean hasValue(Entry entry, VirtualAttributeRule rule)
+  {
+    // Indicates whether this virtual attribute provider will generate
+    // at least one value for the provided entry.
+    // True is the DN is the one of the root DSE : "".
+    return entry.getDN().toNormalizedString().equalsIgnoreCase("");
 
+  }
 
   /**
    * {@inheritDoc}
@@ -111,14 +117,7 @@
   @Override()
   public boolean isMultiValued()
   {
-    if (currentConfig == null)
-    {
-      return true;
-    }
-    else
-    {
-      return (currentConfig.getValue().size() > 1);
-    }
+    return false;
   }
 
 
@@ -194,8 +193,7 @@
                       UserDefinedVirtualAttributeCfg configuration,
                       List<Message> unacceptableReasons)
   {
-    // The new configuration should always be acceptable.
-    return true;
+    return false;
   }
 
 
@@ -206,9 +204,6 @@
   public ConfigChangeResult applyConfigurationChange(
                                  UserDefinedVirtualAttributeCfg configuration)
   {
-    // Just accept the new configuration as-is.
-    currentConfig = configuration;
-
-    return new ConfigChangeResult(ResultCode.SUCCESS, false);
+    return new ConfigChangeResult(ResultCode.OTHER, false);
   }
 }

--
Gitblit v1.10.0