Package org.apache.directory.shared.ldap.model.message

Examples of org.apache.directory.shared.ldap.model.message.SearchRequestImpl


     *  DIRSERVER-1600
     */
    @Test
    public void testSearchTypesOnly() throws Exception
    {
        SearchRequest sr = new SearchRequestImpl();
        sr.setBase( new Dn( "uid=admin,ou=system" ) );
        sr.setFilter( "(uid=admin)" );
        sr.setScope( SearchScope.OBJECT );
        sr.setTypesOnly( true );

        Cursor<Response> cursor = connection.search( sr );
        int count = 0;
        Entry response = null;

View Full Code Here


            {
                try
                {
                    String baseDn = config.getBaseDn();

                    SearchRequest searchRequest = new SearchRequestImpl();

                    searchRequest.setBase( new Dn( baseDn ) );
                    searchRequest.setFilter( config.getFilter() );
                    searchRequest.setSizeLimit( config.getSearchSizeLimit() );
                    searchRequest.setTimeLimit( config.getSearchTimeout() );

                    searchRequest.setDerefAliases( config.getAliasDerefMode() );
                    searchRequest.setScope( config.getSearchScope() );
                    searchRequest.setTypesOnly( false );

                    searchRequest.addAttributes( config.getAttributes() );

                    DirectoryService directoryService = new MockDirectoryService();
                    directoryService.setSchemaManager( schemaManager );
                    ( ( MockSyncReplConsumer ) syncreplClient ).init( directoryService );
                    syncreplClient.start();
View Full Code Here

    private void dump( CoreSession session, Dn entryDn )
    {
        try
        {
            SearchRequest searchRequest = new SearchRequestImpl();

            searchRequest.setBase( new Dn( schemaManager, "dc=example,dc=com" ) );
            searchRequest.setFilter( "(objectClass=*)" );
            searchRequest.setScope( SearchScope.SUBTREE );
            searchRequest.addAttributes( "entryUuid" );

            System.out.println( "-----------> Dumping the server <-----------" );
            System.out.println( "-----------> Looking for " + entryDn.getNormName() + " <-----------" );

            EntryFilteringCursor cursor = session.search( searchRequest );
View Full Code Here

    public void action( LdapMessageContainer<SearchRequestDecorator> container )
    {
        // Now, we can allocate the SearchRequest Object
        TLV tlv = container.getCurrentTLV();

        SearchRequest internalSearchRequest = new SearchRequestImpl();
        internalSearchRequest.setMessageId( container.getMessageId() );
        SearchRequestDecorator searchRequest = new SearchRequestDecorator(
            container.getLdapCodecService(), internalSearchRequest );

        searchRequest.setTlvId( tlv.getId());
        container.setMessage( searchRequest );
View Full Code Here

            LOG.debug( "received a null dn for a search" );
            throw new IllegalArgumentException( "The base Dn cannot be null" );
        }

        // Create a new SearchRequest object
        SearchRequest searchRequest = new SearchRequestImpl();

        searchRequest.setBase( baseDn );
        searchRequest.setFilter( filter );
        searchRequest.setScope( scope );
        searchRequest.addAttributes( attributes );
        searchRequest.setDerefAliases( AliasDerefMode.DEREF_ALWAYS );

        // Process the request in blocking mode
        return new EntryCursorImpl( search( searchRequest ) );
    }
View Full Code Here

     */
    public SearchFuture searchAsync( Dn baseDn, String filter, SearchScope scope, String... attributes )
        throws LdapException
    {
        // Create a new SearchRequest object
        SearchRequest searchRequest = new SearchRequestImpl();

        searchRequest.setBase( baseDn );
        searchRequest.setFilter( filter );
        searchRequest.setScope( scope );
        searchRequest.addAttributes( attributes );
        searchRequest.setDerefAliases( AliasDerefMode.DEREF_ALWAYS );

        // Process the request in blocking mode
        return searchAsync( searchRequest );
    }
View Full Code Here

    {
        Entry entry = null;

        try
        {
            SearchRequest searchRequest = new SearchRequestImpl();

            searchRequest.setBase( dn );
            searchRequest.setFilter( "(objectClass=*)" );
            searchRequest.setScope( SearchScope.OBJECT );
            searchRequest.addAttributes( attributes );
            searchRequest.setDerefAliases( AliasDerefMode.DEREF_ALWAYS );

            if ( ( controls != null ) && ( controls.length > 0 ) )
            {
                searchRequest.addAllControls( controls );
            }

            Cursor<Response> cursor = search( searchRequest );

            // Read the response
View Full Code Here

     *  DIRSERVER-1600
     */
    @Test
    public void testSearchTypesOnly() throws Exception
    {
        SearchRequest sr = new SearchRequestImpl();
        sr.setBase( new Dn( "uid=admin,ou=system" ) );
        sr.setFilter( "(uid=admin)" );
        sr.setScope( SearchScope.OBJECT );
        sr.setTypesOnly( true );
       
        Cursor<Response> cursor = connection.search( sr );
        int count = 0;
        Entry response = null;

View Full Code Here


    @Test
    public void testSimpleSearchWithControl() throws Exception
    {
        SearchRequest searchRequest = new SearchRequestImpl().setBase( new Dn( "ou=system" ) ).setFilter( "(objectclass=*)" )
        .setScope( SearchScope.ONELEVEL ).addControl( new ManageDsaITImpl() );
        EntryCursor cursor = connection.search( "ou=system", "(objectclass=*)", SearchScope.ONELEVEL );
        int count = 0;
       
        while ( cursor.next() )
View Full Code Here


    @Test
    public void testSearchWithDerefAlias() throws Exception
    {
        SearchRequest searchRequest = new SearchRequestImpl();
        searchRequest.setBase( new Dn( "ou=users,ou=system" ) );
        searchRequest.setFilter( "(objectClass=*)" );
        searchRequest.setScope( SearchScope.ONELEVEL );
        searchRequest.addAttributes( "*" );

        int count = 0;
        Cursor<Response> cursor = connection.search( searchRequest );

        while ( cursor.next() )
        {
            count++;
        }
        cursor.close();

        // due to dereferencing of aliases we get only one entry
        assertEquals( 2, count );

        count = 0;
        searchRequest.setDerefAliases( AliasDerefMode.NEVER_DEREF_ALIASES );
        cursor = connection.search( searchRequest );

        while ( cursor.next() )
        {
            count++;
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.model.message.SearchRequestImpl

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.