Author: rmeggins
Update of /cvs/dirsec/directoryconsole/src/com/netscape/admin/dirserv/panel
In directory
cvs1.fedora.phx.redhat.com:/tmp/cvs-serv26442/directoryconsole/src/com/netscape/admin/dirserv/panel
Modified Files:
LDBMPluginSettingPanel.java
Log Message:
Resolves: bug 238762
Bug Description: Support "auto" for "Import cache size" in the LDBM
Plug-in Settings
Reviewed by: nhosoi (Thanks!)
Fix Description: Added a check box for "use auto cache size". If this is
checked, a value of -1 will be saved for nsslapd-import-cache-autosize which will tell the
server to use the default auto cache value. If this is not checked, a value of 0 will be
saved which will tell the server to use the number from nsslapd-import-cachesize. If the
check box is checked, the import cachesize field will be disabled. Here are a couple of
screen shots.
https://bugzilla.redhat.com/attachment.cgi?id=326699
https://bugzilla.redhat.com/attachment.cgi?id=326700
Platforms tested: RHEL5
Flag Day: no
Doc impact: yes - will have to document the new UI
Index: LDBMPluginSettingPanel.java
===================================================================
RCS file:
/cvs/dirsec/directoryconsole/src/com/netscape/admin/dirserv/panel/LDBMPluginSettingPanel.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- LDBMPluginSettingPanel.java 18 Jul 2005 00:55:58 -0000 1.1.1.1
+++ LDBMPluginSettingPanel.java 12 Dec 2008 18:35:38 -0000 1.2
@@ -20,6 +20,8 @@
package com.netscape.admin.dirserv.panel;
import java.awt.*;
+import java.awt.event.ActionEvent;
+
import javax.swing.*;
import javax.swing.border.*;
import com.netscape.admin.dirserv.*;
@@ -37,7 +39,7 @@
*/
public class LDBMPluginSettingPanel extends BlankPanel {
- public LDBMPluginSettingPanel(IDSModel model, String dnEntry) {
+ public LDBMPluginSettingPanel(IDSModel model, String dnEntry) {
super(model, "pldbmsetting",true);
_helpToken = "configuration-database-plugin-setting-help";
_dnEntry = dnEntry;
@@ -75,6 +77,10 @@
_lRootDatabaseLoc = makeJLabel(_section,"RootDatabaseLoc");
_lRootDatabaseLoc.setLabelFor(_tfRootDatabaseLoc);
+ /* add check box for autocache size */
+ _cbAutoCacheSize = makeJCheckBox(_section,"autoCacheSize", false);
+
+ /* import cache size field */
_tfImportCacheSize = makeJTextField(_section,"importCacheSize");
_lImportCacheSize = makeJLabel( _section,"importCacheSize" );
_lImportCacheSize.setLabelFor(_tfImportCacheSize);
@@ -110,6 +116,10 @@
_lRootDatabaseLoc, false, isLocal());
entries.add(_dnEntry, DB_FILE_LOC_ATTR_NAME, fileEntry);
setComponentTable(_tfRootDatabaseLoc, fileEntry);
+
+ DSEntryBoolean autoDSEntry = new DSEntryBoolean(null, _cbAutoCacheSize,
"-1", "0");
+ entries.add(_dnEntry, IMPORT_AUTO_CACHE_SIZE_ATTR_NAME, autoDSEntry);
+ setComponentTable(_cbAutoCacheSize, autoDSEntry);
DSEntryLong importsizeDSEntry = new DSEntryLong(null,
_tfImportCacheSize, _lImportCacheSize,
@@ -125,12 +135,38 @@
addEntryField( panel, _lMaxCacheSize, _tfMaxCacheSize, lMaxCacheSizeUnit );
addEntryField( panel, _lLookLimit, _tfLookLimit, lLookLimitUnit );
addEntryField( panel, _lModeFile, _tfModeFile, lModeFileUnit );
+ addEntryField( panel, new JLabel(""), _cbAutoCacheSize, new
JLabel("") );
addEntryField( panel, _lImportCacheSize, _tfImportCacheSize,
lImportCacheSizeUnit);
addBottomGlue();
_isInitialized = true;
}
-
+
+ private void enableCacheSize() {
+ boolean enabled = !_cbAutoCacheSize.isSelected();
+ _tfImportCacheSize.setEnabled(enabled);
+ _lImportCacheSize.setEnabled(enabled);
+ }
+ /* (non-Javadoc)
+ * @see com.netscape.admin.dirserv.panel.BlankPanel#refresh()
+ */
+ public boolean refresh() {
+ // TODO Auto-generated method stub
+ boolean status = super.refresh();
+ enableCacheSize();
+ return status;
+ }
+
+ /* (non-Javadoc)
+ * @see
com.netscape.admin.dirserv.panel.BlankPanel#actionPerformed(java.awt.event.ActionEvent)
+ */
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(_cbAutoCacheSize)) {
+ enableCacheSize();
+ }
+ super.actionPerformed(e);
+ }
+
private JTextField _tfMaxCacheSize;
private JLabel _lMaxCacheSize;
@@ -142,6 +178,8 @@
private JTextField _tfRootDatabaseLoc;
private JLabel _lRootDatabaseLoc;
+
+ private JCheckBox _cbAutoCacheSize;
private JTextField _tfImportCacheSize;
private JLabel _lImportCacheSize;
@@ -156,6 +194,8 @@
"nsslapd-directory";
private static final String DB_IMPORT__CACHE_SIZE_ATTR_NAM =
"nsslapd-import-cachesize";
+ private static final String IMPORT_AUTO_CACHE_SIZE_ATTR_NAME =
+ "nsslapd-import-cache-autosize";
private static final long LIMIT_MIN_VAL = -1;
private static final long LIMIT_MAX_VAL = Long.MAX_VALUE;
private static final long CACHE_SIZE_NUM_MIN_VAL = 500000;