~ubuntu-branches/ubuntu/wily/389-ds-console/wily-proposed

« back to all changes in this revision

Viewing changes to src/com/netscape/admin/dirserv/panel/replication/LegacyConsumerSettingPanel.java

  • Committer: Package Import Robot
  • Author(s): Timo Aaltonen
  • Date: 2012-03-15 19:58:37 UTC
  • Revision ID: package-import@ubuntu.com-20120315195837-296zyft51thld8q7
Tags: upstream-1.2.6
ImportĀ upstreamĀ versionĀ 1.2.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/** BEGIN COPYRIGHT BLOCK
 
2
 * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
 
3
 * Copyright (C) 2005 Red Hat, Inc.
 
4
 * All rights reserved.
 
5
 * 
 
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.
 
9
 * 
 
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.
 
14
 * 
 
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 **/
 
19
 
 
20
package com.netscape.admin.dirserv.panel.replication;
 
21
 
 
22
import java.util.StringTokenizer;
 
23
import java.awt.*;
 
24
import java.awt.event.*;
 
25
import java.util.*;
 
26
import javax.swing.*;
 
27
import javax.swing.event.*;
 
28
import netscape.ldap.*;
 
29
import com.netscape.admin.dirserv.*;
 
30
import com.netscape.admin.dirserv.panel.*;
 
31
import com.netscape.management.client.*;
 
32
import com.netscape.management.client.util.*;
 
33
 
 
34
/**
 
35
 * Panel for Directory Server Consumer Replication Setting
 
36
 *
 
37
 * @author  jpanchen
 
38
 * @version %I%, %G%
 
39
 * @date                9/15/97
 
40
 * @see     com.netscape.admin.dirserv.panel.replication
 
41
 */
 
