directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1670531 [8/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/ReplicationSaslDialog.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/ReplicationSaslDialog.java?rev=1670531&view=auto
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/ReplicationSaslDialog.java (added)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/ReplicationSaslDialog.java Wed Apr  1 01:01:42 2015
@@ -0,0 +1,411 @@
+/*
+ *  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.studio.common.ui.widgets.BaseWidgetUtils;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+import org.eclipse.jface.dialogs.Dialog;
+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.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.Text;
+
+import org.apache.directory.studio.openldap.syncrepl.SaslMechanism;
+import org.apache.directory.studio.openldap.syncrepl.SyncRepl;
+
+
+/**
+ * The ReplicationSaslDialog is used to edit the SASL configuration of a SyncRepl consumer.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class ReplicationSaslDialog extends Dialog
+{
+    /** The SyncRepl value */
+    private SyncRepl syncRepl;
+
+    /** The connection */
+    private IBrowserConnection browserConnection;
+
+    // UI widgets
+    private ScrolledComposite scrolledComposite;
+    private Composite composite;
+    private ComboViewer saslMechanismComboViewer;
+    private Text realmText;
+    private Text authenticationIdText;
+    private Text authorizationIdText;
+    private Text credentialsText;
+    private Button showCredentialsCheckbox;
+    private Text secPropsText;
+
+    // Listeners
+    private SelectionListener showCredentialsCheckboxListener = new SelectionAdapter()
+    {
+        public void widgetSelected( SelectionEvent e )
+        {
+            if ( showCredentialsCheckbox.getSelection() )
+            {
+                credentialsText.setEchoChar( '\0' );
+            }
+            else
+            {
+                credentialsText.setEchoChar( '\u2022' );
+            }
+        }
+    };
+
+
+    /**
+     * Creates a new instance of OverlayDialog.
+     * 
+     * @param parentShell the parent shell
+     * @param index the index
+     * @param browserConnection the connection
+     */
+    public ReplicationSaslDialog( 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 );
+
+        createSaslConfigurationGroup( composite );
+
+        initFromSyncRepl();
+
+        applyDialogFont( scrolledComposite );
+        composite.setSize( composite.computeSize( SWT.DEFAULT, SWT.DEFAULT ) );
+
+        return scrolledComposite;
+    }
+
+
+    /**
+     * Creates the SASL Configuration group.
+     *
+     * @param parent the parent composite
+     */
+    private void createSaslConfigurationGroup( Composite parent )
+    {
+        // SASL Configuration Group
+        Group group = BaseWidgetUtils.createGroup( parent, "SASL Configuration", 1 );
+        group.setLayout( new GridLayout( 2, false ) );
+        group.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+        // SASL Mechanism
+        BaseWidgetUtils.createLabel( group, "SASL Mechanism:", 1 );
+        saslMechanismComboViewer = new ComboViewer( group );
+        saslMechanismComboViewer.getControl().setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        saslMechanismComboViewer.setContentProvider( new ArrayContentProvider() );
+        saslMechanismComboViewer.setLabelProvider( new LabelProvider()
+        {
+            public String getText( Object element )
+            {
+                if ( element instanceof SaslMechanism )
+                {
+                    return ( ( SaslMechanism ) element ).getTitle();
+                }
+
+                return super.getText( element );
+            }
+        } );
+        saslMechanismComboViewer.setInput( new SaslMechanism[]
+            { SaslMechanism.DIGEST_MD5, SaslMechanism.GSSAPI } );
+
+        // Authentication ID
+        BaseWidgetUtils.createLabel( group, "Authentication ID:", 1 );
+        authenticationIdText = BaseWidgetUtils.createText( group, "", 1 );
+
+        // Authorization ID
+        BaseWidgetUtils.createLabel( group, "Authorization ID:", 1 );
+        authorizationIdText = BaseWidgetUtils.createText( group, "", 1 );
+
+        // Credentials
+        BaseWidgetUtils.createLabel( group, "Credentials:", 1 );
+        credentialsText = BaseWidgetUtils.createText( group, "", 1 );
+        credentialsText.setEchoChar( '\u2022' );
+
+        // Show Credentials Checkbox
+        BaseWidgetUtils.createLabel( group, "", 1 );
+        showCredentialsCheckbox = BaseWidgetUtils.createCheckbox( group, "Show Credentials", 1 );
+
+        // Realm
+        BaseWidgetUtils.createLabel( group, "Realm:", 1 );
+        realmText = BaseWidgetUtils.createText( group, "", 1 );
+
+        // Sec Props
+        BaseWidgetUtils.createLabel( group, "Sec Props:", 1 );
+        secPropsText = BaseWidgetUtils.createText( group, "", 1 );
+    }
+
+
+    /**
+     * Initializes the dialog using the SyncRepl object.
+     */
+    private void initFromSyncRepl()
+    {
+        if ( syncRepl != null )
+        {
+            // SASL Mechanism
+            String saslMechanismString = syncRepl.getSaslMech();
+
+            if ( saslMechanismString != null )
+            {
+                try
+                {
+                    saslMechanismComboViewer.setSelection( new StructuredSelection( SaslMechanism
+                        .parse( saslMechanismString ) ) );
+                }
+                catch ( ParseException e )
+                {
+                    // Silent
+                }
+            }
+
+            // Authentication ID
+            String authenticationId = syncRepl.getAuthcid();
+
+            if ( authenticationId != null )
+            {
+                authenticationIdText.setText( authenticationId );
+            }
+
+            // Authorization ID
+            String authorizationId = syncRepl.getAuthzid();
+
+            if ( authorizationId != null )
+            {
+                authorizationIdText.setText( authorizationId );
+            }
+
+            // Credentials
+            String credentials = syncRepl.getCredentials();
+
+            if ( credentials != null )
+            {
+                credentialsText.setText( credentials );
+            }
+
+            // Realm
+            String realm = syncRepl.getRealm();
+
+            if ( realm != null )
+            {
+                realmText.setText( realm );
+            }
+
+            // Sec Props
+            String secProps = syncRepl.getSecProps();
+
+            if ( secProps != null )
+            {
+                secPropsText.setText( secProps );
+            }
+
+            addListeners();
+        }
+    }
+
+
+    /**
+     * Adds listeners.
+     */
+    private void addListeners()
+    {
+        showCredentialsCheckbox.addSelectionListener( showCredentialsCheckboxListener );
+    }
+
+
+    /**
+     * Saves the content of the dialog to the SyncRepl object.
+     */
+    private void saveToSyncRepl()
+    {
+        if ( syncRepl != null )
+        {
+            // SASL Mechanism
+            syncRepl.setSaslMech( getSaslMechanism() );
+
+            // Authentication ID
+            String authenticationId = authenticationIdText.getText();
+
+            if ( ( authenticationId != null ) && ( !"".equals( authenticationId ) ) )
+            {
+                syncRepl.setAuthcid( authenticationId );
+            }
+            else
+            {
+                syncRepl.setAuthcid( null );
+            }
+
+            // Authorization ID
+            String authorizationId = authorizationIdText.getText();
+
+            if ( ( authorizationId != null ) && ( !"".equals( authorizationId ) ) )
+            {
+                syncRepl.setAuthzid( authorizationId );
+            }
+            else
+            {
+                syncRepl.setAuthzid( null );
+            }
+
+            // Credentials
+            String credentials = credentialsText.getText();
+
+            if ( ( credentials != null ) && ( !"".equals( credentials ) ) )
+            {
+                syncRepl.setCredentials( credentials );
+            }
+            else
+            {
+                syncRepl.setCredentials( null );
+            }
+
+            // Realm
+            String realm = realmText.getText();
+
+            if ( ( realm != null ) && ( !"".equals( realm ) ) )
+            {
+                syncRepl.setRealm( realm );
+            }
+            else
+            {
+                syncRepl.setRealm( null );
+            }
+
+            // Sec Props
+            String secProps = secPropsText.getText();
+
+            if ( ( secProps != null ) && ( !"".equals( secProps ) ) )
+            {
+                syncRepl.setSecProps( secProps );
+            }
+            else
+            {
+                syncRepl.setSecProps( null );
+            }
+        }
+    }
+
+
+    /**
+     * Gets the selected SASL mechanism.
+     *
+     * @return the selected SASL mechanism
+     */
+    private String getSaslMechanism()
+    {
+        StructuredSelection selection = ( StructuredSelection ) saslMechanismComboViewer.getSelection();
+
+        if ( ( selection != null ) && ( !selection.isEmpty() ) )
+        {
+            return ( ( SaslMechanism ) selection.getFirstElement() ).getValue();
+        }
+
+        return null;
+    }
+
+
+    /**
+     * Gets the SyncRepl value.
+     *
+     * @return the SyncRepl value
+     */
+    public SyncRepl getSyncRepl()
+    {
+        return syncRepl;
+    }
+}

