directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1670531 [7/14] - in /directory/studio/trunk/plugins/openldap.config.editor: ./ resources/icons/ src/main/java/org/apache/directory/studio/openldap/config/ src/main/java/org/apache/directory/studio/openldap/config/actions/ src/main/java/org...
Date Wed, 01 Apr 2015 01:01:43 GMT
Added: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/ReplicationConsumerDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/ReplicationConsumerDialog.java?rev=1670531&view=auto
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/ReplicationConsumerDialog.java (added)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/ReplicationConsumerDialog.java Wed Apr  1 01:01:42 2015
@@ -0,0 +1,1388 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.openldap.config.editor.dialogs;
+
+
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.directory.api.ldap.model.constants.SchemaConstants;
+import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException;
+import org.apache.directory.api.ldap.model.name.Dn;
+import org.apache.directory.studio.common.ui.widgets.BaseWidgetUtils;
+import org.apache.directory.studio.ldapbrowser.common.widgets.WidgetModifyEvent;
+import org.apache.directory.studio.ldapbrowser.common.widgets.WidgetModifyListener;
+import org.apache.directory.studio.ldapbrowser.common.widgets.search.EntryWidget;
+import org.apache.directory.studio.ldapbrowser.common.widgets.search.FilterWidget;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ComboViewer;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.events.VerifyEvent;
+import org.eclipse.swt.events.VerifyListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.swt.widgets.Text;
+
+import org.apache.directory.studio.openldap.common.ui.dialogs.AttributeDialog;
+import org.apache.directory.studio.openldap.config.OpenLdapConfigurationPlugin;
+import org.apache.directory.studio.openldap.config.OpenLdapConfigurationPluginConstants;
+import org.apache.directory.studio.openldap.syncrepl.BindMethod;
+import org.apache.directory.studio.openldap.syncrepl.Provider;
+import org.apache.directory.studio.openldap.syncrepl.SaslMechanism;
+import org.apache.directory.studio.openldap.syncrepl.Scope;
+import org.apache.directory.studio.openldap.syncrepl.StartTls;
+import org.apache.directory.studio.openldap.syncrepl.SyncRepl;
+import org.apache.directory.studio.openldap.syncrepl.Type;
+
+
+/**
+ * The ReplicationConsumerDialog is used to edit the configuration of a SyncRepl consumer.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class ReplicationConsumerDialog extends Dialog
+{
+    /** The Simple Authentication tab item index */
+    private static final int SIMPLE_AUTHENTICATION_TAB_ITEM_INDEX = 0;
+
+    /** The SASL Authentication tab item index */
+    private static final int SASL_AUTHENTICATION_TAB_ITEM_INDEX = 1;
+
+    /** The SyncRepl value */
+    private SyncRepl syncRepl;
+
+    /** The connection */
+    private IBrowserConnection browserConnection;
+
+    private List<String> attributes = new ArrayList<String>();
+
+    // UI widgets
+    private Button okButton;
+    private ScrolledComposite scrolledComposite;
+    private Composite composite;
+    private Text replicaIdText;
+    private ComboViewer replicationTypeComboViewer;
+    private Button configureReplicationButton;
+    private Text hostText;
+    private Text portText;
+    private ComboViewer encryptionMethodComboViewer;
+    private Button configureStartTlsButton;
+    private TabFolder authenticationTabFolder;
+    private Text bindDnText;
+    private Text credentialsText;
+    private Button showCredentialsCheckbox;
+    private Label saslAuthenticationLabel;
+    private Button configureSaslAuthenticationButton;
+    private EntryWidget searchBaseDnEntryWidget;
+    private FilterWidget filterWidget;
+    private ComboViewer scopeComboViewer;
+    private TableViewer attributesTableViewer;
+    private Button addAttributeButton;
+    private Button editAttributeButton;
+    private Button deleteAttributeButton;
+    private Button attributesOnlyCheckbox;
+
+    // Listeners
+    private VerifyListener integerVerifyListener = new VerifyListener()
+    {
+        public void verifyText( VerifyEvent e )
+        {
+            if ( !e.text.matches( "[0-9]*" ) ) //$NON-NLS-1$
+            {
+                e.doit = false;
+            }
+        }
+    };
+
+    private ModifyListener replicatIdTextListener = new ModifyListener()
+    {
+        public void modifyText( ModifyEvent e )
+        {
+            String replicaId = replicaIdText.getText();
+
+            if ( ( replicaId != null ) && ( !"".equals( replicaId ) ) )
+            {
+                syncRepl.setRid( replicaId );
+            }
+            else
+            {
+                syncRepl.setRid( null );
+            }
+
+            updateOkButtonEnableState();
+        }
+    };
+
+    private ISelectionChangedListener replicationTypeComboViewerListener = new ISelectionChangedListener()
+    {
+        public void selectionChanged( SelectionChangedEvent event )
+        {
+            syncRepl.setType( getReplicationType() );
+        }
+    };
+
+    private SelectionListener configureReplicationButtonListener = new SelectionAdapter()
+    {
+        public void widgetSelected( SelectionEvent e )
+        {
+            ReplicationOptionsDialog dialog = new ReplicationOptionsDialog( getShell(), syncRepl, browserConnection );
+            if ( dialog.open() == ReplicationOptionsDialog.OK )
+            {
+                syncRepl = dialog.getSyncRepl();
+                refreshUI();
+            }
+        }
+    };
+
+    private ModifyListener hostTextListener = new ModifyListener()
+    {
+        public void modifyText( ModifyEvent e )
+        {
+            syncRepl.setProvider( getProvider() );
+
+            updateOkButtonEnableState();
+        }
+    };
+
+    private ModifyListener portTextListener = new ModifyListener()
+    {
+        public void modifyText( ModifyEvent e )
+        {
+            syncRepl.setProvider( getProvider() );
+        }
+    };
+
+    private ISelectionChangedListener encryptionMethodComboViewerListener = new ISelectionChangedListener()
+    {
+        public void selectionChanged( SelectionChangedEvent event )
+        {
+            syncRepl.setProvider( getProvider() );
+
+            // Getting the selected encryption method
+            EncryptionMethod encryptionMethod = getEncryptionMethod();
+
+            if ( ( encryptionMethod == EncryptionMethod.NO_ENCRYPTION )
+                || ( encryptionMethod == EncryptionMethod.SSL_ENCRYPTION_LDAPS ) )
+            {
+                configureStartTlsButton.setEnabled( false );
+            }
+            else if ( encryptionMethod == EncryptionMethod.START_TLS_EXTENSION )
+            {
+                configureStartTlsButton.setEnabled( true );
+            }
+        }
+    };
+
+    private SelectionListener configureStartTlsButtonListener = new SelectionAdapter()
+    {
+        public void widgetSelected( SelectionEvent e )
+        {
+            // TODO
+        }
+    };
+
+    private SelectionListener authenticationTabFolderListener = new SelectionAdapter()
+    {
+        public void widgetSelected( SelectionEvent e )
+        {
+            // Simple Authentication
+            if ( authenticationTabFolder.getSelectionIndex() == SIMPLE_AUTHENTICATION_TAB_ITEM_INDEX )
+            {
+                syncRepl.setBindMethod( BindMethod.SIMPLE );
+
+                // Reseting SASL authentication parameters
+                syncRepl.setSaslMech( null );
+                syncRepl.setAuthcid( null );
+                syncRepl.setAuthzid( null );
+                syncRepl.setCredentials( null );
+                syncRepl.setRealm( null );
+                syncRepl.setSecProps( null );
+            }
+            // SASL Authentication
+            else if ( authenticationTabFolder.getSelectionIndex() == SASL_AUTHENTICATION_TAB_ITEM_INDEX )
+            {
+                syncRepl.setBindMethod( BindMethod.SASL );
+
+                // Reseting simple authentication parameters
+                syncRepl.setBindDn( null );
+                syncRepl.setCredentials( null );
+            }
+
+            refreshUI();
+        };
+    };
+
+    private ModifyListener bindDnTextListener = new ModifyListener()
+    {
+        public void modifyText( ModifyEvent e )
+        {
+            String bindDn = bindDnText.getText();
+
+            if ( ( bindDn != null ) && ( !"".equals( bindDn ) ) )
+            {
+                syncRepl.setBindDn( bindDn );
+            }
+            else
+            {
+                syncRepl.setBindDn( null );
+            }
+        }
+    };
+
+    private ModifyListener credentialsTextListener = new ModifyListener()
+    {
+        public void modifyText( ModifyEvent e )
+        {
+            String credentials = credentialsText.getText();
+
+            if ( ( credentials != null ) && ( !"".equals( credentials ) ) )
+            {
+                syncRepl.setCredentials( credentials );
+            }
+            else
+            {
+                syncRepl.setCredentials( null );
+            }
+        }
+    };
+
+    private SelectionListener showCredentialsCheckboxListener = new SelectionAdapter()
+    {
+        public void widgetSelected( SelectionEvent e )
+        {
+            if ( showCredentialsCheckbox.getSelection() )
+            {
+                credentialsText.setEchoChar( '\0' );
+            }
+            else
+            {
+                credentialsText.setEchoChar( '\u2022' );
+            }
+        }
+    };
+
+    private SelectionListener configureSaslAuthenticationButtonListener = new SelectionAdapter()
+    {
+        public void widgetSelected( SelectionEvent e )
+        {
+            ReplicationSaslDialog dialog = new ReplicationSaslDialog( getShell(), syncRepl, browserConnection );
+            if ( dialog.open() == ReplicationSaslDialog.OK )
+            {
+                syncRepl = dialog.getSyncRepl();
+                refreshUI();
+            }
+        }
+    };
+
+    private WidgetModifyListener searchBaseDnEntryWidgetListener = new WidgetModifyListener()
+    {
+        public void widgetModified( WidgetModifyEvent event )
+        {
+            Dn searchBaseDn = searchBaseDnEntryWidget.getDn();
+
+            if ( ( searchBaseDn != null ) && ( !Dn.EMPTY_DN.equals( searchBaseDn ) ) )
+            {
+                syncRepl.setSearchBase( searchBaseDn.getName() );
+            }
+            else
+            {
+                syncRepl.setSearchBase( null );
+            }
+
+            updateOkButtonEnableState();
+        }
+    };
+
+    private WidgetModifyListener filterWidgetListener = new WidgetModifyListener()
+    {
+        public void widgetModified( WidgetModifyEvent event )
+        {
+            String filter = filterWidget.getFilter();
+
+            if ( ( filter != null ) && ( !"".equals( filter ) ) )
+            {
+                syncRepl.setFilter( filter );
+            }
+            else
+            {
+                syncRepl.setFilter( null );
+            }
+        }
+    };
+
+    private ISelectionChangedListener scopeComboViewerListener = new ISelectionChangedListener()
+    {
+        public void selectionChanged( SelectionChangedEvent event )
+        {
+            syncRepl.setScope( getScope() );
+        }
+    };
+
+    private ISelectionChangedListener attributesTableViewerSelectionChangedListener = new ISelectionChangedListener()
+    {
+        public void selectionChanged( SelectionChangedEvent event )
+        {
+            updateAttributesTableButtonsState();
+        }
+    };
+
+    private IDoubleClickListener attributesTableViewerDoubleClickListener = new IDoubleClickListener()
+    {
+        public void doubleClick( DoubleClickEvent event )
+        {
+            editAttributeButtonAction();
+        }
+    };
+
+    private SelectionListener addAttributeButtonListener = new SelectionAdapter()
+    {
+        public void widgetSelected( SelectionEvent e )
+        {
+            addAttributeButtonAction();
+        }
+    };
+
+    private SelectionListener editAttributeButtonListener = new SelectionAdapter()
+    {
+        public void widgetSelected( SelectionEvent e )
+        {
+            editAttributeButtonAction();
+        }
+    };
+
+    private SelectionListener deleteAttributeButtonListener = new SelectionAdapter()
+    {
+        public void widgetSelected( SelectionEvent e )
+        {
+            deleteAttributeButtonAction();
+        }
+    };
+
+    private SelectionListener attributesOnlyCheckboxListener = new SelectionAdapter()
+    {
+        public void widgetSelected( SelectionEvent e )
+        {
+            syncRepl.setAttrsOnly( attributesOnlyCheckbox.getSelection() );
+        };
+    };
+
+
+    /**
+     * Creates a new instance of OverlayDialog.
+     * 
+     * @param parentShell the parent shell
+     * @param index the index
+     * @param browserConnection the connection
+     */
+    public ReplicationConsumerDialog( Shell parentShell, IBrowserConnection browserConnection )
+    {
+        super( parentShell );
+        super.setShellStyle( super.getShellStyle() | SWT.RESIZE );
+        this.browserConnection = browserConnection;
+        this.syncRepl = createDefaultSyncRepl();
+    }
+
+
+    /**
+     * Creates a new instance of OverlayDialog.
+     * 
+     * @param parentShell the parent shell
+     * @param index the index
+     * @param browserConnection the connection
+     */
+    public ReplicationConsumerDialog( Shell parentShell, SyncRepl syncRepl, IBrowserConnection browserConnection )
+    {
+        super( parentShell );
+        super.setShellStyle( super.getShellStyle() | SWT.RESIZE );
+        this.browserConnection = browserConnection;
+
+        if ( syncRepl != null )
+        {
+            this.syncRepl = syncRepl.copy();
+        }
+        else
+        {
+            this.syncRepl = createDefaultSyncRepl();
+        }
+    }
+
+
+    /**
+     * Creates a default SyncRepl configuration.
+     *
+     * @return a default SyncRepl configuration
+     */
+    private SyncRepl createDefaultSyncRepl()
+    {
+        SyncRepl syncRepl = new SyncRepl();
+
+        return syncRepl;
+    }
+
+
+    /**
+     * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+     */
+    protected void configureShell( Shell shell )
+    {
+        super.configureShell( shell );
+        shell.setText( "Replication Consumer" );
+    }
+
+
+    /**
+     * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
+     */
+    protected void createButtonsForButtonBar( Composite parent )
+    {
+        okButton = createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true );
+        createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false );
+
+        updateOkButtonEnableState();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void okPressed()
+    {
+        super.okPressed();
+    }
+
+
+    /**
+     * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+     */
+    protected Control createDialogArea( Composite parent )
+    {
+        // Creating the scrolled composite
+        scrolledComposite = new ScrolledComposite( parent, SWT.H_SCROLL | SWT.V_SCROLL );
+        scrolledComposite.setExpandHorizontal( true );
+        scrolledComposite.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
+
+        // Creating the composite and attaching it to the scrolled composite
+        composite = new Composite( scrolledComposite, SWT.NONE );
+        composite.setLayout( new GridLayout() );
+        scrolledComposite.setContent( composite );
+
+        createReplicationConsumerGroup( composite );
+        createReplicationProviderGroup( composite );
+        createReplicationAuthenticationGroup( composite );
+        createReplicationDataGroup( composite );
+
+        refreshUI();
+
+        applyDialogFont( scrolledComposite );
+        composite.setSize( composite.computeSize( SWT.DEFAULT, SWT.DEFAULT ) );
+
+        return scrolledComposite;
+    }
+
+
+    /**
+     * Creates the replication consumer group.
+     *
+     * @param parent the parent composite
+     */
+    private void createReplicationConsumerGroup( Composite parent )
+    {
+        // Replication Provider Group
+        Group group = BaseWidgetUtils.createGroup( parent, "Replication Consumer", 1 );
+        GridLayout groupGridLayout = new GridLayout( 2, false );
+        group.setLayout( groupGridLayout );
+        group.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+        // Replica ID
+        BaseWidgetUtils.createLabel( group, "Replica ID:", 1 );
+        replicaIdText = BaseWidgetUtils.createText( group, "", 1 );
+        replicaIdText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+        // Replication Type
+        BaseWidgetUtils.createLabel( group, "Replication Type:", 1 );
+        replicationTypeComboViewer = new ComboViewer( group );
+        replicationTypeComboViewer.getControl().setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        replicationTypeComboViewer.setContentProvider( new ArrayContentProvider() );
+        replicationTypeComboViewer.setLabelProvider( new LabelProvider()
+        {
+            public String getText( Object element )
+            {
+                if ( element instanceof Type )
+                {
+                    Type type = ( Type ) element;
+
+                    switch ( type )
+                    {
+                        case REFRESH_AND_PERSIST:
+                            return "Refresh And Persist";
+                        case REFRESH_ONLY:
+                            return "Refresh Only";
+                    }
+                }
+
+                return super.getText( element );
+            }
+        } );
+        replicationTypeComboViewer.setInput( new Type[]
+            { Type.REFRESH_AND_PERSIST, Type.REFRESH_ONLY } );
+
+        // Configure Replication Options Button
+        BaseWidgetUtils.createLabel( group, "", 1 );
+        configureReplicationButton = BaseWidgetUtils.createButton( group, "Configure Replication Options...", 1 );
+        configureReplicationButton.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false ) );
+    }
+
+
+    /**
+     * Creates the replication provider group.
+     *
+     * @param parent the parent composite
+     */
+    private void createReplicationProviderGroup( Composite parent )
+    {
+        // Replication Provider Group
+        Group group = BaseWidgetUtils.createGroup( parent, "Replication Provider Connection", 1 );
+        GridLayout groupGridLayout = new GridLayout( 2, false );
+        group.setLayout( groupGridLayout );
+        group.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+        // Host
+        BaseWidgetUtils.createLabel( group, "Provider Host:", 1 );
+        hostText = BaseWidgetUtils.createText( group, "", 1 );
+        hostText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+        // Port
+        BaseWidgetUtils.createLabel( group, "Provider Port:", 1 );
+        portText = BaseWidgetUtils.createText( group, "", 1 );
+        portText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+        // Encryption Method
+        BaseWidgetUtils.createLabel( group, "Encryption Method:", 1 );
+        encryptionMethodComboViewer = new ComboViewer( group );
+        encryptionMethodComboViewer.getControl().setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        encryptionMethodComboViewer.setContentProvider( new ArrayContentProvider() );
+        encryptionMethodComboViewer.setLabelProvider( new LabelProvider()
+        {
+            public String getText( Object element )
+            {
+                if ( element instanceof EncryptionMethod )
+                {
+                    EncryptionMethod encryptionMethod = ( EncryptionMethod ) element;
+
+                    switch ( encryptionMethod )
+                    {
+                        case NO_ENCRYPTION:
+                            return "No Encryption";
+                        case SSL_ENCRYPTION_LDAPS:
+                            return "Use SSL Encryption (ldaps://)";
+                        case START_TLS_EXTENSION:
+                            return "Use Start TLS Extension";
+                    }
+                }
+
+                return super.getText( element );
+            }
+        } );
+        encryptionMethodComboViewer.setInput( new EncryptionMethod[]
+            {
+                EncryptionMethod.NO_ENCRYPTION,
+                EncryptionMethod.SSL_ENCRYPTION_LDAPS,
+                EncryptionMethod.START_TLS_EXTENSION } );
+
+        // Configure Start TLS Button
+        BaseWidgetUtils.createLabel( group, "", 1 );
+        configureStartTlsButton = BaseWidgetUtils.createButton( group, "Configure Start TLS...", 1 );
+        configureStartTlsButton.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false ) );
+        configureStartTlsButton.setEnabled( false );
+    }
+
+
+    /**
+     * Creates the replication authentication group.
+     *
+     * @param parent the parent composite
+     */
+    private void createReplicationAuthenticationGroup( Composite parent )
+    {
+        // Replication Provider Group
+        Group group = BaseWidgetUtils.createGroup( parent, "Authentication", 1 );
+        GridLayout groupGridLayout = new GridLayout( 2, false );
+        group.setLayout( groupGridLayout );
+        group.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+        // Authentication
+        authenticationTabFolder = new TabFolder( group, SWT.TOP );
+        authenticationTabFolder.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true, 2, 1 ) );
+
+        // Simple Authentication Composite
+        Composite simpleAuthenticationComposite = new Composite( authenticationTabFolder, SWT.NONE );
+        simpleAuthenticationComposite.setLayout( new GridLayout( 2, false ) );
+        simpleAuthenticationComposite.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
+
+        // Bind DN Text
+        BaseWidgetUtils.createLabel( simpleAuthenticationComposite, "Bind DN:", 1 );
+        bindDnText = BaseWidgetUtils.createText( simpleAuthenticationComposite, "", 1 );
+        bindDnText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+        // Credentials Text
+        BaseWidgetUtils.createLabel( simpleAuthenticationComposite, "Credentials:", 1 );
+        credentialsText = BaseWidgetUtils.createText( simpleAuthenticationComposite, "", 1 );
+        credentialsText.setEchoChar( '\u2022' );
+
+        // Show Credentials Checkbox
+        BaseWidgetUtils.createLabel( simpleAuthenticationComposite, "", 1 );
+        showCredentialsCheckbox = BaseWidgetUtils.createCheckbox( simpleAuthenticationComposite, "Show Credentials", 1 );
+
+        // Simple Authentication TabItem
+        TabItem simpleAuthenticationTabItem = new TabItem( authenticationTabFolder, SWT.NONE,
+            SIMPLE_AUTHENTICATION_TAB_ITEM_INDEX );
+        simpleAuthenticationTabItem.setText( "Simple Authentication" );
+        simpleAuthenticationTabItem.setControl( simpleAuthenticationComposite );
+
+        // SASL Authentication Composite
+        Composite saslAuthenticationComposite = new Composite( authenticationTabFolder, SWT.NONE );
+        saslAuthenticationComposite.setLayout( new GridLayout() );
+        saslAuthenticationComposite.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
+
+        // SASL Authentication Wrapped Label
+        saslAuthenticationLabel = new Label( saslAuthenticationComposite, SWT.WRAP | SWT.CENTER );
+        saslAuthenticationLabel.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, true ) );
+
+        // Configure SASL Authentication Button
+        configureSaslAuthenticationButton = BaseWidgetUtils.createButton( saslAuthenticationComposite,
+            "Configure SASL Authentication...", 1 );
+        configureSaslAuthenticationButton.setLayoutData( new GridData( SWT.CENTER, SWT.BOTTOM, true, false ) );
+
+        // SASL Authentication TabItem
+        TabItem saslAuthenticationTabItem = new TabItem( authenticationTabFolder, SWT.NONE,
+            SASL_AUTHENTICATION_TAB_ITEM_INDEX );
+        saslAuthenticationTabItem.setText( "SASL Authentication" );
+        saslAuthenticationTabItem.setControl( saslAuthenticationComposite );
+    }
+
+
+    /**
+     * Creates the replication data group.
+     *
+     * @param parent the parent composite
+     */
+    private void createReplicationDataGroup( Composite parent )
+    {
+        // Replication Data Group
+        Group group = BaseWidgetUtils.createGroup( parent, "Replication Data Configuration", 1 );
+        GridLayout groupGridLayout = new GridLayout( 3, false );
+        groupGridLayout.verticalSpacing = groupGridLayout.marginHeight = 0;
+        group.setLayout( groupGridLayout );
+        group.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+        // Search Base DN Text
+        BaseWidgetUtils.createLabel( group, "Search Base DN:", 1 );
+        searchBaseDnEntryWidget = new EntryWidget( browserConnection, Dn.EMPTY_DN );
+        searchBaseDnEntryWidget.createWidget( group );
+
+        // Filter Text
+        BaseWidgetUtils.createLabel( group, "Filter:", 1 );
+        filterWidget = new FilterWidget();
+        filterWidget.setBrowserConnection( browserConnection );
+        filterWidget.createWidget( group );
+
+        // Scope Combo Viewer
+        BaseWidgetUtils.createLabel( group, "Scope:", 1 );
+        scopeComboViewer = new ComboViewer( group );
+        scopeComboViewer.getControl().setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 2, 1 ) );
+        scopeComboViewer.setContentProvider( new ArrayContentProvider() );
+        scopeComboViewer.setLabelProvider( new LabelProvider()
+        {
+            public String getText( Object element )
+            {
+                if ( element instanceof Scope )
+                {
+                    Scope scope = ( Scope ) element;
+
+                    switch ( scope )
+                    {
+                        case BASE:
+                            return "Base";
+                        case ONE:
+                            return "One Level";
+                        case SUB:
+                            return "Subtree";
+                        case SUBORD:
+                            return "Subordinate Subtree";
+                    }
+                }
+
+                return super.getText( element );
+            }
+        } );
+        scopeComboViewer.setInput( new Scope[]
+            { Scope.SUB, Scope.SUBORD, Scope.ONE, Scope.BASE } );
+
+        // Attributes Table Viewer
+        BaseWidgetUtils.createLabel( group, "Attributes:", 1 );
+        Composite attributesTableComposite = new Composite( group, SWT.NONE );
+        attributesTableComposite.setLayout( new GridLayout( 2, false ) );
+        attributesTableComposite.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true, 2, 1 ) );
+        attributesTableViewer = new TableViewer( attributesTableComposite );
+        attributesTableViewer.getControl().setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true, 1, 3 ) );
+        attributesTableViewer.setContentProvider( new ArrayContentProvider() );
+        attributesTableViewer.setLabelProvider( new LabelProvider()
+        {
+            public String getText( Object element )
+            {
+                if ( SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES.equals( element ) )
+                {
+                    return SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES + " " + "<all operational attributes>";
+                }
+                else if ( SchemaConstants.ALL_USER_ATTRIBUTES.equals( element ) )
+                {
+                    return SchemaConstants.ALL_USER_ATTRIBUTES + " " + "<all user attributes>";
+                }
+
+                return super.getText( element );
+            };
+
+
+            public Image getImage( Object element )
+            {
+                return OpenLdapConfigurationPlugin.getDefault().getImage(
+                    OpenLdapConfigurationPluginConstants.IMG_ATTRIBUTE );
+            }
+        } );
+        attributesTableViewer.setInput( attributes );
+
+        // Add Attribute Button
+        addAttributeButton = BaseWidgetUtils.createButton( attributesTableComposite, "Add...", 1 );
+        addAttributeButton.setLayoutData( createNewButtonGridData() );
+
+        // Edit Attribute Button
+        editAttributeButton = BaseWidgetUtils.createButton( attributesTableComposite, "Edit...", 1 );
+        editAttributeButton.setEnabled( false );
+        editAttributeButton.setLayoutData( createNewButtonGridData() );
+
+        // Delete Attribute Button
+        deleteAttributeButton = BaseWidgetUtils.createButton( attributesTableComposite, "Delete", 1 );
+        deleteAttributeButton.setEnabled( false );
+        deleteAttributeButton.setLayoutData( createNewButtonGridData() );
+
+        // Attributes Only Checkbox
+        BaseWidgetUtils.createLabel( group, "", 1 ); //$NON-NLS-1$
+        attributesOnlyCheckbox = BaseWidgetUtils.createCheckbox( group, "Attributes Only (no values)", 1 );
+        attributesOnlyCheckbox.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false, 2, 1 ) );
+    }
+
+
+    /**
+     * Updates the state of the attributes table buttons.
+     */
+    private void updateAttributesTableButtonsState()
+    {
+        StructuredSelection selection = ( StructuredSelection ) attributesTableViewer.getSelection();
+
+        editAttributeButton.setEnabled( !selection.isEmpty() );
+        deleteAttributeButton.setEnabled( !selection.isEmpty() );
+    }
+
+
+    /**
+     * Action launched when the add attribute button is clicked.
+     */
+    private void addAttributeButtonAction()
+    {
+        AttributeDialog dialog = new AttributeDialog( addAttributeButton.getShell(), browserConnection );
+        if ( dialog.open() == AttributeDialog.OK )
+        {
+            String attribute = dialog.getAttribute();
+
+            attributes.add( attribute );
+            syncRepl.setAttributes( attributes.toArray( new String[0] ) );
+            attributesTableViewer.refresh();
+            attributesTableViewer.setSelection( new StructuredSelection( attribute ) );
+        }
+    }
+
+
+    /**
+     * Action launched when the edit attribute button is clicked.
+     */
+    private void editAttributeButtonAction()
+    {
+        StructuredSelection selection = ( StructuredSelection ) attributesTableViewer.getSelection();
+
+        if ( !selection.isEmpty() )
+        {
+            String selectedAttribute = ( String ) selection.getFirstElement();
+            AttributeDialog dialog = new AttributeDialog( editAttributeButton.getShell(), browserConnection,
+                selectedAttribute );
+            if ( dialog.open() == AttributeDialog.OK )
+            {
+                String attribute = dialog.getAttribute();
+                int selectedAttributeIndex = attributes.indexOf( selectedAttribute );
+
+                attributes.remove( selectedAttributeIndex );
+                attributes.add( selectedAttributeIndex, attribute );
+                syncRepl.setAttributes( attributes.toArray( new String[0] ) );
+                attributesTableViewer.refresh();
+                attributesTableViewer.setSelection( new StructuredSelection( attribute ) );
+            }
+        }
+    }
+
+
+    /**
+     * Action launched when the delete attribute button is clicked.
+     */
+    private void deleteAttributeButtonAction()
+    {
+        StructuredSelection selection = ( StructuredSelection ) attributesTableViewer.getSelection();
+
+        if ( !selection.isEmpty() )
+        {
+            String selectedAttribute = ( String ) selection.getFirstElement();
+            attributes.remove( selectedAttribute );
+            syncRepl.setAttributes( attributes.toArray( new String[0] ) );
+            attributesTableViewer.refresh();
+
+            //            updateAttributesTableButtonsState();
+        }
+    }
+
+
+    /**
+     * Create a new button grid data.
+     *
+     * @return the new button grid data
+     */
+    private GridData createNewButtonGridData()
+    {
+        GridData gd = new GridData( SWT.FILL, SWT.BEGINNING, false, false );
+        gd.widthHint = IDialogConstants.BUTTON_WIDTH;
+        return gd;
+    }
+
+
+    private void refreshUI()
+    {
+        if ( syncRepl != null )
+        {
+            removeListeners();
+
+            //
+            // Replication Consumer
+            //
+
+            // Replica ID
+            String replicaId = syncRepl.getRid();
+
+            if ( replicaId != null )
+            {
+                replicaIdText.setText( replicaId );
+            }
+            else
+            {
+                replicaIdText.setText( "" );
+            }
+
+            // Replication Type
+            Type replicationType = syncRepl.getType();
+
+            if ( replicationType != null )
+            {
+                replicationTypeComboViewer.setSelection( new StructuredSelection( replicationType ) );
+            }
+            else
+            {
+                replicationTypeComboViewer.setSelection( new StructuredSelection( Type.REFRESH_AND_PERSIST ) );
+            }
+
+            //
+            // Replication Provider Connection
+            //
+
+            // Provider
+            Provider provider = syncRepl.getProvider();
+
+            if ( provider != null )
+            {
+                // Provider Host
+                String providerHost = provider.getHost();
+
+                if ( providerHost != null )
+                {
+                    hostText.setText( providerHost );
+                }
+                else
+                {
+                    hostText.setText( "" );
+                }
+
+                // Provider Port
+                int providerPort = provider.getPort();
+
+                if ( providerPort != Provider.NO_PORT )
+                {
+                    portText.setText( "" + providerPort );
+                }
+                else
+                {
+                    portText.setText( "" );
+                }
+
+                // Encryption Type
+                boolean isLdaps = provider.isLdaps();
+                StartTls startTls = syncRepl.getStartTls();
+
+                if ( isLdaps && ( startTls == null ) )
+                {
+                    // SSL Encryption (LDAPS)
+                    encryptionMethodComboViewer.setSelection( new StructuredSelection(
+                        EncryptionMethod.SSL_ENCRYPTION_LDAPS ) );
+                }
+                else if ( !isLdaps && ( startTls != null ) )
+                {
+                    // Start TLS
+                    encryptionMethodComboViewer.setSelection( new StructuredSelection(
+                        EncryptionMethod.START_TLS_EXTENSION ) );
+                }
+                else
+                {
+                    // No Encryption Type
+                    encryptionMethodComboViewer
+                        .setSelection( new StructuredSelection( EncryptionMethod.NO_ENCRYPTION ) );
+                }
+            }
+            else
+            {
+                hostText.setText( "" );
+                portText.setText( "" );
+                encryptionMethodComboViewer.setSelection( new StructuredSelection( EncryptionMethod.NO_ENCRYPTION ) );
+            }
+
+            //
+            // Authentication
+            //
+            BindMethod bindMethod = syncRepl.getBindMethod();
+
+            if ( ( bindMethod == null ) || ( bindMethod == BindMethod.SIMPLE ) )
+            {
+                // Simple Authentication
+                authenticationTabFolder.setSelection( SIMPLE_AUTHENTICATION_TAB_ITEM_INDEX );
+
+                // Bind DN
+                String bindDn = syncRepl.getBindDn();
+
+                if ( bindDn != null )
+                {
+                    bindDnText.setText( bindDn );
+                }
+                else
+                {
+                    bindDnText.setText( "" );
+                }
+
+                // Credentials
+                String credentials = syncRepl.getCredentials();
+
+                if ( credentials != null )
+                {
+                    credentialsText.setText( credentials );
+                }
+                else
+                {
+                    credentialsText.setText( "" );
+                }
+
+                // SASL Authentication Label
+                saslAuthenticationLabel.setText( getSaslAuthenticationLabelText() );
+            }
+            else
+            {
+                // SASL Authentication
+                authenticationTabFolder.setSelection( SASL_AUTHENTICATION_TAB_ITEM_INDEX );
+
+                // SASL Authentication Label
+                saslAuthenticationLabel.setText( getSaslAuthenticationLabelText() );
+                saslAuthenticationLabel.update();
+
+                // Simple Authentication fields
+                bindDnText.setText( "" );
+                credentialsText.setText( "" );
+            }
+
+            //
+            // Replication Data Configuration
+            //
+
+            // Search Base DN
+            String searchBaseDn = syncRepl.getSearchBase();
+
+            if ( searchBaseDn != null )
+            {
+                try
+                {
+                    searchBaseDnEntryWidget.setInput( browserConnection, new Dn( searchBaseDn ) );
+                }
+                catch ( LdapInvalidDnException e )
+                {
+                    // Silent
+                    searchBaseDnEntryWidget.setInput( browserConnection, Dn.EMPTY_DN );
+                }
+            }
+            else
+            {
+                searchBaseDnEntryWidget.setInput( browserConnection, Dn.EMPTY_DN );
+            }
+
+            // Filter
+            String filter = syncRepl.getFilter();
+
+            if ( filter != null )
+            {
+                filterWidget.setFilter( filter );
+            }
+            else
+            {
+                filterWidget.setFilter( "" );
+            }
+
+            // Scope
+            Scope scope = syncRepl.getScope();
+
+            if ( scope != null )
+            {
+                scopeComboViewer.setSelection( new StructuredSelection( scope ) );
+            }
+            else
+            {
+                scopeComboViewer.setSelection( new StructuredSelection( Scope.SUB ) );
+            }
+
+            // Attributes
+            String[] attributes = syncRepl.getAttributes();
+            this.attributes.clear();
+
+            if ( attributes != null )
+            {
+                this.attributes.addAll( Arrays.asList( attributes ) );
+                attributesTableViewer.refresh();
+            }
+
+            // Attributes Only
+            attributesOnlyCheckbox.setSelection( syncRepl.isAttrsOnly() );
+
+            addListeners();
+        }
+    }
+
+
+    /**
+     * Gets the SASL authentication label text.
+     *
+     * @return the text for the SASL authentication label
+     */
+    private String getSaslAuthenticationLabelText()
+    {
+        // SASL Mechanism
+        String saslMechanismString = syncRepl.getSaslMech();
+        String saslMechanismTitle = "(none)";
+        try
+        {
+            SaslMechanism saslMechanism = SaslMechanism.parse( saslMechanismString );
+            saslMechanismTitle = saslMechanism.getTitle();
+        }
+        catch ( ParseException e )
+        {
+            // Silent
+        }
+
+        // Authentication ID
+        String authenticationId = syncRepl.getAuthcid();
+
+        if ( ( authenticationId != null ) && ( !"".equals( authenticationId ) ) )
+        {
+            return NLS.bind( "Authentication ID is ''{0}'', with ''{1}'' SASL mechanism.", authenticationId,
+                saslMechanismTitle );
+        }
+
+        // Authorization ID
+        String authorizationId = syncRepl.getAuthzid();
+
+        if ( ( authorizationId != null ) && ( !"".equals( authorizationId ) ) )
+        {
+            return NLS.bind( "Authorization ID is ''{0}'', with ''{1}'' SASL mechanism.", authorizationId,
+                saslMechanismTitle );
+        }
+
+        return "SASL Authentication isn't configured.";
+    }
+
+
+    /**
+     * Gets the replication type.
+     *
+     * @return the replication type
+     */
+    private Type getReplicationType()
+    {
+        StructuredSelection selection = ( StructuredSelection ) replicationTypeComboViewer.getSelection();
+
+        if ( ( selection != null ) && ( !selection.isEmpty() ) )
+        {
+            return ( Type ) selection.getFirstElement();
+        }
+
+        return null;
+    }
+
+
+    /**
+     * Gets the provider.
+     *
+     * @return the provider
+     */
+    private Provider getProvider()
+    {
+        Provider provider = new Provider();
+
+        // Host
+        String host = hostText.getText();
+
+        if ( ( host != null ) && ( !"".equals( host ) ) )
+        {
+            provider.setHost( host );
+        }
+        else
+        {
+            provider.setHost( null );
+        }
+
+        // Port
+        String portString = portText.getText();
+
+        if ( ( host != null ) && ( !"".equals( host ) ) )
+        {
+            try
+            {
+                provider.setPort( Integer.parseInt( portString ) );
+            }
+            catch ( NumberFormatException e )
+            {
+                // Silent
+                provider.setPort( Provider.NO_PORT );
+            }
+        }
+        else
+        {
+            provider.setPort( Provider.NO_PORT );
+        }
+
+        // Encryption Type
+        provider.setLdaps( EncryptionMethod.SSL_ENCRYPTION_LDAPS == getEncryptionMethod() );
+
+        return provider;
+    }
+
+
+    /**
+     * Gets the encryption method.
+     *
+     * @return the encryption method
+     */
+    private EncryptionMethod getEncryptionMethod()
+    {
+        StructuredSelection selection = ( StructuredSelection ) encryptionMethodComboViewer.getSelection();
+
+        if ( ( selection != null ) && ( !selection.isEmpty() ) )
+        {
+            return ( EncryptionMethod ) selection.getFirstElement();
+        }
+
+        return null;
+    }
+
+
+    /**
+     * Gets the scope.
+     *
+     * @return the scope
+     */
+    private Scope getScope()
+    {
+        StructuredSelection selection = ( StructuredSelection ) scopeComboViewer.getSelection();
+
+        if ( ( selection != null ) && ( !selection.isEmpty() ) )
+        {
+            return ( Scope ) selection.getFirstElement();
+        }
+
+        return null;
+    }
+
+
+    /**
+     * Adds listeners.
+     */
+    private void addListeners()
+    {
+        replicaIdText.addModifyListener( replicatIdTextListener );
+        replicaIdText.addVerifyListener( integerVerifyListener );
+        replicationTypeComboViewer.addSelectionChangedListener( replicationTypeComboViewerListener );
+        configureReplicationButton.addSelectionListener( configureReplicationButtonListener );
+        hostText.addModifyListener( hostTextListener );
+        portText.addModifyListener( portTextListener );
+        portText.addVerifyListener( integerVerifyListener );
+        encryptionMethodComboViewer.addSelectionChangedListener( encryptionMethodComboViewerListener );
+        configureStartTlsButton.addSelectionListener( configureStartTlsButtonListener );
+        authenticationTabFolder.addSelectionListener( authenticationTabFolderListener );
+        bindDnText.addModifyListener( bindDnTextListener );
+        credentialsText.addModifyListener( credentialsTextListener );
+        showCredentialsCheckbox.addSelectionListener( showCredentialsCheckboxListener );
+        configureSaslAuthenticationButton.addSelectionListener( configureSaslAuthenticationButtonListener );
+        searchBaseDnEntryWidget.addWidgetModifyListener( searchBaseDnEntryWidgetListener );
+        filterWidget.addWidgetModifyListener( filterWidgetListener );
+        scopeComboViewer.addSelectionChangedListener( scopeComboViewerListener );
+        attributesTableViewer.addSelectionChangedListener( attributesTableViewerSelectionChangedListener );
+        attributesTableViewer.addDoubleClickListener( attributesTableViewerDoubleClickListener );
+        addAttributeButton.addSelectionListener( addAttributeButtonListener );
+        editAttributeButton.addSelectionListener( editAttributeButtonListener );
+        deleteAttributeButton.addSelectionListener( deleteAttributeButtonListener );
+        attributesOnlyCheckbox.addSelectionListener( attributesOnlyCheckboxListener );
+    }
+
+
+    /**
+     * Removes listeners.
+     */
+    private void removeListeners()
+    {
+        replicaIdText.removeModifyListener( replicatIdTextListener );
+        replicaIdText.removeVerifyListener( integerVerifyListener );
+        replicationTypeComboViewer.removeSelectionChangedListener( replicationTypeComboViewerListener );
+        configureReplicationButton.removeSelectionListener( configureReplicationButtonListener );
+        hostText.removeModifyListener( hostTextListener );
+        portText.removeModifyListener( portTextListener );
+        portText.removeVerifyListener( integerVerifyListener );
+        encryptionMethodComboViewer.removeSelectionChangedListener( encryptionMethodComboViewerListener );
+        configureStartTlsButton.removeSelectionListener( configureStartTlsButtonListener );
+        authenticationTabFolder.removeSelectionListener( authenticationTabFolderListener );
+        bindDnText.removeModifyListener( bindDnTextListener );
+        credentialsText.removeModifyListener( credentialsTextListener );
+        showCredentialsCheckbox.removeSelectionListener( showCredentialsCheckboxListener );
+        configureSaslAuthenticationButton.removeSelectionListener( configureSaslAuthenticationButtonListener );
+        searchBaseDnEntryWidget.removeWidgetModifyListener( searchBaseDnEntryWidgetListener );
+        filterWidget.removeWidgetModifyListener( filterWidgetListener );
+        scopeComboViewer.removeSelectionChangedListener( scopeComboViewerListener );
+        attributesTableViewer.removeSelectionChangedListener( attributesTableViewerSelectionChangedListener );
+        attributesTableViewer.removeDoubleClickListener( attributesTableViewerDoubleClickListener );
+        addAttributeButton.removeSelectionListener( addAttributeButtonListener );
+        editAttributeButton.removeSelectionListener( editAttributeButtonListener );
+        deleteAttributeButton.removeSelectionListener( deleteAttributeButtonListener );
+        attributesOnlyCheckbox.removeSelectionListener( attributesOnlyCheckboxListener );
+    }
+
+
+    /**
+     * Updates the OK button 'enable' state.
+     */
+    private void updateOkButtonEnableState()
+    {
+        // Replica ID
+        String replicaId = replicaIdText.getText();
+
+        if ( ( replicaId == null ) || "".equals( replicaId ) )
+        {
+            okButton.setEnabled( false );
+            return;
+        }
+
+        // Host
+        String host = hostText.getText();
+
+        if ( ( host == null ) || "".equals( host ) )
+        {
+            okButton.setEnabled( false );
+            return;
+        }
+
+        // Search Base DN
+        Dn searchBaseDn = searchBaseDnEntryWidget.getDn();
+
+        if ( ( searchBaseDn == null ) || Dn.EMPTY_DN.equals( searchBaseDn ) )
+        {
+            // TODO add another check
+            // The Search Base DN must be within the database naming context
+            okButton.setEnabled( false );
+            return;
+        }
+
+        okButton.setEnabled( true );
+    }
+
+
+    /**
+     * Gets the SyncRepl value.
+     *
+     * @return the SyncRepl value
+     */
+    public SyncRepl getSyncRepl()
+    {
+        return syncRepl;
+    }
+
+    /**
+     * Enum used for the Encryption Method selected by the user.
+     *
+     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+     */
+    private enum EncryptionMethod
+    {
+        NO_ENCRYPTION,
+        SSL_ENCRYPTION_LDAPS,
+        START_TLS_EXTENSION
+    }
+}