42
public class LegacyConsumerSettingPanel extends BlankPanel {
 
43
    
 
44
    /*==========================================================
 
45
     * constructors
 
46
     *==========================================================*/
 
47
     
 
48
    /**
 
49
     * public constructor
 
50
     * construction is delayed until selected.
 
51
     * @param parent parent panel
 
52
     */
 
53
    public LegacyConsumerSettingPanel(IDSModel model) {
 
54
                super(model, "replication");
 
55
                setTitle(_resource.getString(_section+"-setting","title"));
 
56
                _model = model;
 
57
                _helpToken = "configuration-replication-legacyconsumersettings-help";
 
58
                _refreshWhenSelect = false;
 
59
    }
 
60
        
 
61
    /*==========================================================
 
62
     * public methods
 
63
     *==========================================================*/
 
64
         
 
65
    /**
 
66
     * Actual panel construction
 
67
     */
 
68
    public void init() {
 
69
                if (_isInitialized) {
 
70
                        return;
 
71
                }
 
72
                _entryExists = false;
 
73
                try {
 
74
                        LDAPConnection ldc = _model.getServerInfo().getLDAPConnection();
 
75
                        _legacyEntry = ldc.read(REPSETTINGS_DN);
 
76
                        if (_legacyEntry != null) {
 
77
                                _entryExists = true;
 
78
                        }
 
79
                } catch (LDAPException lde) {
 
80
                }
 
81
                
 
82
                _isLegacyConsumerEnabled = _entryExists;
 
83
                
 
84
                GridBagConstraints gbc = getGBC();      
 
85
                
 
86
                _myPanel.setLayout(new GridBagLayout());
 
87
                _myPanel.setBackground(getBackground());
 
88
                _myPanel.setPreferredSize(ReplicationTool.DEFAULT_PANEL_SIZE);
 
89
                _myPanel.setMaximumSize(ReplicationTool.DEFAULT_PANEL_SIZE);
 
90
                
 
91
                //add Description label
 
92
        JTextArea desc = makeMultiLineLabel( 2, 60,
 
93
                                                                                         _resource.getString(
 
94
                                                                                                                                 _section,"setting-desc") );
 
95
                gbc.anchor = gbc.NORTHWEST;
 
96
        gbc.gridwidth = 2;
 
97
                gbc.weightx    = 1.0;
 
98
                gbc.fill = gbc.HORIZONTAL;
 
99
        _myPanel.add(desc, gbc);
 
100
                gbc.weightx    = 0.0;
 
101
                gbc.fill = gbc.HORIZONTAL;
 
102
                gbc.gridwidth = gbc.REMAINDER;
 
103
                _myPanel.add(Box.createGlue(),gbc);
 
104
                
 
105
                // Switch on/off
 
106
                _cbEnable = makeJCheckBox( _section,
 
107
                                                                   "enable",
 
108
                                                                   _entryExists,
 
109
                                                                   _resource);
 
110
                _cbEnable.setSelected( _entryExists );
 
111
                _cbEnable.addItemListener(this);
 
112
                gbc.gridwidth = 2;
 
113
                gbc.weightx    = 0;
 
114
                gbc.fill = gbc.NONE;
 
115
                _myPanel.add(_cbEnable,gbc);
 
116
                gbc.weightx    = 1.0;
 
117
                gbc.fill = gbc.HORIZONTAL;
 
118
                gbc.gridwidth = gbc.REMAINDER;
 
119
                _myPanel.add(Box.createGlue(),gbc);         
 
120
                
 
121
                // Auth param
 
122
                ReplicationTool.resetGBC(gbc);
 
123
                gbc.insets = (Insets) ReplicationTool.BOTTOM_INSETS.clone();
 
124
        gbc.anchor = gbc.NORTH;
 
125
        gbc.gridwidth = gbc.REMAINDER;
 
126
        gbc.weightx=1.0;
 
127
                _myPanel.add(createAuth(), gbc);
 
128
 
 
129
                checkEnabledField();
 
130
                addBottomGlue ();
 
131
        _isInitialized = true;
 
132
    }
 
133
        
 
134
    private JPanel createAuth(){
 
135
        //setup Normal Auth panel               
 
136
                String title = _resource.getString(_section+"-normalAuth","label");
 
137
        JPanel panel = new GroupPanel(title);        
 
138
        
 
139
                //add supplier DN
 
140
        _dnLabel = makeJLabel(_resource.getString(_section+"-supplierDN","label"));                             
 
141
        _dnLabel.setToolTipText(_resource.getString(_section+"-supplierDN","ttip"));
 
142
                _dnLabel.resetKeyboardActions();
 
143
                
 
144
                GridBagConstraints gbc = new GridBagConstraints();
 
145
                ReplicationTool.resetGBC(gbc);
 
146
                gbc.insets = (Insets) ReplicationTool.BOTTOM_INSETS.clone();
 
147
        gbc.anchor = gbc.NORTHEAST;
 
148
                gbc.gridwidth  = gbc.RELATIVE;
 
149
                gbc.fill = gbc.NONE;
 
150
                gbc.weightx = 0.0;              
 
151
        panel.add(_dnLabel, gbc);
 
152
                
 
153
        _dnText= makeJTextField(_section, "supplierDN", _resource);
 
154
                _dnLabel.setLabelFor(_dnText);
 
155
                _saveDN = DSUtil.getAttrValue( _legacyEntry, UPDATEDN_ATTR_NAME );
 
156
                if( _saveDN != null ) {
 
157
                        _dnText.setText( _saveDN );
 
158
                } else {
 
159
                        _dnText.setText("");
 
160
                }               
 
161
 
 
162
                gbc.gridwidth  = gbc.REMAINDER;
 
163
        gbc.anchor = gbc.NORTHWEST;
 
164
                gbc.fill = gbc.HORIZONTAL;
 
165
                gbc.weightx = 1.0;
 
166
        panel.add(_dnText, gbc);
 
167
                
 
168
        
 
169
        // passwd 
 
170
        _pwdLabel = makeJLabel(_resource.getString(_section+"-SupplierNewPwd","label"));
 
171
        _pwdLabel.setToolTipText(_resource.getString(_section+"-SupplierNewPwd","ttip"));
 
172
                _pwdLabel.resetKeyboardActions();
 
173
 
 
174
        gbc.anchor = gbc.NORTHEAST;
 
175
                gbc.gridwidth  = gbc.RELATIVE;
 
176
                gbc.fill = gbc.NONE;
 
177
                gbc.weightx = 0.0;
 
178
        panel.add(_pwdLabel, gbc);
 
179
                
 
180
        _pwdText= makeJPasswordField(_section, "SupplierNewPwd",
 
181
                                                                         "", 10, _resource);
 
182
                _pwdLabel.setLabelFor(_pwdText);
 
183
                _savePwd = DSUtil.getAttrValue( _legacyEntry, UPDATEDN_PASSWORD_ATTR_NAME);
 
184
                if( _savePwd != null){
 
185
                        _pwdText.setText( _savePwd );
 
186
                } else {
 
187
                        _savePwd = "";
 
188
                        _pwdText.setText("");
 
189
                }
 
190
 
 
191
        gbc.anchor = gbc.NORTHWEST;
 
192
                gbc.gridwidth  = gbc.REMAINDER;
 
193
                gbc.fill = gbc.HORIZONTAL;
 
194
                gbc.weightx = 1.0;
 
195
        panel.add(_pwdText, gbc);
 
196
                
 
197
        // pwd again
 
198
        _againLabel= makeJLabel(_resource.getString(_section+"-SupplierNewPwd","again"));
 
199
                _againLabel.resetKeyboardActions(); 
 
200
                
 
201
                gbc.anchor = gbc.NORTHEAST;
 
202
                gbc.gridwidth  = gbc.RELATIVE;
 
203
                gbc.fill = gbc.NONE;
 
204
                gbc.weightx = 0.0;
 
205
        panel.add(_againLabel, gbc);
 
206
                
 
207
                _againText= makeJPasswordField(_section, "SupplierNewPwd",
 
208
                                                                           "", 10, _resource);          
 
209
                _againLabel.setLabelFor(_againText);
 
210
        gbc.anchor = gbc.NORTHWEST;
 
211
                gbc.fill = gbc.HORIZONTAL;
 
212
                gbc.gridwidth  = gbc.REMAINDER;
 
213
                // empty passwd is not valid
 
214
                _againText.setText( _savePwd );
 
215
        panel.add(_againText, gbc);        
 
216
                
 
217
                return(panel);
 
218
    }
 
219
 
 
220
   /**
 
221
     * Update on-screen data from Directory.
 
222
     *
 
223
     **/
 
224
    public boolean refresh () {
 
225
                Debug.println("LegacyConsumerPanel.refresh()");
 
226
                /* We re-read the entry from the server */
 
227
                _entryExists = false;
 
228
                try {
 
229
                        LDAPConnection ldc = _model.getServerInfo().getLDAPConnection();
 
230
                        _legacyEntry = ldc.read(REPSETTINGS_DN);
 
231
                        if (_legacyEntry != null) {
 
232
                                _entryExists = true;
 
233
                        }
 
234
                } catch (LDAPException lde) {
 
235
                        _legacyEntry = null;
 
236
                }
 
237
                _isLegacyConsumerEnabled = _entryExists;
 
238
                _saveDN = DSUtil.getAttrValue( _legacyEntry, UPDATEDN_ATTR_NAME );              
 
239
                _savePwd = DSUtil.getAttrValue( _legacyEntry, UPDATEDN_PASSWORD_ATTR_NAME);
 
240
 
 
241
                checkOkay();
 
242
                return true;
 
243
        }
 
244
 
 
245
    /**
 
246
     * Update on-screen data from Directory.
 
247
         *
 
248
         * Note: we overwrite the data that the user may have modified.  This is done in order to keep
 
249
         * the coherency between the refresh behaviour of the different panels of the configuration tab.
 
250
     *
 
251
     **/
 
252
    public void refreshFromServer () {
 
253
                Debug.println("LegacyConsumerPanel.refreshFromServer()");
 
254
                resetCallback();
 
255
        }
 
256
        
 
257
 
 
258
    public void resetCallback() {
 
259
                /* We re-read the entry from the server */
 
260
                _entryExists = false;
 
261
                try {
 
262
                        LDAPConnection ldc = _model.getServerInfo().getLDAPConnection();
 
263
                        _legacyEntry = ldc.read(REPSETTINGS_DN);
 
264
                        if (_legacyEntry != null) {
 
265
                                _entryExists = true;
 
266
                        }
 
267
                } catch (LDAPException lde) {
 
268
                        _legacyEntry = null;
 
269
                }
 
270
                _isLegacyConsumerEnabled = _entryExists;
 
271
                _saveDN = DSUtil.getAttrValue( _legacyEntry, UPDATEDN_ATTR_NAME );              
 
272
                _savePwd = DSUtil.getAttrValue( _legacyEntry, UPDATEDN_PASSWORD_ATTR_NAME);
 
273
 
 
274
                if( _saveDN != null){
 
275
                        _dnText.setText( _saveDN );
 
276
                } else {
 
277
                        _dnText.setText("");
 
278
                }
 
279
                _cbEnable.setSelected( _entryExists );
 
280
                _isDNDirty = false;
 
281
                _pwdText.setText( _savePwd );
 
282
                _againText.setText( _savePwd );
 
283
                _isPwdDirty = false;    
 
284
                checkOkay();
 
285
    }
 
286
 
 
287
    public void okCallback() {
 
288
                if (!_isValid ||
 
289
                        !_isDirty) {
 
290
                        return;
 
291
                }
 
292
                LDAPConnection ldc = _model.getServerInfo().getLDAPConnection();
 
293
                /* We read again the entry to check if it exists ...*/
 
294
                _entryExists = false;
 
295
                try {
 
296
                        _legacyEntry = ldc.read(REPSETTINGS_DN);
 
297
                        if (_legacyEntry != null) {
 
298
                                _entryExists = true;
 
299
                        }
 
300
                } catch (LDAPException lde) {
 
301
                        _legacyEntry = null;
 
302
                }
 
303
                checkStatus();
 
304
 
 
305
                String pwd = new String( _pwdText.getPassword() );              
 
306
                
 
307
                if( _mustDelete ) {
 
308
                        try {
 
309
                                ldc.delete(  REPSETTINGS_DN );
 
310
                                _entryExists = false;
 
311
                                _mustDelete = false;
 
312
                                _dnText.setText("");
 
313
                                _pwdText.setText("");
 
314
                                _againText.setText("");
 
315
                        } catch (LDAPException e) {
 
316
                                /* If the entry does not exists, it's already removed, and we don't display any error message */
 
317
                                if (e.getLDAPResultCode() == LDAPException.NO_SUCH_OBJECT) {
 
318
                                        _entryExists = false;
 
319
                                        _mustDelete = false;
 
320
                                        _dnText.setText("");
 
321
                                        _pwdText.setText("");
 
322
                                        _againText.setText("");
 
323
                                } else {
 
324
                                        String ldapError =  e.errorCodeToString();
 
325
                                        String ldapMessage = e.getLDAPErrorMessage();
 
326
                                        if ((ldapMessage != null) &&
 
327
                                                (ldapMessage.length() > 0)) {
 
328
                                                ldapError = ldapError + ". "+ldapMessage;
 
329
                                        }
 
330
                                        String[] args_m = { ldapError };
 
331
                                        DSUtil.showErrorDialog( _model.getFrame(),
 
332
                                                                                        "error-del-legacy",
 
333
                                                                                        args_m,
 
334
                                                                                        _section,
 
335
                                                                                        _resource);
 
336
                                        checkOkay();
 
337
                                        return;
 
338
                                }
 
339
                        }
 
340
                } else if (!_entryExists) {
 
341
                        
 
342
                        LDAPAttributeSet las = new LDAPAttributeSet();
 
343
                        
 
344
                        // add the more well known attributes and values
 
345
                        las.add(new LDAPAttribute("objectclass",
 
346
                                                                          REPSETTINGS_OBJECTCLASSES));
 
347
                        las.add(new LDAPAttribute("cn",
 
348
                                                                          REPSETTINGS_CN));
 
349
                        las.add(new LDAPAttribute(UPDATEDN_ATTR_NAME,
 
350
                                                                          _dnText.getText()));
 
351
                        las.add(new LDAPAttribute(UPDATEDN_PASSWORD_ATTR_NAME,
 
352
                                                                          pwd));        
 
353
                        LDAPEntry newEntry = new LDAPEntry(REPSETTINGS_DN, las);
 
354
                        
 
355
                        try {
 
356
                                ldc.add( newEntry );                            
 
357
                        } catch(LDAPException e) {
 
358
                                String ldapError =  e.errorCodeToString();
 
359
                                String ldapMessage = e.getLDAPErrorMessage();
 
360
                                if ((ldapMessage != null) &&
 
361
                                        (ldapMessage.length() > 0)) {
 
362
                                        ldapError = ldapError + ". "+ldapMessage;
 
363
                                }
 
364
                                String[] args_m = { ldapError };
 
365
                                DSUtil.showErrorDialog( _model.getFrame(),
 
366
                                                                                "error-add-legacy",
 
367
                                                                                args_m,
 
368
                                                                                _section,
 
369
                                                                                _resource);
 
370
                                checkOkay();
 
371
                                return;
 
372
                        }           
 
373
                        _legacyEntry = newEntry;
 
374
                        _entryExists = true;                
 
375
                } else {
 
376
                        LDAPModificationSet attrs = new LDAPModificationSet();
 
377
                        attrs.add(LDAPModification.REPLACE,
 
378
                                          new LDAPAttribute("nsslapd-legacy-updatedn",
 
379
                                                                                _dnText.getText()));
 
380
                        attrs.add(LDAPModification.REPLACE,
 
381
                                          new LDAPAttribute("nsslapd-legacy-updatepw",
 
382
                                                                                pwd));  
 
383
                        try {
 
384
                                ldc.modify( _legacyEntry.getDN(), attrs );
 
385
                        } catch(LDAPException e) {                              
 
386
                                String ldapError =  e.errorCodeToString();
 
387
                                String ldapMessage = e.getLDAPErrorMessage();
 
388
                                if ((ldapMessage != null) &&
 
389
                                        (ldapMessage.length() > 0)) {
 
390
                                        ldapError = ldapError + ". "+ldapMessage;
 
391
                                }
 
392
                                String[] args_m = { ldapError };                        
 
393
                                DSUtil.showErrorDialog( _model.getFrame(),
 
394
                                                                                "error-mod-legacy",
 
395
                                                                                args_m,
 
396
                                                                                _section,
 
397
                                                                                _resource);
 
398
                                checkOkay();
 
399
                                return;
 
400
                        }
 
401
                }
 
402
                _saveDN = _dnText.getText();
 
403
                _savePwd = new String(_pwdText.getPassword());
 
404
                checkOkay();
 
405
    }
 
406
 
 
407
 
 
408
    public void changedUpdate(DocumentEvent e) {
 
409
                insertUpdate(e);
 
410
    }
 
411
        
 
412
    public void insertUpdate(DocumentEvent e) {
 
413
                if (!_isInitialized) return;
 
414
                checkOkay();            
 
415
    }
 
416
        
 
417
    public void removeUpdate(DocumentEvent e) {
 
418
                changedUpdate(e);
 
419
    }
 
420
 
 
421
        public void itemStateChanged(ItemEvent e) {
 
422
                if(e.getSource().equals(_cbEnable)) {                   
 
423
                        checkOkay();                    
 
424
                }
 
425
        }
 
426
 
 
427
        public void actionPerformed(ActionEvent e) {
 
428
                checkOkay();            
 
429
        }
 
430
 
 
431
    private void checkPwd(){
 
432
                String p1 = new String( _pwdText.getPassword() );
 
433
                String p2 = new String( _againText.getPassword() );
 
434
                
 
435
                // (p1.length() == 0) && ( p2.length() == 0) in case of SSL strong auth
 
436
                // for the rest i think there is a min and of course they must be the same
 
437
                _isPasswdOK = (((p1.length() == 0) && ( p2.length() == 0)) ||
 
438
                                           (( p1.length() >= _pwdMinLength ) && 
 
439
                                                ( p2.length() >= _pwdMinLength ) &&
 
440
                                                ( p1.compareTo( p2 ) == 0)));
 
441
                
 
442
                _isPwdDirty = !p1.equals(_savePwd);
 
443
                
 
444
                if( _isPasswdOK ) {
 
445
                        if( _isPwdDirty){
 
446
                                setChangeState( _pwdLabel, CHANGE_STATE_MODIFIED);
 
447
                                setChangeState( _againLabel, CHANGE_STATE_MODIFIED);
 
448
                        } else {
 
449
                                setChangeState( _pwdLabel, CHANGE_STATE_UNMODIFIED);
 
450
                                setChangeState( _againLabel, CHANGE_STATE_UNMODIFIED);
 
451
                        }
 
452
                } else {
 
453
                        setChangeState( _pwdLabel, CHANGE_STATE_ERROR);
 
454
                        setChangeState( _againLabel, CHANGE_STATE_ERROR);
 
455
                }
 
456
    }
 
457
        
 
458
    private void checkDN(){
 
459
                _isDNDirty = !DSUtil.equalDNs(_dnText.getText(), _saveDN);
 
460
                _isDNOK = DSUtil.isValidDN( _dnText.getText());
 
461
                if( _isDNOK ) {
 
462
                        if( _isDNDirty ) {
 
463
                                setChangeState( _dnLabel, CHANGE_STATE_MODIFIED);
 
464
                        } else {
 
465
                                setChangeState( _dnLabel, CHANGE_STATE_UNMODIFIED );
 
466
                        }
 
467
                } else {
 
468
                        setChangeState( _dnLabel, CHANGE_STATE_ERROR);
 
469
                }
 
470
    }
 
471
 
 
472
        private void checkEnable() {
 
473
                _isEnableDirty = (_cbEnable.isSelected() != _entryExists);
 
474
                if (_isEnableDirty) {
 
475
                        setChangeState( _cbEnable, CHANGE_STATE_MODIFIED);
 
476
                } else {
 
477
                        setChangeState( _cbEnable, CHANGE_STATE_UNMODIFIED );
 
478
                }
 
479
        }
 
480
    
 
481
    private void checkOkay() {                          
 
482
                checkEnabledField();
 
483
                checkPwd();
 
484
                checkDN();
 
485
                checkEnable();
 
486
                
 
487
                /* if the check box enable is not selected, what we have is always valid */
 
488
                _isValid = _isPasswdOK && _isDNOK || !_cbEnable.isSelected();
 
489
                _isDirty = (_isPwdDirty || _isDNDirty || _isEnableDirty)  &&
 
490
                        (_isEnableDirty || _cbEnable.isSelected());  /* We don't consider dirty if the user has kept the 
 
491
                                                                                                                        legacy disabled ... even if the other fields have been 
 
492
                                                                                                                        modified */
 
493
                if( _mustDelete ) {
 
494
                        setDirtyFlag();
 
495
                        setValidFlag();
 
496
                } else {
 
497
                        if( _isDirty ){                         
 
498
                                setDirtyFlag();
 
499
                        } else {                                
 
500
                                clearDirtyFlag();
 
501
                        }
 
502
                        if (_isValid) {                         
 
503
                                setValidFlag();                         
 
504
                        } else {                
 
505
                                clearValidFlag();                               
 
506
                        }
 
507
                }
 
508
    }
 
509
 
 
510
 
 
511
    private void checkStatus() {
 
512
                _mustDelete = _entryExists && !_cbEnable.isSelected();
 
513
                _isLegacyConsumerEnabled = _cbEnable.isSelected();
 
514
    }
 
515
    
 
516
    /*==========================================================
 
517
     * private methods
 
518
     *==========================================================*/       
 
519
    private void clearPWDFields() {
 
520
        _pwdText.setText("");
 
521
        _againText.setText("");     
 
522
    }             
 
523
 
 
524
    private void checkEnabledField(){
 
525
                checkStatus();
 
526
                _dnLabel.setEnabled( _isLegacyConsumerEnabled );
 
527
                _dnText.setEnabled( _isLegacyConsumerEnabled );
 
528
                _pwdText.setBackground( _dnText.getBackground());
 
529
                _againText.setBackground( _dnText.getBackground());
 
530
                _pwdLabel.setEnabled( _isLegacyConsumerEnabled );
 
531
                _pwdText.setEnabled( _isLegacyConsumerEnabled );
 
532
                _againLabel.setEnabled( _isLegacyConsumerEnabled );
 
533
                _againText.setEnabled( _isLegacyConsumerEnabled );
 
534
    }
 
535
    
 
536
    /*==========================================================
 
537
     * variables
 
538
     *==========================================================*/
 
539
    private IDSModel    _model;
 
540
    private boolean             _entryExists;
 
541
        private boolean         _isValid = true;
 
542
        private boolean         _isDirty = false;
 
543
    private boolean             _isDNDirty = false;
 
544
    private boolean             _isDNOK = true;
 
545
    private boolean             _isPwdDirty = false;
 
546
    private boolean             _isPasswdOK = true;
 
547
        private boolean     _isEnableDirty = false;
 
548
    private boolean             _mustDelete;
 
549
    private boolean             _isLegacyConsumerEnabled;
 
550
        
 
551
    private JTextField          _dnText;
 
552
    private JPasswordField      _pwdText;
 
553
    private JPasswordField      _againText;
 
554
    private JCheckBox           _cbEnable = null;
 
555
    private JLabel              _dnLabel;
 
556
    private JLabel              _againLabel;
 
557
    private JLabel              _pwdLabel;
 
558
    private String              _savePwd;
 
559
    private String              _saveDN;
 
560
    
 
561
//     DSEntryConfirmPassword _againDSEntry;
 
562
//     DSEntryPassword _pwdDSEntry;
 
563
    private LDAPEntry           _legacyEntry;
 
564
 
 
565
    //get resource bundle
 
566
    private static ResourceSet _resource =
 
567
        new ResourceSet("com.netscape.admin.dirserv.panel.replication.replication");
 
568
    private static final String _section = "replication-legacyconsumer";
 
569
 
 
570
    private static final int _pwdMinLength = 8;
 
571
 
 
572
    private static final String REPSETTINGS_CN = "legacy consumer";
 
573
    public static final String REPSETTINGS_DN = "cn=" + REPSETTINGS_CN +
 
574
        ",cn=replication,cn=config";
 
575
    private static final String[] REPSETTINGS_OBJECTCLASSES =
 
576
    {"top", "extensibleObject"};
 
577
    private static final String UPDATEDN_ATTR_NAME =
 
578
        "nsslapd-legacy-updatedn";
 
579
    private static final String UPDATEDN_PASSWORD_ATTR_NAME =
 
580
        "nsslapd-legacy-updatepw";
 
581
}
 
582