Package org.apache.ldap.common.filter

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


     * @throws NamingException if any system indices fail
     * @see org.apache.ldap.server.db.Enumerator#enumerate(ExprNode)
     */
    public NamingEnumeration enumerate( ExprNode node ) throws NamingException
    {
        final ScopeNode snode = ( ScopeNode ) node;
        final BigInteger id = db.getEntryId( snode.getBaseDn() );

        switch( snode.getScope() )
        {
        case( SearchControls.OBJECT_SCOPE ):
            final IndexRecord record = new IndexRecord();
            record.setEntryId( id );
            record.setIndexKey( snode.getBaseDn() );
            return new SingletonEnumeration( record );
        case( SearchControls.ONELEVEL_SCOPE ):
            return enumerateChildren( snode.getBaseDn(),
                snode.getDerefAliases().derefInSearching() );
        case( SearchControls.SUBTREE_SCOPE ):
            return enumerateDescendants( snode );
        default:
            throw new NamingException( "Unrecognized search scope!" );
        }
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.
View Full Code Here

     * @see org.apache.ldap.server.db.Evaluator#evaluate(ExprNode, org.apache.ldap.server.db.IndexRecord)
     */
    public boolean evaluate( ExprNode node, IndexRecord record )
        throws NamingException
    {
        ScopeNode snode = ( ScopeNode ) node;
       
        switch( snode.getScope() )
        {
        case( SearchControls.OBJECT_SCOPE ):
            String dn = db.getEntryDn( record.getEntryId() );
            return dn.equals( snode.getBaseDn() );
        case( SearchControls.ONELEVEL_SCOPE ):
            return assertOneLevelScope( snode, record.getEntryId() );
        case( SearchControls.SUBTREE_SCOPE ):
            return assertSubtreeScope( snode, record.getEntryId() );
        default:
View Full Code Here

     * @throws NamingException if any system indices fail
     * @see org.apache.ldap.server.partition.impl.btree.Enumerator#enumerate(ExprNode)
     */
    public NamingEnumeration enumerate( ExprNode node ) throws NamingException
    {
        final ScopeNode snode = ( ScopeNode ) node;
        final BigInteger id = db.getEntryId( snode.getBaseDn() );

        switch( snode.getScope() )
        {
        case( SearchControls.OBJECT_SCOPE ):
            final IndexRecord record = new IndexRecord();
            record.setEntryId( id );
            record.setIndexKey( snode.getBaseDn() );
            return new SingletonEnumeration( record );
        case( SearchControls.ONELEVEL_SCOPE ):
            return enumerateChildren( snode.getBaseDn(),
                snode.getDerefAliases().derefInSearching() );
        case( SearchControls.SUBTREE_SCOPE ):
            return enumerateDescendants( snode );
        default:
            throw new NamingException( "Unrecognized search scope!" );
        }
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.
View Full Code Here

     * @see org.apache.ldap.server.partition.impl.btree.Evaluator#evaluate(ExprNode, org.apache.ldap.server.partition.impl.btree.IndexRecord)
     */
    public boolean evaluate( ExprNode node, IndexRecord record )
        throws NamingException
    {
        ScopeNode snode = ( ScopeNode ) node;
       
        switch( snode.getScope() )
        {
        case( SearchControls.OBJECT_SCOPE ):
            String dn = db.getEntryDn( record.getEntryId() );
            return dn.equals( snode.getBaseDn() );
        case( SearchControls.ONELEVEL_SCOPE ):
            return assertOneLevelScope( snode, record.getEntryId() );
        case( SearchControls.SUBTREE_SCOPE ):
            return assertSubtreeScope( snode, record.getEntryId() );
        default:
View Full Code Here

     * @see Evaluator#evaluate(ExprNode, String, Attributes)
     */
    public boolean evaluate( ExprNode node, String dn, Attributes record )
        throws NamingException
    {
        ScopeNode snode = ( ScopeNode ) node;

        switch( snode.getScope() )
        {
        case( SearchControls.OBJECT_SCOPE ):
            return dn.equals( snode.getBaseDn() );
        case( SearchControls.ONELEVEL_SCOPE ):
            if ( dn.endsWith( snode.getBaseDn() ) )
            {
                Name candidateDn = parser.parse( dn );
                Name scopeDn = parser.parse( snode.getBaseDn() );
                return ( scopeDn.size() + 1 ) == candidateDn.size();
            }
        case( SearchControls.SUBTREE_SCOPE ):
            return dn.endsWith( snode.getBaseDn() );
        default:
            throw new NamingException( "Unrecognized search scope!" );
        }
    }
View Full Code Here

     * @param namingListener the naming listener to register
     */
    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 );
View Full Code Here

     * @see org.apache.ldap.server.partition.impl.btree.Evaluator#evaluate(ExprNode, org.apache.ldap.server.partition.impl.btree.IndexRecord)
     */
    public boolean evaluate( ExprNode node, IndexRecord record )
        throws NamingException
    {
        ScopeNode snode = ( ScopeNode ) node;
       
        switch( snode.getScope() )
        {
        case( SearchControls.OBJECT_SCOPE ):
            String dn = db.getEntryDn( record.getEntryId() );
            return dn.equals( snode.getBaseDn() );
        case( SearchControls.ONELEVEL_SCOPE ):
            return assertOneLevelScope( snode, record.getEntryId() );
        case( SearchControls.SUBTREE_SCOPE ):
            return assertSubtreeScope( snode, record.getEntryId() );
        default:
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.
View Full Code Here

TOP

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

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.