directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: rev 55043 - incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema
Date Tue, 19 Oct 2004 00:33:55 GMT
Author: akarasulu
Date: Mon Oct 18 17:33:54 2004
New Revision: 55043

Added:
   incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/AbstractSchemaObject.java
  (contents, props changed)
Modified:
   incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/AbstractSyntax.java
   incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/AttributeType.java
   incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/BaseAttributeType.java
   incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/BaseMatchingRule.java
   incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DITContentRule.java
   incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DITStructureRule.java
   incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DefaultObjectClass.java
   incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/MatchingRule.java
   incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/MatchingRuleUse.java
   incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/NameForm.java
   incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/ObjectClass.java
   incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/SchemaObject.java
   incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/Syntax.java
Log:
Commit changes ...

 o cleaning up the schema API
 o created a abstract class hierarchy for ease of implementations
 o corrected several assumptions regarding schema objects
 o added new abstract base class for schema objects



Added: incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/AbstractSchemaObject.java
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/AbstractSchemaObject.java
Mon Oct 18 17:33:54 2004
@@ -0,0 +1,278 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.ldap.common.schema;
+
+
+import org.apache.ldap.common.util.ArrayUtils;
+
+
+/**
+ * The abstract base class for all schema object types.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class AbstractSchemaObject implements SchemaObject
+{
+    /** a numeric object identifier */
+    protected final String oid;
+
+    /** whether or not this SchemaObject is active */
+    protected boolean isObsolete = false;
+    /** a human readible identifiers for this SchemaObject */
+    protected String[] names = ArrayUtils.EMPTY_STRING_ARRAY;
+    /** a short description of this SchemaObject */
+    protected String description;
+
+
+    // ------------------------------------------------------------------------
+    // C O N S T R U C T O R S
+    // ------------------------------------------------------------------------
+
+
+     /**
+      * Creates an abstract SchemaObject.
+      *
+      * @param oid the numeric object identifier (OID)
+      * @see SchemaObject#getOid()
+      * @see MatchingRuleUse
+      * @throws NullPointerException if oid is null
+      */
+    protected AbstractSchemaObject( String oid )
+    {
+        this( oid, ArrayUtils.EMPTY_STRING_ARRAY, false, null );
+    }
+
+
+    /**
+     * Creates an abstract SchemaObject.
+     *
+     * @param oid the numeric object identifier (OID)
+     * @param names the human readable names for this SchemaObject
+     * @throws NullPointerException if oid is null
+     */
+    protected AbstractSchemaObject( String oid, String[] names )
+    {
+        this( oid, names, false, null );
+    }
+
+
+    /**
+     * Creates an abstract SchemaObject.
+     *
+     * @param oid the numeric object identifier (OID)
+     * @param names the human readable names for this SchemaObject
+     * @param isObsolete true if this object is inactive, false if active
+     * @throws NullPointerException if oid is null
+     */
+    protected AbstractSchemaObject( String oid, String[] names, boolean isObsolete )
+    {
+        this( oid, names, isObsolete, null );
+    }
+
+
+    /**
+     * Creates an abstract SchemaObject.
+     *
+     * @param oid the numeric object identifier (OID)
+     * @param isObsolete true if this object is inactive, false if active
+     * @throws NullPointerException if oid is null
+     */
+    protected AbstractSchemaObject( String oid, boolean isObsolete )
+    {
+        this( oid, null, isObsolete, null );
+    }
+
+
+    /**
+     * Creates an abstract SchemaObject.
+     *
+     * @param oid the numeric object identifier (OID)
+     * @param description a brief description for the SchemaObject
+     * @throws NullPointerException if oid is null
+     */
+    protected AbstractSchemaObject( String oid, String description )
+    {
+        this( oid, null, false, description );
+    }
+
+
+    /**
+     * Creates an abstract SchemaObject.
+     *
+     * @param oid the numeric object identifier (OID)
+     * @param names the human readable names for this SchemaObject
+     * @param isObsolete true if this object is inactive, false if active
+     * @param description a brief description for the SchemaObject
+     * @throws NullPointerException if oid is null
+     */
+    protected AbstractSchemaObject( String oid, String[] names,
+                                    boolean isObsolete, String description )
+    {
+        if ( oid == null )
+        {
+            throw new NullPointerException( "oid cannot be null" );
+        }
+
+        this.oid = oid;
+        this.isObsolete = isObsolete;
+        this.description = description;
+
+        if ( names != null )
+        {
+            this.names = names;
+        }
+    }
+
+
+    // ------------------------------------------------------------------------
+    // P U B L I C   A C C E S S O R S
+    // ------------------------------------------------------------------------
+
+
+    /**
+     * @see SchemaObject#getOid()
+     */
+    public String getOid()
+    {
+        return oid;
+    }
+
+
+    /**
+     * @see SchemaObject#isObsolete()
+     */
+    public boolean isObsolete()
+    {
+        return isObsolete;
+    }
+
+
+    /**
+     * @see SchemaObject#getNames()
+     */
+    public String[] getNames()
+    {
+        return names;
+    }
+
+
+    /**
+     * @see SchemaObject#getName()
+     */
+    public String getName()
+    {
+        return ( names == null || names.length == 0 ) ? null : names[0];
+    }
+
+
+    /**
+     * @see SchemaObject#getDescription()
+     */
+    public String getDescription()
+    {
+        return description;
+    }
+
+
+    // ------------------------------------------------------------------------
+    // P R O T E C T E D    M U T A T O R S
+    // ------------------------------------------------------------------------
+
+
+    /**
+     * Sets whether or not this SchemaObject is inactived.
+     *
+     * @param obsolete true if this object is inactive, false if it is in use
+     */
+    protected void setObsolete( boolean obsolete )
+    {
+        isObsolete = obsolete;
+    }
+
+
+    /**
+     * Sets the human readable names for this SchemaObject.
+     *
+     * @param names the human readable names for this SchemaObject
+     */
+    protected void setNames( String[] names )
+    {
+        this.names = names;
+    }
+
+
+    /**
+     * Sets the brief description for this SchemaObject.
+     *
+     * @param description the brief description for this SchemaObject
+     */
+    protected void setDescription( String description )
+    {
+        this.description = description;
+    }
+
+
+    // ------------------------------------------------------------------------
+    // Object overloads
+    // ------------------------------------------------------------------------
+
+
+    /**
+     * Based on the hashCode of the oid property.
+     *
+     * @return the hashCode of the oid String
+     */
+    public int hashCode()
+    {
+        return oid.hashCode();
+    }
+
+
+    /**
+     * If the object implements SchemaObject and has the same OID as this
+     * SchemaObject then they are considered equal.
+     *
+     * @param obj the object to test for equality
+     * @return true if obj is a SchemaObject and the OID's match
+     */
+    public boolean equals( Object obj )
+    {
+        if ( obj == this )
+        {
+            return true;
+        }
+
+        if ( obj instanceof SchemaObject )
+        {
+            return oid.equals( ( ( SchemaObject ) obj ).getOid() );
+        }
+
+        return false;
+    }
+
+
+    /**
+     * Gets the String for the OID of this SchmeaObject.
+     *
+     * @return the OID of this SchmeaObject
+     */
+    public String toString()
+    {
+        return oid.toString();
+    }
+}