Added: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/RwmMappingDialog.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/RwmMappingDialog.java?rev=1670531&view=auto
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/RwmMappingDialog.java (added)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/RwmMappingDialog.java Wed Apr  1 01:01:42 2015
@@ -0,0 +1,477 @@
+/*
+ *  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.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.apache.directory.api.ldap.model.schema.AttributeType;
+import org.apache.directory.api.ldap.model.schema.ObjectClass;
+import org.apache.directory.studio.common.ui.widgets.BaseWidgetUtils;
+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.ISelectionChangedListener;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+import org.apache.directory.studio.openldap.config.model.OlcRwmMapValue;
+import org.apache.directory.studio.openldap.config.model.OlcRwmMapValueTypeEnum;
+
+
+/**
+ * T
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class RwmMappingDialog extends Dialog
+{
+    /** The connection's attribute types */
+    private List<String> connectionAttributeTypes;
+
+    /** The connection's object classes */
+    private List<String> connectionObjectClasses;
+
+    /** The connection */
+    private IBrowserConnection browserConnection;
+
+    /** The value */
+    private OlcRwmMapValue value;
+
+    // UI widgets
+    private Button okButton;
+    private ComboViewer typeComboViewer;
+    private ComboViewer localNameComboViewer;
+    private ComboViewer foreignNameComboViewer;
+
+    // Listeners
+
+    private ModifyListener namesComboViewerListener = new ModifyListener()
+    {
+        public void modifyText( ModifyEvent e )
+        {
+            checkAndUpdateOkButtonEnableState();
+        }
+    };
+    private ISelectionChangedListener typeComboViewerSelectionListener = new ISelectionChangedListener()
+    {
+        public void selectionChanged( SelectionChangedEvent event )
+        {
+            OlcRwmMapValueTypeEnum selectedType = getSelectedType();
+
+            // Backing up the combos text
+            String localNameText = localNameComboViewer.getCombo().getText();
+            String foreignNameText = foreignNameComboViewer.getCombo().getText();
+
+            // Adding the correct suggestions to the viewers
+            if ( OlcRwmMapValueTypeEnum.ATTRIBUTE.equals( selectedType ) )
+            {
+                localNameComboViewer.setInput( connectionAttributeTypes );
+                foreignNameComboViewer.setInput( connectionAttributeTypes );
+            }
+            else if ( OlcRwmMapValueTypeEnum.OBJECTCLASS.equals( selectedType ) )
+            {
+                localNameComboViewer.setInput( connectionObjectClasses );
+                foreignNameComboViewer.setInput( connectionObjectClasses );
+            }
+
+            // Restoring the combos text
+            localNameComboViewer.getCombo().setText( localNameText );
+            foreignNameComboViewer.getCombo().setText( foreignNameText );
+        }
+    };
+
+
+    /**
+     * Creates a new instance of ValueSortingValueDialog.
+     * 
+     * @param parentShell the parent shell
+     * @param browserConnection the connection
+     * @param value the value
+     */
+    public RwmMappingDialog( Shell parentShell, IBrowserConnection browserConnection, String value )
+    {
+        super( parentShell );
+        super.setShellStyle( super.getShellStyle() | SWT.RESIZE );
+        this.browserConnection = browserConnection;
+
+        // Parsing the value
+        try
+        {
+            this.value = OlcRwmMapValue.parse( value );
+
+            if ( this.value == null )
+            {
+                this.value = new OlcRwmMapValue();
+            }
+        }
+        catch ( ParseException e )
+        {
+            this.value = new OlcRwmMapValue();
+        }
+
+        initAttributeTypesAndObjectClassesLists();
+    }
+
+
+    /**
+     * Creates a new instance of ValueSortingValueDialog.
+     * 
+     * @param parentShell the parent shell
+     * @param browserConnection the connection
+     */
+    public RwmMappingDialog( Shell parentShell, IBrowserConnection browserConnection )
+    {
+        super( parentShell );
+        super.setShellStyle( super.getShellStyle() | SWT.RESIZE );
+        this.browserConnection = browserConnection;
+
+        this.value = new OlcRwmMapValue();
+
+        initAttributeTypesAndObjectClassesLists();
+    }
+
+
+    /**
+     * Initializes the lists of attribute types and object classes.
+     */
+    private void initAttributeTypesAndObjectClassesLists()
+    {
+        connectionAttributeTypes = new ArrayList<String>();
+        connectionObjectClasses = new ArrayList<String>();
+
+        if ( browserConnection != null )
+        {
+            // Attribute Types
+            Collection<AttributeType> atds = browserConnection.getSchema().getAttributeTypeDescriptions();
+
+            for ( AttributeType atd : atds )
+            {
+                for ( String name : atd.getNames() )
+                {
+                    connectionAttributeTypes.add( name );
+                }
+            }
+
+            // Object Classes
+            Collection<ObjectClass> ocds = browserConnection.getSchema().getObjectClassDescriptions();
+
+            for ( ObjectClass ocd : ocds )
+            {
+                for ( String name : ocd.getNames() )
+                {
+                    connectionObjectClasses.add( name );
+                }
+            }
+
+            // Creating a case insensitive comparator
+            Comparator<String> ignoreCaseComparator = new Comparator<String>()
+            {
+                public int compare( String o1, String o2 )
+                {
+                    return o1.compareToIgnoreCase( o2 );
+                }
+            };
+
+            // Sorting the lists
+            Collections.sort( connectionAttributeTypes, ignoreCaseComparator );
+            Collections.sort( connectionObjectClasses, ignoreCaseComparator );
+
+            // Adding the '*' special name
+            connectionAttributeTypes.add( 0, "*" );
+            connectionObjectClasses.add( 0, "*" );
+        }
+    }
+
+
+    /**
+     * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+     */
+    protected void configureShell( Shell shell )
+    {
+        super.configureShell( shell );
+        shell.setText( "Mapping" );
+    }
+
+
+    /**
+     * @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 );
+
+        checkAndUpdateOkButtonEnableState();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void okPressed()
+    {
+        // Type
+        value.setType( getSelectedType() );
+
+        // Local Name
+        String localName = localNameComboViewer.getCombo().getText();
+
+        if ( ( localName != null ) && ( !localName.isEmpty() ) )
+        {
+            value.setLocalName( localName );
+        }
+        else
+        {
+            value.setLocalName( null );
+        }
+
+        // Foreign Name
+        String foreignName = foreignNameComboViewer.getCombo().getText();
+
+        if ( ( foreignName != null ) && ( !foreignName.isEmpty() ) )
+        {
+            value.setForeignName( foreignName );
+        }
+        else
+        {
+            value.setForeignName( null );
+        }
+
+        super.okPressed();
+    }
+
+
+    /**
+     * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+     */
+    protected Control createDialogArea( Composite parent )
+    {
+        // Creating the dialog composites
+        Composite dialogComposite = ( Composite ) super.createDialogArea( parent );
+        GridData gridData = new GridData( SWT.FILL, SWT.FILL, true, true );
+        gridData.widthHint = convertHorizontalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH );
+        //        gridData.heightHint = convertVerticalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH ) * 4 / 3;
+        dialogComposite.setLayoutData( gridData );
+        Composite composite = BaseWidgetUtils.createColumnContainer( dialogComposite, 2, 1 );
+
+        // Type
+        BaseWidgetUtils.createLabel( composite, "Type:", 1 );
+        typeComboViewer = new ComboViewer( composite );
+        typeComboViewer.getControl().setLayoutData(
+            new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        typeComboViewer.setContentProvider( new ArrayContentProvider() );
+        typeComboViewer.setLabelProvider( new LabelProvider()
+        {
+            public String getText( Object element )
+            {
+                if ( element instanceof OlcRwmMapValueTypeEnum )
+                {
+                    OlcRwmMapValueTypeEnum type = ( OlcRwmMapValueTypeEnum ) element;
+
+                    switch ( type )
+                    {
+                        case ATTRIBUTE:
+                            return "Attribute Type";
+                        case OBJECTCLASS:
+                            return "Object Class";
+                    }
+                }
+
+                return super.getText( element );
+            }
+        } );
+        typeComboViewer.setInput( new OlcRwmMapValueTypeEnum[]
+            {
+                OlcRwmMapValueTypeEnum.ATTRIBUTE,
+                OlcRwmMapValueTypeEnum.OBJECTCLASS
+        } );
+
+        // Local Name
+        BaseWidgetUtils.createLabel( composite, "Local Name:", 1 );
+        localNameComboViewer = new ComboViewer( new Combo( composite, SWT.DROP_DOWN ) );
+        localNameComboViewer.getControl()
+            .setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        localNameComboViewer.setContentProvider( new ArrayContentProvider() );
+
+        // Foreign Name
+        BaseWidgetUtils.createLabel( composite, "Foreign Name:", 1 );
+        foreignNameComboViewer = new ComboViewer( new Combo( composite, SWT.DROP_DOWN ) );
+        foreignNameComboViewer.getControl()
+            .setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        foreignNameComboViewer.setContentProvider( new ArrayContentProvider() );
+
+        initFromValue();
+
+        addListeners();
+
+        applyDialogFont( composite );
+        return composite;
+    }
+
+
+    /**
+     * Adds listeners to UI widgets.
+     */
+    private void addListeners()
+    {
+        typeComboViewer.addSelectionChangedListener( typeComboViewerSelectionListener );
+        localNameComboViewer.getCombo().addModifyListener( namesComboViewerListener );
+        foreignNameComboViewer.getCombo().addModifyListener( namesComboViewerListener );
+    }
+
+
+    /**
+     * Inits the UI from the value.
+     */
+    private void initFromValue()
+    {
+        // Type
+        OlcRwmMapValueTypeEnum type = value.getType();
+
+        if ( type != null )
+        {
+            typeComboViewer.setSelection( new StructuredSelection( type ) );
+
+            // Adding the correct suggestions to the viewers
+            if ( OlcRwmMapValueTypeEnum.ATTRIBUTE.equals( type ) )
+            {
+                localNameComboViewer.setInput( connectionAttributeTypes );
+                foreignNameComboViewer.setInput( connectionAttributeTypes );
+            }
+            else if ( OlcRwmMapValueTypeEnum.OBJECTCLASS.equals( type ) )
+            {
+                localNameComboViewer.setInput( connectionObjectClasses );
+                foreignNameComboViewer.setInput( connectionObjectClasses );
+            }
+        }
+        else
+        {
+            typeComboViewer.setSelection( new StructuredSelection( OlcRwmMapValueTypeEnum.ATTRIBUTE ) );
+
+            // Adding the suggestions to the viewers
+            localNameComboViewer.setInput( connectionAttributeTypes );
+            foreignNameComboViewer.setInput( connectionAttributeTypes );
+        }
+
+        // Local Name
+        String localName = value.getLocalName();
+
+        if ( localName != null )
+        {
+            localNameComboViewer.getCombo().setText( localName );
+        }
+        else
+        {
+            localNameComboViewer.getCombo().setText( "" );
+        }
+
+        // Local Name
+        String foreignName = value.getForeignName();
+
+        if ( foreignName != null )
+        {
+            foreignNameComboViewer.getCombo().setText( foreignName );
+        }
+        else
+        {
+            foreignNameComboViewer.getCombo().setText( "" );
+        }
+    }
+
+
+    /**
+     * Gets the selected sort method.
+     *
+     * @return the selected sort method
+     */
+    private OlcRwmMapValueTypeEnum getSelectedType()
+    {
+        StructuredSelection selection = ( StructuredSelection ) typeComboViewer.getSelection();
+
+        if ( !selection.isEmpty() )
+        {
+            return ( OlcRwmMapValueTypeEnum ) selection.getFirstElement();
+        }
+
+        return null;
+    }
+
+
+    /**
+     * Checks and updates the OK button 'enable' state.
+     */
+    private void checkAndUpdateOkButtonEnableState()
+    {
+        boolean enableOkButton = true;
+
+        do
+        {
+            // Type
+            if ( getSelectedType() == null )
+            {
+                enableOkButton = false;
+                break;
+            }
+
+            // Local Name can be omitted, so we don't check it
+
+            // Foreign Name can't be omitted
+            String foreignName = foreignNameComboViewer.getCombo().getText();
+
+            if ( ( foreignName == null ) || ( foreignName.isEmpty() ) )
+            {
+                enableOkButton = false;
+                break;
+            }
+        }
+        while ( false );
+
+        okButton.setEnabled( enableOkButton );
+    }
+
+
+    /**
+     * Gets the value.
+     *
+     * @return the value
+     */
+    public String getValue()
+    {
+        return value.toString();
+    }
+}

