Package org.apache.directory.shared.ldap.schema

Examples of org.apache.directory.shared.ldap.schema.AttributeType


        try
        {
            ExprNode filter = FilterParser.parse( "(uid=" + username + ")" );
            Set<AttributeTypeOptions> returningAttributes = new HashSet<AttributeTypeOptions>();
           
            AttributeType passwordAT = adminSession.getDirectoryService().getSchemaManager().lookupAttributeTypeRegistry( SchemaConstants.USER_PASSWORD_AT );
            returningAttributes.add( new AttributeTypeOptions( passwordAT) );
            bindDn = (String)ldapSession.getSaslProperty( SaslConstants.SASL_USER_BASE_DN );
           
            DN baseDn = new DN( bindDn );
View Full Code Here


        int pos = 0;

        for ( Value<?> value : attr )
        {
            AttributeType attributeType = null;

            try
            {
                attributeType = attributeTypeParser.parseAttributeTypeDescription( value.getString() );
            }
            catch ( ParseException e )
            {
                LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException( I18n.err( I18n.ERR_408,
                    value.getString() ), ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
                iave.setRootCause( e );
                throw iave;
            }

            // if the supertype is provided make sure it exists in some schema
            if ( ( attributeType.getSuperiorOid() != null ) && !schemaManager.getAttributeTypeRegistry().contains( attributeType.getSuperiorOid() ) )
            {
                throw new LdapOperationNotSupportedException( I18n.err( I18n.ERR_409, attributeType.getSuperiorOid() ),
                    ResultCodeEnum.UNWILLING_TO_PERFORM );
            }

            // if the syntax is provided by the description make sure it exists in some schema
            if ( attributeType.getSyntaxOid() != null && !schemaManager.getLdapSyntaxRegistry().contains( attributeType.getSyntaxOid() ) )
            {
                throw new LdapOperationNotSupportedException( I18n.err( I18n.ERR_410, attributeType.getSyntaxOid() ),
                    ResultCodeEnum.UNWILLING_TO_PERFORM );
            }

            // if the matchingRule is provided make sure it exists in some schema
            if ( attributeType.getEqualityOid() != null && !schemaManager.getMatchingRuleRegistry().contains( attributeType.getEqualityOid() ) )
            {
                throw new LdapOperationNotSupportedException( I18n.err( I18n.ERR_411, attributeType.getEqualityOid() ),
                    ResultCodeEnum.UNWILLING_TO_PERFORM );
            }

            // if the matchingRule is provided make sure it exists in some schema
            if ( attributeType.getOrderingOid() != null && !schemaManager.getMatchingRuleRegistry().contains( attributeType.getOrderingOid() ) )
            {
                throw new LdapOperationNotSupportedException( I18n.err( I18n.ERR_412, attributeType.getOrderingOid() ),
                    ResultCodeEnum.UNWILLING_TO_PERFORM );
            }

            // if the matchingRule is provided make sure it exists in some schema
            if ( attributeType.getSubstringOid() != null && !schemaManager.getMatchingRuleRegistry().contains( attributeType.getSubstringOid() ) )
            {
                throw new LdapOperationNotSupportedException( I18n.err( I18n.ERR_413, attributeType.getSubstringOid() ),
                    ResultCodeEnum.UNWILLING_TO_PERFORM );
            }

            // if the equality matching rule is null and no super type is specified then there is
            // definitely no equality matchingRule that can be resolved.  We cannot use an attribute
            // without a matchingRule for search or for building indices not to mention lookups.
            if ( attributeType.getEqualityOid() == null )
            {
                if ( attributeType.getSuperiorOid() == null )
                {
                    throw new LdapOperationNotSupportedException( I18n.err( I18n.ERR_414 ), ResultCodeEnum.UNWILLING_TO_PERFORM );
                }
                else
                {
                    AttributeType superType = schemaManager
                        .lookupAttributeTypeRegistry( attributeType.getSuperiorOid() );

                    if ( superType == null )
                    {
                        throw new LdapOperationNotSupportedException( I18n.err( I18n.ERR_415 ), ResultCodeEnum.UNWILLING_TO_PERFORM );
View Full Code Here

            {
                SchemaManager schemaManager = directoryService.getSchemaManager();
               
                try
                {
                    AttributeType type = schemaManager.lookupAttributeTypeRegistry( id );
                    return ! type.getSyntax().isHumanReadable();
                }
                catch ( Exception e )
                {
                    if ( StringTools.isEmpty( id ) )
                    {
View Full Code Here

     * @return the filter expression tree
     * @throws Exception if there are problems while looking up attributes
     */
    private static ExprNode getFilter( SchemaManager schemaManager, String principal ) throws Exception
    {
        AttributeType type = schemaManager.lookupAttributeTypeRegistry( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT );
        Value<String> value = new ServerStringValue( type, principal );
        return new EqualityNode<String>( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT, value );
    }
View Full Code Here

   
    private Value<?> convertToValue( String oid, Object value ) throws NamingException
    {
        Value<?> val = null;
       
        AttributeType attributeType = directoryService.getSchemaManager().lookupAttributeTypeRegistry( oid );
       
        // make sure we add the request controls to operation
        if ( attributeType.getSyntax().isHumanReadable() )
        {
            if ( value instanceof String )
            {
                val = new ServerStringValue( attributeType, (String)value );
            }
View Full Code Here

            Iterator<AttributeType> descendants = schemaManager.getAttributeTypeRegistry().descendants(
                node.getAttribute() );

            do
            {
                AttributeType descendant = descendants.next();

                attr = ( ServerAttribute ) entry.get( descendant );

                if ( attr != null )
                {
View Full Code Here

            Iterator<AttributeType> descendants = schemaManager.getAttributeTypeRegistry().descendants(
                node.getAttribute() );

            while ( descendants.hasNext() )
            {
                AttributeType descendant = descendants.next();

                attr = ( ServerAttribute ) entry.get( descendant );

                //noinspection unchecked
                if ( attr != null && evaluate( ( IndexEntry<Object, ServerEntry, ID> ) indexEntry, attr ) )
View Full Code Here

            Iterator<AttributeType> descendants = schemaManager.getAttributeTypeRegistry().descendants(
                node.getAttribute() );

            while ( descendants.hasNext() )
            {
                AttributeType descendant = descendants.next();

                attr = ( ServerAttribute ) entry.get( descendant );

                if ( attr != null && evaluate( null, attr ) )
                {
View Full Code Here

     */
    public boolean compare( NextInterceptor next, CompareOperationContext opContext ) throws Exception
    {
        opContext.getDn().normalize( schemaManager.getNormalizerMapping() );
       
        AttributeType at = opContext.getSession().getDirectoryService().getSchemaManager().lookupAttributeTypeRegistry( opContext.getOid() );
       
        if ( at.getSyntax().isHumanReadable() && ( opContext.getValue().isBinary() ) )
        {
            String value = opContext.getValue().getString();
            opContext.setValue( new ClientStringValue( value ) );
        }
       
View Full Code Here

                    entry.add( upId, upValue );
                }
                // 2) The attribute exists
                else
                {
                    AttributeType at = schemaManager.lookupAttributeTypeRegistry( upId );

                    // 2.1 if the attribute is single valued, replace the value
                    if ( at.isSingleValued() )
                    {
                        entry.removeAttributes( upId );
                        entry.add( upId, upValue );
                    }
                    // 2.2 the attribute is multi-valued : add the missing value
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.schema.AttributeType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.