예제 #1
0
 /// <summary> Adds the schema definition to the idList and nameList HashMaps.
 /// This method is used by the methods fetchSchema and add.
 ///
 /// Note that the nameTable has all keys cast to Upper-case.  This is so we
 /// can have a case-insensitive HashMap.  The getXXX (string key) methods
 /// will also cast to uppercase.
 ///
 /// </summary>
 /// <param name="schemaType">   Type of schema definition, use one of the final
 /// integers defined at the top of this class:
 /// ATTRIBUTE, OBJECT_CLASS, SYNTAX, NAME_FORM,
 /// DITCONTENT, DITSTRUCTURE, MATCHING, MATCHING_USE
 ///
 /// </param>
 /// <param name="element">      Schema element definition.
 /// </param>
 private void addElement(int schemaType, LdapSchemaElement element)
 {
     SupportClass.PutElement(idTable[schemaType], element.ID, element);
     string[] names = element.Names;
     for (int i = 0; i < names.Length; i++)
     {
         SupportClass.PutElement(nameTable[schemaType], names[i].ToUpper(), element);
     }
 }
예제 #2
0
        // ########################################################################
        // The following methods return an Enumeration of SchemaElements by schema type
        // ########################################################################

        // #######################################################################
        //  The following methods retrieve an Enumeration of Names of a schema type
        // #######################################################################


        /// <summary> This helper function returns a number that represents the type of schema
        /// definition the element represents.  The top of this file enumerates
        /// these types.
        ///
        /// </summary>
        /// <param name="element">  A class extending LdapSchemaElement.
        ///
        /// </param>
        /// <returns>      a Number that identifies the type of schema element and
        /// will be one of the following:
        /// ATTRIBUTE, OBJECT_CLASS, SYNTAX, NAME_FORM,
        /// DITCONTENT, DITSTRUCTURE, MATCHING, MATCHING_USE
        /// </returns>
        private int getType(LdapSchemaElement element)
        {
            if (element is LdapAttributeSchema)
            {
                return(ATTRIBUTE);
            }
            else if (element is LdapObjectClassSchema)
            {
                return(OBJECT_CLASS);
            }
            else if (element is LdapSyntaxSchema)
            {
                return(SYNTAX);
            }
            else if (element is LdapNameFormSchema)
            {
                return(NAME_FORM);
            }
            else if (element is LdapMatchingRuleSchema)
            {
                return(MATCHING);
            }
            else if (element is LdapMatchingRuleUseSchema)
            {
                return(MATCHING_USE);
            }
            else if (element is LdapDITContentRuleSchema)
            {
                return(DITCONTENT);
            }
            else if (element is LdapDITStructureRuleSchema)
            {
                return(DITSTRUCTURE);
            }
            else
            {
                throw new ArgumentException("The specified schema element type is not recognized");
            }
        }