Modified: incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/AbstractSyntax.java
==============================================================================
--- incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/AbstractSyntax.java
(original)
+++ incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/AbstractSyntax.java
Mon Oct 18 17:33:54 2004
@@ -23,19 +23,12 @@
  * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public abstract class AbstractSyntax implements Syntax
+public abstract class AbstractSyntax extends AbstractSchemaObject implements Syntax
 {
-    /** the oid of this Syntax */
-    private final String oid;
-
     /** the human readible flag */
-    private boolean isHumanReadible;
-    /** a short description of this Syntax */
-    private String description;
-    /** a human readible identifier for this Syntax */
-    private String name;
-    
-    
+    private boolean isHumanReadible = false;
+
+
     // ------------------------------------------------------------------------
     // C O N S T R U C T O R S
     // ------------------------------------------------------------------------
@@ -48,8 +41,7 @@
      */
     protected AbstractSyntax( String oid )
     {
-        this.oid = oid;
-        this.isHumanReadible = false;
+        super( oid );
     }
     
     
@@ -57,13 +49,12 @@
      * Creates a Syntax object using a unique OID.
      *
      * @param oid the OID for this Syntax
-     * @param name the name for this Syntax
+     * @param isHumanReadible whether or not Syntax is human readible
      */
-    protected AbstractSyntax( String oid, String name )
+    protected AbstractSyntax( String oid, boolean isHumanReadible )
     {
-        this.oid = oid;
-        this.name = name;
-        this.isHumanReadible = false;
+        super( oid );
+        this.isHumanReadible = isHumanReadible;
     }
 
 
@@ -71,14 +62,11 @@
      * Creates a Syntax object using a unique OID.
      *
      * @param oid the OID for this Syntax
-     * @param name the name for this Syntax
-     * @param isHumanReadible whether or not Syntax is human readible
+     * @param description the description for this Syntax
      */
-    protected AbstractSyntax( String oid, String name, boolean isHumanReadible )
+    protected AbstractSyntax( String oid, String description )
     {
-        this.oid = oid;
-        this.name = name;
-        this.isHumanReadible = isHumanReadible;
+        super( oid, description );
     }
 
 
@@ -86,16 +74,12 @@
      * Creates a Syntax object using a unique OID.
      *
      * @param oid the OID for this Syntax
-     * @param name the name for this Syntax
      * @param isHumanReadible whether or not Syntax is human readible
      * @param description the description for this Syntax
      */
-    protected AbstractSyntax( String oid, String name, String description,
-                          boolean isHumanReadible )
+    protected AbstractSyntax( String oid, String description, boolean isHumanReadible )
     {
-        this.oid = oid;
-        this.name = name;
-        this.description = description;
+        super( oid, description );
         this.isHumanReadible = isHumanReadible;
     }
 
@@ -113,33 +97,6 @@
         return isHumanReadible;
     }
 
