Package org.apache.directory.server.xdbm

Examples of org.apache.directory.server.xdbm.IndexEntry


        boolean hasNext = cursor.next();

        if ( hasNext )
        {
            IndexEntry cursorEntry = cursor.get();
            IndexEntry<String, String> entry = new IndexEntry();
            entry.setId( ( String ) cursorEntry.getId() );
            entry.setKey( ( ( ParentIdAndRdn ) cursorEntry.getTuple().getKey() ).getParentId() );

            if ( entry.getKey().equals( parentId ) )
            {
                prefetched = entry;
                return true;
            }
        }
View Full Code Here


        boolean hasPrevious = currentCursor.previous();

        if ( hasPrevious )
        {
            IndexEntry entry = currentCursor.get();

            if ( ( ( ParentIdAndRdn ) entry.getTuple().getKey() ).getParentId().equals( currentParentId ) )
            {
                prefetched = entry;
                return true;
            }
        }
View Full Code Here

            // too memory consuming.
            // The idea is to use a ChildrenCursor each time we have an entry with chidren,
            // and process recursively.
            if ( hasNext )
            {
                IndexEntry cursorEntry = currentCursor.get();
                ParentIdAndRdn parentIdAndRdn = ( ( ParentIdAndRdn ) ( cursorEntry.getKey() ) );

                // Check that we aren't out of the cursor's limit
                if ( !parentIdAndRdn.getParentId().equals( currentParentId ) )
                {
                    // Ok, we went too far. Unstack the cursor and return
                    finished = cursorStack.size() == 0;

                    if ( !finished )
                    {
                        currentCursor.close();
                        currentCursor = ( Cursor<IndexEntry<ParentIdAndRdn, String>> ) cursorStack.pop();
                        currentParentId = ( String ) parentIdStack.pop();
                    }

                    // And continue...
                }
                else
                {
                    // We have a candidate, it will be returned.
                    if ( topLevel )
                    {
                        prefetched = new IndexEntry();
                        prefetched.setId( cursorEntry.getId() );
                        prefetched.setKey( baseId );
                    }
                    else
                    {
                        prefetched = cursorEntry;
                    }

                    // Check if the current entry has children or not.
                    if ( parentIdAndRdn.getNbDescendants() > 0 )
                    {
                        String newParentId = ( String ) cursorEntry.getId();

                        // Yes, then create a new cursor and go down one level
                        Cursor<IndexEntry<ParentIdAndRdn, String>> cursor = db.getRdnIndex().forwardCursor();

                        IndexEntry<ParentIdAndRdn, String> startingPos = new IndexEntry<ParentIdAndRdn, String>();
View Full Code Here

        assertFalse( cursor.previous() );
        assertFalse( cursor.available() );

        try
        {
            cursor.after( new IndexEntry() );
            fail( "should fail with UnsupportedOperationException " );
        }
        catch ( UnsupportedOperationException uoe )
        {
        }

        try
        {
            cursor.before( new IndexEntry() );
            fail( "should fail with UnsupportedOperationException " );
        }
        catch ( UnsupportedOperationException uoe )
        {
        }
View Full Code Here

        addEntry( modifiedEntry );

        String baseId = getEntryId( modifiedEntry.getDn() );

        ParentIdAndRdn parentIdAndRdn = getRdnIndex().reverseLookup( baseId );
        IndexEntry indexEntry = new IndexEntry();

        indexEntry.setId( baseId );
        indexEntry.setKey( parentIdAndRdn );

        Cursor<IndexEntry<ParentIdAndRdn, String>> cursor = new SingletonIndexCursor<ParentIdAndRdn>(
            indexEntry );
        String parentId = parentIdAndRdn.getParentId();
View Full Code Here

    // Private and Protected Methods
    // ------------------------------------------------------------------------

    private void prefetch() throws NamingException
    {
        IndexEntry rec = null;

        /*
         * Scan underlying Cursor until we arrive at the next valid candidate
         * if the cursor is exhuasted we clean up after completing the loop
         */
        while ( underlying.hasMore() )
        {
            rec = underlying.next();

            // If value is valid then we set it as the next candidate to return
            try
            {
                if ( assertion.assertCandidate( rec ) )
                {
                    if ( checkDups )
                    {
                        boolean dup = candidates.containsKey( rec.getId() );

                        if ( dup )
                        {
                            /*
                             * Dup checking is on and candidate is a duplicate that
                             * has already been seen so we need to skip it.
                             */
                            continue;
                        }
                        else
                        {
                            /*
                             * Dup checking is on and the candidate is not in the
                             * dup LUT so we need to set it as the next to return
                             * and add it to the LUT in case we encounter it another
                             * time.
                             */
                            prefetched.copy( rec );
                            candidates.put( rec.getId(), rec.getId() );
                            return;
                        }
                    }

                    prefetched.copy( rec );
View Full Code Here

    // Private and Protected Methods
    // ------------------------------------------------------------------------

    private void prefetch() throws NamingException
    {
        IndexEntry rec = null;

        /*
         * Scan underlying Cursor until we arrive at the next valid candidate
         * if the cursor is exhuasted we clean up after completing the loop
         */
        while ( underlying.hasMore() )
        {
            rec = underlying.next();

            // If value is valid then we set it as the next candidate to return
            try
            {
                if ( assertion.assertCandidate( rec ) )
                {
                    if ( checkDups )
                    {
                        boolean dup = candidates.containsKey( rec.getId() );

                        if ( dup )
                        {
                            /*
                             * Dup checking is on and candidate is a duplicate that
                             * has already been seen so we need to skip it.
                             */
                            continue;
                        }
                        else
                        {
                            /*
                             * Dup checking is on and the candidate is not in the
                             * dup LUT so we need to set it as the next to return
                             * and add it to the LUT in case we encounter it another
                             * time.
                             */
                            prefetched.copy( rec );
                            candidates.put( rec.getId(), rec.getId() );
                            return;
                        }
                    }

                    prefetched.copy( rec );
View Full Code Here

            List<ForwardIndexEntry> recordForwards = new ArrayList<ForwardIndexEntry>();
            IndexCursor<Long, Entry, Long> childList = db.list( id );

            while ( childList.next() )
            {
                IndexEntry old = childList.get();
                ForwardIndexEntry newRec = new ForwardIndexEntry();
                newRec.copy( old );
                recordForwards.add( newRec );
            }

            childList.close();

            Iterator list = recordForwards.iterator();

            while ( list.hasNext() )
            {
                IndexEntry rec = ( IndexEntry ) list.next();

                if ( engine != null && exprNode != null )
                {
                    if ( db.getChildCount( rec.getId() ) == 0 )
                    {
                        Evaluator evaluator = engine.evaluator( exprNode );
                        if ( evaluator.evaluateId( rec.getId() ) )
                        {
                            Entry newEntry = db.lookup( rec.getId() );
                            EntryNode child = new EntryNode( ( Long ) rec.getId(), this, db, newEntry, map, exprNode,
                                engine );
                            children.add( child );
                        }
                        else
                        {
                            continue;
                        }
                    }
                    else
                    {
                        Entry newEntry = db.lookup( rec.getId() );
                        EntryNode child = new EntryNode( ( Long ) rec.getId(), this, db, newEntry, map, exprNode,
                            engine );
                        children.add( child );
                    }
                }
                else
                {
                    Entry newEntry = db.lookup( ( Long ) rec.getId() );
                    EntryNode child = new EntryNode( ( Long ) rec.getId(), this, db, newEntry, map );
                    children.add( child );
                }
            }
        }
        catch ( Exception e )
View Full Code Here

        DefaultTableModel tableModel = new DefaultTableModel( cols, 0 );
        Object[] row = new Object[2];
        int count = 0;
        while ( cursor.next() && count < limitMax )
        {
            IndexEntry rec = ( IndexEntry ) cursor.get();
            row[0] = rec.getId();
            row[1] = partition.getEntryDn( ( Long ) row[0] ).getNormName();
            tableModel.addRow( row );
            count++;
        }
View Full Code Here

TOP

Related Classes of org.apache.directory.server.xdbm.IndexEntry

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.