directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1689673 - in /directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config: editor/ editor/databases/ editor/wrappers/ model/database/
Date Tue, 07 Jul 2015 13:52:22 GMT
Author: elecharny
Date: Tue Jul  7 13:52:21 2015
New Revision: 1689673

URL: http://svn.apache.org/r1689673
Log:
o Renamed a field
o Added a listener on the Index table, so that it's saved in the backend
o Copy the original index into the table
o Saved the index into the olc config
o add some toString methods

Modified:
    directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/OpenLDAPServerConfigurationEditorUtils.java
    directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/databases/AbstractDatabaseSpecificDetailsBlock.java
    directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/databases/DatabasesMasterDetailsBlock.java
    directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/databases/MdbDatabaseSpecificDetailsBlock.java
    directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/DatabaseWrapper.java
    directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/database/OlcMdbConfig.java

Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/OpenLDAPServerConfigurationEditorUtils.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/OpenLDAPServerConfigurationEditorUtils.java?rev=1689673&r1=1689672&r2=1689673&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/OpenLDAPServerConfigurationEditorUtils.java
(original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/OpenLDAPServerConfigurationEditorUtils.java
Tue Jul  7 13:52:21 2015
@@ -337,12 +337,9 @@ public class OpenLDAPServerConfiguration
     /**
      * Saves the configuration.
      *
-     * @param input
-     *      the connection server configuration input
-     * @param editor
-     *      the editor
-     * @param monitor
-     *      the monitor
+     * @param input the connection server configuration input
+     * @param editor the editor
+     * @param monitor the monitor
      * @return
      *      <code>true</code> if the operation is successful,
      *      <code>false</code> if not

Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/databases/AbstractDatabaseSpecificDetailsBlock.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/AbstractDatabaseSpecificDetailsBlock.java?rev=1689673&r1=1689672&r2=1689673&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/databases/AbstractDatabaseSpecificDetailsBlock.java
(original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/databases/AbstractDatabaseSpecificDetailsBlock.java
Tue Jul  7 13:52:21 2015
@@ -56,6 +56,7 @@ public abstract class AbstractDatabaseSp
             detailsPage.setEditorDirty();
         }
     };
+    
     protected WidgetModifyListener dirtyWidgetModifyListener = new WidgetModifyListener()
     {
         public void widgetModified( WidgetModifyEvent event )
@@ -63,6 +64,7 @@ public abstract class AbstractDatabaseSp
             detailsPage.setEditorDirty();
         }
     };
+    
     protected SelectionListener dirtySelectionListener = new SelectionAdapter()
     {
         public void widgetSelected( SelectionEvent e )

Modified: directory/studio/trunk/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/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/databases/DatabasesMasterDetailsBlock.java?rev=1689673&r1=1689672&r2=1689673&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/databases/DatabasesMasterDetailsBlock.java
(original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/databases/DatabasesMasterDetailsBlock.java
Tue Jul  7 13:52:21 2015
@@ -102,7 +102,7 @@ public class DatabasesMasterDetailsBlock
 
     // UI Fields
     /** The table listing all the existing databases */
-    private TableViewer databseViewer;
+    private TableViewer databaseTableViewer;
 
     /** The button used to add a new Database */
     private Button addButton;
@@ -150,7 +150,7 @@ public class DatabasesMasterDetailsBlock
                     */
                     detailsPart.commit( false );
                     managedForm.fireSelectionChanged( managedForm.getParts()[0], event.getSelection()
);
-                    databseViewer.refresh();
+                    databaseTableViewer.refresh();
                     refreshButtonStates();
                 }
             }
@@ -272,11 +272,11 @@ public class DatabasesMasterDetailsBlock
         SectionPart sectionPart = new SectionPart( section );
         this.managedForm = managedForm;
         managedForm.addPart( sectionPart );
-        databseViewer = new TableViewer( table );
+        databaseTableViewer = new TableViewer( table );
 
-        databseViewer.setContentProvider( new ArrayContentProvider() );
-        databseViewer.setLabelProvider( new DatabaseWrapperLabelProvider() );
-        databseViewer.setSorter( new DatabaseWrapperViewerSorter() );
+        databaseTableViewer.setContentProvider( new ArrayContentProvider() );
+        databaseTableViewer.setLabelProvider( new DatabaseWrapperLabelProvider() );
+        databaseTableViewer.setSorter( new DatabaseWrapperViewerSorter() );
         
         // Add a contextual menu to enable/disable a Database. This is a 2.5 feature.
         // TODO : check with the schemaManager
@@ -374,7 +374,7 @@ public class DatabasesMasterDetailsBlock
             databaseWrappers.add( new DatabaseWrapper( database ) );
         }
 
-        databseViewer.setInput( databaseWrappers );
+        databaseTableViewer.setInput( databaseWrappers );
     }
 
 
@@ -384,7 +384,7 @@ public class DatabasesMasterDetailsBlock
     public void refreshUI()
     {
         initFromInput();
-        databseViewer.refresh();
+        databaseTableViewer.refresh();
     }
 
 