-    
-    /**
-     * @see org.apache.ldap.common.schema.Syntax#getDescription()
-     */
-    public final String getDescription()
-    {
-        return description;
-    }
-
-    
-    /**
-     * @see org.apache.ldap.common.schema.Syntax#getName()
-     */
-    public final String getName()
-    {
-        return name;
-    }
-
-    
-    /**
-     * @see org.apache.ldap.common.schema.Syntax#getOid()
-     */
-    public final String getOid()
-    {
-        return oid;
-    }
-    
 
     // ------------------------------------------------------------------------
     // Protected setters
@@ -147,17 +104,6 @@
 
     
     /**
-     * Sets the description for this Syntax.
-     * 
-     * @param description the description to set
-     */
-    protected void setDescription( String description )
-    {
-        this.description = description;
-    }
-
-    
-    /**
      * Sets the human readible flag value.
      * 
      * @param isHumanReadible the human readible flag value to set
@@ -168,17 +114,6 @@
     }
 
     
-    /**
-     * Sets the name of this Syntax.
-     *
-     * @param name the name to set.
-     */
-    protected void setName( String name )
-    {
-        this.name = name;
-    }
-
-
     // ------------------------------------------------------------------------
     // Object overloads
     // ------------------------------------------------------------------------
@@ -204,27 +139,16 @@
      */
     public boolean equals( Object obj )
     {
-        if ( obj == this )
+        if (! super.equals( obj ) )
         {
-            return true;
+            return false;
         }
 
         if ( obj instanceof Syntax )
         {
-            return oid.equals( ( ( Syntax ) obj ).getOid() );
+            return true;
         }
 
         return false;
-    }
-
-
-    /**
-     * Prints out the Syntax OID of the Syntax
-     *
-     * @return
-     */
-    public String toString()
-    {
-        return super.toString();
     }
 }

