From dd9c5d6a0520fec68fa12485a4da033f84840930 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 14 Feb 2014 09:30:43 +0000
Subject: [PATCH] OPENDJ-1308 Migrate schema support

---
 opendj3-server-dev/src/server/org/opends/server/api/MatchingRule.java                      |   11 ++---
 opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/MatchingRulePanel.java |   22 +++++-----
 opendj3-server-dev/src/server/org/opends/server/api/AbstractMatchingRule.java              |   48 +++++++----------------
 3 files changed, 30 insertions(+), 51 deletions(-)

diff --git a/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/MatchingRulePanel.java b/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/MatchingRulePanel.java
index 7367acd..1444528 100644
--- a/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/MatchingRulePanel.java
+++ b/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/MatchingRulePanel.java
@@ -24,11 +24,8 @@
  *      Copyright 2008-2010 Sun Microsystems, Inc.
  *      Portions Copyright 2014 ForgeRock AS
  */
-
 package org.opends.guitools.controlpanel.ui;
 
-import static org.opends.messages.AdminToolMessages.*;
-
 import java.awt.Component;
 import java.awt.GridBagConstraints;
 import java.awt.event.KeyAdapter;
@@ -42,20 +39,17 @@
 import javax.swing.JLabel;
 import javax.swing.JList;
 
+import org.forgerock.i18n.LocalizableMessage;
 import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent;
 import org.opends.guitools.controlpanel.ui.components.TitlePanel;
 import org.opends.guitools.controlpanel.util.LowerCaseComparator;
 import org.opends.guitools.controlpanel.util.Utilities;
-import org.forgerock.i18n.LocalizableMessage;
-import org.opends.server.api.ApproximateMatchingRule;
-import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.EqualityMatchingRule;
-import org.opends.server.api.MatchingRule;
-import org.opends.server.api.OrderingMatchingRule;
-import org.opends.server.api.SubstringMatchingRule;
+import org.opends.server.api.*;
 import org.opends.server.types.AttributeType;
 import org.opends.server.types.Schema;
 
+import static org.opends.messages.AdminToolMessages.*;
+
 /**
  * Class displaying the contents of a matching rule.
  *
@@ -84,6 +78,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public LocalizableMessage getTitle()
   {
     return INFO_CTRL_PANEL_MATCHING_RULE_PANEL_TITLE.get();
@@ -92,6 +87,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public Component getPreferredFocusComponent()
   {
     return usedByAttributes;
@@ -100,6 +96,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public void configurationChanged(ConfigurationChangeEvent ev)
   {
   }
@@ -107,6 +104,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public void okClicked()
   {
   }
@@ -174,6 +172,7 @@
       /**
        * {@inheritDoc}
        */
+      @Override
       public void mouseClicked(MouseEvent ev)
       {
         if (ev.getClickCount() == 1)
@@ -189,6 +188,7 @@
       /**
        * {@inheritDoc}
        */
+      @Override
       public void keyTyped(KeyEvent ev)
       {
         if ((ev.getKeyChar() == KeyEvent.VK_SPACE) ||
@@ -218,7 +218,7 @@
     name.setText(n);
     oid.setText(matchingRule.getOID());
     AttributeSyntax<?> s = null;
-    String syntaxOID = matchingRule.getSyntaxOID();
+    String syntaxOID = matchingRule.getSyntax().getOID();
     for (AttributeSyntax<?> candidate : schema.getSyntaxes().values())
     {
       if (candidate.getOID().equals(syntaxOID))
diff --git a/opendj3-server-dev/src/server/org/opends/server/api/AbstractMatchingRule.java b/opendj3-server-dev/src/server/org/opends/server/api/AbstractMatchingRule.java
index ac542d2..51bdc54 100644
--- a/opendj3-server-dev/src/server/org/opends/server/api/AbstractMatchingRule.java
+++ b/opendj3-server-dev/src/server/org/opends/server/api/AbstractMatchingRule.java
@@ -32,6 +32,8 @@
 
 import org.forgerock.opendj.ldap.ByteSequence;
 import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.schema.Schema;
+import org.forgerock.opendj.ldap.schema.Syntax;
 import org.opends.server.types.ConditionResult;
 import org.opends.server.types.DirectoryException;
 
@@ -54,22 +56,6 @@
    * {@inheritDoc}
    */
   @Override
-  public abstract Collection<String> getNames();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public abstract String getOID();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
   public ByteString normalizeAssertionValue(ByteSequence value)
       throws DirectoryException
   {
@@ -93,27 +79,23 @@
     return getOID();
   }
 
-
-
   /**
-   * {@inheritDoc}
+   * Retrieves the OID of the syntax with which this matching rule is
+   * associated.
+   *
+   * @return The OID of the syntax with which this matching rule is
+   *         associated.
    */
-  @Override
-  public abstract String getDescription();
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
   public abstract String getSyntaxOID();
 
+  /** {@inheritDoc} */
+  @Override
+  public Syntax getSyntax()
+  {
+    return Schema.getCoreSchema().getSyntax(getSyntaxOID());
+  }
 
-
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
   @Override
   public boolean isObsolete()
   {
@@ -262,7 +244,7 @@
       buffer.append(" SYNTAX ");
     }
 
-    buffer.append(getSyntaxOID());
+    buffer.append(getSyntax().getOID());
     buffer.append(" )");
   }
 }
diff --git a/opendj3-server-dev/src/server/org/opends/server/api/MatchingRule.java b/opendj3-server-dev/src/server/org/opends/server/api/MatchingRule.java
index 7e13154..5439bad 100644
--- a/opendj3-server-dev/src/server/org/opends/server/api/MatchingRule.java
+++ b/opendj3-server-dev/src/server/org/opends/server/api/MatchingRule.java
@@ -32,6 +32,7 @@
 
 import org.forgerock.opendj.ldap.ByteSequence;
 import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.schema.Syntax;
 import org.opends.server.types.ConditionResult;
 import org.opends.server.types.DirectoryException;
 
@@ -103,16 +104,12 @@
    */
   String getDescription();
 
-
-
   /**
-   * Retrieves the OID of the syntax with which this matching rule is
-   * associated.
+   * Whole class to be replaced by the equivalent SDK class.
    *
-   * @return The OID of the syntax with which this matching rule is
-   *         associated.
+   * @return SDK syntax
    */
-  String getSyntaxOID();
+  Syntax getSyntax();
 
 
 

--
Gitblit v1.10.0