@@ -393,7 +393,7 @@ public class DatabasesMasterDetailsBlock
      */
     private void addListeners()
     {
-        databseViewer.addSelectionChangedListener( viewerSelectionChangedListener );
+        databaseTableViewer.addSelectionChangedListener( viewerSelectionChangedListener );
         addButton.addSelectionListener( addButtonSelectionListener );
         deleteButton.addSelectionListener( deleteButtonSelectionListener );
         upButton.addSelectionListener( upButtonSelectionListener );
@@ -422,8 +422,8 @@ public class DatabasesMasterDetailsBlock
 
         DatabaseWrapper databaseWrapper = new DatabaseWrapper( database );
         databaseWrappers.add( databaseWrapper );
-        databseViewer.refresh();
-        databseViewer.setSelection( new StructuredSelection( databaseWrapper ) );
+        databaseTableViewer.refresh();
+        databaseTableViewer.setSelection( new StructuredSelection( databaseWrapper ) );
         setEditorDirty();
     }
 
@@ -433,7 +433,7 @@ public class DatabasesMasterDetailsBlock
      */
     private void deleteSelectedDatabase()
     {
-        StructuredSelection selection = ( StructuredSelection ) databseViewer.getSelection();
+        StructuredSelection selection = ( StructuredSelection ) databaseTableViewer.getSelection();
 
         if ( !selection.isEmpty() )
         {
@@ -573,7 +573,7 @@ public class DatabasesMasterDetailsBlock
      */
     private void moveSelectedDatabaseUp()
     {
-        StructuredSelection selection = ( StructuredSelection ) databseViewer.getSelection();
+        StructuredSelection selection = ( StructuredSelection ) databaseTableViewer.getSelection();
 
         if ( !selection.isEmpty() )
         {
@@ -595,7 +595,7 @@ public class DatabasesMasterDetailsBlock
                 selectedDatabase.setOlcDatabase( "{" + swapDatabaseOrderingPrefix + "}" +
selectedDatabaseName );
                 swapDatabase.setOlcDatabase( "{" + selectedDatabaseOrderingPrefix + "}" +
swapDatabaseName );
 
-                databseViewer.refresh();
+                databaseTableViewer.refresh();
                 refreshButtonStates();
                 setEditorDirty();
             }
@@ -636,7 +636,7 @@ public class DatabasesMasterDetailsBlock
      */
     private void moveSelectedDatabaseDown()
     {
-        StructuredSelection selection = ( StructuredSelection ) databseViewer.getSelection();
+        StructuredSelection selection = ( StructuredSelection ) databaseTableViewer.getSelection();
 
         if ( !selection.isEmpty() )
         {
@@ -658,7 +658,7 @@ public class DatabasesMasterDetailsBlock
                 selectedDatabase.setOlcDatabase( "{" + swapDatabaseOrderingPrefix + "}" +
selectedDatabaseName );
                 swapDatabase.setOlcDatabase( "{" + selectedDatabaseOrderingPrefix + "}" +
swapDatabaseName );
 
-                databseViewer.refresh();
+                databaseTableViewer.refresh();
                 refreshButtonStates();
                 setEditorDirty();
             }
@@ -705,7 +705,7 @@ public class DatabasesMasterDetailsBlock
     private void refreshButtonStates()
     {
         // Getting the selection of the table viewer
-        StructuredSelection selection = ( StructuredSelection ) databseViewer.getSelection();
+        StructuredSelection selection = ( StructuredSelection ) databaseTableViewer.getSelection();
 
         if ( !selection.isEmpty() )
         {
@@ -733,7 +733,7 @@ public class DatabasesMasterDetailsBlock
     {
         ( ( OpenLDAPServerConfigurationEditor ) page.getEditor() ).setDirty( true );
         detailsPage.commit( false );
-        databseViewer.refresh();
+        databaseTableViewer.refresh();
     }
 
 

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=1689673&r1=1689672&r2=1689673&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
Tue Jul  7 13:52:21 2015
@@ -20,9 +20,14 @@
 package org.apache.directory.studio.openldap.config.editor.databases;
 
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.directory.api.util.Strings;
 import org.apache.directory.studio.common.ui.widgets.BaseWidgetUtils;
 import org.apache.directory.studio.common.ui.widgets.TableWidget;
+import org.apache.directory.studio.common.ui.widgets.WidgetModifyEvent;
+import org.apache.directory.studio.common.ui.widgets.WidgetModifyListener;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
 import org.apache.directory.studio.openldap.config.editor.wrappers.DbIndexDecorator;
 import org.apache.directory.studio.openldap.config.editor.wrappers.DbIndexWrapper;
@@ -113,8 +118,26 @@ public class MdbDatabaseSpecificDetailsB
 
     /** The olcDbSearchStack attribute( Integer) */
     private Text searchStackDepthText;
-
-
+    
+    
+    /**
+     * The olcAllows listener
+     */
+    private WidgetModifyListener indexesListener = new WidgetModifyListener()
+    {
+        public void widgetModified( WidgetModifyEvent e )
+        {
+            List<String> indices = new ArrayList<String>();
+            
+            for ( DbIndexWrapper dbIndex : indicesWidget.getElements() )
+            {
+                indices.add( dbIndex.toString() );
+            }
+            
+            database.setOlcDbIndex( indices );
+        }
+    };
+        
     /**
      * Creates a new instance of MdbDatabaseSpecificDetailsBlock.
      * 
@@ -226,6 +249,8 @@ public class MdbDatabaseSpecificDetailsB
         indicesWidget = new TableWidget<DbIndexWrapper>( new DbIndexDecorator( null,
browserConnection ) );
         indicesWidget.createWidgetWithEdit( databaseIndexesComposite, toolkit );
         indicesWidget.getControl().setLayoutData( new GridData( SWT.FILL, SWT.NONE, true,
false, 2, 1 ) );
+        
+        indicesWidget.addWidgetModifyListener( indexesListener );
     }
 
 
@@ -335,7 +360,14 @@ public class MdbDatabaseSpecificDetailsB
             modeUnixPermissionsWidget.setValue( mode );
 
             // Indices Text
-            //indicesWidget.setIndices( database.getOlcDbIndex() );
+            List<DbIndexWrapper> dbIndexWrappers = new ArrayList<DbIndexWrapper>();
+            
+            for ( String index : database.getOlcDbIndex() )
+            {
+                dbIndexWrappers.add( new DbIndexWrapper( index ) );
+            }
+            
+            indicesWidget.setElements( dbIndexWrappers );
 
             // Max Readers Text
             Integer maxReaders = database.getOlcDbMaxReaders();
@@ -448,12 +480,10 @@ public class MdbDatabaseSpecificDetailsB
         // Indices
         database.clearOlcDbIndex();
 
-        /*
-        for ( String index : indicesWidget.getIndices() )
+        for ( DbIndexWrapper dbIndexWrapper : indicesWidget.getElements() )
         {
-            database.addOlcDbIndex( index );
+            database.addOlcDbIndex( dbIndexWrapper.toString() );
         }
-        */
 
         // Max readers
         try

Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/DatabaseWrapper.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/DatabaseWrapper.java?rev=1689673&r1=1689672&r2=1689673&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/DatabaseWrapper.java
(original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/DatabaseWrapper.java
Tue Jul  7 13:52:21 2015
@@ -22,8 +22,6 @@ package org.apache.directory.studio.open
 import org.apache.directory.studio.openldap.config.model.database.OlcDatabaseConfig;
 
 
-
-
 /**
  * This class implements a database wrapper used in the 'Databases' page UI.
  * 
@@ -74,4 +72,13 @@ public class DatabaseWrapper
     {
         this.database = database;
     }
+    
+    
+    /**
+     * @see Object#toString()
+     */
+    public String toString()
+    {
+        return database.toString();
+    }
 }

Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/database/OlcMdbConfig.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/database/OlcMdbConfig.java?rev=1689673&r1=1689672&r2=1689673&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/database/OlcMdbConfig.java
(original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/database/OlcMdbConfig.java
Tue Jul  7 13:52:21 2015
@@ -29,14 +29,19 @@ import org.apache.directory.studio.openl
 
 /**
  * Java bean for the 'olcMdbConfig' object class. There are a few parameter
- * that can be managed for the MDB databse :
+ * that can be managed for the MDB database :
  * <ul>
- * <li>directory : the place on disk the DB will be stored</li>
- * <li>maxSize : the size of the database, in bytes. As it can't grow automatically,
set it to
+ * <li>olcDbDirectory : the place on disk the DB will be stored</li>
+ * <li>olcDbCheckpoint : </li>
+ * <li>olcDbEnvFlags</li>
+ * <li>olcDbIndex</li>
+ * <li>olcDbMaxEntrySize</li>
+ * <li>olcDbMaxreaders</li>
+ * <li>olcDbMaxSize : the size of the database, in bytes. As it can't grow automatically,
set it to
  * the expected maximum DB size</li>
- * <li></li>
- * <li></li>
- * <li></li>
+ * <li>olcDbMode</li>
+ * <li>olcDbNoSync</li>
+ * <li>olcDbSearchStack</li>
  * </ul>
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
@@ -327,4 +332,20 @@ public class OlcMdbConfig extends OlcDat
     {
         return DatabaseTypeEnum.MDB.toString().toLowerCase();
     };
+    
+    
+    /**
+     * @see Object#toString()
+     */
+    public String toString()
+    {
+        if ( getOlcSuffix().size() > 0 )
+        { 
+            return getOlcDatabase() + ":" + getOlcSuffix().get( 0 );
+        }
+        else
+        {
+            return getOlcDatabase();
+        }
+    }
 }



Mime
View raw message