Modified: incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/AttributeType.java
==============================================================================
--- incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/AttributeType.java
(original)
+++ incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/AttributeType.java
Mon Oct 18 17:33:54 2004
@@ -126,27 +126,6 @@
 public interface AttributeType extends SchemaObject
 {
     /**
-     * Gets the object identifier for this AttributeType.
-     * 
-     * @return the object identifier for this AttributeType
-     */
-    String getOid();
-    
-    /**
-     * Gets the first name in the list of names for this AttributeTypeImpl.
-     *
-     * @return the first name in the list of names
-     */
-    String getName();
-    
-    /**
-     * Gets all the names for this AttributeType.
-     *
-     * @return String names for this AttributeType
-     */
-    String[] getAllNames();
-
-    /**
      * Gets whether or not this AttributeType is single-valued.
      *
      * @return true if only one value can exist for this AttributeType, false
@@ -168,13 +147,6 @@
      */
     boolean isCollective();
     
-    /**
-     * Gets whether or not this AttributeType is obsolete.
-     *
-     * @return true if obsolete, false if not.
-     */
-    boolean isObsolete();
-
     /**
      * Determines the usage for this AttributeType.
      *

Modified: incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/BaseAttributeType.java
==============================================================================
--- incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/BaseAttributeType.java
(original)
+++ incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/BaseAttributeType.java
Mon Oct 18 17:33:54 2004
@@ -27,20 +27,14 @@
  * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class BaseAttributeType implements Serializable, AttributeType
+public class BaseAttributeType extends AbstractSchemaObject implements Serializable, AttributeType
 {
     // ------------------------------------------------------------------------
     // Specification Attributes 
     // ------------------------------------------------------------------------
 
-    /** the object identifier for this attributeType */
-    private final String oid;
     /** the optional superior attributeType */
     private AttributeType superior;
-    /** names for this attribute of this type */
-    private String[] nameArray;
-    /** the optional description for this attributeType*/
-    private String descption;
     /** the equality matching rule for this attributeType */
     private MatchingRule equality;
     /** the substring matching rule for this attributeType */
@@ -55,8 +49,6 @@
     private boolean isCollective = false;
     /** whether or not this type can be modified by directory users */
     private boolean canUserModify = true;
-    /** whether or not this type has been obsoleted */
-    private boolean isObsolete = true;
     /** the usage for this attributeType */
     private UsageEnum usage = UsageEnum.USERAPPLICATIONS;
     /** the length of this attribute in bytes */
@@ -75,7 +67,7 @@
      */
     protected BaseAttributeType( String oid )
     {
-        this.oid = oid;
+        super( oid );
     }
 
 
@@ -90,40 +82,12 @@
     }
 
 
-    public String getName()
-    {
-        if ( nameArray == null )
-        {
-            return null;
-        }
-
-        if ( nameArray.length == 0 )
-        {
-            return null;
-        }
-
-        return ( String ) nameArray[0];
-    }
-
-
-    public String[] getAllNames()
-    {
-        return nameArray;
-    }
-
-
     public boolean isObsolete()
     {
         return isObsolete;
     }
 
 
