The LdapSchemaElement class is the base class representing schema elements (definitions) in Ldap. An LdapSchemaElement is read-only, single-valued LdapAttribute. Therefore, it does not support the addValue and removeValue methods from LdapAttribute. This class overrides those methods and throws UnsupportedOperationException if either of those methods are invoked by an application.
Inheritance: LdapAttribute
Exemplo n.º 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);
     }
 }
        /// <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);
            var names = element.Names;

            for (var i = 0; i < names.Length; i++)
            {
                SupportClass.PutElement(_nameTable[schemaType], names[i].ToUpper(), element);
            }
        }
        /// <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)
        {
            _idTable[schemaType][element.Id] = element;
            var names = element.GetNames();

            foreach (var name in names)
            {
                _nameTable[schemaType][name.ToUpper()] = element;
            }
        }
        // ########################################################################
        // 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);
            }

            if (element is LdapObjectClassSchema)
            {
                return(ObjectClass);
            }

            if (element is LdapSyntaxSchema)
            {
                return(Syntax);
            }

            if (element is LdapNameFormSchema)
            {
                return(NameForm);
            }

            if (element is LdapMatchingRuleSchema)
            {
                return(Matching);
            }

            if (element is LdapMatchingRuleUseSchema)
            {
                return(MatchingUse);
            }

            if (element is LdapDitContentRuleSchema)
            {
                return(Ditcontent);
            }

            if (element is LdapDitStructureRuleSchema)
            {
                return(Ditstructure);
            }

            throw new ArgumentException("The specified schema element type is not recognized");
        }
Exemplo n.º 5
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(LdapSchema.ATTRIBUTE);
            }
            else if (element is LdapObjectClassSchema)
            {
                return(LdapSchema.OBJECT_CLASS);
            }
            else if (element is LdapSyntaxSchema)
            {
                return(LdapSchema.SYNTAX);
            }
            else if (element is LdapNameFormSchema)
            {
                return(LdapSchema.NAME_FORM);
            }
            else if (element is LdapMatchingRuleSchema)
            {
                return(LdapSchema.MATCHING);
            }
            else if (element is LdapMatchingRuleUseSchema)
            {
                return(LdapSchema.MATCHING_USE);
            }
            else if (element is LdapDITContentRuleSchema)
            {
                return(LdapSchema.DITCONTENT);
            }
            else if (element is LdapDITStructureRuleSchema)
            {
                return(LdapSchema.DITSTRUCTURE);
            }
            else
            {
                throw new System.ArgumentException("The specified schema element type is not recognized");
            }
        }
Exemplo n.º 6
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 LdapSchema.ATTRIBUTE;
			else if (element is LdapObjectClassSchema)
				return LdapSchema.OBJECT_CLASS;
			else if (element is LdapSyntaxSchema)
				return LdapSchema.SYNTAX;
			else if (element is LdapNameFormSchema)
				return LdapSchema.NAME_FORM;
			else if (element is LdapMatchingRuleSchema)
				return LdapSchema.MATCHING;
			else if (element is LdapMatchingRuleUseSchema)
				return LdapSchema.MATCHING_USE;
			else if (element is LdapDITContentRuleSchema)
				return LdapSchema.DITCONTENT;
			else if (element is LdapDITStructureRuleSchema)
				return LdapSchema.DITSTRUCTURE;
			else
				throw new System.ArgumentException("The specified schema element type is not recognized");
		}
Exemplo n.º 7
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);
			System.String[] names = element.Names;
			for (int i = 0; i < names.Length; i++)
			{
				SupportClass.PutElement(nameTable[schemaType], names[i].ToUpper(), element);
			}
			return ;
		}