Package org.apache.directory.studio.ldapbrowser.core.model

Examples of org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection


            }
        }
        else if ( parent instanceof BrowserCategory )
        {
            BrowserCategory category = ( BrowserCategory ) parent;
            IBrowserConnection browserConnection = category.getParent();

            switch ( category.getType() )
            {
                case BrowserCategory.TYPE_DIT:
                {
                    // open connection when expanding DIT
                    if ( browserConnection.getConnection() != null
                        && !browserConnection.getConnection().getJNDIConnectionWrapper().isConnected() )
                    {
                        new StudioBrowserJob( new OpenConnectionsRunnable( browserConnection.getConnection() ) )
                            .execute();
                        return new String[]
                            { Messages.getString( "BrowserContentProvider.OpeningConnection" ) }; //$NON-NLS-1$
                    }

                    return new Object[]
                        { browserConnection.getRootDSE() };
                }

                case BrowserCategory.TYPE_SEARCHES:
                {
                    return browserConnection.getSearchManager().getSearches().toArray();
                }

                case BrowserCategory.TYPE_BOOKMARKS:
                {
                    return browserConnection.getBookmarkManager().getBookmarks();
                }
            }

            return new Object[0];
        }
View Full Code Here


    /**
     * This implementation opens the browser connection when the connection was opened.
     */
    public void connectionOpened( Connection connection, StudioProgressMonitor monitor )
    {
        IBrowserConnection browserConnection = BrowserCorePlugin.getDefault().getConnectionManager()
            .getBrowserConnection( connection );
        if ( browserConnection != null )
        {
            try
            {
View Full Code Here

    /**
     * This implementation closes the browser connection when the connection was closed.
     */
    public void connectionClosed( Connection connection, StudioProgressMonitor monitor )
    {
        IBrowserConnection browserConnection = BrowserCorePlugin.getDefault().getConnectionManager()
            .getBrowserConnection( connection );
        if ( browserConnection != null )
        {
            try
            {
                EventRegistry.suspendEventFireingInCurrentThread();
                browserConnection.clearCaches();
            }
            finally
            {
                EventRegistry.resumeEventFireingInCurrentThread();
                BrowserConnectionUpdateEvent browserConnectionUpdateEvent = new BrowserConnectionUpdateEvent(
View Full Code Here

     */
    public Object[] getElements( Object parent )
    {
        if ( parent instanceof IBrowserConnection )
        {
            IBrowserConnection connection = ( IBrowserConnection ) parent;
            if ( !connectionToCategoriesMap.containsKey( connection ) )
            {
                BrowserCategory[] categories = new BrowserCategory[3];
                categories[0] = new BrowserCategory( BrowserCategory.TYPE_DIT, connection );
                categories[1] = new BrowserCategory( BrowserCategory.TYPE_SEARCHES, connection );
View Full Code Here

            }
        }
        else if ( parent instanceof BrowserCategory )
        {
            BrowserCategory category = ( BrowserCategory ) parent;
            IBrowserConnection connection = category.getParent();

            switch ( category.getType() )
            {
                case BrowserCategory.TYPE_DIT:
                {
                    // open connection when expanding DIT
                    if ( !connection.getConnection().getJNDIConnectionWrapper().isConnected() )
                    {
                        new StudioBrowserJob( new OpenConnectionsRunnable( connection.getConnection() ) ).execute();
                        return new String[]
                            { "Opening Connection..." };
                    }

                    return new Object[]
                        { connection.getRootDSE() };
                }

                case BrowserCategory.TYPE_SEARCHES:
                {
                    return connection.getSearchManager().getSearches();
                }

                case BrowserCategory.TYPE_BOOKMARKS:
                {
                    return connection.getBookmarkManager().getBookmarks();
                }
            }

            return new Object[0];
        }
View Full Code Here

                    while ( !monitor.isCanceled() && enumeration != null && enumeration.hasMore() )
                    {
                        SearchResult sr = enumeration.next();
                        LdapDN dn = JNDIUtils.getDn( sr );
                        boolean isReferral = false;
                        IBrowserConnection resultBrowserConnection = browserConnection;
                        if ( sr instanceof StudioSearchResult )
                        {
                            StudioSearchResult ssr = ( StudioSearchResult ) sr;

                            isReferral = ssr.isReferral();

                            Connection connection = ssr.getConnection();
                            IBrowserConnection bc = BrowserCorePlugin.getDefault().getConnectionManager()
                                .getBrowserConnection( connection );
                            if ( bc != null )
                            {
                                resultBrowserConnection = bc;
                            }
View Full Code Here

        }

        // filter controls if not supported by server
        if ( searchParameter.getControls() != null )
        {
            IBrowserConnection connection = search.getBrowserConnection();
            Set<String> suppportedConrolSet = new HashSet<String>();
            if ( connection.getRootDSE() != null
                && connection.getRootDSE().getAttribute( IRootDSE.ROOTDSE_ATTRIBUTE_SUPPORTEDCONTROL ) != null )
            {
                IAttribute scAttribute = connection.getRootDSE().getAttribute(
                    IRootDSE.ROOTDSE_ATTRIBUTE_SUPPORTEDCONTROL );
                String[] supportedControls = scAttribute.getStringValues();
                for ( int i = 0; i < supportedControls.length; i++ )
                {
                    suppportedConrolSet.add( supportedControls[i].toLowerCase() );
View Full Code Here

     * @return the delegate, may be null if the delegate doesn't exist.
     */
    protected IEntry getDelegate()
    {
        // always get the fresh entry from cache
        IBrowserConnection conn = BrowserCorePlugin.getDefault().getConnectionManager().getBrowserConnectionById( connectionId );
        delegate = conn.getEntryFromCache( dn );
       
        if ( delegate != null
            && !delegate.getBrowserConnection().getConnection().getJNDIConnectionWrapper().isConnected() )
        {
            entryDoesNotExist = false;
View Full Code Here

        fetchBaseDnsButton.addSelectionListener( new SelectionAdapter()
        {
            public void widgetSelected( SelectionEvent e )
            {
                Connection connection = getTestConnection();
                IBrowserConnection browserConnection = new BrowserConnection( connection );

                FetchBaseDNsRunnable runnable = new FetchBaseDNsRunnable( browserConnection );
                IStatus status = RunnableContextRunner.execute( runnable, runnableContext, true );
                if ( status.isOK() )
                {
View Full Code Here

            searchNameText.setText( search.getName() );
        }

        if ( search.getBrowserConnection() != null )
        {
            IBrowserConnection browserConnection = search.getBrowserConnection();
            LdapDN searchBase = search.getSearchBase();

            if ( browserConnectionWidget != null )
            {
                browserConnectionWidget.setBrowserConnection( browserConnection );
View Full Code Here

TOP

Related Classes of org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection

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.