directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1672089 - /directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/databases/MdbDatabaseSpecificDetailsBlock.java
Date Wed, 08 Apr 2015 13:45:08 GMT
Author: elecharny
Date: Wed Apr  8 13:45:07 2015
New Revision: 1672089

URL: http://svn.apache.org/r1672089
Log:
o Added the two missing envFlags and maxEntrySize attributes.
o Expose those attributes only when they are present in the schema.

Modified:
    directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/databases/MdbDatabaseSpecificDetailsBlock.java

Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/databases/MdbDatabaseSpecificDetailsBlock.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/databases/MdbDatabaseSpecificDetailsBlock.java?rev=1672089&r1=1672088&r2=1672089&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/databases/MdbDatabaseSpecificDetailsBlock.java
(original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/databases/MdbDatabaseSpecificDetailsBlock.java
Wed Apr  8 13:45:07 2015
@@ -22,6 +22,8 @@ package org.apache.directory.studio.open
 
 import org.apache.directory.api.util.Strings;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+import org.apache.directory.studio.openldap.config.model.database.OlcMdbConfig;
+import org.apache.directory.studio.openldap.config.model.widgets.IndicesWidget;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.VerifyEvent;
 import org.eclipse.swt.events.VerifyListener;
@@ -31,30 +33,80 @@ import org.eclipse.swt.widgets.Composite
 import org.eclipse.swt.widgets.Text;
 import org.eclipse.ui.forms.widgets.FormToolkit;
 import org.eclipse.ui.forms.widgets.Section;
-import org.apache.directory.studio.openldap.common.ui.widgets.BooleanWithDefaultWidget;
-import org.apache.directory.studio.openldap.common.ui.widgets.DirectoryBrowserWidget;
-import org.apache.directory.studio.openldap.common.ui.widgets.UnixPermissionsWidget;
-import org.apache.directory.studio.openldap.config.model.database.OlcMdbConfig;
-import org.apache.directory.studio.openldap.config.model.widgets.IndicesWidget;
 
 
 /**
- * This class implements a block for Memory-Mapped DB Specific Details.
+ * This class implements a block for Memory-Mapped DB Specific Details. The GUI will
+ * look like :
+ * 
+ * <pre>
+ * .--------------------------------------------------------------------.
+ * | Database Specific Settings                                         |
+ * +--------------------------------------------------------------------+
+ * | v Database Configuration                                           |
+ * |  Directory : [                                     [v] (browse...) |
+ * |  Mode :      [--------(0000)               ] (Edit Permissions...) |
+ * |                                                                    |
+ * | v Database indices                                                 |
+ * |  +----------------------------------------------+                  |
+ * |  | indice 1                                     | (Add)            |
+ * |  | indice 2                                     | (Edit)           |
+ * |  | ...                                          | (Delete)         |
+ * |  +----------------------------------------------+                  |
+ * |                                                                    |
+ * | v Database Limits                                                  |
+ * |  Maximum Readers :     [                         ]                 |
+ * |  Maximum Size :        [                         ]                 |
+ * |  Maximum Entry Size :  [                         ]                 | (2.4.41)
+ * |  Search Stack Depth :  [                         ]                 |
+ * |  Checkpoint Interval : [                         ]                 |
+ * |                                                                    |
+ * | v Database Options                                                 |
+ * |  Disable Synchronous Database Writes : [----------]                |
+ * |  Environment Flags :                                               | (2.4.33)
+ * |    +----------------------------------------------+                |
+ * |    | Flag 1                                       | (Add)          |
+ * |    | Flag 2                                       | (Edit)         |
+ * |    | ...                                          | (Delete)       |
+ * |    +----------------------------------------------+                |
+ * +--------------------------------------------------------------------+
+ * </pre>
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public class MdbDatabaseSpecificDetailsBlock extends AbstractDatabaseSpecificDetailsBlock<OlcMdbConfig>
 {
     // UI Widgets
+    /** The olcDbDirectory attribute (String) */
     private DirectoryBrowserWidget directoryBrowserWidget;
-    private UnixPermissionsWidget modeUnixPermissionsWidget;
+
+    /** The olcDbCheckpoint attribute (String) */
+    private Text checkpointText;
+
+    /** The olcDbEnvFlags attribute (String, multi-values) */
+    private Text envFlagsText;
+
+    /** The olcDbIndex attribute (String, multi-values) */
     private IndicesWidget indicesWidget;
+
+    /** The olcMaxEntrySize attribute (Integer) No yet available (2.4.41) */
+    private Text maxEntrySizeText;
+
+    /** The olcDbMaxReaders attribute (Integer) */
     private Text maxReadersText;
+
+    /** The olcMaxSize attribute (Long) */
     private Text maxSizeText;
-    private Text searchStackDepthText;
-    private Text checkpointText;
+
+    /** The olcDbMode attribute (String) */
+    private UnixPermissionsWidget modeUnixPermissionsWidget;
+
+    /** The olcDbNoSync attribute (Boolean) */
     private BooleanWithDefaultWidget disableSynchronousDatabaseWritesBooleanWithDefaultWidget;
 
+    /** The olcDbSearchStack attribute( Integer) */
+    private Text searchStackDepthText;
+
 
     /**
      * Creates a new instance of MdbDatabaseSpecificDetailsBlock.
@@ -180,6 +232,14 @@ public class MdbDatabaseSpecificDetailsB
         maxSizeText = createIntegerText( toolkit, databaseLimitsComposite );
         maxSizeText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
 
+        if ( browserConnection.getSchema().hasAttributeTypeDescription( "olcDbMaxEntrySize"
) )
+        {
+            // Max Entry Size Text
+            toolkit.createLabel( databaseLimitsComposite, "Maximum Entry Size:" );
+            maxEntrySizeText = createIntegerText( toolkit, databaseLimitsComposite );
+            maxEntrySizeText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false
) );
+        }
+
         // Search Stack Depth Text
         toolkit.createLabel( databaseLimitsComposite, "Search Stack Depth:" );
         searchStackDepthText = createIntegerText( toolkit, databaseLimitsComposite );
@@ -215,6 +275,8 @@ public class MdbDatabaseSpecificDetailsB
         disableSynchronousDatabaseWritesBooleanWithDefaultWidget.create( databaseOptionsComposite,
toolkit );
         disableSynchronousDatabaseWritesBooleanWithDefaultWidget.getControl().setLayoutData(
             new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+        // Env flags here...
     }
 
 
@@ -240,15 +302,15 @@ public class MdbDatabaseSpecificDetailsB
 
             // Max Readers Text
             Integer maxReaders = database.getOlcDbMaxReaders();
-            maxReadersText.setText( ( maxReaders == null ) ? "" : "" + maxReaders ); //$NON-NLS-1$
+            maxReadersText.setText( ( maxReaders == null ) ? "" : maxReaders.toString() );
//$NON-NLS-1$
 
             // Max Size Text
             Long maxSize = database.getOlcDbMaxSize();
-            maxSizeText.setText( ( maxSize == null ) ? "" : "" + maxSize ); //$NON-NLS-1$
+            maxSizeText.setText( ( maxSize == null ) ? "" : maxSize.toString() ); //$NON-NLS-1$
 
             // Search Stack Depth Text
             Integer searchStackDepth = database.getOlcDbSearchStack();
-            searchStackDepthText.setText( ( searchStackDepth == null ) ? "" : "" + searchStackDepth
); //$NON-NLS-1$
+            searchStackDepthText.setText( ( searchStackDepth == null ) ? "" : searchStackDepth.toString()
); //$NON-NLS-1$
 
             // Checkpoint Text
             String checkpoint = database.getOlcDbCheckpoint();
@@ -274,6 +336,12 @@ public class MdbDatabaseSpecificDetailsB
 
         maxReadersText.addModifyListener( dirtyModifyListener );
         maxSizeText.addModifyListener( dirtyModifyListener );
+
+        if ( browserConnection.getSchema().hasAttributeTypeDescription( "olcDbMaxEntrySize"
) )
+        {
+            maxEntrySizeText.addModifyListener( dirtyModifyListener );
+        }
+
         searchStackDepthText.addModifyListener( dirtyModifyListener );
         checkpointText.addModifyListener( dirtyModifyListener );
 
@@ -293,6 +361,12 @@ public class MdbDatabaseSpecificDetailsB
 
         maxReadersText.removeModifyListener( dirtyModifyListener );
         maxSizeText.removeModifyListener( dirtyModifyListener );
+
+        if ( browserConnection.getSchema().hasAttributeTypeDescription( "olcDbMaxEntrySize"
) )
+        {
+            maxEntrySizeText.removeModifyListener( dirtyModifyListener );
+        }
+
         searchStackDepthText.removeModifyListener( dirtyModifyListener );
         checkpointText.removeModifyListener( dirtyModifyListener );
 
@@ -330,7 +404,7 @@ public class MdbDatabaseSpecificDetailsB
      */
     public void commit( boolean onSave )
     {
-        // Directory Text
+        // Directory
         String directory = directoryBrowserWidget.getDirectoryPath();
 
         if ( Strings.isEmpty( directory ) )
@@ -344,17 +418,18 @@ public class MdbDatabaseSpecificDetailsB
 
         directoryBrowserWidget.saveDialogSettings();
 
-        // Mode Text
+        // Mode
         database.setOlcDbMode( modeUnixPermissionsWidget.getValue() );
 
-        // Indices Widget
+        // Indices
         database.clearOlcDbIndex();
+
         for ( String index : indicesWidget.getIndices() )
         {
             database.addOlcDbIndex( index );
         }
 
-        // Cache Size Text
+        // Max readers
         try
         {
             database.setOlcDbMaxReaders( Integer.parseInt( maxReadersText.getText() ) );
@@ -364,7 +439,7 @@ public class MdbDatabaseSpecificDetailsB
             database.setOlcDbMaxReaders( null );
         }
 
-        // Cache Free Text
+        // Max Size
         try
         {
             database.setOlcDbMaxSize( Long.parseLong( maxSizeText.getText() ) );
@@ -374,7 +449,20 @@ public class MdbDatabaseSpecificDetailsB
             database.setOlcDbMaxSize( null );
         }
 
-        // Search Stack Depth Text
+        // Max Entry Size
+        if ( browserConnection.getSchema().hasAttributeTypeDescription( "olcDbMaxEntrySize"
) )
+        {
+            try
+            {
+                database.setOlcDbMaxEntrySize( Integer.parseInt( maxEntrySizeText.getText()
) );
+            }
+            catch ( NumberFormatException e )
+            {
+                database.setOlcDbMaxEntrySize( null );
+            }
+        }
+
+        // Search Stack Depth
         try
         {
             database.setOlcDbSearchStack( Integer.parseInt( searchStackDepthText.getText()
) );
@@ -384,10 +472,10 @@ public class MdbDatabaseSpecificDetailsB
             database.setOlcDbSearchStack( null );
         }
 
-        // Checkpoint Interval Text
+        // Checkpoint Interval
         database.setOlcDbCheckpoint( checkpointText.getText() );
 
-        // Disable Synchronous Database Writes Widget
+        // Disable Synchronous Database Writes
         database.setOlcDbNoSync( disableSynchronousDatabaseWritesBooleanWithDefaultWidget.getValue()
);
     }
 }



Mime
View raw message