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 2017/09/03 22:58:54 UTC
svn commit: r1807179 [1/2] - in
/directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config:
./ actions/ editor/ editor/databases/ editor/overlays/ editor/pages/ jobs/
model/ model/io...
Author: elecharny
Date: Sun Sep 3 22:58:53 2017
New Revision: 1807179
URL: http://svn.apache.org/viewvc?rev=1807179&view=rev
Log:
o Renamed some classes to use Ldap instead of LDAP.
o Added some constants
o Fixed a non-exported attribute (cn), using the annotation default value
o Removed some useless traces
o Minor formatting
Added:
directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/OpenLdapServerConfigurationEditor.java
- copied, changed from r1807178, directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/OpenLDAPServerConfigurationEditor.java
directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/OpenLdapServerConfigurationEditorUtils.java
- copied, changed from r1807178, directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/OpenLDAPServerConfigurationEditorUtils.java
directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/OpenLdapConfigFormat.java
directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/OpenLdapVersion.java
directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/wizards/Messages.java
directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/wizards/NewOpenLdapConfigurationFileWizard.java
- copied, changed from r1807178, directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/wizards/NewOpenLDAPConfigurationFileWizard.java
directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/wizards/messages.properties
directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/wizards/messages_de.properties
directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/wizards/messages_fr.properties
Removed:
directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/OpenLDAPServerConfigurationEditor.java
directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/OpenLDAPServerConfigurationEditorUtils.java
directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/wizards/NewOpenLDAPConfigurationFileWizard.java
Modified:
directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/OpenLdapConfigurationPlugin.java
directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/OpenLdapConfigurationPluginConstants.java
directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/actions/EditorExportConfigurationAction.java
directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/actions/EditorImportConfigurationAction.java
directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/actions/OpenConfigurationAction.java
directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/actions/OpenDirectoryConfigurationAction.java
directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/NewServerConfigurationInput.java
directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/databases/DatabasesMasterDetailsBlock.java
directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/PBindAccessOverlayDetailsPage.java
directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/DatabasesPage.java
directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OpenLDAPServerConfigurationEditorPage.java
directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OptionsPage.java
directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OverlaysPage.java
directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OverviewPage.java
directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/SecurityPage.java
directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/TuningPage.java
directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/jobs/LoadConfigurationRunnable.java
directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/io/ConfigurationReader.java
directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/io/ConfigurationWriter.java
directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/io/SaveConfigurationRunnable.java
Modified: directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/OpenLdapConfigurationPlugin.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/OpenLdapConfigurationPlugin.java?rev=1807179&r1=1807178&r2=1807179&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/OpenLdapConfigurationPlugin.java (original)
+++ directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/OpenLdapConfigurationPlugin.java Sun Sep 3 22:58:53 2017
@@ -70,8 +70,6 @@ public class OpenLdapConfigurationPlugin
{
if ( schemaManager == null )
{
- long t0 = System.currentTimeMillis();
-
// Initializing the schema manager
schemaManager = new DefaultSchemaManager( new OpenLdapSchemaLoader() );
@@ -84,9 +82,6 @@ public class OpenLdapConfigurationPlugin
schemaManager = null;
throw new Exception( "Could not load the OpenLDAP schema correctly." );
}
- long t1 = System.currentTimeMillis();
- long delta = t1 - t0;
- System.out.println( "delta : " + delta );
}
return schemaManager;
Modified: directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/OpenLdapConfigurationPluginConstants.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/OpenLdapConfigurationPluginConstants.java?rev=1807179&r1=1807178&r2=1807179&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/OpenLdapConfigurationPluginConstants.java (original)
+++ directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/OpenLdapConfigurationPluginConstants.java Sun Sep 3 22:58:53 2017
@@ -19,7 +19,6 @@
*/
package org.apache.directory.studio.openldap.config;
-
/**
* This interface contains all the Constants used in the Plugin.
*
@@ -43,4 +42,7 @@ public interface OpenLdapConfigurationPl
String IMG_IMPORT = "resources/icons/import.gif"; //$NON-NLS-1$
String IMG_OVERLAY = "resources/icons/overlay.gif"; //$NON-NLS-1$
String IMG_LDAP_SERVER = "resources/icons/server.gif"; //$NON-NLS-1$
+
+ public static final String WIZARD_NEW_OPENLDAP_CONFIG = OpenLdapConfigurationPlugin.getDefault().getPluginProperties()
+ .getString( "NewWizards_NewOpenLdapConfigurationFileWizard_id" ); //$NON-NLS-1$
}
Modified: directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/actions/EditorExportConfigurationAction.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/actions/EditorExportConfigurationAction.java?rev=1807179&r1=1807178&r2=1807179&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/actions/EditorExportConfigurationAction.java (original)
+++ directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/actions/EditorExportConfigurationAction.java Sun Sep 3 22:58:53 2017
@@ -27,8 +27,8 @@ import org.eclipse.osgi.util.NLS;
import org.apache.directory.studio.openldap.config.OpenLdapConfigurationPlugin;
import org.apache.directory.studio.openldap.config.OpenLdapConfigurationPluginConstants;
-import org.apache.directory.studio.openldap.config.editor.OpenLDAPServerConfigurationEditor;
-import org.apache.directory.studio.openldap.config.editor.OpenLDAPServerConfigurationEditorUtils;
+import org.apache.directory.studio.openldap.config.editor.OpenLdapServerConfigurationEditor;
+import org.apache.directory.studio.openldap.config.editor.OpenLdapServerConfigurationEditorUtils;
/**
@@ -39,7 +39,7 @@ import org.apache.directory.studio.openl
public class EditorExportConfigurationAction extends Action
{
/** The associated editor */
- private OpenLDAPServerConfigurationEditor editor;
+ private OpenLdapServerConfigurationEditor editor;
/**
@@ -48,7 +48,7 @@ public class EditorExportConfigurationAc
* @param editor
* the associated editor
*/
- public EditorExportConfigurationAction( OpenLDAPServerConfigurationEditor editor )
+ public EditorExportConfigurationAction( OpenLdapServerConfigurationEditor editor )
{
this.editor = editor;
}
@@ -83,7 +83,7 @@ public class EditorExportConfigurationAc
{
try
{
- OpenLDAPServerConfigurationEditorUtils.saveAs( editor.getConfiguration(), editor.getSite()
+ OpenLdapServerConfigurationEditorUtils.saveAs( editor.getConfiguration(), editor.getSite()
.getShell(), false );
}
catch ( Exception e )
Modified: directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/actions/EditorImportConfigurationAction.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/actions/EditorImportConfigurationAction.java?rev=1807179&r1=1807178&r2=1807179&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/actions/EditorImportConfigurationAction.java (original)
+++ directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/actions/EditorImportConfigurationAction.java Sun Sep 3 22:58:53 2017
@@ -31,7 +31,7 @@ import org.eclipse.swt.widgets.Directory
import org.apache.directory.studio.openldap.config.OpenLdapConfigurationPlugin;
import org.apache.directory.studio.openldap.config.OpenLdapConfigurationPluginConstants;
-import org.apache.directory.studio.openldap.config.editor.OpenLDAPServerConfigurationEditor;
+import org.apache.directory.studio.openldap.config.editor.OpenLdapServerConfigurationEditor;
import org.apache.directory.studio.openldap.config.model.OpenLdapConfiguration;
import org.apache.directory.studio.openldap.config.model.io.ConfigurationReader;
@@ -44,7 +44,7 @@ import org.apache.directory.studio.openl
public class EditorImportConfigurationAction extends Action
{
/** The associated editor */
- private OpenLDAPServerConfigurationEditor editor;
+ private OpenLdapServerConfigurationEditor editor;
/**
@@ -53,7 +53,7 @@ public class EditorImportConfigurationAc
* @param editor
* the associated editor
*/
- public EditorImportConfigurationAction( OpenLDAPServerConfigurationEditor editor )
+ public EditorImportConfigurationAction( OpenLdapServerConfigurationEditor editor )
{
this.editor = editor;
}
Modified: directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/actions/OpenConfigurationAction.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/actions/OpenConfigurationAction.java?rev=1807179&r1=1807178&r2=1807179&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/actions/OpenConfigurationAction.java (original)
+++ directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/actions/OpenConfigurationAction.java Sun Sep 3 22:58:53 2017
@@ -30,7 +30,7 @@ import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PlatformUI;
import org.apache.directory.studio.openldap.config.editor.ConnectionServerConfigurationInput;
-import org.apache.directory.studio.openldap.config.editor.OpenLDAPServerConfigurationEditor;
+import org.apache.directory.studio.openldap.config.editor.OpenLdapServerConfigurationEditor;
/**
@@ -55,7 +55,7 @@ public class OpenConfigurationAction imp
{
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
.openEditor( new ConnectionServerConfigurationInput( selectedConnection ),
- OpenLDAPServerConfigurationEditor.ID );
+ OpenLdapServerConfigurationEditor.ID );
}
catch ( Exception e )
{
Modified: directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/actions/OpenDirectoryConfigurationAction.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/actions/OpenDirectoryConfigurationAction.java?rev=1807179&r1=1807178&r2=1807179&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/actions/OpenDirectoryConfigurationAction.java (original)
+++ directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/actions/OpenDirectoryConfigurationAction.java Sun Sep 3 22:58:53 2017
@@ -32,7 +32,7 @@ import org.eclipse.ui.IWorkbenchWindowAc
import org.eclipse.ui.PartInitException;
import org.apache.directory.studio.openldap.config.editor.DirectoryServerConfigurationInput;
-import org.apache.directory.studio.openldap.config.editor.OpenLDAPServerConfigurationEditor;
+import org.apache.directory.studio.openldap.config.editor.OpenLdapServerConfigurationEditor;
/**
@@ -75,7 +75,7 @@ public class OpenDirectoryConfigurationA
try
{
window.getActivePage().openEditor( new DirectoryServerConfigurationInput( new File(
- selectedDirectory ) ), OpenLDAPServerConfigurationEditor.ID );
+ selectedDirectory ) ), OpenLdapServerConfigurationEditor.ID );
}
catch ( PartInitException e )
{
Modified: directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/NewServerConfigurationInput.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/NewServerConfigurationInput.java?rev=1807179&r1=1807178&r2=1807179&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/NewServerConfigurationInput.java (original)
+++ directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/NewServerConfigurationInput.java Sun Sep 3 22:58:53 2017
@@ -20,6 +20,8 @@
package org.apache.directory.studio.openldap.config.editor;
+import org.apache.directory.studio.openldap.config.model.OpenLdapConfigFormat;
+import org.apache.directory.studio.openldap.config.model.OpenLdapVersion;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IPersistableElement;
@@ -32,6 +34,12 @@ import org.eclipse.ui.IPersistableElemen
*/
public class NewServerConfigurationInput implements IEditorInput
{
+ /** The selected version */
+ private OpenLdapVersion openLdapVersion;
+
+ /** The file format*/
+ private OpenLdapConfigFormat openLdapConfigFormat;
+
/**
* {@inheritDoc}
*/
@@ -85,4 +93,40 @@ public class NewServerConfigurationInput
{
return null;
}
+
+
+ /**
+ * @return the openLdapVersion
+ */
+ public OpenLdapVersion getOpenLdapVersion()
+ {
+ return openLdapVersion;
+ }
+
+
+ /**
+ * @param openLdapVersion the openLdapVersion to set
+ */
+ public void setOpenLdapVersion( OpenLdapVersion openLdapVersion )
+ {
+ this.openLdapVersion = openLdapVersion;
+ }
+
+
+ /**
+ * @return the openLdapConfigFomat
+ */
+ public OpenLdapConfigFormat getOpenLdapConfigFormat()
+ {
+ return openLdapConfigFormat;
+ }
+
+
+ /**
+ * @param openLdapConfigFomat the openLdapConfigFomat to set
+ */
+ public void setOpenLdapConfigFormat( OpenLdapConfigFormat openLdapConfigFormat )
+ {
+ this.openLdapConfigFormat = openLdapConfigFormat;
+ }
}
Copied: directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/OpenLdapServerConfigurationEditor.java (from r1807178, directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/OpenLDAPServerConfigurationEditor.java)
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/OpenLdapServerConfigurationEditor.java?p2=directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/OpenLdapServerConfigurationEditor.java&p1=directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/OpenLDAPServerConfigurationEditor.java&r1=1807178&r2=1807179&rev=1807179&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/OpenLDAPServerConfigurationEditor.java (original)
+++ directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/OpenLdapServerConfigurationEditor.java Sun Sep 3 22:58:53 2017
@@ -57,10 +57,10 @@ import org.eclipse.ui.forms.editor.FormE
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class OpenLDAPServerConfigurationEditor extends FormEditor implements IPageChangedListener
+public class OpenLdapServerConfigurationEditor extends FormEditor implements IPageChangedListener
{
/** The Editor ID */
- public static final String ID = OpenLDAPServerConfigurationEditor.class.getName();
+ public static final String ID = OpenLdapServerConfigurationEditor.class.getName();
/** The flag indicating if the editor is dirty */
private boolean dirty = false;
@@ -103,6 +103,11 @@ public class OpenLDAPServerConfiguration
super.init( site, input );
setPartName( input.getName() );
+ // Checking if the input is a new server configuration file
+ // New server configuration file have a dirty state
+ // set to true since they are not saved yet
+ setDirty( input instanceof NewServerConfigurationInput );
+
addPageChangedListener( this );
readConfiguration();
@@ -240,7 +245,7 @@ public class OpenLDAPServerConfiguration
doSavePages( monitor );
// Saving the configuration as a new file and getting the associated new editor input
- IEditorInput newInput = OpenLDAPServerConfigurationEditorUtils.saveAs( getConfiguration(), true );
+ IEditorInput newInput = OpenLdapServerConfigurationEditorUtils.saveAs( getConfiguration(), getSite().getShell(), true );
// Checking if the 'save as' is successful
if ( newInput != null )
Copied: directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/OpenLdapServerConfigurationEditorUtils.java (from r1807178, directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/OpenLDAPServerConfigurationEditorUtils.java)
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/OpenLdapServerConfigurationEditorUtils.java?p2=directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/OpenLdapServerConfigurationEditorUtils.java&p1=directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/OpenLDAPServerConfigurationEditorUtils.java&r1=1807178&r2=1807179&rev=1807179&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/OpenLDAPServerConfigurationEditorUtils.java (original)
+++ directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/OpenLdapServerConfigurationEditorUtils.java Sun Sep 3 22:58:53 2017
@@ -51,6 +51,8 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.PlatformUI;
import org.apache.directory.studio.openldap.config.ExpandedLdifUtils;
@@ -69,76 +71,122 @@ import org.apache.directory.studio.openl
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class OpenLDAPServerConfigurationEditorUtils
+public class OpenLdapServerConfigurationEditorUtils
{
- private OpenLDAPServerConfigurationEditorUtils()
+ private OpenLdapServerConfigurationEditorUtils()
{
// Do nothing
}
/**
- * Performs the "Save as..." action.
+ * Opens a {@link FileDialog} in the UI thread.
*
- * @param configuration the configuration
- * @param newInput a flag to indicate if a new input is required
- * @return the new input for the editor
- * @throws Exception
+ * @param shell the shell
+ * @return the result of the dialog
*/
- public static IEditorInput saveAs( OpenLdapConfiguration configuration, boolean newInput ) throws Exception
+ private static String openFileDialogInUIThread( final Shell shell )
{
- // The path of the directory
- String path = null;
-
- // Creating a dialog for directory selection
- DirectoryDialog dialog = new DirectoryDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow()
- .getShell(), SWT.SAVE );
-
- while ( true )
+ // Defining our own encapsulating class for the result
+ class DialogResult
{
- // Opening the dialog
- path = openDirectoryDialogInUIThread( dialog );
+ private String result;
- // Checking the returned path
- if ( path == null )
+ public String getResult()
{
- // Cancel button has been clicked
- return null;
+ return result;
}
- // Getting the directory indicated by the user
- final File directory = new File( path );
- // Checking if the directory exists
- if ( !directory.exists() )
+ public void setResult( String result )
{
- CommonUIUtils.openErrorDialog( "The directory does not exist." );
- continue;
+ this.result = result;
}
+ }
- // Checking if the location is a directory
- if ( !directory.isDirectory() )
- {
- CommonUIUtils.openErrorDialog( "The location is not a directory." );
- continue;
- }
+ // Creating an object to hold the result
+ final DialogResult result = new DialogResult();
- // Checking if the directory is writable
- if ( !directory.canWrite() )
+ // Opening the dialog in the UI thread
+ Display.getDefault().syncExec( () ->
{
- CommonUIUtils.openErrorDialog( "The directory is not writable." );
- continue;
- }
+ FileDialog dialog = new FileDialog( shell, SWT.SAVE );
+ result.setResult( dialog.open() );
+ } );
+
+ return result.getResult();
+ }
+
+
+ /**
+ * Performs the "Save as..." action.
+ *
+ * @param configuration the configuration
+ * @param newInput a flag to indicate if a new input is required
+ * @return the new input for the editor
+ * @throws Exception
+ */
+ public static IEditorInput saveAs( OpenLdapConfiguration configuration, Shell shell, boolean newInput ) throws Exception
+ {
+ // detect IDE or RCP:
+ // check if perspective org.eclipse.ui.resourcePerspective is available
+ boolean isIDE = CommonUIUtils.isIDEEnvironment();
+ String path = null;
- // Checking if the directory is empty
- if ( !isEmpty( directory ) )
+ if ( isIDE )
+ {
+ }
+ else
+ {
+ boolean canOverwrite = false;
+
+ while ( !canOverwrite )
{
- CommonUIUtils.openErrorDialog( "The directory is not empty." );
- continue;
+ // Opening the dialog
+ // Open FileDialog
+ path = openFileDialogInUIThread( shell );
+
+ // Checking the returned path
+ if ( path == null )
+ {
+ // Cancel button has been clicked
+ return null;
+ }
+
+ // Getting the directory indicated by the user
+ final File directory = new File( path );
+
+ // Checking if the directory exists
+ if ( !directory.exists() )
+ {
+ CommonUIUtils.openErrorDialog( "The directory does not exist." );
+ continue;
+ }
+
+ // Checking if the location is a directory
+ if ( !directory.isDirectory() )
+ {
+ CommonUIUtils.openErrorDialog( "The location is not a directory." );
+ continue;
+ }
+
+ // Checking if the directory is writable
+ if ( !directory.canWrite() )
+ {
+ CommonUIUtils.openErrorDialog( "The directory is not writable." );
+ continue;
+ }
+
+ // Checking if the directory is empty
+ if ( !isEmpty( directory ) )
+ {
+ CommonUIUtils.openErrorDialog( "The directory is not empty." );
+ continue;
+ }
+
+ // The directory meets all requirements
+ break;
}
-
- // The directory meets all requirements
- break;
}
// Saving the file to disk
@@ -327,7 +375,7 @@ public class OpenLDAPServerConfiguration
* @return <code>true</code> if the operation is successful, <code>false</code> if not
* @throws Exception
*/
- public static void saveConfiguration( ConnectionServerConfigurationInput input, OpenLDAPServerConfigurationEditor editor,
+ public static void saveConfiguration( ConnectionServerConfigurationInput input, OpenLdapServerConfigurationEditor editor,
IProgressMonitor monitor ) throws Exception
{
// Getting the browser connection associated with the connection in the input
Modified: directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/databases/DatabasesMasterDetailsBlock.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/databases/DatabasesMasterDetailsBlock.java?rev=1807179&r1=1807178&r2=1807179&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/databases/DatabasesMasterDetailsBlock.java (original)
+++ directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/databases/DatabasesMasterDetailsBlock.java Sun Sep 3 22:58:53 2017
@@ -28,7 +28,7 @@ import org.apache.directory.api.ldap.mod
import org.apache.directory.studio.common.ui.widgets.BaseWidgetUtils;
import org.apache.directory.studio.openldap.common.ui.model.DatabaseTypeEnum;
import org.apache.directory.studio.openldap.config.OpenLdapConfigurationPluginUtils;
-import org.apache.directory.studio.openldap.config.editor.OpenLDAPServerConfigurationEditor;
+import org.apache.directory.studio.openldap.config.editor.OpenLdapServerConfigurationEditor;
import org.apache.directory.studio.openldap.config.editor.dialogs.DatabaseTypeDialog;
import org.apache.directory.studio.openldap.config.editor.pages.DatabasesPage;
import org.apache.directory.studio.openldap.config.editor.wrappers.DatabaseWrapper;
@@ -835,7 +835,7 @@ public class DatabasesMasterDetailsBlock
*/
public void setEditorDirty()
{
- ( ( OpenLDAPServerConfigurationEditor ) page.getEditor() ).setDirty( true );
+ ( ( OpenLdapServerConfigurationEditor ) page.getEditor() ).setDirty( true );
detailsPage.commit( false );
databaseTableViewer.refresh();
}
Modified: directory/studio/branches/studio-value/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/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/PBindAccessOverlayDetailsPage.java?rev=1807179&r1=1807178&r2=1807179&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/PBindAccessOverlayDetailsPage.java (original)
+++ directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/overlays/PBindAccessOverlayDetailsPage.java Sun Sep 3 22:58:53 2017
@@ -89,10 +89,8 @@ public class PBindAccessOverlayDetailsPa
/**
* Creates the General Settings Section
*
- * @param parent
- * the parent composite
- * @param toolkit
- * the toolkit to use
+ * @param parent the parent composite
+ * @param toolkit the toolkit to use
*/
private void createGeneralSettingsSection( Composite parent, FormToolkit toolkit )
{
@@ -119,6 +117,7 @@ public class PBindAccessOverlayDetailsPa
public void selectionChanged( IFormPart part, ISelection selection )
{
IStructuredSelection ssel = ( IStructuredSelection ) selection;
+
if ( ssel.size() == 1 )
{
overlay = ( OlcAccessLogConfig ) ssel.getFirstElement();
Modified: directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/DatabasesPage.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/DatabasesPage.java?rev=1807179&r1=1807178&r2=1807179&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/DatabasesPage.java (original)
+++ directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/DatabasesPage.java Sun Sep 3 22:58:53 2017
@@ -20,7 +20,7 @@
package org.apache.directory.studio.openldap.config.editor.pages;
-import org.apache.directory.studio.openldap.config.editor.OpenLDAPServerConfigurationEditor;
+import org.apache.directory.studio.openldap.config.editor.OpenLdapServerConfigurationEditor;
import org.apache.directory.studio.openldap.config.editor.databases.DatabasesMasterDetailsBlock;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.swt.widgets.Composite;
@@ -52,7 +52,7 @@ public class DatabasesPage extends OpenL
*
* @param editor the associated editor
*/
- public DatabasesPage( OpenLDAPServerConfigurationEditor editor )
+ public DatabasesPage( OpenLdapServerConfigurationEditor editor )
{
super( editor, ID, TITLE );
}
Modified: directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OpenLDAPServerConfigurationEditorPage.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OpenLDAPServerConfigurationEditorPage.java?rev=1807179&r1=1807178&r2=1807179&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OpenLDAPServerConfigurationEditorPage.java (original)
+++ directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OpenLDAPServerConfigurationEditorPage.java Sun Sep 3 22:58:53 2017
@@ -26,7 +26,7 @@ import org.apache.directory.studio.commo
import org.apache.directory.studio.openldap.config.actions.EditorExportConfigurationAction;
import org.apache.directory.studio.openldap.config.actions.EditorImportConfigurationAction;
import org.apache.directory.studio.openldap.config.editor.Messages;
-import org.apache.directory.studio.openldap.config.editor.OpenLDAPServerConfigurationEditor;
+import org.apache.directory.studio.openldap.config.editor.OpenLdapServerConfigurationEditor;
import org.apache.directory.studio.openldap.config.model.OpenLdapConfiguration;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.Separator;
@@ -91,7 +91,7 @@ public abstract class OpenLDAPServerConf
*
* @param editor the associated editor
*/
- public OpenLDAPServerConfigurationEditorPage( OpenLDAPServerConfigurationEditor editor, String id, String title )
+ public OpenLDAPServerConfigurationEditorPage( OpenLdapServerConfigurationEditor editor, String id, String title )
{
super( editor, id, title );
}
@@ -102,9 +102,9 @@ public abstract class OpenLDAPServerConf
*
* @return the ServerConfigurationEditor object associated with the page
*/
- public OpenLDAPServerConfigurationEditor getServerConfigurationEditor()
+ public OpenLdapServerConfigurationEditor getServerConfigurationEditor()
{
- return ( OpenLDAPServerConfigurationEditor ) getEditor();
+ return ( OpenLdapServerConfigurationEditor ) getEditor();
}
@@ -151,7 +151,7 @@ public abstract class OpenLDAPServerConf
FormToolkit toolkit = managedForm.getToolkit();
toolkit.decorateFormHeading( form.getForm() );
- OpenLDAPServerConfigurationEditor editor = ( OpenLDAPServerConfigurationEditor ) getEditor();
+ OpenLdapServerConfigurationEditor editor = ( OpenLdapServerConfigurationEditor ) getEditor();
IToolBarManager toolbarManager = form.getToolBarManager();
toolbarManager.add( new EditorImportConfigurationAction( editor ) );
Modified: directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OptionsPage.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OptionsPage.java?rev=1807179&r1=1807178&r2=1807179&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OptionsPage.java (original)
+++ directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OptionsPage.java Sun Sep 3 22:58:53 2017
@@ -37,7 +37,7 @@ import org.apache.directory.studio.openl
import org.apache.directory.studio.openldap.common.ui.model.RequireConditionEnum;
import org.apache.directory.studio.openldap.common.ui.model.RestrictOperationEnum;
import org.apache.directory.studio.openldap.config.OpenLdapConfigurationPluginUtils;
-import org.apache.directory.studio.openldap.config.editor.OpenLDAPServerConfigurationEditor;
+import org.apache.directory.studio.openldap.config.editor.OpenLdapServerConfigurationEditor;
import org.apache.directory.studio.openldap.config.editor.wrappers.AllowFeatureDecorator;
import org.apache.directory.studio.openldap.config.editor.wrappers.DisallowFeatureDecorator;
import org.apache.directory.studio.openldap.config.editor.wrappers.OrderedStringValueDecorator;
@@ -395,7 +395,7 @@ public class OptionsPage extends OpenLDA
*
* @param editor the associated editor
*/
- public OptionsPage( OpenLDAPServerConfigurationEditor editor )
+ public OptionsPage( OpenLdapServerConfigurationEditor editor )
{
super( editor, ID, TITLE );
}
Modified: directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OverlaysPage.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OverlaysPage.java?rev=1807179&r1=1807178&r2=1807179&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OverlaysPage.java (original)
+++ directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OverlaysPage.java Sun Sep 3 22:58:53 2017
@@ -22,7 +22,7 @@ package org.apache.directory.studio.open
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.apache.directory.studio.openldap.config.editor.OpenLDAPServerConfigurationEditor;
+import org.apache.directory.studio.openldap.config.editor.OpenLdapServerConfigurationEditor;
import org.apache.directory.studio.openldap.config.editor.overlays.OverlaysMasterDetailsBlock;
@@ -48,7 +48,7 @@ public class OverlaysPage extends OpenLD
* @param editor
* the associated editor
*/
- public OverlaysPage( OpenLDAPServerConfigurationEditor editor )
+ public OverlaysPage( OpenLdapServerConfigurationEditor editor )
{
super( editor, ID, TITLE );
}
Modified: directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OverviewPage.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OverviewPage.java?rev=1807179&r1=1807178&r2=1807179&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OverviewPage.java (original)
+++ directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OverviewPage.java Sun Sep 3 22:58:53 2017
@@ -30,7 +30,7 @@ import org.apache.directory.studio.commo
import org.apache.directory.studio.openldap.common.ui.model.LogLevelEnum;
import org.apache.directory.studio.openldap.common.ui.dialogs.LogLevelDialog;
import org.apache.directory.studio.openldap.config.OpenLdapConfigurationPluginUtils;
-import org.apache.directory.studio.openldap.config.editor.OpenLDAPServerConfigurationEditor;
+import org.apache.directory.studio.openldap.config.editor.OpenLdapServerConfigurationEditor;
import org.apache.directory.studio.openldap.config.editor.overlays.ModuleWrapper;
import org.apache.directory.studio.openldap.config.editor.overlays.ModuleWrapperLabelProvider;
import org.apache.directory.studio.openldap.config.editor.overlays.ModuleWrapperViewerSorter;
@@ -232,7 +232,7 @@ public class OverviewPage extends OpenLD
*
* @param editor the associated editor
*/
- public OverviewPage( OpenLDAPServerConfigurationEditor editor )
+ public OverviewPage( OpenLdapServerConfigurationEditor editor )
{
super( editor, ID, TITLE );
}
Modified: directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/SecurityPage.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/SecurityPage.java?rev=1807179&r1=1807178&r2=1807179&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/SecurityPage.java (original)
+++ directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/SecurityPage.java Sun Sep 3 22:58:53 2017
@@ -44,7 +44,7 @@ import org.apache.directory.studio.commo
import org.apache.directory.studio.common.ui.widgets.TableWidget;
import org.apache.directory.studio.common.ui.widgets.WidgetModifyListener;
import org.apache.directory.studio.openldap.common.ui.model.PasswordHashEnum;
-import org.apache.directory.studio.openldap.config.editor.OpenLDAPServerConfigurationEditor;
+import org.apache.directory.studio.openldap.config.editor.OpenLdapServerConfigurationEditor;
import org.apache.directory.studio.openldap.config.editor.dialogs.OverlayDialog;
import org.apache.directory.studio.openldap.config.editor.dialogs.SaslSecPropsDialog;
import org.apache.directory.studio.openldap.config.editor.wrappers.PasswordHashDecorator;
@@ -423,7 +423,7 @@ public class SecurityPage extends OpenLD
*
* @param editor the associated editor
*/
- public SecurityPage( OpenLDAPServerConfigurationEditor editor )
+ public SecurityPage( OpenLdapServerConfigurationEditor editor )
{
super( editor, ID, TITLE );
}
Modified: directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/TuningPage.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/TuningPage.java?rev=1807179&r1=1807178&r2=1807179&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/TuningPage.java (original)
+++ directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/TuningPage.java Sun Sep 3 22:58:53 2017
@@ -44,7 +44,7 @@ import org.apache.directory.studio.commo
import org.apache.directory.studio.common.ui.widgets.BaseWidgetUtils;
import org.apache.directory.studio.common.ui.widgets.TableWidget;
import org.apache.directory.studio.common.ui.widgets.WidgetModifyListener;
-import org.apache.directory.studio.openldap.config.editor.OpenLDAPServerConfigurationEditor;
+import org.apache.directory.studio.openldap.config.editor.OpenLdapServerConfigurationEditor;
import org.apache.directory.studio.openldap.config.editor.dialogs.OverlayDialog;
import org.apache.directory.studio.openldap.config.editor.dialogs.SizeLimitDialog;
import org.apache.directory.studio.openldap.config.editor.wrappers.LimitWrapper;
@@ -205,7 +205,7 @@ public class TuningPage extends OpenLDAP
*
* @param editor the associated editor
*/
- public TuningPage( OpenLDAPServerConfigurationEditor editor )
+ public TuningPage( OpenLdapServerConfigurationEditor editor )
{
super( editor, ID, TITLE );
}
Modified: directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/jobs/LoadConfigurationRunnable.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/jobs/LoadConfigurationRunnable.java?rev=1807179&r1=1807178&r2=1807179&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/jobs/LoadConfigurationRunnable.java (original)
+++ directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/jobs/LoadConfigurationRunnable.java Sun Sep 3 22:58:53 2017
@@ -30,7 +30,7 @@ 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.NewServerConfigurationInput;
-import org.apache.directory.studio.openldap.config.editor.OpenLDAPServerConfigurationEditor;
+import org.apache.directory.studio.openldap.config.editor.OpenLdapServerConfigurationEditor;
import org.apache.directory.studio.openldap.config.model.OlcGlobal;
import org.apache.directory.studio.openldap.config.model.OpenLdapConfiguration;
import org.apache.directory.studio.openldap.config.model.io.ConfigurationReader;
@@ -44,7 +44,7 @@ import org.apache.directory.studio.openl
public class LoadConfigurationRunnable implements StudioRunnableWithProgress
{
/** The associated editor */
- private OpenLDAPServerConfigurationEditor editor;
+ private OpenLdapServerConfigurationEditor editor;
/**
@@ -52,7 +52,7 @@ public class LoadConfigurationRunnable i
*
* @param editor the editor
*/
- public LoadConfigurationRunnable( OpenLDAPServerConfigurationEditor editor )
+ public LoadConfigurationRunnable( OpenLdapServerConfigurationEditor editor )
{
this.editor = editor;
}
Added: directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/OpenLdapConfigFormat.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/OpenLdapConfigFormat.java?rev=1807179&view=auto
==============================================================================
--- directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/OpenLdapConfigFormat.java (added)
+++ directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/OpenLdapConfigFormat.java Sun Sep 3 22:58:53 2017
@@ -0,0 +1,31 @@
+/*
+ * 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.model;
+
+/**
+ * The OpenLDAP configuration format : either static (slapd.conf) or dynamic (slapd.d).
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public enum OpenLdapConfigFormat
+{
+ STATIC, // slapd.d
+ DYNAMIC; // slapd.conf
+}
Added: directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/OpenLdapVersion.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/OpenLdapVersion.java?rev=1807179&view=auto
==============================================================================
--- directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/OpenLdapVersion.java (added)
+++ directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/OpenLdapVersion.java Sun Sep 3 22:58:53 2017
@@ -0,0 +1,130 @@
+/*
+ * 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.model;
+
+/**
+ * The various OpenLDAP versions
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public enum OpenLdapVersion
+{
+ VERSION_2_4_0( "2.4.0" ), // Most of the configuration AT were already defined in 2.4.0
+ // Version prior to 2.4.6 were beta or alpha
+ VERSION_2_4_6( "2.4.6" ), // olcSortVals, olcServerID, olcTLSCRLFile
+ VERSION_2_4_7( "2.4.7" ), // olcIndexIntLen
+ VERSION_2_4_8( "2.4.8" ), //olcDbCryptFile, olcDbCryptKey, olcDbSocketPath, olcDbSocketExtensions, olcMemberOfDanglingError
+ VERSION_2_4_9( "2.4.9" ),
+ VERSION_2_4_10( "2.4.10" ), // olcRefintModifiersName
+ VERSION_2_4_11( "2.4.11" ),
+ VERSION_2_4_12( "2.4.12" ), // olcDbNoRefs, olcDbNoUndefFilter, olcLdapSyntaxes
+ VERSION_2_4_13( "2.4.13" ), // olcDbPageSize, olcAddContentAcl
+ VERSION_2_4_14( "2.4.14" ),
+ VERSION_2_4_15( "2.4.15" ),
+ VERSION_2_4_16( "2.4.16" ),
+ VERSION_2_4_17( "2.4.17" ), // olcPPolicyForwardUpdates, olcSaslAuxprops, olcWriteTimeout
+ VERSION_2_4_18( "2.4.18" ), // olcTCPBuffer
+ VERSION_2_4_19( "2.4.19" ),
+ VERSION_2_4_20( "2.4.20" ), // olcSyncUseSubentry
+ VERSION_2_4_21( "2.4.21" ),
+ VERSION_2_4_22( "2.4.22" ), // olcExtraAttrs, olcDbIDAssertPassThru, olcSaslAuxpropsDontUseCopy, olcSaslAuxpropsDontUseCopyIgnore
+ VERSION_2_4_23( "2.4.23" ),
+ VERSION_2_4_24( "2.4.24" ), // olcDbBindAllowed
+ VERSION_2_4_25( "2.4.25" ),
+ VERSION_2_4_26( "2.4.26" ),
+ VERSION_2_4_27( "2.4.27" ), // olcDbMaxReaders, olcDbMaxSize, olcDbMode, olcDbNoSync, olcDbSearchStack
+ VERSION_2_4_28( "2.4.28" ),
+ VERSION_2_4_29( "2.4.29" ),
+ VERSION_2_4_30( "2.4.30" ),
+ VERSION_2_4_31( "2.4.31" ),
+ VERSION_2_4_32( "2.4.32" ),
+ VERSION_2_4_33( "2.4.33" ), // olcDbEnvFlags
+ VERSION_2_4_34( "2.4.34" ), // olcDbKeepalive, olcDbOnErr, olcIndexHash64
+ VERSION_2_4_35( "2.4.35" ),
+ VERSION_2_4_36( "2.4.36" ), // olcDisabled, olcListenerThreads, olcThreadQueues
+ VERSION_2_4_37( "2.4.37" ), // olcTLSProtocolMin
+ VERSION_2_4_38( "2.4.38" ),
+ VERSION_2_4_39( "2.4.39" ),
+ VERSION_2_4_40( "2.4.40" ),
+ VERSION_2_4_41( "2.4.41" ),
+ VERSION_2_4_42( "2.4.42" ),
+ VERSION_2_4_43( "2.4.43" ),
+ VERSION_2_4_44( "2.4.44" ),
+ VERSION_2_4_45( "2.4.45" );
+
+ /** The interned version */
+ private String version;
+
+ /**
+ * A private constructor
+ * @param version
+ */
+ private OpenLdapVersion( String version )
+ {
+ this.version = version;
+ }
+
+
+ /**
+ * Get the enum associated to a String
+ *
+ * @param version The version we are looking at
+ * @return The found version, or VERSION_2_4_0 of not found.
+ */
+ public static OpenLdapVersion getVersion( String version )
+ {
+ for ( OpenLdapVersion openLDAPVersion : OpenLdapVersion.values() )
+ {
+ if ( openLDAPVersion.version.equalsIgnoreCase( version ) )
+ {
+ return openLDAPVersion;
+ }
+ }
+
+ return OpenLdapVersion.VERSION_2_4_0;
+ }
+
+
+ /**
+ * @return The interned String representation for this value
+ */
+ public String getValue()
+ {
+ return version;
+ }
+
+
+ /**
+ * @return An array containing all the interned versions as String in reverse order (newest first)
+ */
+ public static String[] getVersions()
+ {
+ OpenLdapVersion[] values = OpenLdapVersion.values();
+ String[] versions = new String[values.length];
+ int i = values.length - 1;
+
+ for ( OpenLdapVersion value : values )
+ {
+ versions[i--] = value.version;
+ }
+
+ return versions;
+ }
+}
Modified: directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/io/ConfigurationReader.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/io/ConfigurationReader.java?rev=1807179&r1=1807178&r2=1807179&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/io/ConfigurationReader.java (original)
+++ directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/io/ConfigurationReader.java Sun Sep 3 22:58:53 2017
@@ -63,7 +63,7 @@ import org.apache.directory.studio.openl
import org.apache.directory.studio.openldap.config.OpenLdapConfigurationPlugin;
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.OpenLDAPServerConfigurationEditorUtils;
+import org.apache.directory.studio.openldap.config.editor.OpenLdapServerConfigurationEditorUtils;
import org.apache.directory.studio.openldap.config.jobs.EntryBasedConfigurationPartition;
import org.apache.directory.studio.openldap.config.model.AuxiliaryObjectClass;
import org.apache.directory.studio.openldap.config.model.ConfigurationElement;
@@ -359,7 +359,7 @@ public class ConfigurationReader
// Create the set of candidates
for ( Value objectClassValue : objectClassAttribute )
{
- ObjectClass oc = OpenLDAPServerConfigurationEditorUtils.getObjectClass( schemaManager,
+ ObjectClass oc = OpenLdapServerConfigurationEditorUtils.getObjectClass( schemaManager,
objectClassValue.getValue() );
if ( ( oc != null ) && ( oc.isStructural() ) )
@@ -371,14 +371,14 @@ public class ConfigurationReader
// Now find the parent OC
for ( Value objectClassValue : objectClassAttribute )
{
- ObjectClass oc = OpenLDAPServerConfigurationEditorUtils.getObjectClass( schemaManager,
+ ObjectClass oc = OpenLdapServerConfigurationEditorUtils.getObjectClass( schemaManager,
objectClassValue.getValue() );
if ( oc != null )
{
for ( String superiorName : oc.getSuperiorOids() )
{
- ObjectClass superior = OpenLDAPServerConfigurationEditorUtils.getObjectClass( schemaManager,
+ ObjectClass superior = OpenLdapServerConfigurationEditorUtils.getObjectClass( schemaManager,
superiorName );
if ( ( superior != null ) && ( superior.isStructural() )
@@ -421,7 +421,7 @@ public class ConfigurationReader
{
for ( Value objectClassValue : objectClassAttribute )
{
- ObjectClass oc = OpenLDAPServerConfigurationEditorUtils.getObjectClass( schemaManager,
+ ObjectClass oc = OpenLdapServerConfigurationEditorUtils.getObjectClass( schemaManager,
objectClassValue.getValue() );
if ( ( oc != null ) && ( oc.isAuxiliary() ) )
@@ -464,7 +464,7 @@ public class ConfigurationReader
// The DN corresponding to the configuration base
// Creating the configuration partition
- EntryBasedConfigurationPartition configurationPartition = OpenLDAPServerConfigurationEditorUtils
+ EntryBasedConfigurationPartition configurationPartition = OpenLdapServerConfigurationEditorUtils
.createConfigurationPartition( schemaManager, configurationDn );
// Opening the connection (if needed)
Modified: directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/io/ConfigurationWriter.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/io/ConfigurationWriter.java?rev=1807179&r1=1807178&r2=1807179&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/io/ConfigurationWriter.java (original)
+++ directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/io/ConfigurationWriter.java Sun Sep 3 22:58:53 2017
@@ -41,9 +41,10 @@ import org.apache.directory.api.ldap.mod
import org.apache.directory.api.ldap.model.name.Rdn;
import org.apache.directory.api.ldap.model.schema.ObjectClass;
import org.apache.directory.api.ldap.model.schema.SchemaManager;
+import org.apache.directory.api.util.Strings;
import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
import org.apache.directory.studio.openldap.config.OpenLdapConfigurationPlugin;
-import org.apache.directory.studio.openldap.config.editor.OpenLDAPServerConfigurationEditorUtils;
+import org.apache.directory.studio.openldap.config.editor.OpenLdapServerConfigurationEditorUtils;
import org.apache.directory.studio.openldap.config.model.AuxiliaryObjectClass;
import org.apache.directory.studio.openldap.config.model.ConfigurationElement;
import org.apache.directory.studio.openldap.config.model.OlcConfig;
@@ -72,10 +73,8 @@ public class ConfigurationWriter
/**
* Creates a new instance of ConfigWriter.
*
- * @param browserConnection
- * the browser connection
- * @param configuration
- * the configuration
+ * @param browserConnection the browser connection
+ * @param configuration the configuration
*/
public ConfigurationWriter( IBrowserConnection browserConnection, OpenLdapConfiguration configuration )
{
@@ -87,8 +86,7 @@ public class ConfigurationWriter
/**
* Creates a new instance of ConfigWriter.
*
- * @param configuration
- * the configuration
+ * @param configuration the configuration
*/
public ConfigurationWriter( OpenLdapConfiguration configuration )
{
@@ -154,7 +152,7 @@ public class ConfigurationWriter
// Checking auxiliary object classes
List<AuxiliaryObjectClass> auxiliaryObjectClassesList = configurationBean.getAuxiliaryObjectClasses();
- if ( ( auxiliaryObjectClassesList != null ) && auxiliaryObjectClassesList.isEmpty() )
+ if ( ( auxiliaryObjectClassesList != null ) && !auxiliaryObjectClassesList.isEmpty() )
{
for ( AuxiliaryObjectClass auxiliaryObjectClass : auxiliaryObjectClassesList )
{
@@ -202,9 +200,7 @@ public class ConfigurationWriter
if ( ( configurationBean != null ) && ( beanClass != null ) && ( entry != null ) )
{
// Looping on all fields of the bean
- Field[] fields = beanClass.getDeclaredFields();
-
- for ( Field field : fields )
+ for ( Field field : beanClass.getDeclaredFields() )
{
// Making the field accessible (we get an exception if we don't do that)
field.setAccessible( true );
@@ -223,27 +219,16 @@ public class ConfigurationWriter
// Checking if we have a value for the attribute type
String attributeType = configurationElement.attributeType();
- if ( ( attributeType != null ) && ( !"".equals( attributeType ) ) )
+ if ( !Strings.isEmpty( attributeType ) )
{
- // Checking if the field is optional and if the default value matches
- if ( configurationElement.isOptional() &&
- configurationElement.defaultValue().equalsIgnoreCase( fieldValue.toString() ) )
- {
- // Skipping the addition of the value
- continue;
- }
-
- // Adding values to the entry
- addAttributeTypeValues( configurationElement.attributeType(), fieldValue, entry );
-
- continue;
+ // Adding values to the entry, and if it's empty, add the default value
+ addAttributeTypeValues( configurationElement, fieldValue, entry );
}
-
- // Checking if we're dealing with a AdsBaseBean subclass type
- if ( OlcConfig.class.isAssignableFrom( fieldClass ) )
+
+ else if ( OlcConfig.class.isAssignableFrom( fieldClass ) )
{
+ // Checking if we're dealing with a AdsBaseBean subclass type
addConfigurationBean( ( OlcConfig ) fieldValue, entry.getDn() );
- continue;
}
}
}
@@ -255,12 +240,9 @@ public class ConfigurationWriter
/**
* Gets the Dn associated with the configuration bean.
*
- * @param bean
- * the configuration bean
- * @param parentDn
- * the parent dn
- * @return
- * the Dn associated with the configuration bean based on the given base Dn.
+ * @param bean the configuration bean
+ * @param parentDn the parent dn
+ * @return the Dn associated with the configuration bean based on the given base Dn.
* @throws LdapInvalidDnException
* @throws IllegalArgumentException
* @throws IllegalAccessException
@@ -285,8 +267,7 @@ public class ConfigurationWriter
}
// Looping on all fields of the bean
- Field[] fields = beanClass.getDeclaredFields();
- for ( Field field : fields )
+ for ( Field field : beanClass.getDeclaredFields() )
{
// Making the field accessible (we get an exception if we don't do that)
field.setAccessible( true );
@@ -294,9 +275,11 @@ public class ConfigurationWriter
// Looking for the @ConfigurationElement annotation and
// if the field is the Rdn
ConfigurationElement configurationElement = field.getAnnotation( ConfigurationElement.class );
+
if ( ( configurationElement != null ) && ( configurationElement.isRdn() ) )
{
Object value = field.get( bean );
+
if ( value == null )
{
continue;
@@ -309,10 +292,21 @@ public class ConfigurationWriter
if ( values.isEmpty() )
{
- continue;
+ String defaultValue = configurationElement.defaultValue();
+
+ if ( defaultValue != null )
+ {
+ value = defaultValue;
+ }
+ else
+ {
+ continue;
+ }
+ }
+ else
+ {
+ value = values.toArray()[0];
}
-
- value = values.toArray()[0];
}
if ( ( bean.getParentDn() != null ) )
@@ -338,14 +332,13 @@ public class ConfigurationWriter
/**
* Gets the name of the object class to use for the given bean class.
*
- * @param c
- * the bean class
- * @return
- * the name of the object class to use for the given bean class
+ * @param clazz the bean class
+ * @return the name of the object class to use for the given bean class
*/
- private String getObjectClassNameForBean( Class<?> c )
+ private String getObjectClassNameForBean( Class<?> clazz )
{
- String classNameWithPackage = getClassNameWithoutPackageName( c );
+ String classNameWithPackage = getClassNameWithoutPackageName( clazz );
+
return Character.toLowerCase( classNameWithPackage.charAt( 0 ) ) + classNameWithPackage.substring( 1 );
}
@@ -353,16 +346,15 @@ public class ConfigurationWriter
/**
* Gets the class name of the given class stripped from its package name.
*
- * @param c
- * the class
- * @return
- * the class name of the given class stripped from its package name
+ * @param clazz the class
+ * @return the class name of the given class stripped from its package name
*/
- private String getClassNameWithoutPackageName( Class<?> c )
+ private String getClassNameWithoutPackageName( Class<?> clazz )
{
- String className = c.getName();
+ String className = clazz.getName();
int firstChar = className.lastIndexOf( '.' ) + 1;
+
if ( firstChar > 0 )
{
return className.substring( firstChar );
@@ -375,12 +367,9 @@ public class ConfigurationWriter
/**
* Writes the configuration bean as LDIF to the given file.
*
- * @param path
- * the output file path
- * @throws ConfigurationException
- * if an error occurs during the conversion to LDIF
- * @throws IOException
- * if an error occurs when writing the file
+ * @param path the output file path
+ * @throws ConfigurationException if an error occurs during the conversion to LDIF
+ * @throws IOException if an error occurs when writing the file
*/
public void writeToPath( String path ) throws ConfigurationException, IOException
{
@@ -391,12 +380,9 @@ public class ConfigurationWriter
/**
* Writes the configuration bean as LDIF to the given file.
*
- * @param file
- * the output file
- * @throws ConfigurationException
- * if an error occurs during the conversion to LDIF
- * @throws IOException
- * if an error occurs when writing the file
+ * @param file the output file
+ * @throws ConfigurationException if an error occurs during the conversion to LDIF
+ * @throws IOException if an error occurs when writing the file
*/
public void writeToFile( File file ) throws ConfigurationException, IOException
{
@@ -411,11 +397,8 @@ public class ConfigurationWriter
/**
* Writes the configuration to a String object.
*
- * @return
- * a String containing the LDIF
- * representation of the configuration
- * @throws ConfigurationException
- * if an error occurs during the conversion to LDIF
+ * @return a String containing the LDIF representation of the configuration
+ * @throws ConfigurationException if an error occurs during the conversion to LDIF
*/
public String writeToString() throws ConfigurationException
{
@@ -425,6 +408,7 @@ public class ConfigurationWriter
// Building the StringBuilder
StringBuilder sb = new StringBuilder();
sb.append( "version: 1\n" );
+
for ( LdifEntry entry : entries )
{
sb.append( entry.toString() );
@@ -438,19 +422,10 @@ public class ConfigurationWriter
* Gets the converted LDIF entries from the configuration bean.
*
* @param browserConnection the browserConnection
- * @return
- * the list of converted LDIF entries
- * @throws ConfigurationException
- * if an error occurs during the conversion to LDIF
- */
- /**
- * TODO getConvertedLdifEntries.
- *
- * @return
- * @throws ConfigurationException
+ * @return the list of converted LDIF entries
+ * @throws ConfigurationException if an error occurs during the conversion to LDIF
*/
- public List<LdifEntry> getConvertedLdifEntries()
- throws ConfigurationException
+ public List<LdifEntry> getConvertedLdifEntries() throws ConfigurationException
{
// Converting the configuration bean to a list of LDIF entries
convertConfigurationBeanToLdifEntries( ConfigurationUtils.getConfigurationDn( browserConnection ) );
@@ -463,10 +438,8 @@ public class ConfigurationWriter
/**
* Gets the converted LDIF entries from the configuration bean.
*
- * @return
- * the list of converted LDIF entries
- * @throws ConfigurationException
- * if an error occurs during the conversion to LDIF
+ * @return the list of converted LDIF entries
+ * @throws ConfigurationException if an error occurs during the conversion to LDIF
*/
public List<LdifEntry> getConvertedLdifEntries( Dn configurationDn ) throws ConfigurationException
{
@@ -481,10 +454,8 @@ public class ConfigurationWriter
/**
* Adds the computed 'objectClass' attribute for the given entry and object class name.
*
- * @param entry
- * the entry
- * @param objectClass
- * the object class name
+ * @param entry the entry
+ * @param objectClass the object class name
* @throws LdapException
*/
private void addObjectClassAttribute( LdifEntry entry, String objectClass )
@@ -492,7 +463,7 @@ public class ConfigurationWriter
{
try
{
- ObjectClass objectClassObject = OpenLDAPServerConfigurationEditorUtils.getObjectClass( OpenLdapConfigurationPlugin
+ ObjectClass objectClassObject = OpenLdapServerConfigurationEditorUtils.getObjectClass( OpenLdapConfigurationPlugin
.getDefault().getSchemaManager(), objectClass );
if ( objectClassObject != null )
@@ -519,12 +490,9 @@ public class ConfigurationWriter
/**
* Recursively computes the 'objectClass' attribute values set.
*
- * @param schemaManager
- * the schema manager
- * @param objectClassAttributeValues
- * the set containing the values
- * @param objectClass
- * the current object class
+ * @param schemaManager the schema manager
+ * @param objectClassAttributeValues the set containing the values
+ * @param objectClass the current object class
* @throws LdapException
*/
private void computeObjectClassAttributeValues( Set<String> objectClassAttributeValues, ObjectClass objectClass )
@@ -534,7 +502,7 @@ public class ConfigurationWriter
{
SchemaManager schemaManager = OpenLdapConfigurationPlugin.getDefault().getSchemaManager();
- ObjectClass topObjectClass = OpenLDAPServerConfigurationEditorUtils.getObjectClass( schemaManager,
+ ObjectClass topObjectClass = OpenLdapServerConfigurationEditorUtils.getObjectClass( schemaManager,
SchemaConstants.TOP_OC );
if ( topObjectClass != null )
@@ -556,7 +524,7 @@ public class ConfigurationWriter
{
for ( String superior : superiors )
{
- ObjectClass superiorObjectClass = OpenLDAPServerConfigurationEditorUtils.getObjectClass( schemaManager,
+ ObjectClass superiorObjectClass = OpenLdapServerConfigurationEditorUtils.getObjectClass( schemaManager,
superior );
computeObjectClassAttributeValues( objectClassAttributeValues, superiorObjectClass );
}
@@ -577,17 +545,16 @@ public class ConfigurationWriter
/**
* Adds values for an attribute type to the given entry.
*
- * @param attributeType
- * the attribute type
- * @param value
- * the value
- * @param entry
- * the entry
+ * @param attributeType the attribute type
+ * @param value the value
+ * @param entry the entry
* @throws org.apache.directory.api.ldap.model.exception.LdapException
*/
- private void addAttributeTypeValues( String attributeType, Object o, LdifEntry entry )
+ private void addAttributeTypeValues( ConfigurationElement configurationElement, Object o, LdifEntry entry )
throws LdapException
{
+ String attributeType = configurationElement.attributeType();
+
// We don't store a 'null' value
if ( o != null )
{
@@ -597,6 +564,51 @@ public class ConfigurationWriter
// Adding each single value separately
Collection<?> values = ( Collection<?> ) o;
+ if ( values.isEmpty() )
+ {
+ if ( !configurationElement.isOptional() )
+ {
+ // Add the default value
+ addAttributeTypeValue( attributeType, configurationElement.defaultValue(), entry );
+ }
+ }
+ else
+ {
+ for ( Object value : values )
+ {
+ addAttributeTypeValue( attributeType, value, entry );
+ }
+ }
+ }
+ else
+ {
+ // Adding the single value
+ addAttributeTypeValue( attributeType, o, entry );
+ }
+ }
+ }
+
+
+ /**
+ * Adds values for an attribute type to the given entry.
+ *
+ * @param attributeType the attribute type
+ * @param value the value
+ * @param entry the entry
+ * @throws org.apache.directory.api.ldap.model.exception.LdapException
+ */
+ private void addAttributeTypeValues( String attributeType, Object object, LdifEntry entry )
+ throws LdapException
+ {
+ // We don't store a 'null' value
+ if ( object != null )
+ {
+ // Is the value multiple?
+ if ( isMultiple( object.getClass() ) )
+ {
+ // Adding each single value separately
+ Collection<?> values = ( Collection<?> ) object;
+
for ( Object value : values )
{
addAttributeTypeValue( attributeType, value, entry );
@@ -605,7 +617,7 @@ public class ConfigurationWriter
else
{
// Adding the single value
- addAttributeTypeValue( attributeType, o, entry );
+ addAttributeTypeValue( attributeType, object, entry );
}
}
}
@@ -615,12 +627,9 @@ public class ConfigurationWriter
* Adds a value, either byte[] or another type (converted into a String
* via the Object.toString() method), to the attribute.
*
- * @param attributeType
- * the attribute type
- * @param value
- * the value
- * @param entry
- * the entry
+ * @param attributeType the attribute type
+ * @param value the value
+ * @param entry the entry
*/
private void addAttributeTypeValue( String attributeType, Object value, LdifEntry entry ) throws LdapException
{
@@ -662,11 +671,8 @@ public class ConfigurationWriter
/**
* Indicates the given type is multiple.
*
- * @param clazz
- * the class
- * @return
- * <code>true</code> if the given is multiple,
- * <code>false</code> if not.
+ * @param clazz the class
+ * @return <code>true</code> if the given is multiple, <code>false</code> if not.
*/
private boolean isMultiple( Class<?> clazz )
{
Modified: directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/io/SaveConfigurationRunnable.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/io/SaveConfigurationRunnable.java?rev=1807179&r1=1807178&r2=1807179&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/io/SaveConfigurationRunnable.java (original)
+++ directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/io/SaveConfigurationRunnable.java Sun Sep 3 22:58:53 2017
@@ -28,8 +28,9 @@ 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.OpenLDAPServerConfigurationEditor;
-import org.apache.directory.studio.openldap.config.editor.OpenLDAPServerConfigurationEditorUtils;
+import org.apache.directory.studio.openldap.config.editor.NewServerConfigurationInput;
+import org.apache.directory.studio.openldap.config.editor.OpenLdapServerConfigurationEditor;
+import org.apache.directory.studio.openldap.config.editor.OpenLdapServerConfigurationEditorUtils;
/**
@@ -40,7 +41,7 @@ import org.apache.directory.studio.openl
public class SaveConfigurationRunnable implements StudioRunnableWithProgress
{
/** The associated editor */
- private OpenLDAPServerConfigurationEditor editor;
+ private OpenLdapServerConfigurationEditor editor;
/**
@@ -49,7 +50,7 @@ public class SaveConfigurationRunnable i
* @param editor
* the editor
*/
- public SaveConfigurationRunnable( OpenLDAPServerConfigurationEditor editor )
+ public SaveConfigurationRunnable( OpenLdapServerConfigurationEditor editor )
{
super();
this.editor = editor;
@@ -100,17 +101,25 @@ public class SaveConfigurationRunnable i
if ( input instanceof ConnectionServerConfigurationInput )
{
// Saving the ServerConfiguration to the connection
- OpenLDAPServerConfigurationEditorUtils.saveConfiguration( ( ConnectionServerConfigurationInput ) input,
+ OpenLdapServerConfigurationEditorUtils.saveConfiguration( ( ConnectionServerConfigurationInput ) input,
editor, monitor );
success = true;
}
else if ( input instanceof DirectoryServerConfigurationInput )
{
// Saving the ServerConfiguration to the 'slapd.d' directory
- OpenLDAPServerConfigurationEditorUtils.saveConfiguration( editor.getConfiguration(),
+ OpenLdapServerConfigurationEditorUtils.saveConfiguration( editor.getConfiguration(),
( ( DirectoryServerConfigurationInput ) input ).getDirectory() );
success = true;
}
+ else if ( input instanceof NewServerConfigurationInput )
+ {
+ // The 'ServerConfigurationEditorInput' class is used when a
+ // new Server Configuration File is created.
+
+ // We are saving this as if it is a "Save as..." action.
+ editor.doSaveAs( monitor );
+ }
editor.setDirty( !success );
}
Added: directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/wizards/Messages.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/wizards/Messages.java?rev=1807179&view=auto
==============================================================================
--- directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/wizards/Messages.java (added)
+++ directory/studio/branches/studio-value/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/wizards/Messages.java Sun Sep 3 22:58:53 2017
@@ -0,0 +1,54 @@
+/*
+ * 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.wizards;
+
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+
+/**
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class Messages
+{
+ private static final String BUNDLE_NAME = "org.apache.directory.studio.openldap.config.wizards"; //$NON-NLS-1$
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
+
+
+ private Messages()
+ {
+ }
+
+
+ public static String getString( String key )
+ {
+ try
+ {
+ return RESOURCE_BUNDLE.getString( key );
+ }
+ catch ( MissingResourceException e )
+ {
+ return '!' + key + '!';
+ }
+ }
+}