You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2015/04/01 03:01:43 UTC
svn commit: r1670531 [9/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...
Added: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/overlays/MemberOfOverlayConfigurationBlock.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/MemberOfOverlayConfigurationBlock.java?rev=1670531&view=auto
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/overlays/MemberOfOverlayConfigurationBlock.java (added)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/overlays/MemberOfOverlayConfigurationBlock.java Wed Apr 1 01:01:42 2015
@@ -0,0 +1,607 @@
+/*
+ * 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.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.apache.directory.api.ldap.model.message.ResultCodeEnum;
+import org.apache.directory.api.ldap.model.name.Dn;
+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.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ComboViewer;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+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.apache.directory.studio.openldap.common.ui.widgets.EntryWidget;
+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.OlcMemberOf;
+import org.apache.directory.studio.openldap.config.model.OlcMemberOfDanglingReferenceBehaviorEnum;
+
+
+/**
+ * This class implements a block for the configuration of the Member Of overlay.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class MemberOfOverlayConfigurationBlock extends AbstractOverlayDialogConfigurationBlock<OlcMemberOf>
+{
+ /** The connection's attribute types */
+ private List<String> connectionAttributeTypes;
+
+ /** The connection's objectClasses */
+ private List<String> connectionObjectClasses;
+
+ /** The list of result codes */
+ private List<ResultCodeEnum> resultCodes;
+
+ // UI widgets
+ private ComboViewer groupObjectClassComboViewer;
+ private ComboViewer groupAttributeTypeComboViewer;
+ private ComboViewer entryAttributeTypeComboViewer;
+ private EntryWidget modifierNameEntryWidget;
+ private ComboViewer danglingReferenceBehaviorComboViewer;
+ private ComboViewer danglingReferenceErrorCodeComboViewer;
+ private Button maintianReferentialIntegrityCheckbox;
+
+
+ /**
+ * Creates a new instance of MemberOfOverlayConfigurationBlock.
+ *
+ * @param dialog the dialog
+ * @param browserConnection the connection
+ */
+ public MemberOfOverlayConfigurationBlock( OverlayDialog dialog, IBrowserConnection browserConnection )
+ {
+ super( dialog, browserConnection );
+ setOverlay( new OlcMemberOf() );
+
+ init();
+ }
+
+
+ /**
+ * Creates a new instance of MemberOfOverlayConfigurationBlock.
+ *
+ * @param dialog the dialog
+ * @param browserConnection the connection
+ * @param overlay the overlay
+ */
+ public MemberOfOverlayConfigurationBlock( OverlayDialog dialog, IBrowserConnection browserConnection,
+ OlcMemberOf overlay )
+ {
+ super( dialog, browserConnection );
+
+ if ( overlay == null )
+ {
+ overlay = new OlcMemberOf();
+ }
+
+ setOverlay( overlay );
+
+ init();
+ }
+
+
+ /**
+ * Initializes the list of attribute types and object class.
+ */
+ private void init()
+ {
+ initAttributeTypesAndObjectClassesLists();
+ initResultCodesList();
+ }
+
+
+ /**
+ * 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 );
+ }
+ }
+
+
+ /**
+ * Initializes the list of result codes.
+ */
+ private void initResultCodesList()
+ {
+ // Initializing the list
+ resultCodes = new ArrayList<ResultCodeEnum>();
+
+ // Adding all result codes to the list
+ resultCodes.add( ResultCodeEnum.SUCCESS );
+ resultCodes.add( ResultCodeEnum.PARTIAL_RESULTS );
+ resultCodes.add( ResultCodeEnum.COMPARE_FALSE );
+ resultCodes.add( ResultCodeEnum.COMPARE_TRUE );
+ resultCodes.add( ResultCodeEnum.REFERRAL );
+ resultCodes.add( ResultCodeEnum.SASL_BIND_IN_PROGRESS );
+ resultCodes.add( ResultCodeEnum.AUTH_METHOD_NOT_SUPPORTED );
+ resultCodes.add( ResultCodeEnum.STRONG_AUTH_REQUIRED );
+ resultCodes.add( ResultCodeEnum.CONFIDENTIALITY_REQUIRED );
+ resultCodes.add( ResultCodeEnum.ALIAS_DEREFERENCING_PROBLEM );
+ resultCodes.add( ResultCodeEnum.INAPPROPRIATE_AUTHENTICATION );
+ resultCodes.add( ResultCodeEnum.INVALID_CREDENTIALS );
+ resultCodes.add( ResultCodeEnum.INSUFFICIENT_ACCESS_RIGHTS );
+ resultCodes.add( ResultCodeEnum.OPERATIONS_ERROR );
+ resultCodes.add( ResultCodeEnum.PROTOCOL_ERROR );
+ resultCodes.add( ResultCodeEnum.TIME_LIMIT_EXCEEDED );
+ resultCodes.add( ResultCodeEnum.SIZE_LIMIT_EXCEEDED );
+ resultCodes.add( ResultCodeEnum.ADMIN_LIMIT_EXCEEDED );
+ resultCodes.add( ResultCodeEnum.UNAVAILABLE_CRITICAL_EXTENSION );
+ resultCodes.add( ResultCodeEnum.BUSY );
+ resultCodes.add( ResultCodeEnum.UNAVAILABLE );
+ resultCodes.add( ResultCodeEnum.UNWILLING_TO_PERFORM );
+ resultCodes.add( ResultCodeEnum.LOOP_DETECT );
+ resultCodes.add( ResultCodeEnum.NO_SUCH_ATTRIBUTE );
+ resultCodes.add( ResultCodeEnum.UNDEFINED_ATTRIBUTE_TYPE );
+ resultCodes.add( ResultCodeEnum.INAPPROPRIATE_MATCHING );
+ resultCodes.add( ResultCodeEnum.CONSTRAINT_VIOLATION );
+ resultCodes.add( ResultCodeEnum.ATTRIBUTE_OR_VALUE_EXISTS );
+ resultCodes.add( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
+ resultCodes.add( ResultCodeEnum.NO_SUCH_OBJECT );
+ resultCodes.add( ResultCodeEnum.ALIAS_PROBLEM );
+ resultCodes.add( ResultCodeEnum.INVALID_DN_SYNTAX );
+ resultCodes.add( ResultCodeEnum.NAMING_VIOLATION );
+ resultCodes.add( ResultCodeEnum.OBJECT_CLASS_VIOLATION );
+ resultCodes.add( ResultCodeEnum.NOT_ALLOWED_ON_NON_LEAF );
+ resultCodes.add( ResultCodeEnum.NOT_ALLOWED_ON_RDN );
+ resultCodes.add( ResultCodeEnum.ENTRY_ALREADY_EXISTS );
+ resultCodes.add( ResultCodeEnum.OBJECT_CLASS_MODS_PROHIBITED );
+ resultCodes.add( ResultCodeEnum.AFFECTS_MULTIPLE_DSAS );
+ resultCodes.add( ResultCodeEnum.OTHER );
+ resultCodes.add( ResultCodeEnum.CANCELED );
+ resultCodes.add( ResultCodeEnum.NO_SUCH_OPERATION );
+ resultCodes.add( ResultCodeEnum.TOO_LATE );
+ resultCodes.add( ResultCodeEnum.CANNOT_CANCEL );
+ resultCodes.add( ResultCodeEnum.UNKNOWN );
+
+ // Sorting the list
+ Collections.sort( resultCodes, new Comparator<ResultCodeEnum>()
+ {
+ public int compare( ResultCodeEnum o1, ResultCodeEnum o2 )
+ {
+ return Integer.compare( o1.getResultCode(), o2.getResultCode() );
+ }
+ } );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void createBlockContent( Composite parent )
+ {
+ Composite composite = BaseWidgetUtils.createColumnContainer( parent, 2, 1 );
+
+ // Group Object Class
+ BaseWidgetUtils.createLabel( composite, "Group Object Class:", 1 );
+ groupObjectClassComboViewer = new ComboViewer( new Combo( composite, SWT.DROP_DOWN ) );
+ groupObjectClassComboViewer.getControl().setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+ groupObjectClassComboViewer.setContentProvider( new ArrayContentProvider() );
+ groupObjectClassComboViewer.setInput( connectionObjectClasses );
+
+ // Group Attribute Type
+ BaseWidgetUtils.createLabel( composite, "Group Attribute Type:", 1 );
+ groupAttributeTypeComboViewer = new ComboViewer( new Combo( composite, SWT.DROP_DOWN ) );
+ groupAttributeTypeComboViewer.getControl()
+ .setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+ groupAttributeTypeComboViewer.setContentProvider( new ArrayContentProvider() );
+ groupAttributeTypeComboViewer.setInput( connectionAttributeTypes );
+
+ // Entry Attribute Type
+ BaseWidgetUtils.createLabel( composite, "Entry Attribute Type:", 1 );
+ entryAttributeTypeComboViewer = new ComboViewer( new Combo( composite, SWT.DROP_DOWN ) );
+ entryAttributeTypeComboViewer.getControl()
+ .setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+ entryAttributeTypeComboViewer.setContentProvider( new ArrayContentProvider() );
+ entryAttributeTypeComboViewer.setInput( connectionAttributeTypes );
+
+ // Modifier Name
+ BaseWidgetUtils.createLabel( composite, "Modifier's Name:", 1 );
+ modifierNameEntryWidget = new EntryWidget( browserConnection );
+ modifierNameEntryWidget.createWidget( composite );
+ modifierNameEntryWidget.getControl().setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+ // Dangling Reference Behavior
+ BaseWidgetUtils.createLabel( composite, "Dangling Ref. Behavior:", 1 );
+ danglingReferenceBehaviorComboViewer = new ComboViewer( composite );
+ danglingReferenceBehaviorComboViewer.getControl().setLayoutData(
+ new GridData( SWT.FILL, SWT.NONE, true, false ) );
+ danglingReferenceBehaviorComboViewer.setContentProvider( new ArrayContentProvider() );
+ danglingReferenceBehaviorComboViewer.setLabelProvider( new LabelProvider()
+ {
+ public String getText( Object element )
+ {
+ if ( element instanceof OlcMemberOfDanglingReferenceBehaviorEnum )
+ {
+ OlcMemberOfDanglingReferenceBehaviorEnum behavior = ( OlcMemberOfDanglingReferenceBehaviorEnum ) element;
+
+ switch ( behavior )
+ {
+ case IGNORE:
+ return "Ignore";
+ case DROP:
+ return "Drop";
+ case ERROR:
+ return "Error";
+ }
+ }
+
+ return super.getText( element );
+ };
+ } );
+ danglingReferenceBehaviorComboViewer.setInput( new OlcMemberOfDanglingReferenceBehaviorEnum[]
+ {
+ OlcMemberOfDanglingReferenceBehaviorEnum.IGNORE,
+ OlcMemberOfDanglingReferenceBehaviorEnum.DROP,
+ OlcMemberOfDanglingReferenceBehaviorEnum.ERROR
+ } );
+
+ // Dangling Reference Error Code
+ BaseWidgetUtils.createLabel( composite, "Dangling Ref. Error Code:", 1 );
+ danglingReferenceErrorCodeComboViewer = new ComboViewer( composite );
+ danglingReferenceErrorCodeComboViewer.getControl().setLayoutData(
+ new GridData( SWT.FILL, SWT.NONE, true, false ) );
+ danglingReferenceErrorCodeComboViewer.setContentProvider( new ArrayContentProvider() );
+ danglingReferenceErrorCodeComboViewer.setLabelProvider( new LabelProvider()
+ {
+ public String getText( Object element )
+ {
+ if ( element instanceof ResultCodeEnum )
+ {
+ ResultCodeEnum resultCode = ( ResultCodeEnum ) element;
+
+ return NLS.bind( "{0} ({1})", new Object[]
+ { resultCode.getResultCode(), resultCode.getMessage() } );
+ }
+
+ return super.getText( element );
+ };
+ } );
+ danglingReferenceErrorCodeComboViewer.setInput( resultCodes );
+
+ // Maintain Referential Integrity
+ maintianReferentialIntegrityCheckbox = BaseWidgetUtils.createCheckbox( composite,
+ "Maintain Referential Integrity", 2 );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void refresh()
+ {
+ if ( overlay != null )
+ {
+ // Group Object Class
+ setComboViewerText( groupObjectClassComboViewer, overlay.getOlcMemberOfGroupOC() );
+
+ // Group Attribute Type
+ setComboViewerText( groupAttributeTypeComboViewer, overlay.getOlcMemberOfMemberAD() );
+
+ // Entry Attribute Type
+ setComboViewerText( entryAttributeTypeComboViewer, overlay.getOlcMemberOfMemberOfAD() );
+
+ // Modifier Name
+ Dn modifierName = overlay.getOlcMemberOfDN();
+
+ if ( modifierName != null )
+ {
+ modifierNameEntryWidget.setInput( modifierName );
+ }
+ else
+ {
+ modifierNameEntryWidget.setInput( Dn.EMPTY_DN );
+ }
+
+ // Dangling Reference Behavior
+ String danglingReferenceBehaviorString = overlay.getOlcMemberOfDangling();
+
+ if ( danglingReferenceBehaviorString != null )
+ {
+ OlcMemberOfDanglingReferenceBehaviorEnum danglingReferenceBehavior = OlcMemberOfDanglingReferenceBehaviorEnum
+ .fromString( danglingReferenceBehaviorString );
+
+ if ( danglingReferenceBehavior != null )
+ {
+ danglingReferenceBehaviorComboViewer.setSelection( new StructuredSelection(
+ danglingReferenceBehavior ) );
+ }
+ else
+ {
+ danglingReferenceBehaviorComboViewer.setSelection( new StructuredSelection(
+ OlcMemberOfDanglingReferenceBehaviorEnum.IGNORE ) );
+ }
+ }
+ else
+ {
+ danglingReferenceBehaviorComboViewer.setSelection( new StructuredSelection(
+ OlcMemberOfDanglingReferenceBehaviorEnum.IGNORE ) );
+ }
+
+ // Dangling Reference Error Code
+ String danglingReferenceErrorCode = overlay.getOlcMemberOfDanglingError();
+
+ if ( danglingReferenceErrorCode != null )
+ {
+ try
+ {
+ // Getting the error code as a ResultCodeEnum value
+ ResultCodeEnum resultCode = ResultCodeEnum.getResultCode( Integer
+ .parseInt( danglingReferenceErrorCode ) );
+
+ danglingReferenceErrorCodeComboViewer.setSelection( new StructuredSelection( resultCode ) );
+
+ }
+ catch ( NumberFormatException e )
+ {
+ // The error code is not an int value
+ danglingReferenceErrorCodeComboViewer.setSelection( new StructuredSelection(
+ ResultCodeEnum.CONSTRAINT_VIOLATION ) );
+ }
+ }
+ else
+ {
+ danglingReferenceErrorCodeComboViewer.setSelection( new StructuredSelection(
+ ResultCodeEnum.CONSTRAINT_VIOLATION ) );
+ }
+
+ // Maintain Referential Integrity
+ Boolean maintainReferentialIntegrity = overlay.getOlcMemberOfRefInt();
+
+ if ( maintainReferentialIntegrity != null )
+ {
+ maintianReferentialIntegrityCheckbox.setSelection( maintainReferentialIntegrity );
+ }
+ else
+ {
+ maintianReferentialIntegrityCheckbox.setSelection( false );
+ }
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void save()
+ {
+ if ( overlay != null )
+ {
+ // Group Object Class
+ String groupObjectClass = getComboViewerText( groupObjectClassComboViewer );
+
+ if ( ( groupObjectClass != null ) && ( !groupObjectClass.isEmpty() ) )
+ {
+ overlay.setOlcMemberOfGroupOC( groupObjectClass );
+ }
+ else
+ {
+ overlay.setOlcMemberOfGroupOC( null );
+ }
+
+ // Group Attribute Type
+ String groupAttributeType = getComboViewerText( groupAttributeTypeComboViewer );
+
+ if ( ( groupAttributeType != null ) && ( !groupAttributeType.isEmpty() ) )
+ {
+ overlay.setOlcMemberOfMemberAD( groupAttributeType );
+ }
+ else
+ {
+ overlay.setOlcMemberOfMemberAD( null );
+ }
+
+ // Entry Attribute Type
+ String entryAttributeType = getComboViewerText( entryAttributeTypeComboViewer );
+
+ if ( ( entryAttributeType != null ) && ( !entryAttributeType.isEmpty() ) )
+ {
+ overlay.setOlcMemberOfMemberOfAD( entryAttributeType );
+ }
+ else
+ {
+ overlay.setOlcMemberOfMemberOfAD( null );
+ }
+
+ // Modifier Name
+ Dn modifierName = modifierNameEntryWidget.getDn();
+
+ if ( ( modifierName != null ) && ( !Dn.EMPTY_DN.equals( modifierName ) ) )
+ {
+ overlay.setOlcMemberOfDN( modifierName );
+ }
+ else
+ {
+ overlay.setOlcMemberOfDN( null );
+ }
+
+ // Dangling Reference Behavior
+ OlcMemberOfDanglingReferenceBehaviorEnum danglingReferenceBehavior = getSelectedDanglingReferenceBehavior();
+
+ if ( danglingReferenceBehavior != null )
+ {
+ overlay.setOlcMemberOfDangling( danglingReferenceBehavior.toString() );
+ }
+ else
+ {
+
+ overlay.setOlcMemberOfDangling( null );
+ }
+
+ // Dangling Reference Error Code
+ ResultCodeEnum danglingReferenceErrorCode = getSelectedDanglingReferenceErrorCode();
+
+ if ( ( danglingReferenceErrorCode != null )
+ && ( !ResultCodeEnum.CONSTRAINT_VIOLATION.equals( danglingReferenceErrorCode ) ) )
+ {
+ overlay.setOlcMemberOfDanglingError( danglingReferenceErrorCode.getResultCode() + "" );
+ }
+ else
+ {
+ overlay.setOlcMemberOfDanglingError( null );
+ }
+
+ // Maintain Referential Integrity
+ overlay.setOlcMemberOfRefInt( maintianReferentialIntegrityCheckbox.getSelection() );
+
+ }
+ }
+
+
+ /**
+ * Gets the text selection of the combo viewer.
+ *
+ * @param viewer the viewer
+ * @return the text selection of the viewer
+ */
+ private String getComboViewerText( ComboViewer viewer )
+ {
+ return viewer.getCombo().getText();
+ }
+
+
+ /**
+ * Sets the text selection of the combo viewer.
+ *
+ * @param viewer the viewer
+ * @param text the text
+ */
+ private void setComboViewerText( ComboViewer viewer, String text )
+ {
+ if ( text != null )
+ {
+ viewer.getCombo().setText( text );
+ }
+ else
+ {
+ viewer.getCombo().setText( "" );
+ }
+ }
+
+
+ /**
+ * Gets the selected dangling reference behavior.
+ *
+ * @return the selected dangling reference behavior
+ */
+ private OlcMemberOfDanglingReferenceBehaviorEnum getSelectedDanglingReferenceBehavior()
+ {
+ StructuredSelection selection = ( StructuredSelection ) danglingReferenceBehaviorComboViewer.getSelection();
+
+ if ( ( selection != null ) && ( !selection.isEmpty() ) )
+ {
+ Object firstElement = selection.getFirstElement();
+
+ if ( firstElement instanceof OlcMemberOfDanglingReferenceBehaviorEnum )
+ {
+ return ( OlcMemberOfDanglingReferenceBehaviorEnum ) firstElement;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ return null;
+ }
+
+
+ /**
+ * Gets the selected dangling reference error code.
+ *
+ * @return the selected dangling reference error code
+ */
+ private ResultCodeEnum getSelectedDanglingReferenceErrorCode()
+ {
+ StructuredSelection selection = ( StructuredSelection ) danglingReferenceErrorCodeComboViewer.getSelection();
+
+ if ( ( selection != null ) && ( !selection.isEmpty() ) )
+ {
+ Object firstElement = selection.getFirstElement();
+
+ if ( firstElement instanceof ResultCodeEnum )
+ {
+ return ( ResultCodeEnum ) firstElement;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ return null;
+ }
+}
Added: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/overlays/PasswordPolicyOverlayConfigurationBlock.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/PasswordPolicyOverlayConfigurationBlock.java?rev=1670531&view=auto
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/overlays/PasswordPolicyOverlayConfigurationBlock.java (added)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/overlays/PasswordPolicyOverlayConfigurationBlock.java Wed Apr 1 01:01:42 2015
@@ -0,0 +1,168 @@
+/*
+ * 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 org.apache.directory.api.ldap.model.name.Dn;
+import org.apache.directory.studio.common.ui.widgets.BaseWidgetUtils;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+
+import org.apache.directory.studio.openldap.common.ui.widgets.EntryWidget;
+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.OlcPPolicyConfig;
+
+
+/**
+ * This class implements a block for the configuration of the Password Policy Log overlay.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class PasswordPolicyOverlayConfigurationBlock extends AbstractOverlayDialogConfigurationBlock<OlcPPolicyConfig>
+{
+ // UI widgets
+ private EntryWidget defaultPolicyEntryWidget;
+ private Button forwardUpdatesCheckbox;
+ private Button hashCleartextCheckbox;
+ private Button useLockoutCheckbox;
+
+
+ public PasswordPolicyOverlayConfigurationBlock( OverlayDialog dialog )
+ {
+ super( dialog );
+ setOverlay( new OlcPPolicyConfig() );
+ }
+
+
+ public PasswordPolicyOverlayConfigurationBlock( OverlayDialog dialog, IBrowserConnection browserConnection,
+ OlcPPolicyConfig overlay )
+ {
+ super( dialog, browserConnection );
+
+ if ( overlay == null )
+ {
+ overlay = new OlcPPolicyConfig();
+ }
+
+ setOverlay( overlay );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void createBlockContent( Composite parent )
+ {
+ Composite composite = BaseWidgetUtils.createColumnContainer( parent, 3, 1 );
+
+ // Default Policy
+ BaseWidgetUtils.createLabel( composite, "Default Policy:", 1 );
+ defaultPolicyEntryWidget = new EntryWidget( browserConnection, Dn.EMPTY_DN );
+ defaultPolicyEntryWidget.createWidget( composite );
+ defaultPolicyEntryWidget.getControl().setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false ) );
+
+ // Forward Updates
+ forwardUpdatesCheckbox = BaseWidgetUtils.createCheckbox( composite, "Forward Updates", 3 );
+
+ // Hash Cleartext
+ hashCleartextCheckbox = BaseWidgetUtils.createCheckbox( composite, "Hash Cleartext", 3 );
+
+ // Use Lockout
+ useLockoutCheckbox = BaseWidgetUtils.createCheckbox( composite, "Use Lockout", 3 );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void refresh()
+ {
+ if ( overlay != null )
+ {
+ // Default Policy
+ defaultPolicyEntryWidget.setInput( overlay.getOlcPPolicyDefault() );
+
+ // Forward Updates
+ Boolean forwardUpdates = overlay.getOlcPPolicyForwardUpdates();
+
+ if ( forwardUpdates != null )
+ {
+ forwardUpdatesCheckbox.setSelection( forwardUpdates.booleanValue() );
+ }
+ else
+ {
+ forwardUpdatesCheckbox.setSelection( false );
+ }
+
+ // Hash Cleartext
+ Boolean hashCleartext = overlay.getOlcPPolicyHashCleartext();
+
+ if ( hashCleartext != null )
+ {
+ hashCleartextCheckbox.setSelection( hashCleartext.booleanValue() );
+ }
+ else
+ {
+ hashCleartextCheckbox.setSelection( false );
+ }
+
+ // Use Lockout
+ Boolean useLockout = overlay.getOlcPPolicyUseLockout();
+
+ if ( useLockout != null )
+ {
+ useLockoutCheckbox.setSelection( useLockout.booleanValue() );
+ }
+ else
+ {
+ useLockoutCheckbox.setSelection( false );
+ }
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void save()
+ {
+ if ( overlay != null )
+ {
+ // Default Policy
+ overlay.setOlcPPolicyDefault( defaultPolicyEntryWidget.getDn() );
+
+ // Forward Updates
+ overlay.setOlcPPolicyForwardUpdates( forwardUpdatesCheckbox.getSelection() );
+
+ // Hash Cleartext
+ overlay.setOlcPPolicyHashCleartext( hashCleartextCheckbox.getSelection() );
+
+ // Use Lockout
+ overlay.setOlcPPolicyUseLockout( useLockoutCheckbox.getSelection() );
+ }
+
+ // Saving dialog settings
+ defaultPolicyEntryWidget.saveDialogSettings();
+ }
+}
Added: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/overlays/ReferentialIntegrityOverlayConfigurationBlock.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/ReferentialIntegrityOverlayConfigurationBlock.java?rev=1670531&view=auto
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/overlays/ReferentialIntegrityOverlayConfigurationBlock.java (added)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/overlays/ReferentialIntegrityOverlayConfigurationBlock.java Wed Apr 1 01:01:42 2015
@@ -0,0 +1,282 @@
+/*
+ * 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.ArrayList;
+import java.util.List;
+
+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.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.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+
+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.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.model.OlcRefintConfig;
+
+
+/**
+ * This class implements a block for the configuration of the Referential Integrity overlay.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class ReferentialIntegrityOverlayConfigurationBlock extends
+ AbstractOverlayDialogConfigurationBlock<OlcRefintConfig>
+{
+ /** The default modifier name */
+ private static final String DEFAULT_MODIFIER_NAME = "cn=Referential Integrity Overlay";
+
+ /** The attributes list */
+ private List<String> attributes = new ArrayList<String>();
+
+ // UI widgets
+ private TableViewer attributesTableViewer;
+ private Button addAttributeButton;
+ private Button deleteAttributeButton;
+ private EntryWidget placeholderValueEntryWidget;
+ private EntryWidget modifierNameEntryWidget;
+
+ // 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();
+ }
+ }
+ };
+
+
+ public ReferentialIntegrityOverlayConfigurationBlock( OverlayDialog dialog, IBrowserConnection connection )
+ {
+ super( dialog, connection );
+ setOverlay( new OlcRefintConfig() );
+ }
+
+
+ public ReferentialIntegrityOverlayConfigurationBlock( OverlayDialog dialog, IBrowserConnection connection,
+ OlcRefintConfig overlay )
+ {
+ super( dialog, connection );
+ if ( overlay == null )
+ {
+ overlay = new OlcRefintConfig();
+ }
+
+ setOverlay( overlay );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void createBlockContent( Composite parent )
+ {
+ Composite composite = BaseWidgetUtils.createColumnContainer( parent, 2, 1 );
+
+ // Attributes
+ BaseWidgetUtils.createLabel( composite, "Attributes:", 1 );
+ Composite attributesComposite = BaseWidgetUtils.createColumnContainer( composite, 2, 1 );
+
+ // Attributes TableViewer
+ attributesTableViewer = new TableViewer( attributesComposite );
+ 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( attributesComposite, "Add...", 1 );
+ addAttributeButton.setLayoutData( new GridData( SWT.FILL, SWT.BEGINNING, false, false ) );
+ addAttributeButton.addSelectionListener( addAttributeButtonSelectionListener );
+
+ // Attribute Delete Button
+ deleteAttributeButton = BaseWidgetUtils.createButton( attributesComposite, "Delete", 1 );
+ deleteAttributeButton.setEnabled( false );
+ deleteAttributeButton.setLayoutData( new GridData( SWT.FILL, SWT.BEGINNING, false, false ) );
+ deleteAttributeButton.addSelectionListener( deleteAttributeButtonSelectionListener );
+
+ // Placeholder Value
+ BaseWidgetUtils.createLabel( composite, "Placeholder Value:", 1 );
+ placeholderValueEntryWidget = new EntryWidget( getDialog().getBrowserConnection() );
+ placeholderValueEntryWidget.createWidget( composite );
+ placeholderValueEntryWidget.getControl().setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+ // Modifier Name
+ BaseWidgetUtils.createLabel( composite, "Modifier's Name:", 1 );
+ modifierNameEntryWidget = new EntryWidget( getDialog().getBrowserConnection() );
+ modifierNameEntryWidget.createWidget( composite );
+ modifierNameEntryWidget.getControl().setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void refresh()
+ {
+ if ( overlay != null )
+ {
+ // Attributes
+ List<String> attributeValues = overlay.getOlcRefintAttribute();
+
+ if ( ( attributeValues != null ) && ( attributeValues.size() > 0 ) )
+ {
+ for ( String attribute : attributeValues )
+ {
+ attributes.add( attribute );
+ }
+ }
+
+ attributesTableViewer.refresh();
+
+ // Placeholder Value
+ Dn placeholderValue = overlay.getOlcRefintNothing();
+
+ if ( placeholderValue != null )
+ {
+ placeholderValueEntryWidget.setInput( placeholderValue );
+ }
+ else
+ {
+ placeholderValueEntryWidget.setInput( Dn.EMPTY_DN );
+ }
+
+ // Modifier Name
+ Dn modifierName = overlay.getOlcRefintModifiersName();
+
+ if ( modifierName != null )
+ {
+ modifierNameEntryWidget.setInput( modifierName );
+ }
+ else
+ {
+ try
+ {
+ modifierNameEntryWidget.setInput( new Dn( DEFAULT_MODIFIER_NAME ) );
+ }
+ catch ( LdapInvalidDnException e )
+ {
+ // Nothing to do.
+ }
+ }
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void save()
+ {
+ if ( overlay != null )
+ {
+ // Attributes
+ overlay.setOlcRefintAttribute( attributes );
+
+ // Placeholder Value
+ Dn placeholderValue = placeholderValueEntryWidget.getDn();
+
+ if ( ( placeholderValue != null ) && ( !Dn.EMPTY_DN.equals( placeholderValue ) ) )
+ {
+ overlay.setOlcRefintNothing( placeholderValue );
+ }
+ else
+ {
+ overlay.setOlcRefintNothing( null );
+ }
+
+ // Modifier Name
+ Dn modifierName = modifierNameEntryWidget.getDn();
+
+ if ( ( modifierName != null ) && ( !Dn.EMPTY_DN.equals( modifierName ) )
+ && ( !modifierName.toString().equals( DEFAULT_MODIFIER_NAME ) ) )
+ {
+ overlay.setOlcRefintModifiersName( modifierName );
+ }
+ else
+ {
+ overlay.setOlcRefintModifiersName( null );
+ }
+ }
+ }
+}
Added: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/overlays/RewriteRemapOverlayConfigurationBlock.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/RewriteRemapOverlayConfigurationBlock.java?rev=1670531&view=auto
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/overlays/RewriteRemapOverlayConfigurationBlock.java (added)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/overlays/RewriteRemapOverlayConfigurationBlock.java Wed Apr 1 01:01:42 2015
@@ -0,0 +1,247 @@
+/*
+ * 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.ArrayList;
+import java.util.List;
+
+import org.apache.directory.studio.common.ui.widgets.BaseWidgetUtils;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+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.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+
+import org.apache.directory.studio.openldap.common.ui.dialogs.AttributeDialog;
+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.RwmMappingDialog;
+import org.apache.directory.studio.openldap.config.model.OlcRwmConfig;
+
+
+/**
+ * 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 RewriteRemapOverlayConfigurationBlock extends AbstractOverlayDialogConfigurationBlock<OlcRwmConfig>
+{
+ /** The mappings list */
+ private List<String> mappings = new ArrayList<String>();
+
+ // UI widgets
+ private TableViewer mappingsTableViewer;
+ private Button addMappingButton;
+ private Button editMappingButton;
+ private Button deleteMappingButton;
+
+ // Listeners
+ private ISelectionChangedListener mappingsTableViewerSelectionChangedListener = new ISelectionChangedListener()
+ {
+ public void selectionChanged( SelectionChangedEvent event )
+ {
+ deleteMappingButton.setEnabled( !mappingsTableViewer.getSelection().isEmpty() );
+ }
+ };
+ private IDoubleClickListener mappingsTableViewerDoubleClickListener = new IDoubleClickListener()
+ {
+ public void doubleClick( DoubleClickEvent event )
+ {
+ editMappingButtonAction();
+ }
+ };
+ private SelectionListener addMappingButtonSelectionListener = new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ RwmMappingDialog dialog = new RwmMappingDialog( addMappingButton.getShell(), browserConnection, "" );
+ if ( dialog.open() == AttributeDialog.OK )
+ {
+ String value = dialog.getValue();
+
+ mappings.add( value );
+ mappingsTableViewer.refresh();
+ mappingsTableViewer.setSelection( new StructuredSelection( value ) );
+ }
+ }
+ };
+ private SelectionListener editMappingButtonSelectionListener = new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ editMappingButtonAction();
+ }
+ };
+ private SelectionListener deleteMappingButtonSelectionListener = new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ StructuredSelection selection = ( StructuredSelection ) mappingsTableViewer.getSelection();
+
+ if ( !selection.isEmpty() )
+ {
+ String selectedAttribute = ( String ) selection.getFirstElement();
+
+ mappings.remove( selectedAttribute );
+ mappingsTableViewer.refresh();
+ }
+ }
+ };
+
+
+ public RewriteRemapOverlayConfigurationBlock( OverlayDialog dialog, IBrowserConnection connection )
+ {
+ super( dialog, connection );
+ setOverlay( new OlcRwmConfig() );
+ }
+
+
+ public RewriteRemapOverlayConfigurationBlock( OverlayDialog dialog, IBrowserConnection connection,
+ OlcRwmConfig overlay )
+ {
+ super( dialog, connection );
+ if ( overlay == null )
+ {
+ overlay = new OlcRwmConfig();
+ }
+
+ setOverlay( overlay );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void createBlockContent( Composite parent )
+ {
+ Composite composite = BaseWidgetUtils.createColumnContainer( parent, 1, 1 );
+
+ // Mappings
+ BaseWidgetUtils.createLabel( composite, "Mappings:", 1 );
+ Composite mappingsComposite = BaseWidgetUtils.createColumnContainer( composite, 2, 1 );
+
+ // Mappings TableViewer
+ mappingsTableViewer = new TableViewer( mappingsComposite );
+ GridData tableViewerGridData = new GridData( SWT.FILL, SWT.FILL, true, true, 1, 3 );
+ tableViewerGridData.heightHint = 20;
+ tableViewerGridData.widthHint = 100;
+ mappingsTableViewer.getControl().setLayoutData( tableViewerGridData );
+ mappingsTableViewer.setContentProvider( new ArrayContentProvider() );
+ mappingsTableViewer.setInput( mappings );
+ mappingsTableViewer.addSelectionChangedListener( mappingsTableViewerSelectionChangedListener );
+ mappingsTableViewer.addDoubleClickListener( mappingsTableViewerDoubleClickListener );
+
+ // Mapping Add Button
+ addMappingButton = BaseWidgetUtils.createButton( mappingsComposite, "Add...", 1 );
+ addMappingButton.setLayoutData( new GridData( SWT.FILL, SWT.BEGINNING, false, false ) );
+ addMappingButton.addSelectionListener( addMappingButtonSelectionListener );
+
+ // Mapping Add Button
+ editMappingButton = BaseWidgetUtils.createButton( mappingsComposite, "Edit...", 1 );
+ editMappingButton.setLayoutData( new GridData( SWT.FILL, SWT.BEGINNING, false, false ) );
+ editMappingButton.addSelectionListener( editMappingButtonSelectionListener );
+
+ // Mapping Delete Button
+ deleteMappingButton = BaseWidgetUtils.createButton( mappingsComposite, "Delete", 1 );
+ deleteMappingButton.setEnabled( false );
+ deleteMappingButton.setLayoutData( new GridData( SWT.FILL, SWT.BEGINNING, false, false ) );
+ deleteMappingButton.addSelectionListener( deleteMappingButtonSelectionListener );
+ }
+
+
+ /**
+ * Action launched when the edit mapping button is clicked, or
+ * when the value sorts table viewer is double-clicked.
+ */
+ private void editMappingButtonAction()
+ {
+ StructuredSelection selection = ( StructuredSelection ) mappingsTableViewer.getSelection();
+
+ if ( !selection.isEmpty() )
+ {
+ String selectedMapping = ( String ) selection.getFirstElement();
+
+ RwmMappingDialog dialog = new RwmMappingDialog( addMappingButton.getShell(),
+ browserConnection, selectedMapping );
+ if ( dialog.open() == AttributeDialog.OK )
+ {
+ String value = dialog.getValue();
+
+ int index = mappings.indexOf( selectedMapping );
+ mappings.remove( selectedMapping );
+ mappings.add( index, value );
+ mappingsTableViewer.refresh();
+ mappingsTableViewer.setSelection( new StructuredSelection( value ) );
+ }
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void refresh()
+ {
+ if ( overlay != null )
+ {
+ mappings.clear();
+
+ List<String> olcRwmMap = overlay.getOlcRwmMap();
+
+ if ( olcRwmMap != null )
+ {
+ for ( String value : olcRwmMap )
+ {
+ mappings.add( value );
+ }
+ }
+
+ mappingsTableViewer.refresh();
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void save()
+ {
+ if ( overlay != null )
+ {
+ overlay.clearOlcRwmMap();
+
+ for ( String mapping : mappings )
+ {
+ overlay.addOlcRwmMap( mapping );
+ }
+ }
+ }
+}
Added: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/overlays/SyncProvOverlayConfigurationBlock.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/SyncProvOverlayConfigurationBlock.java?rev=1670531&view=auto
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/overlays/SyncProvOverlayConfigurationBlock.java (added)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/overlays/SyncProvOverlayConfigurationBlock.java Wed Apr 1 01:01:42 2015
@@ -0,0 +1,255 @@
+/*
+ * 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 org.apache.directory.studio.common.ui.widgets.BaseWidgetUtils;
+import org.eclipse.swt.events.VerifyEvent;
+import org.eclipse.swt.events.VerifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+
+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.OlcSyncProvConfig;
+
+
+/**
+ * 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 SyncProvOverlayConfigurationBlock extends AbstractOverlayDialogConfigurationBlock<OlcSyncProvConfig>
+{
+ // UI widgets
+ private Text checkpointOperationsText;
+ private Text checkpointMinutesText;
+ private Text sessionLogOperationsText;
+ private Button skipPresentPhaseButton;
+ private Button honorReloadHintFlagButton;
+
+
+ public SyncProvOverlayConfigurationBlock( OverlayDialog dialog )
+ {
+ super( dialog );
+ setOverlay( new OlcSyncProvConfig() );
+ }
+
+
+ public SyncProvOverlayConfigurationBlock( OverlayDialog dialog, OlcSyncProvConfig overlay )
+ {
+ super( dialog );
+ if ( overlay == null )
+ {
+ overlay = new OlcSyncProvConfig();
+ }
+
+ setOverlay( overlay );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void createBlockContent( Composite parent )
+ {
+ Composite composite = BaseWidgetUtils.createColumnContainer( parent, 1, 1 );
+
+ // Checkpoint
+ Composite checkpointComposite = BaseWidgetUtils.createColumnContainer( composite, 5, 1 );
+ BaseWidgetUtils.createLabel( checkpointComposite, "New checkpoint after", 1 );
+ checkpointOperationsText = createIntegerText( checkpointComposite, "", 1 );
+ BaseWidgetUtils.createLabel( checkpointComposite, "operations or", 1 );
+ checkpointMinutesText = createIntegerText( checkpointComposite, "", 1 );
+ BaseWidgetUtils.createLabel( checkpointComposite, "minutes", 1 );
+
+ // Session Log
+ Composite sessionLogComposite = BaseWidgetUtils.createColumnContainer( composite, 3, 1 );
+ BaseWidgetUtils.createLabel( sessionLogComposite, "Session log holds", 1 );
+ sessionLogOperationsText = createIntegerText( sessionLogComposite, "", 1 );
+ BaseWidgetUtils.createLabel( sessionLogComposite, "operations", 1 );
+
+ // No Present
+ skipPresentPhaseButton = BaseWidgetUtils.createCheckbox( composite, "Skip Present Phase", 1 );
+
+ // Reload Hint
+ honorReloadHintFlagButton = BaseWidgetUtils.createCheckbox( composite, "Honor Reload Hint flag", 1 );
+ }
+
+
+ /**
+ * Create a Text widget only accepting integers.
+ *
+ * @param parent the parent
+ * @param text the initial text
+ * @param span the horizontal span
+ * @return a Text widget only accepting integers
+ */
+ private Text createIntegerText( Composite parent, String text, int span )
+ {
+ Text integerText = BaseWidgetUtils.createText( parent, text, span );
+
+ integerText.addVerifyListener( new VerifyListener()
+ {
+ public void verifyText( VerifyEvent e )
+ {
+ if ( !e.text.matches( "[0-9]*" ) ) //$NON-NLS-1$
+ {
+ e.doit = false;
+ }
+ }
+ } );
+
+ GridData gd = new GridData();
+ gd.widthHint = 40;
+ integerText.setLayoutData( gd );
+
+ return integerText;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void refresh()
+ {
+ if ( overlay != null )
+ {
+ // Checkpoint
+ String checkpointConfiguration = overlay.getOlcSpCheckpoint();
+
+ if ( ( checkpointConfiguration != null ) && ( !checkpointConfiguration.isEmpty() ) )
+ {
+ String[] checkpointConfigurationElements = checkpointConfiguration.split( " " );
+
+ if ( checkpointConfigurationElements.length == 2 )
+ {
+ // Checkpoint Operations
+ try
+ {
+
+ int checkpointOperations = Integer.parseInt( checkpointConfigurationElements[0] );
+ checkpointOperationsText.setText( "" + checkpointOperations );
+ }
+ catch ( NumberFormatException e )
+ {
+ // TODO
+ checkpointOperationsText.setText( "" );
+ }
+
+ // Checkpoint Minutes
+ try
+ {
+
+ int checkpointMinutes = Integer.parseInt( checkpointConfigurationElements[1] );
+ checkpointMinutesText.setText( "" + checkpointMinutes );
+ }
+ catch ( NumberFormatException e )
+ {
+ // TODO
+ checkpointMinutesText.setText( "" );
+ }
+ }
+ else
+ {
+ // TODO
+ checkpointOperationsText.setText( "" );
+ checkpointMinutesText.setText( "" );
+ }
+ }
+ else
+ {
+ // TODO
+ checkpointOperationsText.setText( "" );
+ checkpointMinutesText.setText( "" );
+ }
+
+ // Session Log
+ Integer sessionLogOperations = overlay.getOlcSpSessionlog();
+
+ if ( sessionLogOperations != null )
+ {
+ sessionLogOperationsText.setText( "" + sessionLogOperations );
+ }
+ else
+ {
+ // TODO
+ sessionLogOperationsText.setText( "" );
+ }
+
+ // No Present
+ skipPresentPhaseButton.setSelection( overlay.getOlcSpNoPresent() );
+
+ // Reload Hint
+ honorReloadHintFlagButton.setSelection( overlay.getOlcSpReloadHint() );
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void save()
+ {
+ if ( overlay != null )
+ {
+ // Checkpoint
+ String checkpointOperations = checkpointOperationsText.getText();
+ String checkpointMinutes = checkpointMinutesText.getText();
+
+ if ( ( checkpointOperations != null ) && ( !checkpointOperations.isEmpty() )
+ && ( checkpointMinutes != null ) && ( !checkpointMinutes.isEmpty() ) )
+ {
+ overlay.setOlcSpCheckpoint( checkpointOperations + " " + checkpointMinutes );
+ }
+ else
+ {
+ overlay.setOlcSpCheckpoint( null );
+ }
+
+ // Session Log
+ String sessionLogOperations = sessionLogOperationsText.getText();
+
+ if ( ( sessionLogOperations != null ) && ( !sessionLogOperations.isEmpty() ) )
+ {
+ try
+ {
+ overlay.setOlcSpSessionlog( Integer.parseInt( sessionLogOperations ) );
+ }
+ catch ( NumberFormatException e )
+ {
+ overlay.setOlcSpSessionlog( null );
+ }
+ }
+ else
+ {
+ overlay.setOlcSpSessionlog( null );
+ }
+
+ // No Present
+ overlay.setOlcSpNoPresent( skipPresentPhaseButton.getSelection() );
+
+ // Reload Hint
+ overlay.setOlcSpReloadHint( honorReloadHintFlagButton.getSelection() );
+ }
+ }
+}
Added: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/overlays/ValueSortingOverlayConfigurationBlock.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/ValueSortingOverlayConfigurationBlock.java?rev=1670531&view=auto
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/overlays/ValueSortingOverlayConfigurationBlock.java (added)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/overlays/ValueSortingOverlayConfigurationBlock.java Wed Apr 1 01:01:42 2015
@@ -0,0 +1,249 @@
+/*
+ * 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.ArrayList;
+import java.util.List;
+
+import org.apache.directory.studio.common.ui.widgets.BaseWidgetUtils;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+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.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+
+import org.apache.directory.studio.openldap.common.ui.dialogs.AttributeDialog;
+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.ValueSortingValueDialog;
+import org.apache.directory.studio.openldap.config.model.OlcValSortConfig;
+
+
+/**
+ * This class implements a block for the configuration of the Value Sorting overlay.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class ValueSortingOverlayConfigurationBlock extends
+ AbstractOverlayDialogConfigurationBlock<OlcValSortConfig>
+{
+ /** The value sorts list */
+ private List<String> valueSorts = new ArrayList<String>();
+
+ // UI widgets
+ private TableViewer valueSortsTableViewer;
+ private Button addValueSortButton;
+ private Button editValueSortButton;
+ private Button deleteValueSortButton;
+
+ // Listeners
+ private ISelectionChangedListener valueSortsTableViewerSelectionChangedListener = new ISelectionChangedListener()
+ {
+ public void selectionChanged( SelectionChangedEvent event )
+ {
+ deleteValueSortButton.setEnabled( !valueSortsTableViewer.getSelection().isEmpty() );
+ }
+ };
+ private IDoubleClickListener valueSortsTableViewerDoubleClickListener = new IDoubleClickListener()
+ {
+ public void doubleClick( DoubleClickEvent event )
+ {
+ editValueSortButtonAction();
+ }
+ };
+ private SelectionListener addValueSortButtonSelectionListener = new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ ValueSortingValueDialog dialog = new ValueSortingValueDialog( addValueSortButton.getShell(),
+ browserConnection, "" );
+ if ( dialog.open() == AttributeDialog.OK )
+ {
+ String value = dialog.getValue();
+
+ valueSorts.add( value );
+ valueSortsTableViewer.refresh();
+ valueSortsTableViewer.setSelection( new StructuredSelection( value ) );
+ }
+ }
+ };
+ private SelectionListener editValueSortButtonSelectionListener = new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ editValueSortButtonAction();
+ }
+ };
+ private SelectionListener deleteValueSortButtonSelectionListener = new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ StructuredSelection selection = ( StructuredSelection ) valueSortsTableViewer.getSelection();
+
+ if ( !selection.isEmpty() )
+ {
+ String selectedAttribute = ( String ) selection.getFirstElement();
+
+ valueSorts.remove( selectedAttribute );
+ valueSortsTableViewer.refresh();
+ }
+ }
+ };
+
+
+ public ValueSortingOverlayConfigurationBlock( OverlayDialog dialog, IBrowserConnection connection )
+ {
+ super( dialog, connection );
+ setOverlay( new OlcValSortConfig() );
+ }
+
+
+ public ValueSortingOverlayConfigurationBlock( OverlayDialog dialog, IBrowserConnection connection,
+ OlcValSortConfig overlay )
+ {
+ super( dialog, connection );
+ if ( overlay == null )
+ {
+ overlay = new OlcValSortConfig();
+ }
+
+ setOverlay( overlay );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void createBlockContent( Composite parent )
+ {
+ Composite composite = BaseWidgetUtils.createColumnContainer( parent, 1, 1 );
+
+ // Value Sorts
+ BaseWidgetUtils.createLabel( composite, "Value Sorts:", 1 );
+ Composite valueSortsComposite = BaseWidgetUtils.createColumnContainer( composite, 2, 1 );
+
+ // Value Sorts TableViewer
+ valueSortsTableViewer = new TableViewer( valueSortsComposite );
+ GridData tableViewerGridData = new GridData( SWT.FILL, SWT.FILL, true, true, 1, 3 );
+ tableViewerGridData.heightHint = 20;
+ tableViewerGridData.widthHint = 100;
+ valueSortsTableViewer.getControl().setLayoutData( tableViewerGridData );
+ valueSortsTableViewer.setContentProvider( new ArrayContentProvider() );
+ valueSortsTableViewer.setInput( valueSorts );
+ valueSortsTableViewer.addSelectionChangedListener( valueSortsTableViewerSelectionChangedListener );
+ valueSortsTableViewer.addDoubleClickListener( valueSortsTableViewerDoubleClickListener );
+
+ // Value Sort Add Button
+ addValueSortButton = BaseWidgetUtils.createButton( valueSortsComposite, "Add...", 1 );
+ addValueSortButton.setLayoutData( new GridData( SWT.FILL, SWT.BEGINNING, false, false ) );
+ addValueSortButton.addSelectionListener( addValueSortButtonSelectionListener );
+
+ // Value Sort Add Button
+ editValueSortButton = BaseWidgetUtils.createButton( valueSortsComposite, "Edit...", 1 );
+ editValueSortButton.setLayoutData( new GridData( SWT.FILL, SWT.BEGINNING, false, false ) );
+ editValueSortButton.addSelectionListener( editValueSortButtonSelectionListener );
+
+ // Value Sort Delete Button
+ deleteValueSortButton = BaseWidgetUtils.createButton( valueSortsComposite, "Delete", 1 );
+ deleteValueSortButton.setEnabled( false );
+ deleteValueSortButton.setLayoutData( new GridData( SWT.FILL, SWT.BEGINNING, false, false ) );
+ deleteValueSortButton.addSelectionListener( deleteValueSortButtonSelectionListener );
+ }
+
+
+ /**
+ * Action launched when the edit value sort button is clicked, or
+ * when the value sorts table viewer is double-clicked.
+ */
+ private void editValueSortButtonAction()
+ {
+ StructuredSelection selection = ( StructuredSelection ) valueSortsTableViewer.getSelection();
+
+ if ( !selection.isEmpty() )
+ {
+ String selectedValueSort = ( String ) selection.getFirstElement();
+
+ ValueSortingValueDialog dialog = new ValueSortingValueDialog( addValueSortButton.getShell(),
+ browserConnection, selectedValueSort );
+ if ( dialog.open() == AttributeDialog.OK )
+ {
+ String value = dialog.getValue();
+
+ int index = valueSorts.indexOf( selectedValueSort );
+ valueSorts.remove( selectedValueSort );
+ valueSorts.add( index, value );
+ valueSortsTableViewer.refresh();
+ valueSortsTableViewer.setSelection( new StructuredSelection( value ) );
+ }
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void refresh()
+ {
+ if ( overlay != null )
+ {
+ valueSorts.clear();
+
+ List<String> olcValSortAttr = overlay.getOlcValSortAttr();
+
+ if ( olcValSortAttr != null )
+ {
+ for ( String value : olcValSortAttr )
+ {
+ valueSorts.add( value );
+ }
+ }
+
+ valueSortsTableViewer.refresh();
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void save()
+ {
+ if ( overlay != null )
+ {
+ overlay.clearOlcValSortAttr();
+
+ for ( String valueSort : valueSorts )
+ {
+ overlay.addOlcValSortAttr( valueSort );
+ }
+ }
+ }
+}
Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/AccessLogOverlayDetailsPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/AccessLogOverlayDetailsPage.java?rev=1670531&r1=1670530&r2=1670531&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/AccessLogOverlayDetailsPage.java (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/AccessLogOverlayDetailsPage.java Wed Apr 1 01:01:42 2015
@@ -42,6 +42,8 @@ import org.apache.directory.studio.openl
/**
* This class represents the Details Page of the Server Configuration Editor for the Access Log Overlay type
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
public class AccessLogOverlayDetailsPage implements IDetailsPage
{
Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/AuditLogOverlayDetailsPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/AuditLogOverlayDetailsPage.java?rev=1670531&r1=1670530&r2=1670531&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/AuditLogOverlayDetailsPage.java (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/AuditLogOverlayDetailsPage.java Wed Apr 1 01:01:42 2015
@@ -40,6 +40,8 @@ import org.apache.directory.studio.openl
/**
* This class represents the Details Page of the Server Configuration Editor for the Audit Log Overlay type
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
public class AuditLogOverlayDetailsPage implements IDetailsPage
{
Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/ChainOverlayDetailsPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/ChainOverlayDetailsPage.java?rev=1670531&r1=1670530&r2=1670531&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/ChainOverlayDetailsPage.java (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/ChainOverlayDetailsPage.java Wed Apr 1 01:01:42 2015
@@ -37,6 +37,8 @@ import org.apache.directory.studio.openl
/**
* This class represents the Details Page of the Server Configuration Editor for the Chain Overlay type
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
public class ChainOverlayDetailsPage implements IDetailsPage
{
Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/DistProcOverlayDetailsPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/DistProcOverlayDetailsPage.java?rev=1670531&r1=1670530&r2=1670531&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/DistProcOverlayDetailsPage.java (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/DistProcOverlayDetailsPage.java Wed Apr 1 01:01:42 2015
@@ -37,6 +37,8 @@ import org.apache.directory.studio.openl
/**
* This class represents the Details Page of the Server Configuration Editor for the Dist Proc Overlay type
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
public class DistProcOverlayDetailsPage implements IDetailsPage
{
Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/OverlayType.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/OverlayType.java?rev=1670531&r1=1670530&r2=1670531&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/OverlayType.java (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/OverlayType.java Wed Apr 1 01:01:42 2015
@@ -22,6 +22,8 @@ package org.apache.directory.studio.open
/**
* This enum describes the various type of overlays.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
public enum OverlayType
{
Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/OverlaysMasterDetailsBlock.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/OverlaysMasterDetailsBlock.java?rev=1670531&r1=1670530&r2=1670531&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/OverlaysMasterDetailsBlock.java (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/OverlaysMasterDetailsBlock.java Wed Apr 1 01:01:42 2015
@@ -57,6 +57,8 @@ import org.apache.directory.studio.openl
/**
* This class represents the Overlays Master/Details Block used in the Overlays Page.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
public class OverlaysMasterDetailsBlock extends MasterDetailsBlock
{
Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/OverlaysPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/OverlaysPage.java?rev=1670531&r1=1670530&r2=1670531&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/OverlaysPage.java (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/OverlaysPage.java Wed Apr 1 01:01:42 2015
@@ -29,6 +29,8 @@ import org.apache.directory.studio.openl
/**
* This class represents the General Page of the Server Configuration Editor.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
public class OverlaysPage extends ServerConfigurationEditorPage
{
Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/PBindAccessOverlayDetailsPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/PBindAccessOverlayDetailsPage.java?rev=1670531&r1=1670530&r2=1670531&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/PBindAccessOverlayDetailsPage.java (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/PBindAccessOverlayDetailsPage.java Wed Apr 1 01:01:42 2015
@@ -37,6 +37,8 @@ import org.apache.directory.studio.openl
/**
* This class represents the Details Page of the Server Configuration Editor for the PBind Overlay type
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
public class PBindAccessOverlayDetailsPage implements IDetailsPage
{
Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/PasswordPolicyOverlayDetailsPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/PasswordPolicyOverlayDetailsPage.java?rev=1670531&r1=1670530&r2=1670531&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/PasswordPolicyOverlayDetailsPage.java (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/PasswordPolicyOverlayDetailsPage.java Wed Apr 1 01:01:42 2015
@@ -37,6 +37,8 @@ import org.apache.directory.studio.openl
/**
* This class represents the Details Page of the Server Configuration Editor for the Password Policy Overlay type
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
public class PasswordPolicyOverlayDetailsPage implements IDetailsPage
{
Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/SyncProvOverlayDetailsPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/SyncProvOverlayDetailsPage.java?rev=1670531&r1=1670530&r2=1670531&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/SyncProvOverlayDetailsPage.java (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/SyncProvOverlayDetailsPage.java Wed Apr 1 01:01:42 2015
@@ -37,6 +37,8 @@ import org.apache.directory.studio.openl
/**
* This class represents the Details Page of the Server Configuration Editor for the SyncProv Overlay type
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
public class SyncProvOverlayDetailsPage implements IDetailsPage
{
Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/jobs/EntryBasedConfigurationPartition.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/jobs/EntryBasedConfigurationPartition.java?rev=1670531&r1=1670530&r2=1670531&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/jobs/EntryBasedConfigurationPartition.java (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/jobs/EntryBasedConfigurationPartition.java Wed Apr 1 01:01:42 2015
@@ -24,13 +24,13 @@ import java.util.UUID;
import javax.naming.InvalidNameException;
-import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
-import org.apache.directory.server.core.partition.ldif.AbstractLdifPartition;
import org.apache.directory.api.ldap.model.constants.SchemaConstants;
import org.apache.directory.api.ldap.model.entry.Entry;
import org.apache.directory.api.ldap.model.exception.LdapException;
import org.apache.directory.api.ldap.model.name.Dn;
import org.apache.directory.api.ldap.model.schema.SchemaManager;
+import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
+import org.apache.directory.server.core.partition.ldif.AbstractLdifPartition;
/**
Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/jobs/LoadConfigurationRunnable.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/jobs/LoadConfigurationRunnable.java?rev=1670531&r1=1670530&r2=1670531&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/jobs/LoadConfigurationRunnable.java (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/jobs/LoadConfigurationRunnable.java Wed Apr 1 01:01:42 2015
@@ -21,18 +21,14 @@
package org.apache.directory.studio.openldap.config.jobs;
-import org.apache.directory.api.ldap.model.schema.SchemaManager;
-import org.apache.directory.api.ldap.model.schema.registries.SchemaLoader;
-import org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager;
import org.apache.directory.studio.common.core.jobs.StudioProgressMonitor;
import org.apache.directory.studio.common.core.jobs.StudioRunnableWithProgress;
-import org.apache.directory.studio.ldapbrowser.core.BrowserCorePlugin;
-import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorInput;
import org.apache.directory.studio.openldap.config.editor.ConnectionServerConfigurationInput;
+import org.apache.directory.studio.openldap.config.editor.DirectoryServerConfigurationInput;
import org.apache.directory.studio.openldap.config.editor.ServerConfigurationEditor;
import org.apache.directory.studio.openldap.config.model.OpenLdapConfiguration;
import org.apache.directory.studio.openldap.config.model.io.ConfigurationReader;
@@ -147,6 +143,12 @@ public class LoadConfigurationRunnable i
{
return readConfiguration( ( ConnectionServerConfigurationInput ) input, monitor );
}
+ // If the input is a DirectoryServerConfigurationInput, then we
+ // read the server configuration from the selected 'slapd.d' directory.
+ else if ( input instanceof DirectoryServerConfigurationInput )
+ {
+ return readConfiguration( ( DirectoryServerConfigurationInput ) input, monitor );
+ }
return null;
}
@@ -167,6 +169,29 @@ public class LoadConfigurationRunnable i
StudioProgressMonitor monitor ) throws Exception
{
if ( input != null )
+ {
+ return ConfigurationReader.readConfiguration( input );
+ }
+
+ return null;
+ }
+
+
+ /**
+ * Reads the configuration from the given connection.
+ *
+ * @param input
+ * the editor input
+ * @param monitor
+ * the studio progress monitor
+ * @return
+ * the associated configuration bean
+ * @throws Exception
+ */
+ private OpenLdapConfiguration readConfiguration( DirectoryServerConfigurationInput input,
+ StudioProgressMonitor monitor ) throws Exception
+ {
+ if ( input != null )
{
return ConfigurationReader.readConfiguration( input );
}