Added: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/ValueSortingValueDialog.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/ValueSortingValueDialog.java?rev=1670531&view=auto
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/ValueSortingValueDialog.java (added)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/ValueSortingValueDialog.java Wed Apr  1 01:01:42 2015
@@ -0,0 +1,520 @@
+/*
+ *  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.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.apache.directory.api.ldap.model.name.Dn;
+import org.apache.directory.api.ldap.model.schema.AttributeType;
+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.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.ISelectionChangedListener;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+import org.apache.directory.studio.openldap.common.ui.widgets.EntryWidget;
+import org.apache.directory.studio.openldap.config.model.OlcValSortMethodEnum;
+import org.apache.directory.studio.openldap.config.model.OlcValSortValue;
+
+
+/**
+ * The ValueSortingValueDialog is used to edit a value from the Value Sorting overlay configuration.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class ValueSortingValueDialog extends Dialog
+{
+    /** The 'weighted' combo viewer option */
+    private static final String WEIGHTED_OPTION = "Weighted";
+
+    /** The '<none>' combo viewer option */
+    private static final String NONE_OPTION = "<none>";
+
+    /** The connection's attribute types */
+    private List<String> connectionAttributeTypes;
+
+    /** The connection */
+    private IBrowserConnection browserConnection;
+
+    /** The value */
+    private OlcValSortValue value;
+
+    // UI widgets
+    private Button okButton;
+    private ComboViewer attributeComboViewer;
+    private EntryWidget baseDnEntryWidget;
+    private ComboViewer sortMethodComboViewer;
+    private ComboViewer secondarySortMethodComboViewer;
+
+    // Listeners
+
+    private ModifyListener attributeComboViewerListener = new ModifyListener()
+    {
+        public void modifyText( ModifyEvent e )
+        {
+            checkAndUpdateOkButtonEnableState();
+        }
+    };
+    private WidgetModifyListener baseDnEntryWidgetListener = new WidgetModifyListener()
+    {
+
+        public void widgetModified( WidgetModifyEvent event )
+        {
+            checkAndUpdateOkButtonEnableState();
+        }
+    };
+    private ISelectionChangedListener sortMethodComboViewerListener = new ISelectionChangedListener()
+    {
+        public void selectionChanged( SelectionChangedEvent event )
+        {
+            Object selectedSortMethod = getSelectedSortMethod();
+
+            if ( WEIGHTED_OPTION.equals( selectedSortMethod ) )
+            {
+                secondarySortMethodComboViewer.getCombo().setEnabled( true );
+            }
+            else
+            {
+                secondarySortMethodComboViewer.getCombo().setEnabled( false );
+                secondarySortMethodComboViewer.setSelection( new StructuredSelection( NONE_OPTION ) );
+            }
+        }
+    };
+
+
+    /**
+     * Creates a new instance of ValueSortingValueDialog.
+     * 
+     * @param parentShell the parent shell
+     * @param browserConnection the connection
+     * @param value the value
+     */
+    public ValueSortingValueDialog( Shell parentShell, IBrowserConnection browserConnection, String value )
+    {
+        super( parentShell );
+        super.setShellStyle( super.getShellStyle() | SWT.RESIZE );
+        this.browserConnection = browserConnection;
+
+        // Parsing the value
+        try
+        {
+            this.value = OlcValSortValue.parse( value );
+
+            if ( this.value == null )
+            {
+                this.value = new OlcValSortValue();
+            }
+        }
+        catch ( ParseException e )
+        {
+            this.value = new OlcValSortValue();
+        }
+
+        initAttributeTypesList();
+    }
+
+
+    /**
+     * Creates a new instance of ValueSortingValueDialog.
+     * 
+     * @param parentShell the parent shell
+     * @param browserConnection the connection
+     */
+    public ValueSortingValueDialog( Shell parentShell, IBrowserConnection browserConnection )
+    {
+        super( parentShell );
+        super.setShellStyle( super.getShellStyle() | SWT.RESIZE );
+        this.browserConnection = browserConnection;
+
+        this.value = new OlcValSortValue();
+
+        initAttributeTypesList();
+    }
+
+
+    /**
+     * Initializes the list of attribute types.
+     */
+    private void initAttributeTypesList()
+    {
+        connectionAttributeTypes = new ArrayList<String>();
+
+        if ( browserConnection != null )
+        {
+            // Attribute Types
+            Collection<AttributeType> atds = browserConnection.getSchema().getAttributeTypeDescriptions();
+
+            for ( AttributeType atd : atds )
+            {
+                for ( String name : atd.getNames() )
+                {
+                    connectionAttributeTypes.add( name );
+                }
+            }
+
+            // Sorting the list
+            Collections.sort( connectionAttributeTypes, new Comparator<String>()
+            {
+                public int compare( String o1, String o2 )
+                {
+                    return o1.compareToIgnoreCase( o2 );
+                }
+            } );
+        }
+    }
+
+
+    /**
+     * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+     */
+    protected void configureShell( Shell shell )
+    {
+        super.configureShell( shell );
+        shell.setText( "Value Sort" );
+    }
+
+
+    /**
+     * @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 );
+
+        checkAndUpdateOkButtonEnableState();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void okPressed()
+    {
+        // Attribute
+        value.setAttribute( attributeComboViewer.getCombo().getText() );
+
+        // Base DN
+        value.setBaseDn( baseDnEntryWidget.getDn() );
+
+        // Sort Method
+        Object selectedSortMethod = getSelectedSortMethod();
+
+        if ( WEIGHTED_OPTION.equals( selectedSortMethod ) )
+        {
+            value.setWeighted( true );
+
+            // Secondary Sort Method
+            Object selectedSecondarySortMethod = getSelectedSecondarySortMethod();
+
+            if ( NONE_OPTION.equals( selectedSecondarySortMethod ) )
+            {
+                value.setSortMethod( null );
+            }
+            else
+            {
+                value.setSortMethod( ( OlcValSortMethodEnum ) selectedSecondarySortMethod );
+            }
+        }
+        else
+        {
+            value.setSortMethod( ( OlcValSortMethodEnum ) selectedSortMethod );
+        }
+
+        super.okPressed();
+    }
+
+
+    /**
+     * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+     */
+    protected Control createDialogArea( Composite parent )
+    {
+        // Creating the dialog composites
+        Composite dialogComposite = ( Composite ) super.createDialogArea( parent );
+        GridData gridData = new GridData( SWT.FILL, SWT.FILL, true, true );
+        gridData.widthHint = convertHorizontalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH );
+        //        gridData.heightHint = convertVerticalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH ) * 4 / 3;
+        dialogComposite.setLayoutData( gridData );
+        Composite composite = BaseWidgetUtils.createColumnContainer( dialogComposite, 2, 1 );
+
+        // Attribute
+        BaseWidgetUtils.createLabel( composite, "Attribute:", 1 );
+        attributeComboViewer = new ComboViewer( new Combo( composite, SWT.DROP_DOWN ) );
+        attributeComboViewer.getControl()
+            .setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        attributeComboViewer.setContentProvider( new ArrayContentProvider() );
+        attributeComboViewer.setInput( connectionAttributeTypes );
+
+        // Base DN
+        BaseWidgetUtils.createLabel( composite, "Base DN:", 1 );
+        baseDnEntryWidget = new EntryWidget( browserConnection );
+        baseDnEntryWidget.createWidget( composite );
+        baseDnEntryWidget.getControl().setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+        // Sort Method
+        BaseWidgetUtils.createLabel( composite, "Sort Method:", 1 );
+        sortMethodComboViewer = new ComboViewer( composite );
+        sortMethodComboViewer.getControl().setLayoutData(
+            new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        sortMethodComboViewer.setContentProvider( new ArrayContentProvider() );
+        sortMethodComboViewer.setLabelProvider( new OlcValSortMethodEnumLabelProvider() );
+        sortMethodComboViewer.setInput( new Object[]
+            {
+                OlcValSortMethodEnum.ALPHA_ASCEND,
+                OlcValSortMethodEnum.ALPHA_DESCEND,
+                OlcValSortMethodEnum.NUMERIC_ASCEND,
+                OlcValSortMethodEnum.NUMERIC_DESCEND,
+                WEIGHTED_OPTION
+        } );
+
+        // Secondary Sort Method
+        BaseWidgetUtils.createLabel( composite, "Secondary Sort Method:", 1 );
+        secondarySortMethodComboViewer = new ComboViewer( composite );
+        secondarySortMethodComboViewer.getControl().setLayoutData(
+            new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        secondarySortMethodComboViewer.setContentProvider( new ArrayContentProvider() );
+        secondarySortMethodComboViewer.setLabelProvider( new OlcValSortMethodEnumLabelProvider() );
+        secondarySortMethodComboViewer.setInput( new Object[]
+            {
+                NONE_OPTION,
+                OlcValSortMethodEnum.ALPHA_ASCEND,
+                OlcValSortMethodEnum.ALPHA_DESCEND,
+                OlcValSortMethodEnum.NUMERIC_ASCEND,
+                OlcValSortMethodEnum.NUMERIC_DESCEND
+        } );
+
+        initFromValue();
+
+        addListeners();
+
+        applyDialogFont( composite );
+        return composite;
+    }
+
+
+    /**
+     * Adds listeners to UI widgets.
+     */
+    private void addListeners()
+    {
+        attributeComboViewer.getCombo().addModifyListener( attributeComboViewerListener );
+        baseDnEntryWidget.addWidgetModifyListener( baseDnEntryWidgetListener );
+        sortMethodComboViewer.addSelectionChangedListener( sortMethodComboViewerListener );
+    }
+
+
+    /**
+     * Inits the UI from the value.
+     */
+    private void initFromValue()
+    {
+        // Attribute
+        String attribute = value.getAttribute();
+
+        if ( attribute != null )
+        {
+            attributeComboViewer.getCombo().setText( attribute );
+        }
+        else
+        {
+            attributeComboViewer.getCombo().setText( "" );
+        }
+
+        // Base DN
+        Dn baseDn = value.getBaseDn();
+
+        if ( baseDn != null )
+        {
+            baseDnEntryWidget.setInput( baseDn );
+        }
+        else
+        {
+            baseDnEntryWidget.setInput( Dn.EMPTY_DN );
+        }
+
+        // Sort Method
+        if ( value.isWeighted() )
+        {
+            sortMethodComboViewer.setSelection( new StructuredSelection( WEIGHTED_OPTION ) );
+        }
+        else
+        {
+            OlcValSortMethodEnum secondarySortMethod = value.getSortMethod();
+
+            if ( secondarySortMethod != null )
+            {
+                sortMethodComboViewer.setSelection( new StructuredSelection( secondarySortMethod ) );
+            }
+            else
+            {
+                sortMethodComboViewer
+                    .setSelection( new StructuredSelection( OlcValSortMethodEnum.ALPHA_ASCEND ) );
+            }
+        }
+
+        // Secondary Sort Method
+        if ( value.isWeighted() )
+        {
+            OlcValSortMethodEnum secondarySortMethod = value.getSortMethod();
+
+            if ( secondarySortMethod != null )
+            {
+                secondarySortMethodComboViewer.setSelection( new StructuredSelection( secondarySortMethod ) );
+            }
+            else
+            {
+                secondarySortMethodComboViewer.setSelection( new StructuredSelection( NONE_OPTION ) );
+            }
+        }
+        else
+        {
+            secondarySortMethodComboViewer.setSelection( new StructuredSelection( NONE_OPTION ) );
+            secondarySortMethodComboViewer.getControl().setEnabled( false );
+        }
+    }
+
+
+    /**
+     * Gets the selected sort method.
+     *
+     * @return the selected sort method
+     */
+    private Object getSelectedSortMethod()
+    {
+        StructuredSelection selection = ( StructuredSelection ) sortMethodComboViewer.getSelection();
+
+        if ( !selection.isEmpty() )
+        {
+            return selection.getFirstElement();
+        }
+
+        return null;
+    }
+
+
+    /**
+     * Gets the selected secondary sort method.
+     *
+     * @return the selected secondary sort method
+     */
+    private Object getSelectedSecondarySortMethod()
+    {
+        StructuredSelection selection = ( StructuredSelection ) secondarySortMethodComboViewer.getSelection();
+
+        if ( !selection.isEmpty() )
+        {
+            return selection.getFirstElement();
+        }
+
+        return null;
+    }
+
+
+    /**
+     * Checks and updates the OK button 'enable' state.
+     */
+    private void checkAndUpdateOkButtonEnableState()
+    {
+        boolean enableOkButton = true;
+
+        // Attribute
+        String attribute = attributeComboViewer.getCombo().getText();
+
+        if ( ( attribute == null ) || ( attribute.isEmpty() ) )
+        {
+            enableOkButton = false;
+        }
+
+        // Base DN
+        if ( enableOkButton )
+        {
+            Dn baseDn = baseDnEntryWidget.getDn();
+
+            if ( ( baseDn == null ) || ( Dn.EMPTY_DN.equals( baseDn ) ) )
+            {
+                enableOkButton = false;
+            }
+        }
+
+        okButton.setEnabled( enableOkButton );
+    }
+
+
+    /**
+     * Gets the value.
+     *
+     * @return the value
+     */
+    public String getValue()
+    {
+        return value.toString();
+    }
+
+    /**
+     * This class implement a {@link LabelProvider} for {@link OlcValSortMethodEnum} objects.
+     */
+    private class OlcValSortMethodEnumLabelProvider extends LabelProvider
+    {
+        public String getText( Object element )
+        {
+            if ( element instanceof OlcValSortMethodEnum )
+            {
+                OlcValSortMethodEnum sortMethod = ( OlcValSortMethodEnum ) element;
+
+                switch ( sortMethod )
+                {
+                    case ALPHA_ASCEND:
+                        return "Alpha Ascendant";
+                    case ALPHA_DESCEND:
+                        return "Alpha Descendant";
+                    case NUMERIC_ASCEND:
+                        return "Numeric Ascendant";
+                    case NUMERIC_DESCEND:
+                        return "Numeric Descendant";
+                }
+            }
+
+            return super.getText( element );
+        }
+    }
+}