Added: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/ReplicationOptionsDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/ReplicationOptionsDialog.java?rev=1670531&view=auto
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/ReplicationOptionsDialog.java (added)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/ReplicationOptionsDialog.java Wed Apr  1 01:01:42 2015
@@ -0,0 +1,877 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.openldap.config.editor.dialogs;
+
+
+import java.text.ParseException;
+
+import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException;
+import org.apache.directory.api.ldap.model.name.Dn;
+import org.apache.directory.studio.common.ui.widgets.BaseWidgetUtils;
+import org.apache.directory.studio.ldapbrowser.common.widgets.search.EntryWidget;
+import org.apache.directory.studio.ldapbrowser.common.widgets.search.FilterWidget;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IInputValidator;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ComboViewer;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.events.VerifyEvent;
+import org.eclipse.swt.events.VerifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Spinner;
+import org.eclipse.swt.widgets.Text;
+
+import org.apache.directory.studio.openldap.syncrepl.Interval;
+import org.apache.directory.studio.openldap.syncrepl.KeepAlive;
+import org.apache.directory.studio.openldap.syncrepl.Retry;
+import org.apache.directory.studio.openldap.syncrepl.SchemaChecking;
+import org.apache.directory.studio.openldap.syncrepl.SyncData;
+import org.apache.directory.studio.openldap.syncrepl.SyncRepl;
+import org.apache.directory.studio.openldap.syncrepl.Type;
+
+
+/**
+ * The ReplicationOptionsDialog is used to edit the replication options of a SyncRepl consumer.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class ReplicationOptionsDialog extends Dialog
+{
+    /** The SyncRepl value */
+    private SyncRepl syncRepl;
+
+    /** The connection */
+    private IBrowserConnection browserConnection;
+
+    // UI widgets
+    private ScrolledComposite scrolledComposite;
+    private Composite composite;
+    private ComboViewer replicationTypeComboViewer;
+    private Spinner intervalDaysSpinner;
+    private Spinner intervalHoursSpinner;
+    private Spinner intervalMinutesSpinner;
+    private Spinner intervalSecondsSpinner;
+    private Text retryText;
+    private Button editRetryButton;
+    private Spinner keepAliveIdleSpinner;
+    private Spinner keepAliveProbesSpinner;
+    private Spinner keepAliveIntervalSpinner;
+    private Text sizeLimitText;
+    private Text timeLimitText;
+    private Text networkTimeoutText;
+    private Text timeoutText;
+    private Button enableSchemaCheckingCheckbox;
+    private Button enableDeltaSyncReplCheckbox;
+    private ComboViewer syncDataComboViewer;
+    private EntryWidget logBaseDnEntryWidget;
+    private FilterWidget logFilterWidget;
+
+    // Listeners
+    private VerifyListener integerVerifyListener = new VerifyListener()
+    {
+        public void verifyText( VerifyEvent e )
+        {
+            if ( !e.text.matches( "[0-9]*" ) ) //$NON-NLS-1$
+            {
+                e.doit = false;
+            }
+        }
+    };
+
+    private SelectionListener editRetryButtonListener = new SelectionAdapter()
+    {
+        public void widgetSelected( SelectionEvent e )
+        {
+            // Getting the retry value
+            String retryValue = null;
+            if ( syncRepl != null )
+            {
+                Retry retry = syncRepl.getRetry();
+
+                if ( retry != null )
+                {
+                    retryValue = retry.toString();
+                }
+            }
+
+            // Creating and displaying a dialog to edit the retry value
+            InputDialog dialog = new InputDialog( editRetryButton.getShell(), "Edit Retry Value", "Specify the retry value as a list of the <retry interval> and <# of retries> pairs:",
+                retryValue, new IInputValidator()
+                {
+                    public String isValid( String newText )
+                    {
+                        try
+                        {
+                            Retry.parse( newText );
+                        }
+                        catch ( ParseException e )
+                        {
+                            return e.getMessage();
+                        }
+
+                        return null;
+                    }
+                } );
+
+            if ( InputDialog.OK == dialog.open() )
+            {
+                try
+                {
+                    syncRepl.setRetry( Retry.parse( dialog.getValue() ) );
+                }
+                catch ( ParseException e1 )
+                {
+                    syncRepl.setRetry( null );
+                }
+
+                retryText.setText( getRetryValue() );
+            }
+        }
+    };
+
+    private SelectionListener enableDeltaSyncReplCheckboxListener = new SelectionAdapter()
+    {
+        public void widgetSelected( SelectionEvent e )
+        {
+            boolean isChecked = enableDeltaSyncReplCheckbox.getSelection();
+
+            syncDataComboViewer.getControl().setEnabled( isChecked );
+            logBaseDnEntryWidget.setEnabled( isChecked );
+            logFilterWidget.setEnabled( isChecked );
+        }
+    };
+
+
+    /**
+     * Creates a new instance of OverlayDialog.
+     * 
+     * @param parentShell the parent shell
+     * @param index the index
+     * @param browserConnection the connection
+     */
+    public ReplicationOptionsDialog( Shell parentShell, SyncRepl syncRepl, IBrowserConnection browserConnection )
+    {
+        super( parentShell );
+        super.setShellStyle( super.getShellStyle() | SWT.RESIZE );
+        this.browserConnection = browserConnection;
+
+        if ( syncRepl != null )
+        {
+            this.syncRepl = syncRepl.copy();
+        }
+        else
+        {
+            this.syncRepl = createDefaultSyncRepl();
+        }
+    }
+
+
+    /**
+     * Creates a default SyncRepl configuration.
+     *
+     * @return a default SyncRepl configuration
+     */
+    private SyncRepl createDefaultSyncRepl()
+    {
+        SyncRepl syncRepl = new SyncRepl();
+
+        return syncRepl;
+    }
+
+
+    /**
+     * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+     */
+    protected void configureShell( Shell shell )
+    {
+        super.configureShell( shell );
+        shell.setText( "Replication Options" );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void okPressed()
+    {
+        saveToSyncRepl();
+
+        super.okPressed();
+    }
+
+
+    /**
+     * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+     */
+    protected Control createDialogArea( Composite parent )
+    {
+        // Creating the scrolled composite
+        scrolledComposite = new ScrolledComposite( parent, SWT.H_SCROLL | SWT.V_SCROLL );
+        scrolledComposite.setExpandHorizontal( true );
+        scrolledComposite.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
+
+        // Creating the composite and attaching it to the scrolled composite
+        composite = new Composite( scrolledComposite, SWT.NONE );
+        composite.setLayout( new GridLayout() );
+        scrolledComposite.setContent( composite );
+
+        createReplicationConsumerGroup( composite );
+        createDeltaSyncReplGroup( composite );
+
+        initFromSyncRepl();
+
+        applyDialogFont( scrolledComposite );
+        composite.setSize( composite.computeSize( SWT.DEFAULT, SWT.DEFAULT ) );
+
+        return scrolledComposite;
+    }
+
+
+    /**
+     * Creates the replication consumer group.
+     *
+     * @param parent the parent composite
+     */
+    private void createReplicationConsumerGroup( Composite parent )
+    {
+        // Replication Provider Group
+        Group group = BaseWidgetUtils.createGroup( parent, "Replication Consumer", 1 );
+        group.setLayout( new GridLayout( 3, false ) );
+        group.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+        // Replication Type
+        BaseWidgetUtils.createLabel( group, "Replication Type:", 1 );
+        replicationTypeComboViewer = new ComboViewer( group );
+        replicationTypeComboViewer.getControl().setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 2, 1 ) );
+        replicationTypeComboViewer.setContentProvider( new ArrayContentProvider() );
+        replicationTypeComboViewer.setLabelProvider( new LabelProvider()
+        {
+            public String getText( Object element )
+            {
+                if ( element instanceof Type )
+                {
+                    Type type = ( Type ) element;
+
+                    switch ( type )
+                    {
+                        case REFRESH_AND_PERSIST:
+                            return "Refresh And Persist";
+                        case REFRESH_ONLY:
+                            return "Refresh Only";
+                    }
+                }
+
+                return super.getText( element );
+            }
+        } );
+        replicationTypeComboViewer.setInput( new Type[]
+            { Type.REFRESH_AND_PERSIST, Type.REFRESH_ONLY } );
+
+        // Interval
+        createIntervalComposites( group );
+
+        // Retry
+        BaseWidgetUtils.createLabel( group, "Retry:", 1 );
+        retryText = BaseWidgetUtils.createReadonlyText( group, "", 1 );
+        retryText.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false, 1, 1 ) );
+        editRetryButton = BaseWidgetUtils.createButton( group, "Edit...", 1 );
+        editRetryButton.setLayoutData( new GridData( SWT.BEGINNING, SWT.CENTER, false, false, 1, 1 ) );
+
+        // Keep Alive
+        createKeepAliveComposites( group );
+
+        // Size Limit
+        BaseWidgetUtils.createLabel( group, "Size Limit:", 1 );
+        sizeLimitText = BaseWidgetUtils.createText( group, "", 1 );
+        sizeLimitText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 2, 1 ) );
+
+        // Time Limit
+        BaseWidgetUtils.createLabel( group, "Time Limit:", 1 );
+        timeLimitText = BaseWidgetUtils.createText( group, "", 1 );
+        timeLimitText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 2, 1 ) );
+
+        // Network Timeout
+        BaseWidgetUtils.createLabel( group, "Network Timeout:", 1 );
+        networkTimeoutText = BaseWidgetUtils.createText( group, "", 1 );
+        networkTimeoutText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 2, 1 ) );
+
+        // Timeout
+        BaseWidgetUtils.createLabel( group, "Timeout:", 1 );
+        timeoutText = BaseWidgetUtils.createText( group, "", 1 );
+        timeoutText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 2, 1 ) );
+
+        // Schema Checking
+        enableSchemaCheckingCheckbox = BaseWidgetUtils.createCheckbox( group, "Enable Schema Checking", 2 );
+    }
+
+
+    private void createIntervalComposites( Composite parent )
+    {
+        // Interval Label Composite
+        Composite intervalLabelComposite = BaseWidgetUtils.createColumnContainer( parent, 1, 1 );
+        intervalLabelComposite.setLayoutData( new GridData() );
+
+        // Interval Label
+        BaseWidgetUtils.createLabel( intervalLabelComposite, "Interval:", 1 );
+        BaseWidgetUtils.createLabel( intervalLabelComposite, "", 1 );
+
+        // Interval Composite
+        Composite intervalComposite = BaseWidgetUtils.createColumnContainer( parent, 2, 2 );
+        GridLayout intervalCompositeGridLayout = new GridLayout( 4, false );
+        intervalCompositeGridLayout.marginWidth = intervalCompositeGridLayout.marginHeight = 0;
+        intervalCompositeGridLayout.verticalSpacing = 0;
+        intervalComposite.setLayout( intervalCompositeGridLayout );
+
+        // Interval Days Spinner
+        intervalDaysSpinner = new Spinner( intervalComposite, SWT.BORDER );
+        intervalDaysSpinner.setMinimum( 0 );
+        intervalDaysSpinner.setMaximum( 99999 );
+
+        // Interval Hours Spinner
+        intervalHoursSpinner = new Spinner( intervalComposite, SWT.BORDER );
+        intervalHoursSpinner.setMinimum( 0 );
+        intervalHoursSpinner.setMaximum( 23 );
+
+        // Interval Minutes Spinner
+        intervalMinutesSpinner = new Spinner( intervalComposite, SWT.BORDER );
+        intervalMinutesSpinner.setMinimum( 0 );
+        intervalMinutesSpinner.setMaximum( 59 );
+
+        // Interval Seconds Spinner
+        intervalSecondsSpinner = new Spinner( intervalComposite, SWT.BORDER );
+        intervalSecondsSpinner.setMinimum( 0 );
+        intervalSecondsSpinner.setMaximum( 59 );
+
+        // Days Hours Minutes Seconds Labels
+        BaseWidgetUtils.createLabel( intervalComposite, "Days", 1 );
+        BaseWidgetUtils.createLabel( intervalComposite, "Hours", 1 );
+        BaseWidgetUtils.createLabel( intervalComposite, "Minutes", 1 );
+        BaseWidgetUtils.createLabel( intervalComposite, "Seconds", 1 );
+    }
+
+
+    private void createKeepAliveComposites( Composite parent )
+    {
+        // Keep Alive Label Composite
+        Composite keepAliveLabelComposite = BaseWidgetUtils.createColumnContainer( parent, 1, 1 );
+        keepAliveLabelComposite.setLayoutData( new GridData() );
+
+        // Keep Alive Label
+        BaseWidgetUtils.createLabel( keepAliveLabelComposite, "Keep Alive:", 1 );
+        BaseWidgetUtils.createLabel( keepAliveLabelComposite, "", 1 );
+
+        // Keep Alive Composite
+        Composite keepAliveComposite = BaseWidgetUtils.createColumnContainer( parent, 2, 2 );
+        GridLayout keepAliveCompositeGridLayout = new GridLayout( 3, false );
+        keepAliveCompositeGridLayout.marginWidth = keepAliveCompositeGridLayout.marginHeight = 0;
+        keepAliveCompositeGridLayout.verticalSpacing = 0;
+        keepAliveComposite.setLayout( keepAliveCompositeGridLayout );
+
+        // Keep Alive Idle Spinner
+        keepAliveIdleSpinner = new Spinner( keepAliveComposite, SWT.BORDER );
+        keepAliveIdleSpinner.setMinimum( 0 );
+        keepAliveIdleSpinner.setMaximum( 99999 );
+
+        // Keep Alive Probes Spinner
+        keepAliveProbesSpinner = new Spinner( keepAliveComposite, SWT.BORDER );
+        keepAliveProbesSpinner.setMinimum( 0 );
+        keepAliveProbesSpinner.setMaximum( 99999 );
+
+        // Keep Alive Interval Spinner
+        keepAliveIntervalSpinner = new Spinner( keepAliveComposite, SWT.BORDER );
+        keepAliveIntervalSpinner.setMinimum( 0 );
+        keepAliveIntervalSpinner.setMaximum( 99999 );
+
+        // Idle Probes Interval Labels
+        BaseWidgetUtils.createLabel( keepAliveComposite, "Idle", 1 );
+        BaseWidgetUtils.createLabel( keepAliveComposite, "Probes", 1 );
+        BaseWidgetUtils.createLabel( keepAliveComposite, "Interval", 1 );
+    }
+
+
+    private void createDeltaSyncReplGroup( Composite parent )
+    {
+        // Replication Provider Group
+        Group group = BaseWidgetUtils.createGroup( parent, "Delta SyncRepl Configuration", 1 );
+        group.setLayout( new GridLayout( 3, false ) );
+        group.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+        // Enable Delta SyncRepl Checkbox
+        enableDeltaSyncReplCheckbox = BaseWidgetUtils.createCheckbox( group, "Enable Delta SyncRepl", 3 );
+
+        // Sync Data Combo Viewer
+        BaseWidgetUtils.createLabel( group, "Sync Data:", 1 );
+        syncDataComboViewer = new ComboViewer( group );
+        syncDataComboViewer.getControl().setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 2, 1 ) );
+        syncDataComboViewer.setContentProvider( new ArrayContentProvider() );
+        syncDataComboViewer.setLabelProvider( new LabelProvider()
+        {
+            public String getText( Object element )
+            {
+                if ( element instanceof SyncData )
+                {
+                    SyncData syncData = ( SyncData ) element;
+
+                    switch ( syncData )
+                    {
+                        case ACCESSLOG:
+                            return "Access Log";
+                        case CHANGELOG:
+                            return "Change Log";
+                        case DEFAULT:
+                            return "Default";
+                    }
+                }
+
+                return super.getText( element );
+            }
+        } );
+        syncDataComboViewer.setInput( new SyncData[]
+            { SyncData.ACCESSLOG, SyncData.CHANGELOG } );
+
+        // Log Base DN Text
+        BaseWidgetUtils.createLabel( group, "Log Base DN:", 1 );
+        logBaseDnEntryWidget = new EntryWidget( browserConnection, Dn.EMPTY_DN );
+        logBaseDnEntryWidget.createWidget( group );
+
+        // Log Filter Text
+        BaseWidgetUtils.createLabel( group, "Log Filter:", 1 );
+        logFilterWidget = new FilterWidget();
+        logFilterWidget.setBrowserConnection( browserConnection );
+        logFilterWidget.createWidget( group );
+    }
+
+
+    /**
+     * Initializes the dialog using the SyncRepl object.
+     */
+    private void initFromSyncRepl()
+    {
+        if ( syncRepl != null )
+        {
+            // Replication Type
+            Type replicationType = syncRepl.getType();
+
+            if ( replicationType != null )
+            {
+                replicationTypeComboViewer.setSelection( new StructuredSelection( replicationType ) );
+            }
+            else
+            {
+                replicationTypeComboViewer.setSelection( new StructuredSelection( Type.REFRESH_AND_PERSIST ) );
+            }
+
+            // Interval
+            Interval interval = syncRepl.getInterval();
+
+            if ( interval != null )
+            {
+                intervalDaysSpinner.setSelection( interval.getDays() );
+                intervalHoursSpinner.setSelection( interval.getHours() );
+                intervalMinutesSpinner.setSelection( interval.getMinutes() );
+                intervalSecondsSpinner.setSelection( interval.getSeconds() );
+            }
+
+            // Retry
+            retryText.setText( getRetryValue() );
+
+            // Keep Alive
+            KeepAlive keepAlive = syncRepl.getKeepAlive();
+
+            if ( keepAlive != null )
+            {
+                keepAliveIdleSpinner.setSelection( keepAlive.getIdle() );
+                keepAliveProbesSpinner.setSelection( keepAlive.getProbes() );
+                keepAliveIntervalSpinner.setSelection( keepAlive.getInterval() );
+            }
+
+            // Size Limit
+            int sizeLimit = syncRepl.getSizeLimit();
+
+            if ( sizeLimit != -1 )
+            {
+                sizeLimitText.setText( "" + sizeLimit );
+            }
+
+            // Time Limit
+            int timeLimit = syncRepl.getTimeLimit();
+
+            if ( timeLimit != -1 )
+            {
+                timeLimitText.setText( "" + timeLimit );
+            }
+
+            // Network Timeout
+            int networkTimeout = syncRepl.getNetworkTimeout();
+
+            if ( networkTimeout != -1 )
+            {
+                networkTimeoutText.setText( "" + networkTimeout );
+            }
+
+            // Timeout
+            int timeout = syncRepl.getTimeout();
+
+            if ( timeout != -1 )
+            {
+                timeoutText.setText( "" + timeout );
+            }
+
+            // Enable Schema Checking
+            SchemaChecking schemaChecking = syncRepl.getSchemaChecking();
+
+            if ( schemaChecking != null )
+            {
+                enableSchemaCheckingCheckbox.setSelection( schemaChecking == SchemaChecking.ON );
+            }
+
+            // Sync Data
+            SyncData syncData = syncRepl.getSyncData();
+
+            if ( syncData != null && ( ( syncData == SyncData.ACCESSLOG ) || ( syncData == SyncData.CHANGELOG ) ) )
+            {
+                enableDeltaSyncReplCheckbox.setSelection( true );
+                syncDataComboViewer.setSelection( new StructuredSelection( syncData ) );
+            }
+            else
+            {
+                syncDataComboViewer.setSelection( new StructuredSelection( SyncData.ACCESSLOG ) );
+                syncDataComboViewer.getControl().setEnabled( false );
+                logBaseDnEntryWidget.setEnabled( false );
+                logFilterWidget.setEnabled( false );
+            }
+
+            // Log Base DN
+            String logBaseDn = syncRepl.getLogBase();
+
+            if ( logBaseDn != null )
+            {
+                try
+                {
+                    logBaseDnEntryWidget.setInput( browserConnection, new Dn( logBaseDn ) );
+                }
+                catch ( LdapInvalidDnException e )
+                {
+                    // Silent
+                }
+            }
+
+            // Log Filter
+            String logFilter = syncRepl.getLogFilter();
+
+            if ( logFilter != null )
+            {
+                logFilterWidget.setFilter( logFilter );
+            }
+
+            addListeners();
+        }
+    }
+
+
+    /**
+     * Gets the retry value.
+     *
+     * @return the retry value
+     */
+    private String getRetryValue()
+    {
+        if ( syncRepl != null )
+        {
+
+            Retry retry = syncRepl.getRetry();
+
+            if ( retry != null )
+            {
+                return retry.toString();
+            }
+        }
+        return "(none)";
+    }
+
+
+    /**
+     * Adds listeners.
+     */
+    private void addListeners()
+    {
+        editRetryButton.addSelectionListener( editRetryButtonListener );
+        sizeLimitText.addVerifyListener( integerVerifyListener );
+        timeLimitText.addVerifyListener( integerVerifyListener );
+        networkTimeoutText.addVerifyListener( integerVerifyListener );
+        timeoutText.addVerifyListener( integerVerifyListener );
+        enableDeltaSyncReplCheckbox.addSelectionListener( enableDeltaSyncReplCheckboxListener );
+    }
+
+
+    /**
+     * Saves the content of the dialog to the SyncRepl object.
+     */
+    private void saveToSyncRepl()
+    {
+        if ( syncRepl != null )
+        {
+            // Replication Type
+            syncRepl.setType( getReplicationType() );
+
+            // Interval
+            syncRepl.setInterval( getInterval() );
+
+            // Retry
+            // TODO
+
+            // Keep Alive
+            syncRepl.setKeepAlive( getKeepAlive() );
+
+            // Size Limit
+            String sizeLimitString = sizeLimitText.getText();
+
+            if ( ( sizeLimitString != null ) && ( !"".equals( sizeLimitString ) ) )
+            {
+                try
+                {
+                    int sizeLimit = Integer.parseInt( sizeLimitString );
+                    syncRepl.setSizeLimit( sizeLimit );
+                }
+                catch ( NumberFormatException e )
+                {
+                    // Silent (will never happen)
+                }
+            }
+            else
+            {
+                syncRepl.setSizeLimit( -1 );
+            }
+
+            // Time Limit
+            String timeLimitString = timeLimitText.getText();
+
+            if ( ( timeLimitString != null ) && ( !"".equals( timeLimitString ) ) )
+            {
+                try
+                {
+                    int timeLimit = Integer.parseInt( timeLimitString );
+                    syncRepl.setTimeLimit( timeLimit );
+                }
+                catch ( NumberFormatException e )
+                {
+                    // Silent (will never happen)
+                }
+            }
+            else
+            {
+                syncRepl.setTimeLimit( -1 );
+            }
+
+            // Network Timeout
+            String networkTimeoutString = networkTimeoutText.getText();
+
+            if ( ( networkTimeoutString != null ) && ( !"".equals( networkTimeoutString ) ) )
+            {
+                try
+                {
+                    int networkTimeout = Integer.parseInt( networkTimeoutString );
+                    syncRepl.setNetworkTimeout( networkTimeout );
+                }
+                catch ( NumberFormatException e )
+                {
+                    // Silent (will never happen)
+                }
+            }
+            else
+            {
+                syncRepl.setNetworkTimeout( -1 );
+            }
+
+            // Timeout
+            String timeoutString = timeoutText.getText();
+
+            if ( ( timeoutString != null ) && ( !"".equals( timeoutString ) ) )
+            {
+                try
+                {
+                    int timeout = Integer.parseInt( timeoutString );
+                    syncRepl.setTimeout( timeout );
+                }
+                catch ( NumberFormatException e )
+                {
+                    // Silent (will never happen)
+                }
+            }
+            else
+            {
+                syncRepl.setTimeout( -1 );
+            }
+
+            // Enable Schema Checking
+            syncRepl.setSchemaChecking( getSchemaChecking() );
+
+            // Sync Data
+            syncRepl.setSyncData( getSyncData() );
+
+            // Log Base DN
+            Dn logBaseDn = logBaseDnEntryWidget.getDn();
+
+            if ( ( logBaseDn != null ) && ( !Dn.EMPTY_DN.equals( logBaseDn ) ) )
+            {
+                syncRepl.setLogBase( logBaseDn.getName() );
+            }
+            else
+            {
+                syncRepl.setLogBase( null );
+            }
+
+            // Log Filter
+            String logFilter = logFilterWidget.getFilter();
+
+            if ( ( logBaseDn != null ) && ( !"".equals( logFilter ) ) )
+            {
+                syncRepl.setLogFilter( logFilter );
+            }
+            else
+            {
+                syncRepl.setLogFilter( null );
+            }
+        }
+    }
+
+
+    /**
+     * Gets the replication type.
+     *
+     * @return the replication type
+     */
+    private Type getReplicationType()
+    {
+        StructuredSelection selection = ( StructuredSelection ) replicationTypeComboViewer.getSelection();
+
+        if ( ( selection != null ) && ( !selection.isEmpty() ) )
+        {
+            return ( Type ) selection.getFirstElement();
+        }
+
+        return null;
+    }
+
+
+    /**
+     * Gets the interval.
+     *
+     * @return the interval
+     */
+    private Interval getInterval()
+    {
+        int days = intervalDaysSpinner.getSelection();
+        int hours = intervalHoursSpinner.getSelection();
+        int minutes = intervalMinutesSpinner.getSelection();
+        int seconds = intervalSecondsSpinner.getSelection();
+
+        if ( ( days != 0 ) || ( hours != 0 ) || ( minutes != 0 ) || ( seconds != 0 ) )
+        {
+            return new Interval( days, hours, minutes, seconds );
+        }
+
+        return null;
+    }
+
+
+    /**
+     * Gets the keep alive.
+     *
+     * @return the keep alive
+     */
+    private KeepAlive getKeepAlive()
+    {
+        int idle = keepAliveIdleSpinner.getSelection();
+        int probes = keepAliveProbesSpinner.getSelection();
+        int interval = keepAliveIntervalSpinner.getSelection();
+
+        if ( ( idle != 0 ) || ( probes != 0 ) || ( interval != 0 ) )
+        {
+            return new KeepAlive( idle, probes, interval );
+        }
+
+        return null;
+    }
+
+
+    /**
+     * Gets the schema checking.
+     *
+     * @return the schema checking
+     */
+    private SchemaChecking getSchemaChecking()
+    {
+        if ( enableSchemaCheckingCheckbox.getSelection() )
+        {
+            return SchemaChecking.ON;
+        }
+        else
+        {
+            return SchemaChecking.OFF;
+        }
+    }
+
+
+    /**
+     * Gets the sync data.
+     *
+     * @return the sync data
+     */
+    private SyncData getSyncData()
+    {
+        if ( enableDeltaSyncReplCheckbox.getSelection() )
+        {
+            StructuredSelection selection = ( StructuredSelection ) syncDataComboViewer.getSelection();
+
+            if ( ( selection != null ) && ( !selection.isEmpty() ) )
+            {
+                return ( SyncData ) selection.getFirstElement();
+            }
+        }
+
+        return null;
+    }
+
+
+    /**
+     * Gets the SyncRepl value.
+     *
+     * @return the SyncRepl value
+     */
+    public SyncRepl getSyncRepl()
+    {
+        return syncRepl;
+    }
+}



Mime
View raw message