-    public String getDescription()
-    {
-        return descption;
-    }
-
-
     public String getSyntaxOid()
     {
         return syntax.getOid();
@@ -194,21 +158,9 @@
     // ------------------------------------------------------------------------
 
 
-    protected void setDescription( String description )
-    {
-        this.descption = description;
-    }
-
-
     protected void setSuperior( AttributeType superior )
     {
         this.superior = superior;
-    }
-
-
-    protected void setAllNames( String[] names )
-    {
-        this.nameArray = names;
     }
 
 

Modified: incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/BaseMatchingRule.java
==============================================================================
--- incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/BaseMatchingRule.java
(original)
+++ incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/BaseMatchingRule.java
Mon Oct 18 17:33:54 2004
@@ -26,24 +26,15 @@
  * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class BaseMatchingRule implements MatchingRule
+public class BaseMatchingRule extends AbstractSchemaObject implements MatchingRule
 {
-    /** the object identifier */
-    private final String oid;
-
     /** the syntax this matching rule can be applied to */
     private Syntax syntax;
     /** comparator used to compare and match values of the associated syntax */
     private Comparator comparator;
     /** normalizer used to transform values to a canonical form */
     private Normalizer normalizer;
-    /** isObsolete boolean flag */
-    private boolean isObsolete = false;
-    /** a short descriptive name */
-    private String name = null;
-    /** a description about this MatchingRule */
-    private String description = null;
-    
+
     
     // ------------------------------------------------------------------------
     // C O N S T R U C T O R S
@@ -57,7 +48,7 @@
      */
     public BaseMatchingRule( String oid )
     {
-        this.oid = oid;
+        super( oid );
     }
 
 
@@ -67,49 +58,13 @@
 
     
     /**
-     * @see org.apache.ldap.common.schema.MatchingRule#getDescription()
-     */
-    public String getDescription()
-    {
-        return description;
-    }
-    
-
-    /**
-     * @see org.apache.ldap.common.schema.MatchingRule#getName()
-     */
-    public String getName()
-    {
-        return name;
-    }
-
-    
-    /**
-     * @see org.apache.ldap.common.schema.MatchingRule#getOid()
-     */
-    public String getOid()
-    {
-        return oid;
-    }
-    
-
-    /**
      * @see org.apache.ldap.common.schema.MatchingRule#getSyntax()
      */
     public Syntax getSyntax()
     {
         return syntax;
     }
-    
 
-    /**
-     * @see org.apache.ldap.common.schema.MatchingRule#isObsolete()
-     */
-    public boolean isObsolete()
-    {
-        return isObsolete;
-    }
-    
 
     /**
      * @see org.apache.ldap.common.schema.MatchingRule#getComparator()
@@ -134,39 +89,6 @@
     // ------------------------------------------------------------------------
 
     
-    /**
-     * Sets a short description for this MatchingRule.
-     * 
-     * @param description the description to set
-     */
-    protected void setDescription(String description)
-    {
-        this.description = description;
-    }
-
-    
-    /**
-     * Sets this MatchingRule's isObsolete flag.
-     * 
-     * @param isObsolete whether or not this object is obsolete.
-     */
-    protected void setObsolete( boolean isObsolete )
-    {
-        this.isObsolete = isObsolete;
-    }
-
-    
-    /**
-     * Sets the short descriptive name for this MatchingRule.
-     * 
-     * @param name The name to set
-     */
-    protected void setName( String name )
-    {
-        this.name = name;
-    }
-
-
     /**
      * Sets the syntax this matching rule works with.
      *

Modified: incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DITContentRule.java
==============================================================================
--- incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DITContentRule.java
(original)
+++ incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DITContentRule.java
Mon Oct 18 17:33:54 2004
@@ -107,13 +107,6 @@
 public interface DITContentRule extends SchemaObject
 {
     /**
-     * Gets a short descriptive name for the DITContentRule.
-     *
-     * @return a short name.
-     */
-    String getName();
-
-    /**
      * Gets the oid for this DITContentRule.
      *
      * @return the object identifier

Modified: incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DITStructureRule.java
==============================================================================
--- incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DITStructureRule.java
(original)
+++ incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DITStructureRule.java
Mon Oct 18 17:33:54 2004
@@ -75,13 +75,6 @@
 public interface DITStructureRule extends SchemaObject
 {
     /**
-     * Gets a short descriptive name for the DITStructureRule.
-     *
-     * @return a short name.
-     */
-    String getName();
-
-    /**
      * Gets the oid for this DITStructureRule.
      *
      * @return the object identifier

Modified: incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DefaultObjectClass.java
==============================================================================
--- incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DefaultObjectClass.java
(original)
+++ incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DefaultObjectClass.java
Mon Oct 18 17:33:54 2004
@@ -30,7 +30,7 @@
  * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class DefaultObjectClass implements ObjectClass, Serializable
+public class DefaultObjectClass extends AbstractSchemaObject implements ObjectClass, Serializable
 {
     /** empty array of ObjectClasses so we do not have to recreate objects */
     private static final ObjectClass[] EMPTY_OCLASS_ARR = new ObjectClass[0];
@@ -44,18 +44,10 @@
     /** */
     private ObjectClassTypeEnum type = ObjectClassTypeEnum.ABSTRACT;
     /** */
-    private final String oid;
-    /** */
-    private boolean isObsolete;
-    /** */
-    private String desc;
-    /** */
     private ArrayList mayList;
     /** */
     private ArrayList mustList;
     /** */
-    private String name;
-    /** */
     private ArrayList superClasses;
 
     
@@ -71,7 +63,7 @@
      */
     DefaultObjectClass( String oid )
     {
-        this.oid = oid;
+        super( oid );
     }
 
 
@@ -119,58 +111,12 @@
     }
 
 
-    public String getOid()
-    {
-        return oid;
-    }
-
-
-    public String getName()
-    {
-        return name;
-    }
-
-
-    public String getDescription()
-    {
-        return desc;
-    }
-
-
-    public boolean isObsolete()
-    {
-        return isObsolete;
-    }
-
-
     // ------------------------------------------------------------------------
     // Package Friendly Mutators
     // ------------------------------------------------------------------------
 
 
     /**
-     * Sets whether or not this is an obsoleted ObjectClass.
-     *
-     * @param isObsolete whether or not this is an obsoleted ObjectClass
-     */
-    void setObsolete( boolean isObsolete )
-    {
-        this.isObsolete = isObsolete;
-    }
-
-
-    /**
-     * Sets the description for this objectClass.
-     *
-     * @param desc the description for this objectClass
-     */
-    void setDescription( String desc )
-    {
-        this.desc = desc;
-    }
-
-
-    /**
      * Adds a list of AttributeTypes that may be present within this
      * ObjectClass.
      *
@@ -193,7 +139,7 @@
      *
      * @param mustList more AttributeTypes to add to the mandatory list
      */
-    void addToMustList( ArrayList mustList )
+    void addToMustList( List mustList )
     {
         if ( this.mustList == null )
         {
@@ -205,17 +151,6 @@
 
 
     /**
-     * Sets the name of this ObjectClass.
-     *
-     * @param name the name to set for this ObjectClass
-     */
-    void setName( String name )
-    {
-        this.name = name;
-    }
-
-
-    /**
      * Adds ObjectClass to the list of super classes for this ObjectClass.
      *
      * @param superClasses the list of super classes to add to this ObjectClass
@@ -239,21 +174,5 @@
     void setType( ObjectClassTypeEnum type )
     {
         this.type = type;
-    }
-
-
-    // ------------------------------------------------------------------------
-    // Object Overrides
-    // ------------------------------------------------------------------------
-
-
-    /**
-     * Prints the name of this objectClass.
-     *
-     * @see java.lang.Object#toString()
-     */
-    public String toString()
-    {
-        return ( String ) name;
     }
 }

Modified: incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/MatchingRule.java
==============================================================================
--- incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/MatchingRule.java
(original)
+++ incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/MatchingRule.java
Mon Oct 18 17:33:54 2004
@@ -71,42 +71,14 @@
  * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public interface MatchingRule
+public interface MatchingRule extends SchemaObject
 {
     /**
-     * Gets a long description for the MatchingRule.
-     * 
-     * @return a long description
-     */
-    String getDescription();
-
-    /**
-     * Gets a short descriptive name for the MatchingRule. 
-     * 
-     * @return a short name
-     */
-    String getName();
-
-    /**
-     * Gets the oid for this MatchingRule.
-     * 
-     * @return the object identifier
-     */
-    String getOid();
-
-    /**
      * Gets the SyntaxImpl used by this MatchingRule.
      * 
      * @return the SyntaxImpl of this MatchingRule
      */
     Syntax getSyntax();
-
-    /**
-     * Gets whether or not this MatchingRule has been obsoleted for another.
-     * 
-     * @return true if it is obsolete false otherwise
-     */
-    boolean isObsolete();
 
     /**
      * Gets the Comparator enabling the use of this MatchingRule for ORDERING

Modified: incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/MatchingRuleUse.java
==============================================================================
--- incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/MatchingRuleUse.java
(original)
+++ incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/MatchingRuleUse.java
Mon Oct 18 17:33:54 2004
@@ -76,20 +76,6 @@
 public interface MatchingRuleUse extends SchemaObject
 {
     /**
-     * Gets a short descriptive name for the MatchingRuleUse. 
-     * 
-     * @return a short name
-     */
-    String getName();
-
-    /**
-     * Gets whether or not this MatchingRuleUse has been obsoleted for another.
-     * 
-     * @return true if it is obsolete false otherwise
-     */
-    boolean isObsolete();
-
-    /**
      * Gets the matchingRule this MatchingRuleUse definition applies to. 
      * 
      * @return the matchingRule
@@ -102,5 +88,5 @@
      * 
      * @return the applicable attributes
      */
-    public AttributeType [] getApplicableAttributes();
+    public AttributeType[] getApplicableAttributes();
 }

Modified: incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/NameForm.java
==============================================================================
--- incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/NameForm.java
(original)
+++ incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/NameForm.java
Mon Oct 18 17:33:54 2004
@@ -85,13 +85,6 @@
 public interface NameForm extends SchemaObject
 {
     /**
-     * Gets a short descriptive name for the NameForm.
-     *
-     * @return a short name.
-     */
-    String getName();
-
-    /**
      * Gets the oid for this NameForm.
      *
      * @return the object identifier

Modified: incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/ObjectClass.java
==============================================================================
--- incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/ObjectClass.java
(original)
+++ incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/ObjectClass.java
Mon Oct 18 17:33:54 2004
@@ -71,13 +71,6 @@
     String getOid();
 
     /**
-     * Gets the human readable name of this ObjectClass.
-     *
-     * @return the name of this ObjectClass
-     */
-    String getName();
-
-    /**
      * Gets whether or not this NameForm is obsolete.
      *
      * @return true if obsolete, false if not.

Modified: incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/SchemaObject.java
==============================================================================
--- incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/SchemaObject.java
(original)
+++ incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/SchemaObject.java
Mon Oct 18 17:33:54 2004
@@ -60,6 +60,44 @@
 public interface SchemaObject
 {
     /**
+     * Gets whether or not this SchemaObject has been inactivated.  All
+     * SchemaObjects except Syntaxes allow for this parameter within their
+     * definition.  For Syntaxes this property should always return false in
+     * which case it is never included in the description.
+     *
+     * @return true if inactive, false if active
+     */
+    boolean isObsolete();
+
+    /**
+     * Gets usually what is the numeric object identifier assigned to this
+     * SchemaObject.  All schema objects except for MatchingRuleUses have an
+     * OID assigned specifically to then.  A MatchingRuleUse's OID really is
+     * the OID of it's MatchingRule and not specific to the MatchingRuleUse.
+     * This effects how MatchingRuleUse objects are maintained by the system.
+     *
+     * @return an OID for this SchemaObject or its MatchingRule if this
+     * SchemaObject is a MatchingRuleUse object
+     */
+    String getOid();
+
+    /**
+     * Gets short names for this SchemaObject if any exists for it.
+     *
+     * @return the names for this SchemaObject
+     */
+    String[] getNames();
+
+    /**
+     * Gets the first name in the set of short names for this SchemaObject if
+     * any exists for it.
+     *
+     * @return the first of the names for this SchemaObject or null if one does
+     * not exist
+     */
+    String getName();
+
+    /**
      * Gets a short description about this SchemaObject.
      *  
      * @return a short description about this SchemaObject

Modified: incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/Syntax.java
==============================================================================
--- incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/Syntax.java
(original)
+++ incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/Syntax.java
Mon Oct 18 17:33:54 2004
@@ -73,13 +73,6 @@
     boolean isHumanReadable();
     
     /**
-     * Gets a short descriptive name for the Syntax. 
-     * 
-     * @return a short name
-     */
-    String getName();
-    
-    /**
      * Gets the oid for this Syntax.
      * 
      * @return the object identifier

Mime
View raw message