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

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


    }

   
    static IBrowserConnection getConnection( Object element )
    {
        IBrowserConnection browserConnection = null;
        if ( element instanceof IAdaptable )
        {
            browserConnection = ( IBrowserConnection ) ( ( IAdaptable ) element ).getAdapter( IBrowserConnection.class );
            if(browserConnection == null)
            {
View Full Code Here



    protected Control createContents( Composite parent )
    {

        final IBrowserConnection connection = getConnection( getElement() );

        this.tabFolder = new TabFolder( parent, SWT.TOP );
        RowLayout mainLayout = new RowLayout();
        mainLayout.fill = true;
        mainLayout.marginWidth = 0;
        mainLayout.marginHeight = 0;
        this.tabFolder.setLayout( mainLayout );

        Composite composite = new Composite( this.tabFolder, SWT.NONE );
        GridLayout gl = new GridLayout( 2, false );
        composite.setLayout( gl );
        BaseWidgetUtils.createLabel( composite, "Directory Type:", 1 );
        Text typeText = BaseWidgetUtils.createLabeledText( composite, "-", 1 );
        if ( connection != null && connection.getRootDSE() != null )
        {
            // Try to detect LDAP server from RootDSE
            //  
            IRootDSE rootDSE = connection.getRootDSE();
            String type = detectOpenLDAP( rootDSE );
            if ( type == null )
            {
                type = detectSiemensDirX( rootDSE );
                if ( type == null )
                {
                    type = detectActiveDirectory( rootDSE );
                    if ( type == null )
                    {
                        type = detectByVendorName( rootDSE );
                    }
                }
            }

            if ( type != null )
            {
                typeText.setText( type );
            }
        }
        addInfo( connection, composite, "vendorName", "Vendor Name:" );
        addInfo( connection, composite, "vendorVersion", "Vendor Version:" );
        addInfo( connection, composite, "supportedLDAPVersion", "Supported LDAP Versions:" );
        addInfo( connection, composite, "supportedSASLMechanisms", "Supported SASL Mechanisms:" );

        this.commonsTab = new TabItem( this.tabFolder, SWT.NONE );
        this.commonsTab.setText( "Info" );
        this.commonsTab.setControl( composite );

        // naming contexts
        // alt servers
        // schema DN
        // ldap version

        Composite controlsComposite = new Composite( this.tabFolder, SWT.NONE );
        controlsComposite.setLayoutData( new RowData( 10, 10 ) );
        GridLayout controlsLayout = new GridLayout();
        controlsComposite.setLayout( controlsLayout );
        ListViewer controlsViewer = new ListViewer( controlsComposite );
        controlsViewer.getList().setLayoutData( new GridData( GridData.FILL_BOTH ) );
        controlsViewer.setContentProvider( new ArrayContentProvider() );
        controlsViewer.setLabelProvider( new LabelProvider() );
        if ( connection != null && connection.getRootDSE() != null )
        {
            String[] supportedControls = ( ( RootDSE ) connection.getRootDSE() ).getSupportedControls();
            addDescritionsToOIDs( supportedControls );
            controlsViewer.setInput( supportedControls );
        }
        this.controlsTab = new TabItem( this.tabFolder, SWT.NONE );
        this.controlsTab.setText( "Controls" );
        this.controlsTab.setControl( controlsComposite );

        Composite extensionComposite = new Composite( this.tabFolder, SWT.NONE );
        extensionComposite.setLayoutData( new RowData( 10, 10 ) );
        GridLayout extensionLayout = new GridLayout();
        extensionComposite.setLayout( extensionLayout );
        ListViewer extensionViewer = new ListViewer( extensionComposite );
        extensionViewer.getList().setLayoutData( new GridData( GridData.FILL_BOTH ) );
        extensionViewer.setContentProvider( new ArrayContentProvider() );
        extensionViewer.setLabelProvider( new LabelProvider() );
        if ( connection != null && connection.getRootDSE() != null )
        {
            String[] supportedExtensions = ( ( RootDSE ) connection.getRootDSE() ).getSupportedExtensions();
            addDescritionsToOIDs( supportedExtensions );
            extensionViewer.setInput( supportedExtensions );
        }
        this.extensionsTab = new TabItem( this.tabFolder, SWT.NONE );
        this.extensionsTab.setText( "Extensions" );
        this.extensionsTab.setControl( extensionComposite );

        Composite featureComposite = new Composite( this.tabFolder, SWT.NONE );
        featureComposite.setLayoutData( new RowData( 10, 10 ) );
        GridLayout featureLayout = new GridLayout();
        featureComposite.setLayout( featureLayout );
        ListViewer featureViewer = new ListViewer( featureComposite );
        featureViewer.getList().setLayoutData( new GridData( GridData.FILL_BOTH ) );
        featureViewer.setContentProvider( new ArrayContentProvider() );
        featureViewer.setLabelProvider( new LabelProvider() );
        if ( connection != null && connection.getRootDSE() != null )
        {
            String[] supportedFeatures = ( ( RootDSE ) connection.getRootDSE() ).getSupportedFeatures();
            addDescritionsToOIDs( supportedFeatures );
            featureViewer.setInput( supportedFeatures );
        }
        this.featuresTab = new TabItem( this.tabFolder, SWT.NONE );
        this.featuresTab.setText( "Features" );
        this.featuresTab.setControl( featureComposite );

        Composite rawComposite = new Composite( this.tabFolder, SWT.NONE );
        rawComposite.setLayoutData( new RowData( 10, 10 ) );
        GridLayout rawLayout = new GridLayout();
        rawComposite.setLayout( rawLayout );
        Table table = new Table( rawComposite, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL
            | SWT.FULL_SELECTION | SWT.HIDE_SELECTION );
        GridData gridData = new GridData( GridData.FILL_BOTH );
        table.setLayoutData( gridData );
        table.setHeaderVisible( true );
        table.setLinesVisible( true );
        TableViewer viewer = new TableViewer( table );
        for ( int i = 0; i < EntryEditorWidgetTableMetadata.COLUM_NAMES.length; i++ )
        {
            TableColumn column = new TableColumn( table, SWT.LEFT, i );
            column.setText( EntryEditorWidgetTableMetadata.COLUM_NAMES[i] );
            column.setWidth( 150 );
            column.setResizable( true );
        }
        viewer.setColumnProperties( EntryEditorWidgetTableMetadata.COLUM_NAMES );
        viewer.setSorter( new InnerViewerSorter() );
        viewer.setContentProvider( new InnerContentProvider() );
        viewer.setLabelProvider( new InnerLabelProvider() );
        if ( connection != null )
        {
            IEntry entry = connection.getRootDSE();
            viewer.setInput( entry );
        }
        this.rawTab = new TabItem( this.tabFolder, SWT.NONE );
        this.rawTab.setText( "Raw" );
        this.rawTab.setControl( rawComposite );
View Full Code Here

     */
    public IWizardPage getNextPage()
    {
        if ( templateButton.getSelection() )
        {
            final IBrowserConnection browserConnection = entryWidget.getBrowserConnection();
            final LdapDN dn = entryWidget.getDn();
            final IEntry[] templateEntries = new IEntry[1];

            if ( browserConnection == null )
            {
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void run()
    {
        final IBrowserConnection browserConnection = schemaPage.getConnection();
        if ( browserConnection != null )
        {
            new ReloadSchemasJob( browserConnection ).execute();
            schemaPage.getSchemaBrowser().refresh();
        }
View Full Code Here

        cacheDateText = BaseWidgetUtils.createWrappedLabeledText( cacheComposite, "", 1 );

        BaseWidgetUtils.createLabel( cacheComposite, "Cache Size:", 1 );
        cacheSizeText = BaseWidgetUtils.createWrappedLabeledText( cacheComposite, "", 1 );

        IBrowserConnection connection = RootDSEPropertyPage.getConnection( getElement() );
        this.connectionUpdated( connection );

        return composite;
    }
View Full Code Here

    }


    private void reloadSchema()
    {
        final IBrowserConnection browserConnection = RootDSEPropertyPage.getConnection( getElement() );
        ReloadSchemasJob job = new ReloadSchemasJob( browserConnection );
        RunnableContextJobAdapter.execute( job );
        this.connectionUpdated( browserConnection );
    }
View Full Code Here

        int num = 0;
        StudioProgressMonitor dummyMonitor = new StudioProgressMonitor( monitor );
        for ( int i = 0; !monitor.isCanceled() && !monitor.errorsReported() && i < entriesToDelete.length; i++ )
        {
            IEntry entryToDelete = entriesToDelete[i];
            IBrowserConnection browserConnection = entryToDelete.getBrowserConnection();

            // delete from directory
            int errorStatusSize1 = monitor.getErrorStatus( "" ).getChildren().length; //$NON-NLS-1$
            num = optimisticDeleteEntryRecursive( browserConnection, entryToDelete.getDn(), num, dummyMonitor, monitor );
            int errorStatusSize2 = monitor.getErrorStatus( "" ).getChildren().length; //$NON-NLS-1$

            if ( !monitor.isCanceled() )
            {
                if ( errorStatusSize1 == errorStatusSize2 )
                {
                    // delete
                    deletedEntriesSet.add( entryToDelete );
                    //entryToDelete.setChildrenInitialized( false );

                    // delete from parent entry
                    entriesToUpdateSet.add( entryToDelete.getParententry() );
                    entryToDelete.getParententry().setChildrenInitialized( false );
                    entryToDelete.getParententry().deleteChild( entryToDelete );

                    // delete from searches
                    ISearch[] searches = browserConnection.getSearchManager().getSearches();
                    for ( ISearch search : searches )
                    {
                        if ( search.getSearchResults() != null )
                        {
                            ISearchResult[] searchResults = search.getSearchResults();
                            List<ISearchResult> searchResultList = new ArrayList<ISearchResult>();
                            searchResultList.addAll( Arrays.asList( searchResults ) );
                            for ( Iterator<ISearchResult> it = searchResultList.iterator(); it.hasNext(); )
                            {
                                ISearchResult result = it.next();
                                if ( entryToDelete.equals( result.getEntry() ) )
                                {
                                    it.remove();
                                    searchesToUpdateSet.add( search );
                                }
                            }
                            if ( searchesToUpdateSet.contains( search ) )
                            {
                                search.setSearchResults( searchResultList.toArray( new ISearchResult[searchResultList
                                    .size()] ) );
                            }
                        }
                    }
                }

                // delete from cache
                browserConnection.uncacheEntryRecursive( entryToDelete );
            }
            else
            {
                entriesToUpdateSet.add( entryToDelete );
                entryToDelete.setChildrenInitialized( false );
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 OpenConnectionsJob( 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

                exampleSearch.setFilter( filter.toString() );
            }

            else if ( obj instanceof IBrowserConnection )
            {
                IBrowserConnection connection = ( IBrowserConnection ) obj;
                exampleSearch.setBrowserConnection( connection );
                if ( connection.getRootDSE().getChildrenCount() > 0 )
                {
                    exampleSearch.setSearchBase( connection.getRootDSE().getChildren()[0].getDn() );
                }
                else
                {
                    exampleSearch.setSearchBase( connection.getRootDSE().getDn() );
                }
            }
            else if ( obj instanceof BrowserCategory )
            {
                BrowserCategory cat = ( BrowserCategory ) obj;
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.