Package org.apache.directory.ldapstudio.browser.core.model

Examples of org.apache.directory.ldapstudio.browser.core.model.IConnection


    public final void run()
    {
        ConnectionAndDn connectionAndDn = getConnectionAndDn();
        if ( connectionAndDn != null )
        {
            IConnection connection = connectionAndDn.connection;
            DN dn = connectionAndDn.dn;

            IEntry entry = connection.getEntryFromCache( dn );
            if ( entry == null )
            {
                ReadEntryJob job = new ReadEntryJob( connection, dn );
                RunnableContextJobAdapter.execute( job );
                entry = job.getReadEntry();
View Full Code Here


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

        if ( search.getConnection() != null )
        {
            IConnection connection = search.getConnection();
            DN searchBase = search.getSearchBase();

            if ( connectionWidget != null )
            {
                connectionWidget.setConnection( connection );
View Full Code Here

    }


    static IConnection getConnection( Object element )
    {
        IConnection connection = null;
        if ( element instanceof IAdaptable )
        {
            connection = ( IConnection ) ( ( IAdaptable ) element ).getAdapter( IConnection.class );
        }
        return connection;
View Full Code Here


    protected Control createContents( Composite parent )
    {

        IConnection connection = ( IConnection ) getConnection( getElement() );
        if ( connection != null )
        {
            super.setMessage( "Connection " + Utils.shorten( connection.getName(), 30 ) );
        }

        this.tabFolder = new TabFolder( parent, SWT.TOP );

        this.cpw = new ConnectionPageWrapper( this, null );

        Composite networkComposite = new Composite( this.tabFolder, SWT.NONE );
        GridLayout gl = new GridLayout( 1, false );
        networkComposite.setLayout( gl );
        cpw.addMainInput( connection.getName(), connection.getHost(), connection.getPort(), connection
            .getEncryptionMethod(), networkComposite );
        this.networkTab = new TabItem( this.tabFolder, SWT.NONE );
        this.networkTab.setText( "Network Parameter" );
        this.networkTab.setControl( networkComposite );

        Composite authComposite = new Composite( this.tabFolder, SWT.NONE );
        gl = new GridLayout( 1, false );
        authComposite.setLayout( gl );
        cpw.addAuthenticationMethodInput( connection.getAuthMethod(), authComposite );
        cpw.addSimpleAuthInput( ( connection.getBindPassword() != null ) || ( connection.getBindPrincipal() == null && connection.getBindPassword() == null ),
            connection.getBindPrincipal() != null ? connection.getBindPrincipal().toString() : "", connection
                .getBindPassword() != null ? connection.getBindPassword() : "", authComposite );
        this.authTab = new TabItem( this.tabFolder, SWT.NONE );
        this.authTab.setText( "Authentification" );
        this.authTab.setControl( authComposite );

        Composite optionsComposite = new Composite( this.tabFolder, SWT.NONE );
        gl = new GridLayout( 1, false );
        optionsComposite.setLayout( gl );
        cpw.addBaseDNInput( connection.isFetchBaseDNs(), connection.getBaseDN().toString(), optionsComposite );
        cpw.addLimitInput( connection.getCountLimit(), connection.getTimeLimit(), connection
            .getAliasesDereferencingMethod(), connection.getReferralsHandlingMethod(), optionsComposite );

        this.optionsTab = new TabItem( this.tabFolder, SWT.NONE );
        this.optionsTab.setText( "Options" );
        this.optionsTab.setControl( optionsComposite );
View Full Code Here


    public boolean performOk()
    {

        IConnection connection = ( IConnection ) getConnection( getElement() );

        if ( connection instanceof IConnection )
        {
            connection.setName( cpw.getName() );
            connection.setHost( cpw.getHostName() );
            connection.setPort( cpw.getPort() );
            connection.setEncryptionMethod( cpw.getEncyrptionMethod() );

            connection.setAuthMethod( cpw.getAuthenticationMethod() );

            connection.setFetchBaseDNs( cpw.isAutoFetchBaseDns() );
            try
            {
                connection.setBaseDN( new DN( cpw.getBaseDN() ) );
            }
            catch ( NameException e )
            {
            }
            connection.setCountLimit( cpw.getCountLimit() );
            connection.setTimeLimit( cpw.getTimeLimit() );
            connection.setAliasesDereferencingMethod( cpw.getAliasesDereferencingMethod() );
            connection.setReferralsHandlingMethod( cpw.getReferralsHandlingMethod() );
        }

        if ( connection.getAuthMethod() == IConnection.AUTH_ANONYMOUS )
        {
            connection.setBindPrincipal( null );
            connection.setBindPassword( null );
        }
        if ( connection.getAuthMethod() == IConnection.AUTH_SIMPLE )
        {
            try
            {
                connection.setBindPrincipal( cpw.getSimpleAuthBindPrincipal() );
                connection
                    .setBindPassword( cpw.isSaveSimpleAuthBindPassword() ? cpw.getSimpleAuthBindPassword() : null );
            }
            catch ( Exception e )
            {
            }
View Full Code Here

                    oldValue = oldLine.getValueAsString();
                }

                Schema schema = editor.getConnection() != null ? editor.getConnection().getSchema()
                    : Schema.DEFAULT_SCHEMA;
                IConnection dummyConnection = new DummyConnection( schema );

                IEntry dummyEntry = null;
                if ( containers[0] instanceof LdifContentRecord )
                {
                    dummyEntry = ModelConverter.ldifContentRecordToEntry( ( LdifContentRecord ) containers[0],
View Full Code Here

            {
                // if(selectedConnection != null) {
                SelectConnectionDialog dialog = new SelectConnectionDialog( parent.getShell(), "Select Connection",
                    selectedConnection );
                dialog.open();
                IConnection connection = dialog.getSelectedConnection();
                if ( connection != null )
                {
                    setConnection( connection );
                    notifyListeners();
                }
View Full Code Here

     */
    public Object[] getElements( Object parent )
    {
        if ( parent instanceof IConnection )
        {
            IConnection connection = ( IConnection ) 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;
            IConnection connection = category.getParent();

            switch ( category.getType() )
            {
                case BrowserCategory.TYPE_DIT:
                {
                    // open connection when expanding DIT
                    if ( !connection.isOpened() )
                    {
                        new OpenConnectionsJob( connection ).execute();
                        return new String[]
                            { "Fetching Entries..." };
                    }

                    // get base entries
                    List<IEntry> entryList = new ArrayList<IEntry>();
                    if ( connection.isOpened() )
                    {
                        entryList.addAll( Arrays.asList( connection.getBaseDNEntries() ) );
                        entryList.add( connection.getRootDSE() );
                        entryList.addAll( Arrays.asList( connection.getMetadataEntries() ) );
                    }

                    // remove non-visible entries
                    for ( Iterator<IEntry> it = entryList.iterator(); it.hasNext(); )
                    {
                        Object o = it.next();
                        if ( !preferences.isShowDirectoryMetaEntries()
                            && ( o instanceof DirectoryMetadataEntry || o instanceof RootDSE ) )
                        {
                            it.remove();
                        }
                    }

                    return entryList.toArray();
                }

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

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

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

    {

        super.setEnabled( isEditableLineSelected() );

        // determine value editor
        IConnection connection = getConnection();
        String attributeDescription = getAttributeDescription();
        Object oldValue = getValue();

        if ( attributeDescription != null )
        {
            valueEditor = valueEditorManager.getCurrentValueEditor( connection.getSchema(), attributeDescription );
            Object rawValue = valueEditor.getRawValue( connection, oldValue );
            if ( !( valueEditor instanceof AbstractDialogValueEditor ) || rawValue == null )
            {
                IValueEditor[] vps = valueEditorManager.getAlternativeValueEditors( connection.getSchema(), attributeDescription );
                for ( int i = 0; i < vps.length
                    && ( !( valueEditor instanceof AbstractDialogValueEditor ) || rawValue == null ); i++ )
                {
                    valueEditor = vps[i];
                    rawValue = valueEditor.getRawValue( connection, oldValue );
View Full Code Here

TOP

Related Classes of org.apache.directory.ldapstudio.browser.core.model.IConnection

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.