Package org.apache.ldap.common.filter

Examples of org.apache.ldap.common.filter.BranchNode


    private void initialize() throws NamingException
    {
        // search all naming contexts for static groups and generate
        // normalized sets of members to cache within the map

        BranchNode filter = new BranchNode( BranchNode.OR );
        filter.addNode( new SimpleNode( OC_ATTR, GROUPOFNAMES_OC, SimpleNode.EQUALITY ) );
        filter.addNode( new SimpleNode( OC_ATTR, GROUPOFUNIQUENAMES_OC, SimpleNode.EQUALITY ) );

        Iterator suffixes = nexus.listSuffixes( true );
        while ( suffixes.hasNext() )
        {
            String suffix = ( String ) suffixes.next();
View Full Code Here


    public void addNamingListener( EventContext ctx, Name name, ExprNode filter, SearchControls searchControls,
                                   NamingListener namingListener )
    {
        ScopeNode scope = new ScopeNode( DerefAliasesEnum.NEVERDEREFALIASES, name.toString(),
                searchControls.getSearchScope() );
        BranchNode and = new BranchNode( BranchNode.AND );
        and.addNode( scope );
        and.addNode( filter );
        EventSourceRecord rec = new EventSourceRecord( name, and, ctx, searchControls, namingListener );
        Object obj = sources.get( namingListener );

        if ( obj == null )
        {
View Full Code Here

        if ( node.isLeaf() )
        {
            return leafEvaluator.evaluate( ( SimpleNode ) node, objectClasses );
        }

        BranchNode bnode = ( BranchNode ) node;

        switch( bnode.getOperator() )
        {
        case( BranchNode.OR ):
            Iterator children = bnode.getChildren().iterator();

            while ( children.hasNext() )
            {
                ExprNode child = ( ExprNode ) children.next();

                if ( evaluate( child, objectClasses ) )
                {
                    return true;
                }
            }

            return false;
        case( BranchNode.AND ):
            children = bnode.getChildren().iterator();
            while ( children.hasNext() )
            {
                ExprNode child = ( ExprNode ) children.next();

                if ( ! evaluate( child, objectClasses ) )
                {
                    return false;
                }
            }

            return true;
        case( BranchNode.NOT ):
            if ( null != bnode.getChild() )
            {
                return ! evaluate( bnode.getChild(), objectClasses );
            }

            throw new IllegalArgumentException( "Negation has no child: " + node );
        default:
            throw new IllegalArgumentException( "Unrecognized branch node operator: "
                + bnode.getOperator() );
        }
    }
View Full Code Here

        if ( node.isLeaf() )
        {
            return leafEvaluator.evaluate( node, dn, entry );
        }

        BranchNode bnode = ( BranchNode ) node;

        switch( bnode.getOperator() )
        {
        case( BranchNode.OR ):
            Iterator children = bnode.getChildren().iterator();
           
            while ( children.hasNext() )
            {
                ExprNode child = ( ExprNode ) children.next();
               
                if ( evaluate( child, dn, entry ) )
                {
                    return true;
                }
            }

            return false;
        case( BranchNode.AND ):
            children = bnode.getChildren().iterator();
            while ( children.hasNext() )
            {
                ExprNode child = ( ExprNode ) children.next();

                if ( ! evaluate( child, dn, entry ) )
                {
                    return false;
                }
            }

            return true;
        case( BranchNode.NOT ):
            if ( null != bnode.getChild() )
            {
                return ! evaluate( bnode.getChild(), dn, entry );
            }

            throw new NamingException( "Negation has no child: " + node );
        default:
            throw new NamingException( "Unrecognized branch node operator: "
                + bnode.getOperator() );
        }
    }
View Full Code Here

            if( exprNode.isLeaf() )
            {
                return;
            }

            BranchNode branch = ( BranchNode ) exprNode;
            ArrayList exprNodes = branch.getChildren();
            for ( int ii = 0; ii < exprNodes.size(); ii++ )
            {
                ExprNode child = ( ExprNode ) exprNodes.get(ii);
                children.add( new ASTNode( this, child ) );
            }
View Full Code Here

                throw new IllegalArgumentException( "Unknown leaf assertion" );
            }
        }
        else
        {
            BranchNode branch = ( BranchNode ) node;
           
            switch( branch.getOperator() )
            {
            case( BranchNode.AND ):
                list = enumConj( branch );
                break;
            case( BranchNode.NOT ):
View Full Code Here

        if ( node.isLeaf() )
        {
            return leafEvaluator.evaluate( node, record );
        }

        BranchNode bnode = ( BranchNode ) node;

        switch( bnode.getOperator() )
        {
        case( BranchNode.OR ):
            Iterator children = bnode.getChildren().iterator();
           
            while ( children.hasNext() )
            {
                ExprNode child = ( ExprNode ) children.next();
               
                if ( evaluate( child, record ) )
                {
                    return true;
                }
            }

            return false;
        case( BranchNode.AND ):
            children = bnode.getChildren().iterator();
            while ( children.hasNext() )
            {
                ExprNode child = ( ExprNode ) children.next();

                if ( ! evaluate( child, record ) )
                {
                    return false;
                }
            }

            return true;
        case( BranchNode.NOT ):
            if ( null != bnode.getChild() )
            {
                return ! evaluate( bnode.getChild(), record );
            }

            throw new NamingException( "Negation has no child: " + node );
        default:
            throw new NamingException( "Unrecognized branch node operator: "
                + bnode.getOperator() );
        }
    }
View Full Code Here

        {
            effectiveBase = base;
        }

        // Add the scope node using the eective base to the ilter
        BranchNode root = new BranchNode( AbstractExprNode.AND );
        ExprNode node = new ScopeNode( env, effectiveBase.toString(),
            searchCtls.getSearchScope() );
        root.getChildren().add( node );
        root.getChildren().add( filter );

        // Annotate the node with the optimizer and return search enumeration.
        optimizer.annotate( root );
        return enumerator.enumerate( root );
    }
View Full Code Here

        // --------------------------------------------------------------------
        //                 H A N D L E   B R A N C H   N O D E S      
        // --------------------------------------------------------------------
        else
        {
            BranchNode bnode = ( BranchNode ) node;

            switch( bnode.getOperator() )
            {
            case( BranchNode.AND ):
                count = getConjunctionScan( bnode );
                break;
            case( BranchNode.NOT ):
View Full Code Here

         */
        Attribute attr = null;

        SimpleNode node = null;

        BranchNode filter = new BranchNode( BranchNode.AND );

        NamingEnumeration list = matchingAttributes.getAll();

        // Loop through each attribute value pair
        while ( list.hasMore() )
        {
            attr = ( Attribute ) list.next();
           
            /*
             * According to JNDI if an attribute in the matchingAttributes
             * list does not have any values then we match for just the presence
             * of the attribute in the entry
             */
            if ( attr.size() == 0 )
            {
                filter.addNode( new PresenceNode( attr.getID() ) );

                continue;
            }
           
            /*
             * With 1 or more value we build a set of simple nodes and add them
             * to the AND node - each attribute value pair is a simple AVA node.
             */
            for ( int ii = 0; ii < attr.size(); ii++ )
            {
                Object val = attr.get( ii );
               
                // Add simpel AVA node if its value is a String
                if ( val instanceof String )
                {
                    node = new SimpleNode( attr.getID(), ( String ) val, SimpleNode.EQUALITY );

                    filter.addNode( node );
                }
            }
        }

        return getNexusProxy().search( target , getEnvironment(), filter, ctls );
View Full Code Here

TOP

Related Classes of org.apache.ldap.common.filter.BranchNode

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.