1
/** BEGIN COPYRIGHT BLOCK
2
* Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
3
* Copyright (C) 2005 Red Hat, Inc.
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation version 2 of the License.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
* END COPYRIGHT BLOCK **/
20
package com.netscape.admin.dirserv.panel;
26
import javax.swing.border.*;
27
import com.netscape.admin.dirserv.*;
28
import com.netscape.management.client.*;
29
import com.netscape.management.client.util.*;
30
import netscape.ldap.*;
31
import netscape.ldap.util.DN;
32
import com.netscape.management.nmclf.SuiConstants;
34
* Panel for Directory Server resource page
39
* @see com.netscape.admin.dirserv
41
public class ChainingDefaultPanel extends BlankPanel
42
implements SuiConstants{
44
public ChainingDefaultPanel(IDSModel model, LDAPEntry InstEntry) {
45
super( model, _section, true );
46
_helpToken = "configuration-chaining-default-help";
47
_dnEntry = DEFAULT_PREFIX + InstEntry.getDN();
48
_configEntry = InstEntry;
50
_refreshWhenSelect = false;
58
_myPanel.setLayout(new GridBagLayout());
59
createTwinArea((Container) _myPanel);
61
_isInitialized = true;
67
private void createTwinArea( Container myContainer ) {
69
GridBagConstraints pgbc = new GridBagConstraints();
76
pgbc.fill = pgbc.BOTH;
77
pgbc.anchor = pgbc.NORTHWEST;
78
pgbc.insets = new Insets(DEFAULT_PADDING,DEFAULT_PADDING,
82
JPanel leftPanel = new GroupPanel(
83
DSUtil._resource.getString( _section,
86
JPanel rightPanel = new GroupPanel(
87
DSUtil._resource.getString( _section,
90
JPanel bottomPanel = new GroupPanel(
91
DSUtil._resource.getString( _section,
92
"connection-mgt-title" ),
97
pgbc.fill = pgbc.BOTH;
98
myContainer.add( leftPanel, pgbc );
101
myContainer.add( rightPanel, pgbc );
105
pgbc.gridwidth = pgbc.REMAINDER;
106
myContainer.add( bottomPanel, pgbc );
108
createClientArea( leftPanel );
109
createCascadeArea( rightPanel );
110
createConnMgt( bottomPanel );
113
private void createClientArea( JPanel panel ) {
115
GridBagLayout chbag = new GridBagLayout();
116
GridBagConstraints gbc = new GridBagConstraints() ;
123
gbc.fill = gbc.HORIZONTAL;
124
gbc.anchor = gbc.NORTHWEST;
125
gbc.insets = new Insets(0,DEFAULT_PADDING,
130
panel.setLayout(chbag);
133
* Hidden because to dangerous, it transfort every damn anonymous
134
* into proxy user on remote server
136
* panel.add( _cbnsproxiedauthorization, gbc );
139
gbc.gridwidth = gbc.REMAINDER;
141
panel.add(_cbnsreferralonscopedsearch, gbc );
142
gbc.fill = gbc.HORIZONTAL;
144
gbc.insets.top = DEFAULT_PADDING;
149
addEntryField( panel,
151
_lfnsslapd_sizelimit,
152
_tfnsslapd_sizelimit,
153
lns_sizelimit_unit );
156
addEntryField( panel,
158
_lfnsslapd_timelimit,
159
_tfnsslapd_timelimit,
160
lns_timelimit_unit );
162
gbc.insets = new Insets(0, 0, 0, 0);
164
gbc.fill =gbc.VERTICAL;
166
gbc.gridwidth = gbc.REMAINDER;
167
panel.add(Box.createVerticalGlue(), gbc);
170
private void createCascadeArea( JPanel panel ) {
172
GridBagLayout chbag = new GridBagLayout();
173
GridBagConstraints gbc = new GridBagConstraints() ;
180
gbc.fill = gbc.HORIZONTAL;
181
gbc.anchor = gbc.NORTHWEST;
182
gbc.insets = new Insets(0,DEFAULT_PADDING,
187
panel.setLayout(chbag);
190
* Hidden because to dangerous, it transfort every damn anonymous
191
* into proxy user on remote server
193
* panel.add( _cbnsproxiedauthorization, gbc );
197
gbc.gridwidth = gbc.REMAINDER;
199
panel.add(_cbnschecklocalaci, gbc );
200
gbc.fill = gbc.HORIZONTAL;
203
gbc.insets.top = DEFAULT_PADDING;
206
addEntryField( panel,
211
gbc.insets = new Insets(0, 0, 0, 0);
213
gbc.fill =gbc.VERTICAL;
215
gbc.gridwidth = gbc.REMAINDER;
216
panel.add(Box.createVerticalGlue(), gbc);
220
private void createConnMgt( JPanel panel ) {
222
GridBagLayout chbag = new GridBagLayout();
223
GridBagConstraints gbc = new GridBagConstraints() ;
230
gbc.fill = gbc.HORIZONTAL;
231
gbc.anchor = gbc.NORTHWEST;
232
gbc.insets = new Insets(0,DEFAULT_PADDING,
237
panel.setLayout(chbag);
241
// JLabel lmax = makeJLabel( _section, "shared-label-max-conn");
242
// panel.add( lmax, gbc );
244
addEntryField( panel,
246
_lfnsbindconnectionslimit,
247
_tfnsbindconnectionslimit );
248
addEntryField( panel,
250
_lfnsoperationconnectionslimit,
251
_tfnsoperationconnectionslimit );
253
gbc.insets.top = DEFAULT_PADDING;
256
// JLabel lbind = makeJLabel( _section, "shared-label-bind");
257
// panel.add( lbind, gbc );
259
addEntryField( panel,
263
addEntryField( panel,
266
_tfnsbindretrylimit );
270
addEntryField( panel,
272
_lfnsconcurrentbindlimit,
273
_tfnsconcurrentbindlimit );
275
addEntryField( panel,
277
_lfnsconcurrentoperationslimit,
278
_tfnsconcurrentoperationslimit );
282
addEntryField( panel,
284
_lfnsabandonedsearchcheckinterval,
285
_tfnsabandonedsearchcheckinterval);
286
addEntryField( panel,
289
_tfnsconnectionlife );
291
gbc.insets = new Insets(0, 0, 0, 0);
293
gbc.fill =gbc.VERTICAL;
295
gbc.gridwidth = gbc.REMAINDER;
296
panel.add(Box.createVerticalGlue(), gbc);
300
protected void addEntryField( JPanel panel,
301
GridBagConstraints gbc,
305
Component endGlue = STRETCH_FIELDS ? null : Box.createGlue();
307
STRETCH_FIELDS ? ((label2 != null) ? label2 : field) : endGlue;
312
gbc.anchor = gbc.EAST;
313
int space = UIFactory.getComponentSpace();
314
gbc.insets = new Insets( space, space, 0, space/2 );
315
panel.add( label, gbc );
318
gbc.anchor = gbc.WEST;
319
gbc.insets = new Insets( space, 0, 0, 0 );
320
if ( STRETCH_FIELDS ) {
321
gbc.fill = gbc.HORIZONTAL;
324
gbc.gridwidth = (lastItem == field) ? gbc.REMAINDER : 1;
325
panel.add( field, gbc );
327
if ( label2 != null ) {
331
gbc.insets = new Insets( space, space/2, 0, 0 );
332
gbc.gridwidth = (lastItem == label2) ? gbc.REMAINDER : 1;
333
panel.add( label2, gbc );
336
if ( !STRETCH_FIELDS ) {
338
gbc.anchor = gbc.EAST;
339
gbc.fill = gbc.HORIZONTAL;
341
gbc.gridwidth = gbc.REMAINDER;
342
panel.add( endGlue, gbc );
347
* Add a label and a textfield to a panel, assumed to be using
350
protected void addEntryField( JPanel panel,
351
GridBagConstraints gbc,
354
addEntryField( panel, gbc, label, field, null );
357
private void linkData() {
358
// String defDN = DEFAULT_PREFIX + _dnEntry;
359
DSEntrySet entries = getDSEntrySet();
361
/* nsslapd-timelimit */
362
_tfnsslapd_timelimit = makeNumericalJTextField( _section,
363
"nsslapd-timelimit");
364
_lfnsslapd_timelimit = makeJLabel( _section,
365
"nsslapd-timelimit");
366
_lfnsslapd_timelimit.setLabelFor(_tfnsslapd_timelimit);
367
lns_timelimit_unit = makeJLabel( _section,
368
"nsslapd-timelimit-unit");
369
lns_timelimit_unit.setLabelFor(_tfnsslapd_timelimit);
371
DSEntryInteger nsTimelimitDSEntry = new DSEntryInteger( null,
372
_tfnsslapd_timelimit,
373
_lfnsslapd_timelimit,
377
entries.add( _dnEntry,
379
nsTimelimitDSEntry );
381
setComponentTable( _tfnsslapd_timelimit,
382
nsTimelimitDSEntry );
385
/* nsslapd-sizelimit */
386
_tfnsslapd_sizelimit = makeNumericalJTextField(_section,
387
"nsslapd-sizelimit");
388
_lfnsslapd_sizelimit = makeJLabel(_section,
389
"nsslapd-sizelimit");
390
_lfnsslapd_sizelimit.setLabelFor(_tfnsslapd_sizelimit);
391
lns_sizelimit_unit = makeJLabel(_section,
392
"nsslapd-sizelimit-unit");
393
lns_sizelimit_unit.setLabelFor(_tfnsslapd_sizelimit);
395
DSEntryInteger nsSizelimitDSEntry = new DSEntryInteger( null,
396
_tfnsslapd_sizelimit,
397
_lfnsslapd_sizelimit,
401
entries.add( _dnEntry,
403
nsSizelimitDSEntry );
405
setComponentTable( _tfnsslapd_sizelimit,
406
nsSizelimitDSEntry );
409
/* nsbindconnectionslimit */
410
_tfnsbindconnectionslimit = makeNumericalJTextField( _section,
411
"nsbindconnectionslimit");
412
_lfnsbindconnectionslimit = makeJLabel( _section,
413
"nsbindconnectionslimit");
414
_lfnsbindconnectionslimit.setLabelFor(_tfnsbindconnectionslimit);
415
lnsbindconnectionslimit_unit = makeJLabel( _section,
416
"nsbindconnectionslimit-unit");
418
DSEntryInteger nsBindConnDSEntry = new DSEntryInteger( null,
419
_tfnsbindconnectionslimit,
420
_lfnsbindconnectionslimit,
424
entries.add( _dnEntry,
425
BINDCONNDSENTRY_ATTR,
428
setComponentTable( _tfnsbindconnectionslimit,
431
/* nsoperationconnectionslimit */
432
_tfnsoperationconnectionslimit = makeNumericalJTextField( _section,
433
"nsoperationconnectionslimit");
434
_lfnsoperationconnectionslimit = makeJLabel( _section,
435
"nsoperationconnectionslimit");
436
_lfnsoperationconnectionslimit.setLabelFor(_tfnsoperationconnectionslimit);
437
lnsoperationconnectionslimit_unit = makeJLabel( _section,
438
"nsoperationconnectionslimit-unit");
440
DSEntryInteger nsoperationconnectionslimitDSEntry =
441
new DSEntryInteger( null,
442
_tfnsoperationconnectionslimit,
443
_lfnsoperationconnectionslimit,
447
entries.add( _dnEntry,
449
nsoperationconnectionslimitDSEntry );
451
setComponentTable( _tfnsoperationconnectionslimit,
452
nsoperationconnectionslimitDSEntry );
454
/* nsabandonedsearchcheckinterval */
455
_tfnsabandonedsearchcheckinterval = makeNumericalJTextField( _section,
456
"nsabandonedsearchcheckinterval");
457
_lfnsabandonedsearchcheckinterval = makeJLabel( _section,
458
"nsabandonedsearchcheckinterval");
459
_lfnsabandonedsearchcheckinterval.setLabelFor(_tfnsabandonedsearchcheckinterval);
460
lnsabandonedsearchcheckinterval_unit = makeJLabel( _section,
461
"nsabandonedsearchcheckinterval-unit");
463
DSEntryInteger nsabandonedsearchcheckintervalDSEntry =
464
new DSEntryInteger( null,
465
_tfnsabandonedsearchcheckinterval,
466
_lfnsabandonedsearchcheckinterval,
470
entries.add( _dnEntry,
472
nsabandonedsearchcheckintervalDSEntry );
474
setComponentTable( _tfnsabandonedsearchcheckinterval,
475
nsabandonedsearchcheckintervalDSEntry );
477
/* nsconcurrentbindlimit */
478
_tfnsconcurrentbindlimit = makeNumericalJTextField( _section,
479
"nsconcurrentbindlimit");
480
_lfnsconcurrentbindlimit = makeJLabel( _section,
481
"nsconcurrentbindlimit");
482
_lfnsconcurrentbindlimit.setLabelFor(_tfnsconcurrentbindlimit);
483
lnsconcurrentbindlimit_unit = makeJLabel( _section,
484
"nsconcurrentbindlimit-unit");
486
DSEntryInteger nsconcurrentbindlimitDSEntry = new DSEntryInteger( null,
487
_tfnsconcurrentbindlimit,
488
_lfnsconcurrentbindlimit,
492
entries.add( _dnEntry,
494
nsconcurrentbindlimitDSEntry );
496
setComponentTable( _tfnsconcurrentbindlimit,
497
nsconcurrentbindlimitDSEntry );
499
/* nsconcurrentoperationslimit */
500
_tfnsconcurrentoperationslimit = makeNumericalJTextField( _section,
501
"nsconcurrentoperationslimit");
502
_lfnsconcurrentoperationslimit = makeJLabel( _section,
503
"nsconcurrentoperationslimit");
504
_lfnsconcurrentoperationslimit.setLabelFor(_tfnsconcurrentoperationslimit);
505
lnsconcurrentoperationslimit_unit = makeJLabel( _section,
506
"nsconcurrentoperationslimit-unit");
508
DSEntryInteger nsconcurrentoperationslimitDSEntry = new DSEntryInteger( null,
509
_tfnsconcurrentoperationslimit,
510
_lfnsconcurrentoperationslimit,
514
entries.add( _dnEntry,
516
nsconcurrentoperationslimitDSEntry );
518
setComponentTable( _tfnsconcurrentoperationslimit,
519
nsconcurrentoperationslimitDSEntry );
520
/* nsproxiedauthorization */
521
_cbnsproxiedauthorization = makeJCheckBox( _section,
522
"nsproxiedauthorization",
525
DSEntryBoolean nsproxiedauthorizationDSEntry = new DSEntryBoolean( "1",
526
_cbnsproxiedauthorization );
527
entries.add( _dnEntry,
529
nsproxiedauthorizationDSEntry );
531
setComponentTable( _cbnsproxiedauthorization,
532
nsproxiedauthorizationDSEntry );
534
/* nsconnectionlife */
535
_tfnsconnectionlife = makeNumericalJTextField( _section,
537
_lfnsconnectionlife = makeJLabel( _section,
539
_lfnsconnectionlife.setLabelFor(_tfnsconnectionlife);
540
lnsconnectionlife_unit = makeJLabel( _section,
541
"nsconnectionlife-unit");
543
DSEntryInteger nsconnectionlifeDSEntry = new DSEntryInteger( null,
549
entries.add( _dnEntry,
551
nsconnectionlifeDSEntry );
553
setComponentTable( _tfnsconnectionlife,
554
nsconnectionlifeDSEntry );
557
_tfnsbindtimeout = makeNumericalJTextField( _section,
559
_lfnsbindtimeout = makeJLabel( _section,
561
_lfnsbindtimeout.setLabelFor(_tfnsbindtimeout);
562
lnsbindtimeout_unit = makeJLabel( _section,
563
"nsbindtimeout-unit");
565
DSEntryInteger nsbindtimeoutDSEntry = new DSEntryInteger( null,
571
entries.add( _dnEntry,
573
nsbindtimeoutDSEntry );
575
setComponentTable( _tfnsbindtimeout,
576
nsbindtimeoutDSEntry );
578
/* nsreferralonscopedsearch */
579
_cbnsreferralonscopedsearch = makeJCheckBox( _section,
580
"nsreferralonscopedsearch",
583
DSEntryBoolean nsreferralonscopedsearchDSEntry = new DSEntryBoolean( "0",
584
_cbnsreferralonscopedsearch );
585
entries.add( _dnEntry,
587
nsreferralonscopedsearchDSEntry );
589
setComponentTable( _cbnsreferralonscopedsearch,
590
nsreferralonscopedsearchDSEntry );
592
/* nschecklocalaci */
593
_cbnschecklocalaci = makeJCheckBox( _section,
596
DSEntryBoolean nschecklocalaciDSEntry = new DSEntryBoolean( "0",
597
_cbnschecklocalaci );
598
entries.add( _dnEntry,
600
nschecklocalaciDSEntry );
602
setComponentTable( _cbnschecklocalaci,
603
nschecklocalaciDSEntry );
605
/* nsbindretrylimit */
606
_tfnsbindretrylimit = makeNumericalJTextField( _section,
608
_lfnsbindretrylimit = makeJLabel( _section,
610
_lfnsbindretrylimit.setLabelFor(_tfnsbindretrylimit);
612
DSEntryInteger nsbindretrylimitDSEntry = new DSEntryInteger( null,
618
entries.add( _dnEntry,
620
nsbindretrylimitDSEntry );
622
setComponentTable( _tfnsbindretrylimit,
623
nsbindretrylimitDSEntry );
626
_tfnshoplimit = makeNumericalJTextField( _section,
628
_lfnshoplimit = makeJLabel( _section,
630
_lfnshoplimit.setLabelFor(_tfnshoplimit);
632
DSEntryInteger nshoplimitDSEntry = new DSEntryInteger( null,
638
entries.add( _dnEntry,
642
setComponentTable( _tfnshoplimit,
649
private IDSModel _model = null;
650
private LDAPEntry _configEntry = null;
651
private String _dnEntry;
652
private JTextField _tfnsslapd_timelimit;
653
private JLabel _lfnsslapd_timelimit;
654
private JTextField _tfnsslapd_sizelimit;
655
private JLabel _lfnsslapd_sizelimit;
656
private JLabel _lfnsbindconnectionslimit;
657
private JTextField _tfnsbindconnectionslimit;
658
private JTextField _tfnsoperationconnectionslimit;
659
private JLabel _lfnsoperationconnectionslimit;
660
private JTextField _tfnsabandonedsearchcheckinterval;
661
private JLabel _lfnsabandonedsearchcheckinterval;
662
private JTextField _tfnsconcurrentbindlimit;
663
private JLabel _lfnsconcurrentbindlimit;
664
private JTextField _tfnsconcurrentoperationslimit;
665
private JLabel _lfnsconcurrentoperationslimit;
666
private JCheckBox _cbnsproxiedauthorization;
667
private JTextField _tfnsconnectionlife;
668
private JLabel _lfnsconnectionlife;
669
private JTextField _tfnsbindtimeout;
670
private JLabel _lfnsbindtimeout;
671
private JCheckBox _cbnsreferralonscopedsearch;
672
private JCheckBox _cbnschecklocalaci;
673
private JTextField _tfnsbindretrylimit;
674
private JLabel _lfnsbindretrylimit;
675
private JTextField _tfnshoplimit;
676
private JLabel _lfnshoplimit;
677
private JLabel lns_sizelimit_unit;
678
private JLabel lns_timelimit_unit;
679
private JLabel lnsbindtimeout_unit;
680
private JLabel lnsconnectionlife_unit;
681
private JLabel lnsconcurrentoperationslimit_unit;
682
private JLabel lnsconcurrentbindlimit_unit;
683
private JLabel lnsabandonedsearchcheckinterval_unit;
684
private JLabel lnsbindconnectionslimit_unit;
685
private JLabel lnsoperationconnectionslimit_unit;
687
private static final String TIMELIMIT_ATTR = "nsslapd-timelimit";
688
private static final String SIZELIMIT_ATTR = "nsslapd-sizelimit";
689
private static final String BINDCONNDSENTRY_ATTR = "nsbindconnectionslimit";
690
private static final String OPCONLIMIT_ATTR = "nsoperationconnectionslimit";
691
private static final String ABANDON_ATTR = "nsabandonedsearchcheckinterval";
692
private static final String CONBINDLIMIT_ATTR = "nsconcurrentbindlimit";
693
private static final String CONOPLIMIT_ATTR = "nsconcurrentoperationslimit";
694
private static final String PROXAUTH_ATTR = "nsproxiedauthorization";
695
private static final String CONLIFE_ATTR = "nsconnectionlife";
696
private static final String BINDTIMEOUT_ATTR = "nsbindtimeout";
697
private static final String REFONSEARCH_ATTR = "nsreferralonscopedsearch";
698
private static final String CHECKLOCALACI_ATTR = "nschecklocalaci";
699
private static final String BINDRETRY_ATTR = "nsbindretrylimit";
700
private static final String HOPLIMIT_ATTR = "nshoplimit";
705
private static final String DEFAULT_PREFIX = "cn=default instance config,";
706
private static final String _section = "chaining-default";
707
private static final int MAX_INT_VAL = 2147483647;
708
private static final int TIMELIMIT_MAX_VAL = MAX_INT_VAL;
709
private static final int TIMELIMIT_MIN_VAL = -1;
710
private static final int SIZELIMIT_MAX_VAL = MAX_INT_VAL;
711
private static final int SIZELIMIT_MIN_VAL = -1;
712
private static final int BINDTIMEOUT_MAX_VAL = 3600;
713
private static final int BINDRETRY_MAX_VAL = 10;
715
//copy from BlankPanel
716
final static int DEFAULT_PADDING = 6;
717
final static Insets DEFAULT_EMPTY_INSETS = new Insets(0,0,0,0);
718
final static Insets BOTTOM_INSETS = new Insets(6,6,6,6);