Package org.apache.directory.studio.connection.core.io.jndi

Examples of org.apache.directory.studio.connection.core.io.jndi.StudioNamingEnumeration


    {
        // Creating the response
        if ( batchResponseDsml != null )
        {
            // [Optimization] We're only searching if we need to produce a response
            StudioNamingEnumeration ne = browserConnection.getConnection().getJNDIConnectionWrapper().search(
                request.getBaseObject().getUpName(), request.getFilter().toString(), getSearchControls( request ),
                getAliasDereferencingMethod( request ), ReferralHandlingMethod.IGNORE, getControls( request ), monitor,
                null );

            SearchParameter sp = new SearchParameter();
View Full Code Here



    static JndiLdifEnumeration search( IBrowserConnection browserConnection, SearchParameter parameter,
        StudioProgressMonitor monitor )
    {
        StudioNamingEnumeration result = SearchRunnable.search( browserConnection, parameter, monitor );
        return new JndiLdifEnumeration( result, browserConnection, parameter, monitor );
    }
View Full Code Here

            // Creating a dummy monitor that will be used to check if something
            // went wrong when executing the request
            StudioProgressMonitor dummyMonitor = new StudioProgressMonitor( monitor );

            // Searching for the requested entries
            StudioNamingEnumeration ne = SearchRunnable.search( browserConnection, searchParameter, dummyMonitor );
            monitor.worked( 1 );

            // Getting the DSML string associated to the search
            // and the type of answer the user is expecting
            String dsmlExportString = null;
View Full Code Here

                // add returning attributes for children and alias detection
                SearchParameter searchParameter = getSearchParameter( search );
                ArrayList<ISearchResult> searchResultList = new ArrayList<ISearchResult>();
                ArrayList<SearchContinuation> searchContinuationList = new ArrayList<SearchContinuation>();

                StudioNamingEnumeration enumeration = null;
                // search
                try
                {
                    enumeration = search( browserConnection, searchParameter, monitor );

                    // iterate through the search result
                    while ( !monitor.isCanceled() && enumeration != null && enumeration.hasMore() )
                    {
                        StudioSearchResult sr = enumeration.next();
                        boolean isContinuedSearchResult = sr.isContinuedSearchResult();
                        LdapURL searchContinuationUrl = sr.getSearchContinuationUrl();

                        if ( searchContinuationUrl == null )
                        {
                            LdapDN dn = JNDIUtils.getDn( sr );
                            IEntry entry = null;

                            Connection resultConnection = sr.getConnection();
                            IBrowserConnection resultBrowserConnection = BrowserCorePlugin.getDefault()
                                .getConnectionManager().getBrowserConnection( resultConnection );
                            if ( resultBrowserConnection == null )
                            {
                                resultBrowserConnection = browserConnection;
                            }

                            // get entry from cache or create it
                            entry = resultBrowserConnection.getEntryFromCache( dn );
                            if ( entry == null )
                            {
                                entry = createAndCacheEntry( resultBrowserConnection, dn, monitor );
                            }

                            // initialize special flags
                            initFlags( entry, sr, searchParameter );

                            // fill the attributes
                            fillAttributes( entry, sr, search.getSearchParameter() );

                            if ( isContinuedSearchResult )
                            {
                                // the result is from a continued search
                                // we create a special entry that displays the URL of the entry
                                entry = new ContinuedSearchResultEntry( resultBrowserConnection, dn );
                            }

                            searchResultList
                                .add( new org.apache.directory.studio.ldapbrowser.core.model.impl.SearchResult( entry,
                                    search ) );
                        }
                        else
                        {
                            //entry = new ContinuedSearchResultEntry( resultBrowserConnection, dn );
                            SearchContinuation searchContinuation = new SearchContinuation( search,
                                searchContinuationUrl );
                            searchContinuationList.add( searchContinuation );
                        }

                        monitor
                            .reportProgress( searchResultList.size() == 1 ? BrowserCoreMessages.model__retrieved_1_entry
                                : BrowserCoreMessages.bind( BrowserCoreMessages.model__retrieved_n_entries,
                                    new String[]
                                        { Integer.toString( searchResultList.size() ) } ) );
                    }
                }
                catch ( Exception e )
                {
                    int ldapStatusCode = JNDIUtils.getLdapStatusCode( e );
                    if ( ldapStatusCode == 3 || ldapStatusCode == 4 || ldapStatusCode == 11 )
                    {
                        search.setCountLimitExceeded( true );
                    }
                    else
                    {
                        monitor.reportError( e );
                    }
                }

                // check for response controls
                try
                {
                    if ( enumeration != null )
                    {
                        Control[] jndiControls = enumeration.getResponseControls();
                        if ( jndiControls != null )
                        {
                            for ( Control jndiControl : jndiControls )
                            {
                                if ( jndiControl instanceof PagedResultsResponseControl )
View Full Code Here

                StudioControl ctl = ctls.get( i );
                jndiControls[i] = new BasicControl( ctl.getOid(), ctl.isCritical(), ctl.getControlValue() );
            }
        }

        StudioNamingEnumeration result = browserConnection.getConnection().getJNDIConnectionWrapper().search(
            searchBase, filter, controls, aliasesDereferencingMethod, referralsHandlingMethod, jndiControls, monitor,
            null );
        return result;
    }
View Full Code Here

                searchParameter.setTimeLimit( 0 );
                searchParameter.setAliasesDereferencingMethod( browserConnection.getAliasesDereferencingMethod() );
                searchParameter.setReferralsHandlingMethod( browserConnection.getReferralsHandlingMethod() );
                searchParameter.setInitHasChildrenFlag( true );
                dummyMonitor.reset();
                StudioNamingEnumeration enumeration = search( browserConnection, searchParameter, dummyMonitor );
                try
                {
                    if ( enumeration != null && enumeration.hasMore() )
                    {
                        // create base DN entry
                        entry = new BaseDNEntry( aDN, browserConnection );
                        browserConnection.getRootDSE().addChild( entry );
                        browserConnection.cacheEntry( entry );
                        enumeration.close();
                    }
                }
                catch ( NamingException e )
                {
                }
View Full Code Here

                // add returning attributes for children and alias detection
                SearchParameter searchParameter = getSearchParameter( search );
                ArrayList<ISearchResult> searchResultList = new ArrayList<ISearchResult>();
                ArrayList<SearchContinuation> searchContinuationList = new ArrayList<SearchContinuation>();

                StudioNamingEnumeration enumeration = null;
                // search
                try
                {
                    enumeration = search( browserConnection, searchParameter, monitor );

                    // iterate through the search result
                    while ( !monitor.isCanceled() && enumeration != null && enumeration.hasMore() )
                    {
                        StudioSearchResult sr = enumeration.next();
                        boolean isContinuedSearchResult = sr.isContinuedSearchResult();
                        LdapURL searchContinuationUrl = sr.getSearchContinuationUrl();

                        if ( searchContinuationUrl == null )
                        {
                            LdapDN dn = JNDIUtils.getDn( sr );
                            IEntry entry = null;

                            Connection resultConnection = sr.getConnection();
                            IBrowserConnection resultBrowserConnection = BrowserCorePlugin.getDefault()
                                .getConnectionManager().getBrowserConnection( resultConnection );
                            if ( resultBrowserConnection == null )
                            {
                                resultBrowserConnection = browserConnection;
                            }

                            // get entry from cache or create it
                            entry = resultBrowserConnection.getEntryFromCache( dn );
                            if ( entry == null )
                            {
                                entry = createAndCacheEntry( resultBrowserConnection, dn, monitor );
                            }

                            // initialize special flags
                            initFlags( entry, sr, searchParameter );

                            // fill the attributes
                            fillAttributes( entry, sr, search.getSearchParameter() );

                            if ( isContinuedSearchResult )
                            {
                                // the result is from a continued search
                                // we create a special entry that displays the URL of the entry
                                entry = new ContinuedSearchResultEntry( resultBrowserConnection, dn );
                            }

                            searchResultList
                                .add( new org.apache.directory.studio.ldapbrowser.core.model.impl.SearchResult( entry,
                                    search ) );
                        }
                        else
                        {
                            //entry = new ContinuedSearchResultEntry( resultBrowserConnection, dn );
                            SearchContinuation searchContinuation = new SearchContinuation( search,
                                searchContinuationUrl );
                            searchContinuationList.add( searchContinuation );
                        }

                        monitor
                            .reportProgress( searchResultList.size() == 1 ? BrowserCoreMessages.model__retrieved_1_entry
                                : BrowserCoreMessages.bind( BrowserCoreMessages.model__retrieved_n_entries,
                                    new String[]
                                        { Integer.toString( searchResultList.size() ) } ) );
                    }
                }
                catch ( Exception e )
                {
                    int ldapStatusCode = JNDIUtils.getLdapStatusCode( e );
                    if ( ldapStatusCode == 3 || ldapStatusCode == 4 || ldapStatusCode == 11 )
                    {
                        search.setCountLimitExceeded( true );
                    }
                    else
                    {
                        monitor.reportError( e );
                    }
                }

                // check for response controls
                try
                {
                    if ( enumeration != null )
                    {
                        Control[] jndiControls = enumeration.getResponseControls();
                        if ( jndiControls != null )
                        {
                            for ( Control jndiControl : jndiControls )
                            {
                                if ( jndiControl instanceof PagedResultsResponseControl )
View Full Code Here

                StudioControl ctl = ctls.get( i );
                jndiControls[i] = new BasicControl( ctl.getOid(), ctl.isCritical(), ctl.getControlValue() );
            }
        }

        StudioNamingEnumeration result = browserConnection.getConnection().getJNDIConnectionWrapper().search(
            searchBase, filter, controls, aliasesDereferencingMethod, referralsHandlingMethod, jndiControls, monitor,
            null );
        return result;
    }
View Full Code Here

                searchParameter.setTimeLimit( 0 );
                searchParameter.setAliasesDereferencingMethod( browserConnection.getAliasesDereferencingMethod() );
                searchParameter.setReferralsHandlingMethod( browserConnection.getReferralsHandlingMethod() );
                searchParameter.setInitHasChildrenFlag( true );
                dummyMonitor.reset();
                StudioNamingEnumeration enumeration = search( browserConnection, searchParameter, dummyMonitor );
                try
                {
                    if ( enumeration != null && enumeration.hasMore() )
                    {
                        // create base DN entry
                        entry = new BaseDNEntry( aDN, browserConnection );
                        browserConnection.getRootDSE().addChild( entry );
                        browserConnection.cacheEntry( entry );
                        enumeration.close();
                    }
                }
                catch ( NamingException e )
                {
                }
View Full Code Here

            // Creating a dummy monitor that will be used to check if something
            // went wrong when executing the request
            StudioProgressMonitor dummyMonitor = new StudioProgressMonitor( monitor );

            // Searching for the requested entries
            StudioNamingEnumeration ne = SearchRunnable.search( browserConnection, searchParameter, dummyMonitor );
            monitor.worked( 1 );

            // Getting the DSML string associated to the search
            // and the type of answer the user is expecting
            String dsmlExportString = null;
View Full Code Here

TOP

Related Classes of org.apache.directory.studio.connection.core.io.jndi.StudioNamingEnumeration

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.