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

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



    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 )
        {

            boolean typeDetected = false;

            // check OpenLDAP
            IAttribute ocAttribute = connection.getRootDSE().getAttribute( "objectClass" );
            if ( ocAttribute != null )
            {
                for ( int i = 0; i < ocAttribute.getStringValues().length; i++ )
                {
                    if ( "OpenLDAProotDSE".equals( ocAttribute.getStringValues()[i] ) )
                    {
                        IAttribute ccAttribute = connection.getRootDSE().getAttribute( "configContext" );
                        if ( ccAttribute != null )
                        {
                            typeText.setText( "OpenLDAP 2.3" );
                            typeDetected = true;
                        }
                        if ( !typeDetected )
                        {
                            IAttribute scAttribute = connection.getRootDSE().getAttribute( "supportedControl" );
                            if ( scAttribute != null )
                            {
                                for ( int sci = 0; sci < scAttribute.getStringValues().length; sci++ )
                                {
                                    // if("1.2.840.113556.1.4.319".equals(scAttribute.getStringValues()[sci]))
                                    // {
                                    if ( "2.16.840.1.113730.3.4.18".equals( scAttribute.getStringValues()[sci] ) )
                                    {
                                        typeText.setText( "OpenLDAP 2.2" );
                                        typeDetected = true;
                                    }
                                }
                            }

                        }
                        if ( !typeDetected )
                        {
                            IAttribute seAttribute = connection.getRootDSE().getAttribute( "supportedExtension" );
                            if ( seAttribute != null )
                            {
                                for ( int sei = 0; sei < seAttribute.getStringValues().length; sei++ )
                                {
                                    if ( "1.3.6.1.4.1.4203.1.11.3".equals( seAttribute.getStringValues()[sei] ) )
                                    {
                                        typeText.setText( "OpenLDAP 2.1" );
                                        typeDetected = true;
                                    }
                                }
                            }
                        }
                        if ( !typeDetected )
                        {
                            IAttribute sfAttribute = connection.getRootDSE().getAttribute( "supportedFeatures" );
                            if ( sfAttribute != null )
                            {
                                for ( int sfi = 0; sfi < sfAttribute.getStringValues().length; sfi++ )
                                {
                                    if ( "1.3.6.1.4.1.4203.1.5.4".equals( sfAttribute.getStringValues()[sfi] ) )
                                    {
                                        typeText.setText( "OpenLDAP 2.0" );
                                        typeDetected = true;
                                    }
                                }
                            }
                        }
                        if ( !typeDetected )
                        {
                            typeText.setText( "OpenLDAP" );
                            typeDetected = true;
                        }
                    }
                }
            }

            // check Siemens DirX
            IAttribute ssseAttribute = connection.getRootDSE().getAttribute( "subSchemaSubentry" );
            if ( ssseAttribute != null )
            {
                for ( int i = 0; i < ssseAttribute.getStringValues().length; i++ )
                {
                    if ( "cn=LDAPGlobalSchemaSubentry".equals( ssseAttribute.getStringValues()[i] ) )
                    {
                        typeText.setText( "Siemens DirX" );
                    }
                }
            }

            // check active directory
            IAttribute rdncAttribute = connection.getRootDSE().getAttribute( "rootDomainNamingContext" );
            if ( rdncAttribute != null )
            {
                IAttribute ffAttribute = connection.getRootDSE().getAttribute( "forestFunctionality" );
                if ( ffAttribute != null )
                {
                    typeText.setText( "Microsoft Active Directory 2003" );
                }
                else
                {
                    typeText.setText( "Microsoft Active Directory 2000" );
                }
            }

            // check Novell eDirectory / Sun Directory Server / Netscape
            // Directory Server
            IAttribute vnAttribute = connection.getRootDSE().getAttribute( "vendorName" );
            IAttribute vvAttribute = connection.getRootDSE().getAttribute( "vendorVersion" );
            if ( vnAttribute != null && vnAttribute.getStringValues().length > 0 && vvAttribute != null
                && vvAttribute.getStringValues().length > 0 )
            {
                if ( vnAttribute.getStringValues()[0].indexOf( "Novell" ) > -1
                    || vvAttribute.getStringValues()[0].indexOf( "eDirectory" ) > -1 )
                {
                    typeText.setText( "Novell eDirectory" );
                }
                if ( vnAttribute.getStringValues()[0].indexOf( "Sun" ) > -1
                    || vvAttribute.getStringValues()[0].indexOf( "Sun" ) > -1 )
                {
                    typeText.setText( "Sun Directory Server" );
                }
                if ( vnAttribute.getStringValues()[0].indexOf( "Netscape" ) > -1
                    || vvAttribute.getStringValues()[0].indexOf( "Netscape" ) > -1 )
                {
                    typeText.setText( "Netscape Directory Server" );
                }
            }
        }
        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( 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( 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( 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


    {
        Object rawValue = null;
        Object value = getValue();
        if ( value != null )
        {
            IConnection connection = getConnection();
            rawValue = valueEditor.getRawValue( connection, value );
        }

        return rawValue;
    }
View Full Code Here

    {
        // only if another connection is selected
        if ( connection != viewer.getInput() )
        {

            IConnection currentConnection = viewer.getInput() instanceof IConnection ? ( IConnection ) viewer
                .getInput() : null;

            // save expanded elements and selection
            if ( currentConnection != null )
            {
View Full Code Here

                    return null;

                List entryList = new ArrayList();
                try
                {
                    IConnection connection = null;
                    ByteArrayInputStream in = new ByteArrayInputStream( buffer );
                    DataInputStream readIn = new DataInputStream( in );

                    do
                    {
                        if ( readIn.available() > 1 )
                        {
                            int size = readIn.readInt();
                            byte[] connectionName = new byte[size];
                            readIn.read( connectionName );
                            connection = BrowserCorePlugin.getDefault().getConnectionManager().getConnection(
                                new String( connectionName ) );
                        }

                        IEntry entry = null;
                        if ( readIn.available() > 1 && connection != null )
                        {
                            int size = readIn.readInt();
                            byte[] dn = new byte[size];
                            readIn.read( dn );
                            entry = connection.getEntryFromCache( new DN( new String( dn ) ) );

                        }
                        else
                        {
                            return null;
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

        {
            return null;
        }
        else if ( attributeHierarchy.size() == 1 && attributeHierarchy.getAttribute().getValueSize() == 0 )
        {
            IConnection connection = attributeHierarchy.getAttribute().getEntry().getConnection();
            DN dn = null;
            return new DnValueEditorRawValueWrapper( connection, dn );
        }
        else if ( attributeHierarchy.size() == 1 && attributeHierarchy.getAttribute().getValueSize() == 1 )
        {
            IConnection connection = attributeHierarchy.getAttribute().getEntry().getConnection();
            try
            {
                DN dn = new DN( getDisplayValue( attributeHierarchy ) );
                return new DnValueEditorRawValueWrapper( connection, dn );
            }
View Full Code Here

    public Object getRawValue( IValue value )
    {
        Object o = super.getRawValue( value );
        if ( o != null && o instanceof String )
        {
            IConnection connection = value.getAttribute().getEntry().getConnection();
            try
            {
                DN dn = new DN( ( String ) o );
                return new DnValueEditorRawValueWrapper( connection, dn );
            }
View Full Code Here

    }


    public void run()
    {
        final IConnection connection = schemaBrowser.getSelectedConnection();
        if ( connection != null )
        {
            new ReloadSchemasJob( new IConnection[]
                { connection } ).execute();
            this.schemaBrowser.refresh();
View Full Code Here

                    ByteArrayInputStream in = new ByteArrayInputStream( buffer );
                    DataInputStream readIn = new DataInputStream( in );

                    do
                    {
                        IConnection connection = null;
                        if ( readIn.available() > 1 )
                        {
                            int size = readIn.readInt();
                            byte[] connectionName = new byte[size];
                            readIn.read( connectionName );
                            connection = BrowserCorePlugin.getDefault().getConnectionManager().getConnection(
                                new String( connectionName ) );
                        }

                        IEntry entry = null;
                        if ( readIn.available() > 1 && connection != null )
                        {
                            int size = readIn.readInt();
                            byte[] dn = new byte[size];
                            readIn.read( dn );
                            entry = connection.getEntryFromCache( new DN( new String( dn ) ) );
                        }
                        else
                        {
                            return null;
                        }
View Full Code Here

    public IWizardPage getNextPage()
    {

        if ( templateButton.getSelection() )
        {
            final IConnection connection = entryWidget.getConnection();
            final DN dn = entryWidget.getDn();
            final IEntry[] templateEntries = new IEntry[1];

            if ( connection == null )
            {
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.