Added: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/overlays/AccessLogOverlayConfigurationBlock.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/overlays/AccessLogOverlayConfigurationBlock.java?rev=1670531&view=auto
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/overlays/AccessLogOverlayConfigurationBlock.java (added)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/overlays/AccessLogOverlayConfigurationBlock.java Wed Apr  1 01:01:42 2015
@@ -0,0 +1,573 @@
+/*
+ *  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.overlays;
+
+
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.directory.api.util.Strings;
+import org.apache.directory.studio.common.ui.widgets.BaseWidgetUtils;
+import org.apache.directory.studio.ldapbrowser.common.widgets.search.FilterWidget;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+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.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+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.Group;
+import org.eclipse.swt.widgets.Spinner;
+
+import org.apache.directory.studio.openldap.common.ui.dialogs.AttributeDialog;
+import org.apache.directory.studio.openldap.common.ui.widgets.EntryWidget;
+import org.apache.directory.studio.openldap.common.ui.widgets.LogOperation;
+import org.apache.directory.studio.openldap.common.ui.widgets.LogOperationsWidget;
+import org.apache.directory.studio.openldap.config.OpenLdapConfigurationPlugin;
+import org.apache.directory.studio.openldap.config.OpenLdapConfigurationPluginConstants;
+import org.apache.directory.studio.openldap.config.editor.dialogs.AbstractOverlayDialogConfigurationBlock;
+import org.apache.directory.studio.openldap.config.editor.dialogs.OverlayDialog;
+import org.apache.directory.studio.openldap.config.editor.dialogs.PurgeTimeSpan;
+import org.apache.directory.studio.openldap.config.model.OlcAccessLogConfig;
+
+
+/**
+ * This class implements a block for the configuration of the Access Log overlay.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class AccessLogOverlayConfigurationBlock extends AbstractOverlayDialogConfigurationBlock<OlcAccessLogConfig>
+{
+    /** The attributes list */
+    private List<String> attributes = new ArrayList<String>();
+
+    // UI widgets
+    private EntryWidget databaseEntryWidget;
+    private Button onlyLogSuccessfulRequestsCheckbox;
+    private LogOperationsWidget logOperationsWidget;
+    private TableViewer attributesTableViewer;
+    private Button addAttributeButton;
+    private Button deleteAttributeButton;
+    private FilterWidget filterWidget;
+    private Spinner purgeAgeDaysSpinner;
+    private Spinner purgeAgeHoursSpinner;
+    private Spinner purgeAgeMinutesSpinner;
+    private Spinner purgeAgeSecondsSpinner;
+    private Spinner purgeIntervalDaysSpinner;
+    private Spinner purgeIntervalHoursSpinner;
+    private Spinner purgeIntervalMinutesSpinner;
+    private Spinner purgeIntervalSecondsSpinner;
+
+    // Listeners
+    private ISelectionChangedListener attributesTableViewerSelectionChangedListener = new ISelectionChangedListener()
+    {
+        public void selectionChanged( SelectionChangedEvent event )
+        {
+            deleteAttributeButton.setEnabled( !attributesTableViewer.getSelection().isEmpty() );
+        }
+    };
+    private SelectionListener addAttributeButtonSelectionListener = new SelectionAdapter()
+    {
+        public void widgetSelected( SelectionEvent e )
+        {
+            AttributeDialog dialog = new AttributeDialog( addAttributeButton.getShell(), browserConnection );
+            if ( dialog.open() == AttributeDialog.OK )
+            {
+                String attribute = dialog.getAttribute();
+
+                if ( !attributes.contains( attribute ) )
+                {
+                    attributes.add( attribute );
+                    attributesTableViewer.refresh();
+                    attributesTableViewer.setSelection( new StructuredSelection( attribute ) );
+                }
+            }
+        }
+    };
+    private SelectionListener deleteAttributeButtonSelectionListener = new SelectionAdapter()
+    {
+        public void widgetSelected( SelectionEvent e )
+        {
+            StructuredSelection selection = ( StructuredSelection ) attributesTableViewer.getSelection();
+
+            if ( !selection.isEmpty() )
+            {
+                String selectedAttribute = ( String ) selection.getFirstElement();
+
+                attributes.remove( selectedAttribute );
+                attributesTableViewer.refresh();
+            }
+        }
+    };
+
+
+    /**
+     * Creates a new instance of AccessLogOverlayConfigurationBlock.
+     *
+     * @param dialog the overlay dialog
+     * @param browserConnection the browser connection
+     */
+    public AccessLogOverlayConfigurationBlock( OverlayDialog dialog, IBrowserConnection browserConnection )
+    {
+        super( dialog, browserConnection );
+        setOverlay( new OlcAccessLogConfig() );
+    }
+
+
+    /**
+     * Creates a new instance of AccessLogOverlayConfigurationBlock.
+     *
+     * @param dialog the overlay dialog
+     * @param browserConnection the browser connection
+     * @param overlay the access log overlay
+     */
+    public AccessLogOverlayConfigurationBlock( OverlayDialog dialog, IBrowserConnection browserConnection,
+        OlcAccessLogConfig overlay )
+    {
+        super( dialog, browserConnection );
+
+        if ( overlay == null )
+        {
+            overlay = new OlcAccessLogConfig();
+        }
+
+        setOverlay( overlay );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void createBlockContent( Composite parent )
+    {
+        Composite composite = BaseWidgetUtils.createColumnContainer( parent, 3, 1 );
+
+        // Database
+        BaseWidgetUtils.createLabel( composite, "Database:", 1 );
+        databaseEntryWidget = new EntryWidget( getDialog().getBrowserConnection() );
+        databaseEntryWidget.createWidget( composite );
+        databaseEntryWidget.getControl().setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+        // Successful requests
+        onlyLogSuccessfulRequestsCheckbox = BaseWidgetUtils.createCheckbox( composite, "Only log successful requests",
+            3 );
+
+        createLogOperationsGroup( composite );
+        createAttributesGroup( composite );
+        createFilterGroup( composite );
+        createPurgeGroup( composite );
+    }
+
+
+    /**
+     * Creates the log operations group.
+     *
+     * @param parent the parent composite
+     */
+    private void createLogOperationsGroup( Composite parent )
+    {
+        // Log Operations Group
+        Group logOperationsGroup = BaseWidgetUtils.createGroup( parent, "Log Operations", 3 );
+
+        // Log Operations Widget
+        logOperationsWidget = new LogOperationsWidget();
+        logOperationsWidget.create( logOperationsGroup );
+        logOperationsWidget.getControl().setLayoutData( new GridData( SWT.BEGINNING, SWT.CENTER, false, false, 2, 1 ) );
+        List<LogOperation> logOperations = new ArrayList<LogOperation>();
+        logOperations.add( LogOperation.ADD );
+        logOperations.add( LogOperation.ABANDON );
+        logOperations.add( LogOperation.SESSION );
+        logOperationsWidget.setInput( logOperations );
+    }
+
+
+    /**
+     * Creates the attributes group.
+     *
+     * @param parent the parent composite
+     */
+    private void createAttributesGroup( Composite parent )
+    {
+        // Attributes Group
+        Group attributesGroup = BaseWidgetUtils.createGroup( parent, "Attributes", 3 );
+        GridLayout attributesCompositeGridLayout = new GridLayout( 2, false );
+        attributesCompositeGridLayout.verticalSpacing = 0;
+        attributesGroup.setLayout( attributesCompositeGridLayout );
+
+        // Attributes TableViewer
+        attributesTableViewer = new TableViewer( attributesGroup );
+        GridData tableViewerGridData = new GridData( SWT.FILL, SWT.FILL, true, true, 1, 3 );
+        tableViewerGridData.heightHint = 20;
+        tableViewerGridData.widthHint = 100;
+        attributesTableViewer.getControl().setLayoutData( tableViewerGridData );
+        attributesTableViewer.setContentProvider( new ArrayContentProvider() );
+        attributesTableViewer.setLabelProvider( new LabelProvider()
+        {
+            public Image getImage( Object element )
+            {
+                return OpenLdapConfigurationPlugin.getDefault().getImage(
+                    OpenLdapConfigurationPluginConstants.IMG_ATTRIBUTE );
+            }
+        } );
+        attributesTableViewer.setInput( attributes );
+        attributesTableViewer.addSelectionChangedListener( attributesTableViewerSelectionChangedListener );
+
+        // Attribute Add Button
+        addAttributeButton = BaseWidgetUtils.createButton( attributesGroup, "Add...", 1 );
+        addAttributeButton.setLayoutData( new GridData( SWT.FILL, SWT.BEGINNING, false, false ) );
+        addAttributeButton.addSelectionListener( addAttributeButtonSelectionListener );
+
+        // Attribute Delete Button
+        deleteAttributeButton = BaseWidgetUtils.createButton( attributesGroup, "Delete", 1 );
+        deleteAttributeButton.setEnabled( false );
+        deleteAttributeButton.setLayoutData( new GridData( SWT.FILL, SWT.BEGINNING, false, false ) );
+        deleteAttributeButton.addSelectionListener( deleteAttributeButtonSelectionListener );
+    }
+
+
+    /**
+     * Creates the filter group.
+     *
+     * @param parent the parent composite
+     */
+    private void createFilterGroup( Composite parent )
+    {
+        // Filter Group
+        Group filterGroup = BaseWidgetUtils.createGroup( parent, "Filter", 3 );
+        GridLayout filterGroupGridLayout = new GridLayout( 2, false );
+        filterGroupGridLayout.marginHeight = 0;
+        filterGroupGridLayout.verticalSpacing = 0;
+        filterGroup.setLayout( filterGroupGridLayout );
+
+        filterWidget = new FilterWidget();
+        filterWidget.setFilter( "" );
+        filterWidget.setBrowserConnection( getDialog().getBrowserConnection() );
+        filterWidget.createWidget( filterGroup );
+    }
+
+
+    /**
+     * Creates the purge group.
+     *
+     * @param parent the parent composite
+     */
+    private void createPurgeGroup( Composite parent )
+    {
+        // Purge Group
+        Group purgeGroup = BaseWidgetUtils.createGroup( parent, "Log Purge", 3 );
+        GridLayout purgeCompositeGridLayout = new GridLayout( 5, false );
+        purgeCompositeGridLayout.verticalSpacing = 0;
+        purgeGroup.setLayout( purgeCompositeGridLayout );
+
+        // Age Label
+        BaseWidgetUtils.createLabel( purgeGroup, "Age:", 1 );
+
+        // Age Days Spinner
+        purgeAgeDaysSpinner = new Spinner( purgeGroup, SWT.BORDER );
+        purgeAgeDaysSpinner.setMinimum( 0 );
+        purgeAgeDaysSpinner.setMaximum( 99999 );
+
+        // Age Hours Spinner
+        purgeAgeHoursSpinner = new Spinner( purgeGroup, SWT.BORDER );
+        purgeAgeHoursSpinner.setMinimum( 0 );
+        purgeAgeHoursSpinner.setMaximum( 23 );
+
+        // Age Minutes Spinner
+        purgeAgeMinutesSpinner = new Spinner( purgeGroup, SWT.BORDER );
+        purgeAgeMinutesSpinner.setMinimum( 0 );
+        purgeAgeMinutesSpinner.setMaximum( 59 );
+
+        // Age Seconds Spinner
+        purgeAgeSecondsSpinner = new Spinner( purgeGroup, SWT.BORDER );
+        purgeAgeSecondsSpinner.setMinimum( 0 );
+        purgeAgeSecondsSpinner.setMaximum( 59 );
+
+        // Interval Label
+        BaseWidgetUtils.createLabel( purgeGroup, "Interval:", 1 );
+
+        // Interval Days Spinner
+        purgeIntervalDaysSpinner = new Spinner( purgeGroup, SWT.BORDER );
+        purgeIntervalDaysSpinner.setMinimum( 0 );
+        purgeIntervalDaysSpinner.setMaximum( 99999 );
+
+        // Interval Hours Spinner
+        purgeIntervalHoursSpinner = new Spinner( purgeGroup, SWT.BORDER );
+        purgeIntervalHoursSpinner.setMinimum( 0 );
+        purgeIntervalHoursSpinner.setMaximum( 23 );
+
+        // Interval Minutes Spinner
+        purgeIntervalMinutesSpinner = new Spinner( purgeGroup, SWT.BORDER );
+        purgeIntervalMinutesSpinner.setMinimum( 0 );
+        purgeIntervalMinutesSpinner.setMaximum( 59 );
+
+        // Interval Seconds Spinner
+        purgeIntervalSecondsSpinner = new Spinner( purgeGroup, SWT.BORDER );
+        purgeIntervalSecondsSpinner.setMinimum( 0 );
+        purgeIntervalSecondsSpinner.setMaximum( 59 );
+
+        // Days Hours Minutes Seconds Labels
+        BaseWidgetUtils.createSpacer( purgeGroup, 1 );
+        BaseWidgetUtils.createLabel( purgeGroup, "Days", 1 );
+        BaseWidgetUtils.createLabel( purgeGroup, "Hours", 1 );
+        BaseWidgetUtils.createLabel( purgeGroup, "Minutes", 1 );
+        BaseWidgetUtils.createLabel( purgeGroup, "Seconds", 1 );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void refresh()
+    {
+        if ( overlay != null )
+        {
+            // Database
+            databaseEntryWidget.setInput( overlay.getOlcAccessLogDB() );
+
+            //
+            // Only log successful requests
+            //
+            Boolean onlyLogSuccessfulRequests = overlay.getOlcAccessLogSuccess();
+
+            if ( onlyLogSuccessfulRequests != null )
+            {
+                onlyLogSuccessfulRequestsCheckbox.setSelection( onlyLogSuccessfulRequests.booleanValue() );
+            }
+            else
+            {
+                onlyLogSuccessfulRequestsCheckbox.setSelection( false );
+            }
+
+            //
+            // Log operations
+            //
+            List<String> logOperationsValues = overlay.getOlcAccessLogOps();
+
+            if ( ( logOperationsValues != null ) && ( logOperationsValues.size() > 0 ) )
+            {
+                logOperationsWidget.setInput( getAccessLogOperations( logOperationsValues ) );
+            }
+            else
+            {
+                logOperationsWidget.setInput( null );
+            }
+
+            //
+            // Attributes
+            //
+            List<String> attributeValues = overlay.getOlcAccessLogOldAttr();
+
+            if ( ( attributeValues != null ) && ( attributeValues.size() > 0 ) )
+            {
+                for ( String attribute : attributeValues )
+                {
+                    attributes.add( attribute );
+                }
+            }
+
+            attributesTableViewer.refresh();
+
+            //
+            // Filter
+            //
+            String filter = overlay.getOlcAccessLogOld();
+
+            if ( filter != null )
+            {
+                filterWidget.setFilter( filter );
+            }
+
+            //
+            // Purge
+            //
+            String accessLogPurge = overlay.getOlcAccessLogPurge();
+
+            if ( !Strings.isEmpty( accessLogPurge ) )
+            {
+                // Splitting age and interval purge time spans
+                String[] accessLogPurgeValues = accessLogPurge.split( " " );
+
+                // Checking if we got the appropriate number of members
+                if ( accessLogPurgeValues.length == 2 )
+                {
+                    try
+                    {
+                        // Purge age time span
+                        PurgeTimeSpan purgeAgeTimeSpan = new PurgeTimeSpan( accessLogPurgeValues[0] );
+                        purgeAgeDaysSpinner.setSelection( purgeAgeTimeSpan.getDays() );
+                        purgeAgeHoursSpinner.setSelection( purgeAgeTimeSpan.getHours() );
+                        purgeAgeMinutesSpinner.setSelection( purgeAgeTimeSpan.getMinutes() );
+                        purgeAgeSecondsSpinner.setSelection( purgeAgeTimeSpan.getSeconds() );
+
+                        // Purge interval time span
+                        PurgeTimeSpan purgeIntervalTimeSpan = new PurgeTimeSpan( accessLogPurgeValues[1] );
+                        purgeIntervalDaysSpinner.setSelection( purgeIntervalTimeSpan.getDays() );
+                        purgeIntervalHoursSpinner.setSelection( purgeIntervalTimeSpan.getHours() );
+                        purgeIntervalMinutesSpinner.setSelection( purgeIntervalTimeSpan.getMinutes() );
+                        purgeIntervalSecondsSpinner.setSelection( purgeIntervalTimeSpan.getSeconds() );
+                    }
+                    catch ( ParseException e )
+                    {
+                        // TODO Auto-generated catch block
+                        e.printStackTrace();
+                    }
+                }
+                else
+                {
+                    // We didn't have 2 members in the string
+                    // TODO error
+                }
+            }
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void save()
+    {
+        if ( overlay != null )
+        {
+            // Database
+            overlay.setOlcAccessLogDB( databaseEntryWidget.getDn() );
+
+            // Only log successful requests
+            overlay.setOlcAccessLogSuccess( onlyLogSuccessfulRequestsCheckbox.getSelection() );
+
+            // Log operations
+            overlay.setOlcAccessLogOps( getAccessLogOperationsValues() );
+
+            // Attributes
+            overlay.setOlcAccessLogOldAttr( attributes );
+
+            // Filter
+            overlay.setOlcAccessLogOld( filterWidget.getFilter() );
+
+            // Purge
+            overlay.setOlcAccessLogPurge( getPurgeValue() );
+        }
+
+        // Saving dialog settings
+        databaseEntryWidget.saveDialogSettings();
+        filterWidget.saveDialogSettings();
+    }
+
+
+    /**
+     * Gets the access log operations values.
+     *
+     * @return the access log operations values
+     */
+    private List<String> getAccessLogOperationsValues()
+    {
+        List<String> accessLogOperations = new ArrayList<String>();
+        List<LogOperation> logOperations = logOperationsWidget.getSelectedOperationsList();
+
+        for ( LogOperation logOperation : logOperations )
+        {
+            // Converting log operation to string
+            accessLogOperations.add( logOperation.toString() );
+        }
+
+        return accessLogOperations;
+    }
+
+
+    /**
+     * Gets the access log operations.
+     *
+     * @return the access log operations
+     */
+    private List<LogOperation> getAccessLogOperations( List<String> logOperationsValues )
+    {
+        List<LogOperation> logOperations = new ArrayList<LogOperation>();
+
+        for ( String logOperationValue : logOperationsValues )
+        {
+            // Converting log operation from a string
+            LogOperation logOperation = LogOperation.fromString( logOperationValue );
+
+            if ( logOperation != null )
+            {
+                logOperations.add( logOperation );
+            }
+        }
+
+        return logOperations;
+    }
+
+
+    /**
+     * Gets the purge value.
+     *
+     * @return the purge value
+     */
+    private String getPurgeValue()
+    {
+        return getPurgeAgeTimeSpan().toString() + " " + getPurgeIntervalTimeSpan().toString();
+    }
+
+
+    /**
+     * Gets the purge age time span.
+     *
+     * @return the purge age time span
+     */
+    private PurgeTimeSpan getPurgeAgeTimeSpan()
+    {
+        PurgeTimeSpan purgeAgeTimeSpan = new PurgeTimeSpan();
+
+        purgeAgeTimeSpan.setDays( purgeAgeDaysSpinner.getSelection() );
+        purgeAgeTimeSpan.setHours( purgeAgeHoursSpinner.getSelection() );
+        purgeAgeTimeSpan.setMinutes( purgeAgeMinutesSpinner.getSelection() );
+        purgeAgeTimeSpan.setSeconds( purgeAgeSecondsSpinner.getSelection() );
+
+        return purgeAgeTimeSpan;
+    }
+
+
+    /**
+     * Gets the purge interval time span.
+     *
+     * @return the purge interval time span
+     */
+    private PurgeTimeSpan getPurgeIntervalTimeSpan()
+    {
+        PurgeTimeSpan purgeInternalTimeSpan = new PurgeTimeSpan();
+
+        purgeInternalTimeSpan.setDays( purgeIntervalDaysSpinner.getSelection() );
+        purgeInternalTimeSpan.setHours( purgeIntervalHoursSpinner.getSelection() );
+        purgeInternalTimeSpan.setMinutes( purgeIntervalMinutesSpinner.getSelection() );
+        purgeInternalTimeSpan.setSeconds( purgeIntervalSecondsSpinner.getSelection() );
+
+        return purgeInternalTimeSpan;
+    }
+}

Added: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/overlays/AuditLogOverlayConfigurationBlock.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/overlays/AuditLogOverlayConfigurationBlock.java?rev=1670531&view=auto
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/overlays/AuditLogOverlayConfigurationBlock.java (added)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/overlays/AuditLogOverlayConfigurationBlock.java Wed Apr  1 01:01:42 2015
@@ -0,0 +1,114 @@
+/*
+ *  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.overlays;
+
+
+import java.util.List;
+
+import org.apache.directory.api.util.Strings;
+import org.apache.directory.studio.common.ui.widgets.BaseWidgetUtils;
+import org.eclipse.swt.widgets.Composite;
+
+import org.apache.directory.studio.openldap.common.ui.widgets.FileBrowserWidget;
+import org.apache.directory.studio.openldap.config.editor.dialogs.AbstractOverlayDialogConfigurationBlock;
+import org.apache.directory.studio.openldap.config.editor.dialogs.OverlayDialog;
+import org.apache.directory.studio.openldap.config.model.OlcAuditlogConfig;
+
+
+/**
+ * This class implements a block for the configuration of the Audit Log overlay.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class AuditLogOverlayConfigurationBlock extends AbstractOverlayDialogConfigurationBlock<OlcAuditlogConfig>
+{
+    // UI widgets
+    private FileBrowserWidget fileBrowserWidget;
+
+
+    public AuditLogOverlayConfigurationBlock( OverlayDialog dialog )
+    {
+        super( dialog );
+        setOverlay( new OlcAuditlogConfig() );
+    }
+
+
+    public AuditLogOverlayConfigurationBlock( OverlayDialog dialog, OlcAuditlogConfig overlay )
+    {
+        super( dialog );
+        if ( overlay == null )
+        {
+            overlay = new OlcAuditlogConfig();
+        }
+
+        setOverlay( overlay );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void createBlockContent( Composite parent )
+    {
+        Composite composite = BaseWidgetUtils.createColumnContainer( parent, 3, 1 );
+
+        BaseWidgetUtils.createLabel( composite, "Log File:", 1 );
+
+        fileBrowserWidget = new FileBrowserWidget( "", new String[]
+            { ".ldif", ".log" }, FileBrowserWidget.TYPE_OPEN );
+        fileBrowserWidget.createWidget( composite );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void refresh()
+    {
+        if ( overlay != null )
+        {
+            List<String> auditLogFilesList = overlay.getOlcAuditlogFile();
+
+            if ( auditLogFilesList != null && auditLogFilesList.size() > 0 )
+            {
+                fileBrowserWidget.setFilename( auditLogFilesList.get( 0 ) );
+            }
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void save()
+    {
+        if ( overlay != null )
+        {
+            overlay.clearOlcAuditlogFile();
+
+            String filename = fileBrowserWidget.getFilename();
+
+            if ( !Strings.isEmpty( filename ) )
+            {
+                overlay.addOlcAuditlogFile( filename );
+            }
+        }
+    }
+}



Mime
View raw message