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

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


    /**
     * {@inheritDoc}
     */
    public void saveState( IMemento memento )
    {
        IConnection connection = getConnection();
        SchemaPart schemaElement = getSchemElement();
        memento.putString( "CONNECTION", connection.getName() );
        memento.putString( "SCHEMAELEMENTYPE", schemaElement.getClass().getName() );
        memento.putString( "SCHEMAELEMENTOID", schemaElement.getNumericOID() );
    }
View Full Code Here


    /**
     * {@inheritDoc}
     */
    public void restoreState( IMemento memento )
    {
        IConnection connection = BrowserCorePlugin.getDefault().getConnectionManager().getConnection(
            memento.getString( "CONNECTION" ) );
        String schemaElementType = memento.getString( "SCHEMAELEMENTYPE" );
        String schemaElementOid = memento.getString( "SCHEMAELEMENTOID" );
        SchemaPart schemaElement = null;
        if(ObjectClassDescription.class.getName().equals( schemaElementType ) )
        {
            schemaElement = connection.getSchema().getObjectClassDescription( schemaElementOid );
        }
        else if(AttributeTypeDescription.class.getName().equals( schemaElementType ) )
        {
            schemaElement = connection.getSchema().getAttributeTypeDescription( schemaElementOid );
        }
        else if(LdapSyntaxDescription.class.getName().equals( schemaElementType ) )
        {
            schemaElement = connection.getSchema().getLdapSyntaxDescription( schemaElementOid );
        }
        else if(MatchingRuleDescription.class.getName().equals( schemaElementType ) )
        {
            schemaElement = connection.getSchema().getMatchingRuleDescription( schemaElementOid );
        }
        else if(MatchingRuleUseDescription.class.getName().equals( schemaElementType ) )
        {
            schemaElement = connection.getSchema().getMatchingRuleUseDescription( schemaElementOid );
        }
       
        super.setInput( new SchemaBrowserInput( connection, schemaElement  ) );
    }
View Full Code Here

        viewer.setContentProvider( new ArrayContentProvider() );
        viewer.setLabelProvider( new LabelProvider() );

        if ( getElement() instanceof IConnection )
        {
            IConnection connection = ( IConnection ) getElement();
            if ( connection != null )
            {
                Object[] atds = connection.getSchema().getAttributeTypeDescriptions();
                viewer.setInput( atds );
                column.pack();
            }
        }
        else if ( getElement() instanceof IEntry )
View Full Code Here

        viewer.setContentProvider( new ArrayContentProvider() );
        viewer.setLabelProvider( new LabelProvider() );

        if ( getElement() instanceof IConnection )
        {
            IConnection connection = ( IConnection ) getElement();
            if ( connection != null )
            {
                Object[] ocds = connection.getSchema().getObjectClassDescriptions();
                viewer.setInput( ocds );
                column.pack();
            }
        }
        else if ( getElement() instanceof IEntry )
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

    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


    protected Control createContents( Composite parent )
    {

        final IConnection connection = ConnectionPropertyPage.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 )
        {
            controlsViewer.setInput( ( ( RootDSE ) connection.getRootDSE() ).getSupportedControls() );
        }
        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 )
        {
            extensionViewer.setInput( ( ( RootDSE ) connection.getRootDSE() ).getSupportedExtensions() );
        }
        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 )
        {
            featureViewer.setInput( ( ( RootDSE ) connection.getRootDSE() ).getSupportedFeatures() );
        }
        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

                    if ( readIn.available() > 1 )
                    {
                        int size = readIn.readInt();
                        byte[] connectionName = new byte[size];
                        readIn.read( connectionName );
                        IConnection connection = BrowserCorePlugin.getDefault().getConnectionManager().getConnection(
                            new String( connectionName ) );
                        connectionList.add( connection );
                    }
                }
                while ( readIn.available() > 1 );
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.