summaryrefslogtreecommitdiffstats
path: root/base/console
diff options
context:
space:
mode:
authorEndi Sukma Dewata <edewata@redhat.com>2012-03-24 02:27:47 -0500
committerEndi Sukma Dewata <edewata@redhat.com>2012-03-26 11:43:54 -0500
commit621d9e5c413e561293d7484b93882d985b3fe15f (patch)
tree638f3d75761c121d9a8fb50b52a12a6686c5ac5c /base/console
parent40d3643b8d91886bf210aa27f711731c81a11e49 (diff)
downloadpki-621d9e5c413e561293d7484b93882d985b3fe15f.tar.gz
pki-621d9e5c413e561293d7484b93882d985b3fe15f.tar.xz
pki-621d9e5c413e561293d7484b93882d985b3fe15f.zip
Removed unnecessary pki folder.
Previously the source code was located inside a pki folder. This folder was created during svn migration and is no longer needed. This folder has now been removed and the contents have been moved up one level. Ticket #131
Diffstat (limited to 'base/console')
-rw-r--r--base/console/CMakeLists.txt4
-rw-r--r--base/console/LICENSE291
-rw-r--r--base/console/src/CMakeLists.txt661
-rw-r--r--base/console/src/com/netscape/admin/certsrv/AttrCellRenderer.java60
-rw-r--r--base/console/src/com/netscape/admin/certsrv/CMSAdmin.java969
-rw-r--r--base/console/src/com/netscape/admin/certsrv/CMSAdminResources.java197
-rw-r--r--base/console/src/com/netscape/admin/certsrv/CMSAdminUtil.java1298
-rw-r--r--base/console/src/com/netscape/admin/certsrv/CMSBaseMenuInfo.java178
-rw-r--r--base/console/src/com/netscape/admin/certsrv/CMSBasePanel.java460
-rw-r--r--base/console/src/com/netscape/admin/certsrv/CMSBaseResourceModel.java263
-rw-r--r--base/console/src/com/netscape/admin/certsrv/CMSCAUILoader.java373
-rw-r--r--base/console/src/com/netscape/admin/certsrv/CMSCCMUILoader.java107
-rw-r--r--base/console/src/com/netscape/admin/certsrv/CMSContentTableModel.java100
-rw-r--r--base/console/src/com/netscape/admin/certsrv/CMSEAUILoader.java136
-rw-r--r--base/console/src/com/netscape/admin/certsrv/CMSKernelUILoader.java319
-rw-r--r--base/console/src/com/netscape/admin/certsrv/CMSMessageBox.java124
-rw-r--r--base/console/src/com/netscape/admin/certsrv/CMSOCSPUILoader.java100
-rw-r--r--base/console/src/com/netscape/admin/certsrv/CMSPageFeeder.java150
-rw-r--r--base/console/src/com/netscape/admin/certsrv/CMSPassword.java301
-rw-r--r--base/console/src/com/netscape/admin/certsrv/CMSRAUILoader.java266
-rw-r--r--base/console/src/com/netscape/admin/certsrv/CMSRemoteClassLoader.java109
-rw-r--r--base/console/src/com/netscape/admin/certsrv/CMSResourceObject.java126
-rw-r--r--base/console/src/com/netscape/admin/certsrv/CMSResourcePage.java154
-rw-r--r--base/console/src/com/netscape/admin/certsrv/CMSServerInfo.java172
-rw-r--r--base/console/src/com/netscape/admin/certsrv/CMSTableModel.java256
-rw-r--r--base/console/src/com/netscape/admin/certsrv/CMSTaskModel.java288
-rw-r--r--base/console/src/com/netscape/admin/certsrv/CMSTaskObject.java71
-rw-r--r--base/console/src/com/netscape/admin/certsrv/CMSUIFramework.java242
-rw-r--r--base/console/src/com/netscape/admin/certsrv/CellEditorData.java32
-rw-r--r--base/console/src/com/netscape/admin/certsrv/Console.java1861
-rw-r--r--base/console/src/com/netscape/admin/certsrv/CustomComboBox.java78
-rw-r--r--base/console/src/com/netscape/admin/certsrv/CustomComboBoxModel.java169
-rw-r--r--base/console/src/com/netscape/admin/certsrv/DefaultTableCellEditor.java238
-rw-r--r--base/console/src/com/netscape/admin/certsrv/EAdminException.java142
-rw-r--r--base/console/src/com/netscape/admin/certsrv/GenericCellEditor.java223
-rw-r--r--base/console/src/com/netscape/admin/certsrv/GenericCellRenderer.java153
-rw-r--r--base/console/src/com/netscape/admin/certsrv/HourGlass.java52
-rw-r--r--base/console/src/com/netscape/admin/certsrv/IAttributeContent.java30
-rw-r--r--base/console/src/com/netscape/admin/certsrv/IConnectionListener.java29
-rw-r--r--base/console/src/com/netscape/admin/certsrv/IDataProcessor.java36
-rw-r--r--base/console/src/com/netscape/admin/certsrv/IDisplayPanel.java43
-rw-r--r--base/console/src/com/netscape/admin/certsrv/IEditorPanel.java60
-rw-r--r--base/console/src/com/netscape/admin/certsrv/IFilterPanel.java67
-rw-r--r--base/console/src/com/netscape/admin/certsrv/IMenuAction.java40
-rw-r--r--base/console/src/com/netscape/admin/certsrv/IRefreshTab.java41
-rw-r--r--base/console/src/com/netscape/admin/certsrv/IRefreshTabPanel.java38
-rw-r--r--base/console/src/com/netscape/admin/certsrv/IResourceSelectionListener.java39
-rw-r--r--base/console/src/com/netscape/admin/certsrv/ISubSystemUILoader.java33
-rw-r--r--base/console/src/com/netscape/admin/certsrv/IUIMapper.java89
-rw-r--r--base/console/src/com/netscape/admin/certsrv/LabelCellRenderer.java116
-rw-r--r--base/console/src/com/netscape/admin/certsrv/MultilineLabelUI.java534
-rw-r--r--base/console/src/com/netscape/admin/certsrv/PasswordCellRenderer.java71
-rw-r--r--base/console/src/com/netscape/admin/certsrv/StatusItemContinuousProgress.java97
-rw-r--r--base/console/src/com/netscape/admin/certsrv/UIMapperRegistry.java121
-rw-r--r--base/console/src/com/netscape/admin/certsrv/certsrv-help.properties534
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/ACIDialog.java517
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/ACLDataModel.java47
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/ACLEditDialog.java557
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/ACLImplDataModel.java47
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/ACLImplTab.java227
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/ACLPanel.java231
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/AutoRecoveryModel.java57
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CACertsTab.java392
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSAccessLogPanel.java210
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSAuditLogPanel.java210
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSAutoRecovery.java267
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSBaseConfigDialog.java1078
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSBaseConfigPanel.java180
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSBaseLDAPPanel.java692
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSBaseLogPanel.java366
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSBaseTab.java95
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSBlankPanel.java82
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSCACertSettingPanel.java171
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSCAConnectorPanel.java237
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSCAGeneralPanel.java424
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSCALDAPPanel.java44
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSCRLCachePanel.java371
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSCRLFormatPanel.java448
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSCRLIPPanel.java327
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSCRLSettingPanel.java698
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSCertSettingPanel.java150
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSCipherPreferenceDialog.java201
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSCipherPreferencePane.java112
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSEAGeneralPanel.java169
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSEncryptionPanel.java835
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSErrorLogPanel.java180
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSKRAAutoPanel.java220
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSKRAPasswdPanel.java267
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSKRASchemePanel.java198
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSLDAPSettingPanel.java362
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSNetworkPanel.java465
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSOCSPGeneralPanel.java219
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSPasswordDialog.java310
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSPluginInstanceTab.java442
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSRACLMPanel.java313
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSRAConnectorPanel.java251
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSRAGeneralPanel.java185
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSRALDAPPanel.java44
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSRuleDataModel.java82
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSSMTPPanel.java170
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSSNMPPanel.java296
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSSSL2CipherPreference.java36
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSSSL2CipherSet.java74
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSSSL3CipherPreference.java37
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSSSL3CipherSet.java91
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSSelfTestsPanel.java219
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSTabPanel.java350
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMSUserCertSettingPanel.java155
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CMStoAdminEncryptionPane.java67
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CRLExtensionsConfigDialog.java76
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CRLExtensionsInstanceTab.java114
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CRLExtensionsPluginSelectionDialog.java67
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CRLExtensionsRuleDataModel.java69
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/CRLIPEditor.java330
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/ConfigTableModel.java42
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/ConnectorEditor.java634
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/EvaluatorRegisterDialog.java41
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/GeneralLogPanel.java250
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/JobsConfigDialog.java62
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/JobsImplDataModel.java68
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/JobsImplTab.java323
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/JobsInstanceTab.java104
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/JobsPluginSelectionDialog.java66
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/JobsRegisterDialog.java40
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/JobsRuleDataModel.java71
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/JobsSettingPanel.java240
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/KeyCreateDialog.java299
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/ListCertsModel.java56
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/ListKeysModel.java56
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/LogConfigDialog.java62
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/LogImplDataModel.java68
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/LogImplTab.java315
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/LogInstanceTab.java95
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/LogPluginSelectionDialog.java69
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/LogRegisterDialog.java40
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/LogRuleDataModel.java62
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/MNSchemeWizard.java64
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/MNSchemeWizardInfo.java107
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/MapperConfigDialog.java64
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/MapperImplDataModel.java68
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/MapperImplTab.java320
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/MapperInstanceTab.java95
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/MapperPluginSelectionDialog.java74
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/MapperRegisterDialog.java40
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/MapperRuleDataModel.java62
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/OCSPStoresConfigDialog.java60
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/OCSPStoresInstanceTab.java132
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/OCSPStoresPluginSelectionDialog.java67
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/OCSPStoresRuleDataModel.java69
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/PanelMapperConfigDialog.java409
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/PluginSelectionDialog.java375
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/PolicyConfigDialog.java64
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/PolicyImplDataModel.java68
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/PolicyImplTab.java322
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/PolicyInstanceTab.java139
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/PolicyPluginSelectionDialog.java73
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/PolicyRegisterDialog.java40
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/PolicyRuleDataModel.java71
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/PolicyRuleOrderDialog.java331
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/ProfileComponentCellEditor.java109
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/ProfileConfigDataModel.java83
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/ProfileConfigDialog.java396
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/ProfileDataTable.java68
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/ProfileEditDataModel.java88
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/ProfileEditDialog.java931
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/ProfileImplDataModel.java70
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/ProfileImplTab.java382
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/ProfileInstanceTab.java161
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/ProfileListDataModel.java60
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/ProfileNonPolicyNewDialog.java429
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/ProfileNonPolicySelDialog.java386
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/ProfilePluginSelectionDialog.java187
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/ProfilePolicyEditDataModel.java85
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/ProfilePolicyEditDialog.java698
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/ProfilePolicyNewDialog.java714
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/ProfilePolicySelectionDialog.java515
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/ProfileRegisterDialog.java303
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/ProfileRuleDataModel.java69
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/PublisherConfigDialog.java64
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/PublisherImplDataModel.java68
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/PublisherImplTab.java321
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/PublisherInstanceTab.java95
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/PublisherPluginSelectionDialog.java74
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/PublisherRegisterDialog.java40
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/PublisherRuleDataModel.java62
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/RegisterDialog.java286
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/RuleConfigDialog.java64
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/RuleImplDataModel.java68
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/RuleImplTab.java320
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/RuleInstanceTab.java97
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/RulePluginSelectionDialog.java74
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/RuleRegisterDialog.java40
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/RuleRuleDataModel.java70
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/TKSKeysTab.java366
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/UserCertsTab.java342
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/ViewDialog.java189
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/ViewSelfTestsDialog.java172
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/ViewTableModel.java40
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/WBaseCertExtensionPage.java445
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/WBaseCertRequestPage.java261
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/WBaseDNPage.java493
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/WBaseDNValidityPage.java207
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/WBaseKeyPage.java248
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/WBaseManualCertRequestPage.java508
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/WBaseValidityPage.java258
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/WMNNewAgent.java293
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/WMNOldAgent.java214
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/WMNResultPage.java102
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/WMNSelection.java226
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/WMessageDigestPage.java240
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/WarningDialog.java171
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/ComponentCellRenderer.java32
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/InstallWizard.java202
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/InstallWizardInfo.java1724
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIAdminPage.java266
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIAllCertsInstalledPage.java269
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WICACert1CustomPage.java72
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WICACert1Page.java218
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WICACert2Page.java72
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WICACertDNPage.java97
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WICACertExtensionPage.java80
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WICACertPage.java172
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WICACertSubmitPage.java79
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WICACertValidityPage.java75
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WICAKeyPage.java115
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WICAMessageDigestPage.java80
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WICAOCSPServicePage.java172
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WICARequestResultPage.java59
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WICASerialNumberPage.java381
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WICATokenLogonPage.java76
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WICertDNPage.java153
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WICertExtensionPage.java168
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WICertRequestPage.java73
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WICertSetupStatusPage.java144
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WICertSubmitPage.java144
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WICertValidityPage.java141
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WICloneCAKeyCertPage.java292
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WICloneKRAKeyCertPage.java292
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WICloneMasterPage.java409
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WICloneOCSPKeyCertPage.java237
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIClonePage.java142
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WICloneRAKeyCertPage.java242
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WICloneTKSKeyCertPage.java182
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIConfigWebServerPage.java182
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WICreateInternalDBPage.java581
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIDBEnrollPage.java211
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIDisplayCACertPage.java75
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIDisplayCertPage.java205
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIDisplayKRACertPage.java77
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIDisplayOCSPCertPage.java71
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIDisplayRACertPage.java73
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIDisplaySSLCertPage.java70
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIExistingDBPage.java282
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIGenCAKeyCertPage.java68
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIGenCAKeyCertReqPage.java80
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIGenKRAKeyCertPage.java70
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIGenKRAKeyCertReqPage.java82
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIGenKeyCertPage.java143
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIGenKeyCertReqPage.java291
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIGenOCSPKeyCertPage.java62
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIGenOCSPKeyCertReqPage.java77
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIGenRAKeyCertPage.java67
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIGenRAKeyCertReqPage.java79
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIGenSSLKeyCertReqPage.java76
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIGenServerKeyCertPage.java62
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIInstallCACertStatusPage.java70
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIInstallCAIntroPage.java62
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIInstallCert1Page.java157
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIInstallCert2Page.java140
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIInstallCertStatusPage.java248
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIInstallIntroPage.java133
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIInstallKRACertStatusPage.java72
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIInstallKRAIntroPage.java65
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIInstallOCSPCertStatusPage.java67
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIInstallOCSPIntroPage.java60
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIInstallRACertStatusPage.java69
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIInstallRAIntroPage.java61
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIInstallSSLCertStatusPage.java65
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIInstallSSLIntroPage.java58
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIInternalDBInfoPage.java173
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIInternalDBPage.java313
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIInternalTokenLogonPage.java67
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIIntroMigrationPage.java162
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIIntroPage.java217
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIIntroSingleSignonPage.java162
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIKRACertDNPage.java105
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIKRACertExtensionPage.java75
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIKRACertSubmitPage.java80
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIKRACertValidityPage.java77
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIKRAKeyPage.java100
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIKRAMessageDigestPage.java79
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIKRANumberPage.java378
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIKRARequestResultPage.java58
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIKRAScheme1Page.java188
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIKRAScheme2Page.java309
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIKRAStorageKeyPage.java356
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIKRATokenLogonPage.java74
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIKeyPage.java641
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WILDAPPublishingPage.java279
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WILoggingPage.java202
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WILogonAllTokensPage.java264
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIManualCACertRequestPage.java86
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIManualCertRequestPage.java178
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIManualKRACertRequestPage.java77
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIManualOCSPCertRequestPage.java72
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIManualRACertRequestPage.java74
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIManualSSLCertRequestPage.java69
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIMasterOrClone.java172
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIMigrationPage.java715
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WINetworkPage.java499
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPCertDNPage.java83
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPCertSubmitPage.java76
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPKeyPage.java90
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPMessageDigestPage.java80
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPRequestResultPage.java63
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPTokenLogonPage.java73
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIPasteCACertPage.java67
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIPasteCertPage.java500
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIPasteKRACertPage.java68
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIPasteOCSPCertPage.java63
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIPasteRACertPage.java64
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIPasteSSLCertPage.java60
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIRACertDNPage.java86
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIRACertExtensionPage.java75
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIRACertSubmitPage.java76
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIRACertValidityPage.java74
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIRAKeyPage.java94
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIRAMessageDigestPage.java79
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIRARequestResultPage.java58
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIRATokenLogonPage.java75
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIRecreateDBPage.java139
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIRemoteCASubsystem.java291
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIRemoteKRASubsystem.java371
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIReplAgreementPage.java417
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIRequestResultPage.java148
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WISMTPPage.java129
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WISSLMessageDigestPage.java79
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WISSLRequestResultPage.java58
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WISSLTokenLogonPage.java72
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIServerCertDNPage.java116
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIServerCertExtensionPage.java71
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIServerCertSubmitPage.java89
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIServerCertValidityPage.java69
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIServerKeyPage.java93
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WIServicesPage.java425
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WISingleSignonPage.java532
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WITokenLogonPage.java255
-rw-r--r--base/console/src/com/netscape/admin/certsrv/config/install/WITrustDBPage.java138
-rw-r--r--base/console/src/com/netscape/admin/certsrv/connection/AdminConnection.java818
-rw-r--r--base/console/src/com/netscape/admin/certsrv/connection/BasicAuthenticator.java54
-rw-r--r--base/console/src/com/netscape/admin/certsrv/connection/IAuthenticator.java30
-rw-r--r--base/console/src/com/netscape/admin/certsrv/connection/IConnection.java55
-rw-r--r--base/console/src/com/netscape/admin/certsrv/connection/IConnectionFactory.java40
-rw-r--r--base/console/src/com/netscape/admin/certsrv/connection/JSSConnection.java761
-rw-r--r--base/console/src/com/netscape/admin/certsrv/connection/PromptForTrustDialog.java316
-rw-r--r--base/console/src/com/netscape/admin/certsrv/connection/Request.java70
-rw-r--r--base/console/src/com/netscape/admin/certsrv/connection/Response.java133
-rw-r--r--base/console/src/com/netscape/admin/certsrv/connection/SSLConnectionFactory.java81
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/CertificateServer.gifbin0 -> 363 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/CertificateServerL.gifbin0 -> 501 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/LOGobjs.gifbin0 -> 174 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/UGobjs.gifbin0 -> 176 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/acl.gifbin0 -> 123 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/aclobj.gifbin0 -> 178 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/aclplugin.gifbin0 -> 173 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/alertl.gifbin0 -> 372 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/allfolder16n.gifbin0 -> 878 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/allgroup16n.gifbin0 -> 128 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/alllogdoc16n.gifbin0 -> 154 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/alllogfolder16n.gifbin0 -> 132 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/alluser16n.gifbin0 -> 85 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/alluserwithcert16n.gifbin0 -> 144 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/auth.gifbin0 -> 112 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/authobj.gifbin0 -> 179 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/authplugin.gifbin0 -> 167 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/cert24.gifbin0 -> 501 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/cert41.gifbin0 -> 2153 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/cert42.gifbin0 -> 2291 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/cms-branding.gifbin0 -> 2145 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/error.gifbin0 -> 368 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/genobject.gifbin0 -> 159 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/jobobj.gifbin0 -> 178 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/jobplugin.gifbin0 -> 173 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/jobs.gifbin0 -> 123 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/ldapub.gifbin0 -> 172 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/messagel.gifbin0 -> 693 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/notsecure.gifbin0 -> 157 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/plug.gifbin0 -> 175 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/plugin.gifbin0 -> 143 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/pluginfolder.gifbin0 -> 176 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/red-ball-small.gifbin0 -> 255 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/rule-16.gifbin0 -> 145 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/ruleDisable-16.gifbin0 -> 131 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/ruleplugin-16.gifbin0 -> 172 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/rulesobj.gifbin0 -> 188 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/secure.gifbin0 -> 173 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/servlet-16.gifbin0 -> 104 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/servlet-plugin-16.gifbin0 -> 164 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/images/servletobj.gifbin0 -> 172 bytes
-rw-r--r--base/console/src/com/netscape/admin/certsrv/keycert/CertSetupWizard.java82
-rw-r--r--base/console/src/com/netscape/admin/certsrv/keycert/CertSetupWizardInfo.java412
-rw-r--r--base/console/src/com/netscape/admin/certsrv/keycert/WCACertRequest1Page.java237
-rw-r--r--base/console/src/com/netscape/admin/certsrv/keycert/WCAKeyPage.java102
-rw-r--r--base/console/src/com/netscape/admin/certsrv/keycert/WCertDNPage.java196
-rw-r--r--base/console/src/com/netscape/admin/certsrv/keycert/WCertDNValidityPage.java100
-rw-r--r--base/console/src/com/netscape/admin/certsrv/keycert/WCertExtensionPage.java273
-rw-r--r--base/console/src/com/netscape/admin/certsrv/keycert/WCertMessageDigestPage.java113
-rw-r--r--base/console/src/com/netscape/admin/certsrv/keycert/WCertRequestPage.java81
-rw-r--r--base/console/src/com/netscape/admin/certsrv/keycert/WCertTypePage.java500
-rw-r--r--base/console/src/com/netscape/admin/certsrv/keycert/WCertValidityPage.java139
-rw-r--r--base/console/src/com/netscape/admin/certsrv/keycert/WDisplayCertPage.java258
-rw-r--r--base/console/src/com/netscape/admin/certsrv/keycert/WExecute1Page.java158
-rw-r--r--base/console/src/com/netscape/admin/certsrv/keycert/WExecutePage.java158
-rw-r--r--base/console/src/com/netscape/admin/certsrv/keycert/WGenerateReqPage.java92
-rw-r--r--base/console/src/com/netscape/admin/certsrv/keycert/WInstallCertChainPage.java141
-rw-r--r--base/console/src/com/netscape/admin/certsrv/keycert/WInstallOpPage.java221
-rw-r--r--base/console/src/com/netscape/admin/certsrv/keycert/WInstallStatusPage.java105
-rw-r--r--base/console/src/com/netscape/admin/certsrv/keycert/WIntroInstallCertPage.java93
-rw-r--r--base/console/src/com/netscape/admin/certsrv/keycert/WIntroPage.java120
-rw-r--r--base/console/src/com/netscape/admin/certsrv/keycert/WIssueImportStatusPage.java105
-rw-r--r--base/console/src/com/netscape/admin/certsrv/keycert/WKeyPage.java809
-rw-r--r--base/console/src/com/netscape/admin/certsrv/keycert/WManualCertRequestPage.java199
-rw-r--r--base/console/src/com/netscape/admin/certsrv/keycert/WOperationSelectionPage.java134
-rw-r--r--base/console/src/com/netscape/admin/certsrv/keycert/WOtherCertRequest1Page.java176
-rw-r--r--base/console/src/com/netscape/admin/certsrv/keycert/WPasteCertPage.java261
-rw-r--r--base/console/src/com/netscape/admin/certsrv/keycert/WRAKeyPage.java72
-rw-r--r--base/console/src/com/netscape/admin/certsrv/keycert/WRequestStatusPage.java142
-rw-r--r--base/console/src/com/netscape/admin/certsrv/keycert/WSSLKeyPage.java72
-rw-r--r--base/console/src/com/netscape/admin/certsrv/keycert/WTokenLogonPage.java178
-rw-r--r--base/console/src/com/netscape/admin/certsrv/keycert/WTokenSelectionPage.java158
-rw-r--r--base/console/src/com/netscape/admin/certsrv/keycert/WWarningExecute1Page.java161
-rw-r--r--base/console/src/com/netscape/admin/certsrv/keycert/WWarningExecutePage.java154
-rw-r--r--base/console/src/com/netscape/admin/certsrv/keycert/WWarningPage.java143
-rw-r--r--base/console/src/com/netscape/admin/certsrv/managecert/CertificateInfoDialog.java351
-rw-r--r--base/console/src/com/netscape/admin/certsrv/managecert/ManageCertDialog.java362
-rw-r--r--base/console/src/com/netscape/admin/certsrv/managecert/ManageCertModel.java55
-rw-r--r--base/console/src/com/netscape/admin/certsrv/menu/CertManagementAction.java47
-rw-r--r--base/console/src/com/netscape/admin/certsrv/menu/KeyCertAction.java48
-rw-r--r--base/console/src/com/netscape/admin/certsrv/menu/PKCS11ManagementAction.java47
-rw-r--r--base/console/src/com/netscape/admin/certsrv/menu/RefreshTabPane.java101
-rw-r--r--base/console/src/com/netscape/admin/certsrv/misc/MessageFormatter.java138
-rw-r--r--base/console/src/com/netscape/admin/certsrv/notification/RequestCompletePanel.java280
-rw-r--r--base/console/src/com/netscape/admin/certsrv/notification/RequestInQPanel.java302
-rw-r--r--base/console/src/com/netscape/admin/certsrv/notification/RequestRevokedPanel.java283
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/AbstractCipher.java82
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/AbstractCipherPreference.java279
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/CRLAddCertDialog.java226
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/CRLCertInfoPane.java112
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/CRLDeleteCertDialog.java201
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/CRLManagementDialog.java309
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/CRLTable.java235
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/CRLTableModel.java94
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/CertBasicInfo.java83
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/CertDetailInfoDialog.java111
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/CertInfo.java87
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/CertInfoDialog.java528
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/CertInstallCertInfoPane.java391
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/CertInstallCertPane.java236
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/CertInstallTypePane.java296
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/CertListTable.java316
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/CertListTableModel.java91
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/CertManagementDialog.java220
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/CertRequestCertPane.java197
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/CertRequestEnterPasswordPane.java217
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/CertRequestInfoPane.java403
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/CertRequestSelectTokenPane.java302
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/CertRequestTypePane.java390
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/ChangeKeyPasswordDialog.java175
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/CipherEntry.java190
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/CipherPreferenceDialog.java332
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/CipherResourceSet.java26
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/Comm.java158
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/CreateTrustPane.java231
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/EncryptionPane.java639
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/GuideCertInstallPane.java82
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/GuideCertRequestPane.java81
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/GuideCreateTrustPane.java79
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/GuideIntroPane.java119
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/IAbstractCipherSet.java44
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/ICipherConstants.java76
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/IEncryptionPaneListener.java52
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/IKeyCertPage.java26
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/KeyCertTaskInfo.java116
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/KeyCertUtility.java113
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/KeyCertWizard.java328
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/Message.java241
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/MessageDialog.java66
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/PKCS11AddModuleDialog.java165
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/PKCS11ManagementDialog.java242
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/Response.java407
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/SSL2CipherPreference.java56
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/SSL2CipherSet.java85
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/SSL3CipherPreference.java64
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/SSL3CipherSet.java119
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/StatusPane.java153
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/ToggleCipherPreferencePane.java181
-rw-r--r--base/console/src/com/netscape/admin/certsrv/security/WizardObservable.java48
-rw-r--r--base/console/src/com/netscape/admin/certsrv/status/AccessLogDataModel.java43
-rw-r--r--base/console/src/com/netscape/admin/certsrv/status/AuditLogDataModel.java43
-rw-r--r--base/console/src/com/netscape/admin/certsrv/status/CMSLogPanel.java360
-rw-r--r--base/console/src/com/netscape/admin/certsrv/status/DefaultLogParser.java118
-rw-r--r--base/console/src/com/netscape/admin/certsrv/status/ErrorLogDataModel.java43
-rw-r--r--base/console/src/com/netscape/admin/certsrv/status/ILogParser.java38
-rw-r--r--base/console/src/com/netscape/admin/certsrv/status/LogDataModel.java107
-rw-r--r--base/console/src/com/netscape/admin/certsrv/status/LogEntryViewDialog.java202
-rw-r--r--base/console/src/com/netscape/admin/certsrv/status/LogInstancePanel.java157
-rw-r--r--base/console/src/com/netscape/admin/certsrv/status/StatusPanel.java246
-rw-r--r--base/console/src/com/netscape/admin/certsrv/task/AuthDialog.java244
-rw-r--r--base/console/src/com/netscape/admin/certsrv/task/CGITask.java400
-rw-r--r--base/console/src/com/netscape/admin/certsrv/task/CMSCertRequest.java418
-rw-r--r--base/console/src/com/netscape/admin/certsrv/task/CMSConfigCert.java207
-rw-r--r--base/console/src/com/netscape/admin/certsrv/task/CMSImportCert.java429
-rw-r--r--base/console/src/com/netscape/admin/certsrv/task/CMSMigrateCreate.java340
-rw-r--r--base/console/src/com/netscape/admin/certsrv/task/CMSRemove.java166
-rw-r--r--base/console/src/com/netscape/admin/certsrv/task/CMSRequestCert.java421
-rw-r--r--base/console/src/com/netscape/admin/certsrv/task/CMSRestart.java186
-rw-r--r--base/console/src/com/netscape/admin/certsrv/task/CMSStart.java179
-rw-r--r--base/console/src/com/netscape/admin/certsrv/task/CMSStartDaemon.java284
-rw-r--r--base/console/src/com/netscape/admin/certsrv/task/CMSStatus.java207
-rw-r--r--base/console/src/com/netscape/admin/certsrv/task/CMSStop.java161
-rw-r--r--base/console/src/com/netscape/admin/certsrv/task/CreateInstanceDialog.java246
-rw-r--r--base/console/src/com/netscape/admin/certsrv/task/KeyCert.java62
-rw-r--r--base/console/src/com/netscape/admin/certsrv/task/StatusDialog.java186
-rw-r--r--base/console/src/com/netscape/admin/certsrv/ug/AuthBaseDialog.java355
-rw-r--r--base/console/src/com/netscape/admin/certsrv/ug/AuthConfigDialog.java91
-rw-r--r--base/console/src/com/netscape/admin/certsrv/ug/AuthImplDataModel.java72
-rw-r--r--base/console/src/com/netscape/admin/certsrv/ug/AuthImplTab.java353
-rw-r--r--base/console/src/com/netscape/admin/certsrv/ug/AuthInstanceTab.java141
-rw-r--r--base/console/src/com/netscape/admin/certsrv/ug/AuthPluginSelectionDialog.java95
-rw-r--r--base/console/src/com/netscape/admin/certsrv/ug/AuthRegisterDialog.java40
-rw-r--r--base/console/src/com/netscape/admin/certsrv/ug/AuthRuleDataModel.java64
-rw-r--r--base/console/src/com/netscape/admin/certsrv/ug/AuthViewDialog.java65
-rw-r--r--base/console/src/com/netscape/admin/certsrv/ug/CMSBaseUGTab.java153
-rw-r--r--base/console/src/com/netscape/admin/certsrv/ug/CMSUGTabPanel.java136
-rw-r--r--base/console/src/com/netscape/admin/certsrv/ug/CertDataModel.java85
-rw-r--r--base/console/src/com/netscape/admin/certsrv/ug/CertImportDialog.java256
-rw-r--r--base/console/src/com/netscape/admin/certsrv/ug/CertManagementDialog.java441
-rw-r--r--base/console/src/com/netscape/admin/certsrv/ug/CertViewDialog.java201
-rw-r--r--base/console/src/com/netscape/admin/certsrv/ug/GroupDataModel.java61
-rw-r--r--base/console/src/com/netscape/admin/certsrv/ug/GroupEditor.java596
-rw-r--r--base/console/src/com/netscape/admin/certsrv/ug/GroupListDataModel.java67
-rw-r--r--base/console/src/com/netscape/admin/certsrv/ug/GroupListDialog.java284
-rw-r--r--base/console/src/com/netscape/admin/certsrv/ug/GroupTab.java369
-rw-r--r--base/console/src/com/netscape/admin/certsrv/ug/MemberDataModel.java140
-rw-r--r--base/console/src/com/netscape/admin/certsrv/ug/UserDataModel.java68
-rw-r--r--base/console/src/com/netscape/admin/certsrv/ug/UserEditor.java627
-rw-r--r--base/console/src/com/netscape/admin/certsrv/ug/UserListDataModel.java70
-rw-r--r--base/console/src/com/netscape/admin/certsrv/ug/UserListDialog.java369
-rw-r--r--base/console/src/com/netscape/admin/certsrv/ug/UserTab.java374
-rw-r--r--base/console/src/com/netscape/admin/certsrv/wizard/ConfigServlet.java24
-rw-r--r--base/console/src/com/netscape/admin/certsrv/wizard/IWizardDone.java28
-rw-r--r--base/console/src/com/netscape/admin/certsrv/wizard/IWizardPanel.java98
-rw-r--r--base/console/src/com/netscape/admin/certsrv/wizard/WizardBasePanel.java290
-rw-r--r--base/console/src/com/netscape/admin/certsrv/wizard/WizardInfo.java88
-rw-r--r--base/console/src/com/netscape/admin/certsrv/wizard/WizardWidget.java428
-rw-r--r--base/console/src/com/netscape/certsrv/common/ConfigConstants.java333
-rw-r--r--base/console/src/com/netscape/certsrv/common/Constants.java749
-rw-r--r--base/console/src/com/netscape/certsrv/common/DestDef.java57
-rw-r--r--base/console/src/com/netscape/certsrv/common/NameValuePairs.java80
-rw-r--r--base/console/src/com/netscape/certsrv/common/OpDef.java39
-rw-r--r--base/console/src/com/netscape/certsrv/common/PrefixDef.java41
-rw-r--r--base/console/src/com/netscape/certsrv/common/ScopeDef.java193
-rw-r--r--base/console/src/com/netscape/certsrv/common/TaskId.java129
-rw-r--r--base/console/templates/CMakeLists.txt12
-rwxr-xr-xbase/console/templates/pki_console_wrapper167
565 files changed, 103808 insertions, 0 deletions
diff --git a/base/console/CMakeLists.txt b/base/console/CMakeLists.txt
new file mode 100644
index 000000000..24adfac49
--- /dev/null
+++ b/base/console/CMakeLists.txt
@@ -0,0 +1,4 @@
+project(console Java)
+
+add_subdirectory(src)
+add_subdirectory(templates)
diff --git a/base/console/LICENSE b/base/console/LICENSE
new file mode 100644
index 000000000..e281f4362
--- /dev/null
+++ b/base/console/LICENSE
@@ -0,0 +1,291 @@
+This Program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published
+by the Free Software Foundation; version 2 of the License.
+
+This Program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with this Program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
diff --git a/base/console/src/CMakeLists.txt b/base/console/src/CMakeLists.txt
new file mode 100644
index 000000000..175a4a1a7
--- /dev/null
+++ b/base/console/src/CMakeLists.txt
@@ -0,0 +1,661 @@
+project(pki-console_java Java)
+
+# '/usr/share/java/pki' jars
+find_file(PKI_NSUTIL_JAR
+ NAMES
+ pki-nsutil.jar
+ PATHS
+ ${JAVA_LIB_INSTALL_DIR}
+ /usr/share/java/pki
+)
+
+
+# '/usr/share/java' jars
+find_file(BASE_JAR
+ NAMES
+ idm-console-base.jar
+ PATHS
+ ${JAVA_LIB_INSTALL_DIR}
+ /usr/share/java
+)
+
+find_file(LDAPJDK_JAR
+ NAMES
+ ldapjdk.jar
+ PATHS
+ ${JAVA_LIB_INSTALL_DIR}
+ /usr/share/java
+)
+
+find_file(MMC_JAR
+ NAMES
+ idm-console-mcc.jar
+ PATHS
+ ${JAVA_LIB_INSTALL_DIR}
+ /usr/share/java
+)
+
+find_file(MMC_EN_JAR
+ NAMES
+ idm-console-mcc_en.jar
+ PATHS
+ ${JAVA_LIB_INSTALL_DIR}
+ /usr/share/java
+)
+
+find_file(NMCLF_JAR
+ NAMES
+ idm-console-nmclf.jar
+ PATHS
+ ${JAVA_LIB_INSTALL_DIR}
+ /usr/share/java
+)
+
+find_file(NMCLF_EN_JAR
+ NAMES
+ idm-console-nmclf_en.jar
+ PATHS
+ ${JAVA_LIB_INSTALL_DIR}
+ /usr/share/java
+)
+
+
+# '${JAVA_LIB_INSTALL_DIR}' jars
+find_file(JSS_JAR
+ NAMES
+ jss4.jar
+ PATHS
+ ${JAVA_LIB_INSTALL_DIR}
+ /usr/share/java
+)
+
+find_file(COMMONS_CODEC_JAR
+ NAMES
+ commons-codec.jar
+ PATHS
+ /usr/share/java
+)
+
+
+# identify java sources
+set(pki-console_java_SRCS
+ com/netscape/certsrv/common/TaskId.java
+ com/netscape/certsrv/common/DestDef.java
+ com/netscape/certsrv/common/NameValuePairs.java
+ com/netscape/certsrv/common/ScopeDef.java
+ com/netscape/certsrv/common/PrefixDef.java
+ com/netscape/certsrv/common/ConfigConstants.java
+ com/netscape/certsrv/common/OpDef.java
+ com/netscape/certsrv/common/Constants.java
+ com/netscape/admin/certsrv/CMSCCMUILoader.java
+ com/netscape/admin/certsrv/IFilterPanel.java
+ com/netscape/admin/certsrv/CMSPageFeeder.java
+ com/netscape/admin/certsrv/CMSResourceObject.java
+ com/netscape/admin/certsrv/CMSOCSPUILoader.java
+ com/netscape/admin/certsrv/Console.java
+ com/netscape/admin/certsrv/connection/AdminConnection.java
+ com/netscape/admin/certsrv/connection/Response.java
+ com/netscape/admin/certsrv/connection/BasicAuthenticator.java
+ com/netscape/admin/certsrv/connection/JSSConnection.java
+ com/netscape/admin/certsrv/connection/IAuthenticator.java
+ com/netscape/admin/certsrv/connection/IConnectionFactory.java
+ com/netscape/admin/certsrv/connection/PromptForTrustDialog.java
+ com/netscape/admin/certsrv/connection/SSLConnectionFactory.java
+ com/netscape/admin/certsrv/connection/IConnection.java
+ com/netscape/admin/certsrv/connection/Request.java
+ com/netscape/admin/certsrv/CMSTaskModel.java
+ com/netscape/admin/certsrv/IEditorPanel.java
+ com/netscape/admin/certsrv/IAttributeContent.java
+ com/netscape/admin/certsrv/CMSAdmin.java
+ com/netscape/admin/certsrv/CMSBaseMenuInfo.java
+ com/netscape/admin/certsrv/CMSTaskObject.java
+ com/netscape/admin/certsrv/IResourceSelectionListener.java
+ com/netscape/admin/certsrv/PasswordCellRenderer.java
+ com/netscape/admin/certsrv/GenericCellEditor.java
+ com/netscape/admin/certsrv/CMSRAUILoader.java
+ com/netscape/admin/certsrv/CMSResourcePage.java
+ com/netscape/admin/certsrv/CustomComboBox.java
+ com/netscape/admin/certsrv/AttrCellRenderer.java
+ com/netscape/admin/certsrv/CMSAdminUtil.java
+ com/netscape/admin/certsrv/CMSCAUILoader.java
+ com/netscape/admin/certsrv/misc/MessageFormatter.java
+ com/netscape/admin/certsrv/CMSBasePanel.java
+ com/netscape/admin/certsrv/CMSAdminResources.java
+ com/netscape/admin/certsrv/managecert/ManageCertModel.java
+ com/netscape/admin/certsrv/managecert/ManageCertDialog.java
+ com/netscape/admin/certsrv/managecert/CertificateInfoDialog.java
+ com/netscape/admin/certsrv/EAdminException.java
+ com/netscape/admin/certsrv/CMSTableModel.java
+ com/netscape/admin/certsrv/IDisplayPanel.java
+ com/netscape/admin/certsrv/CustomComboBoxModel.java
+ com/netscape/admin/certsrv/CMSUIFramework.java
+ com/netscape/admin/certsrv/ISubSystemUILoader.java
+ com/netscape/admin/certsrv/CMSRemoteClassLoader.java
+ com/netscape/admin/certsrv/config/PolicyRuleDataModel.java
+ com/netscape/admin/certsrv/config/CMSBaseLDAPPanel.java
+ com/netscape/admin/certsrv/config/CMSSelfTestsPanel.java
+ com/netscape/admin/certsrv/config/RuleImplTab.java
+ com/netscape/admin/certsrv/config/ProfileEditDataModel.java
+ com/netscape/admin/certsrv/config/ProfileInstanceTab.java
+ com/netscape/admin/certsrv/config/ACLDataModel.java
+ com/netscape/admin/certsrv/config/PublisherRuleDataModel.java
+ com/netscape/admin/certsrv/config/MapperImplDataModel.java
+ com/netscape/admin/certsrv/config/ProfileComponentCellEditor.java
+ com/netscape/admin/certsrv/config/LogPluginSelectionDialog.java
+ com/netscape/admin/certsrv/config/RuleRegisterDialog.java
+ com/netscape/admin/certsrv/config/CMSBaseConfigPanel.java
+ com/netscape/admin/certsrv/config/CMSCRLFormatPanel.java
+ com/netscape/admin/certsrv/config/CRLIPEditor.java
+ com/netscape/admin/certsrv/config/CMSAccessLogPanel.java
+ com/netscape/admin/certsrv/config/WarningDialog.java
+ com/netscape/admin/certsrv/config/PolicyPluginSelectionDialog.java
+ com/netscape/admin/certsrv/config/ListCertsModel.java
+ com/netscape/admin/certsrv/config/CMSAutoRecovery.java
+ com/netscape/admin/certsrv/config/CRLExtensionsPluginSelectionDialog.java
+ com/netscape/admin/certsrv/config/CMSSNMPPanel.java
+ com/netscape/admin/certsrv/config/MapperImplTab.java
+ com/netscape/admin/certsrv/config/CRLExtensionsInstanceTab.java
+ com/netscape/admin/certsrv/config/ProfileRegisterDialog.java
+ com/netscape/admin/certsrv/config/CMSCipherPreferenceDialog.java
+ com/netscape/admin/certsrv/config/RegisterDialog.java
+ com/netscape/admin/certsrv/config/CMSCipherPreferencePane.java
+ com/netscape/admin/certsrv/config/ACIDialog.java
+ com/netscape/admin/certsrv/config/PolicyRuleOrderDialog.java
+ com/netscape/admin/certsrv/config/MapperPluginSelectionDialog.java
+ com/netscape/admin/certsrv/config/PolicyImplTab.java
+ com/netscape/admin/certsrv/config/ViewDialog.java
+ com/netscape/admin/certsrv/config/MapperRegisterDialog.java
+ com/netscape/admin/certsrv/config/JobsRuleDataModel.java
+ com/netscape/admin/certsrv/config/GeneralLogPanel.java
+ com/netscape/admin/certsrv/config/WMNSelection.java
+ com/netscape/admin/certsrv/config/OCSPStoresConfigDialog.java
+ com/netscape/admin/certsrv/config/PublisherPluginSelectionDialog.java
+ com/netscape/admin/certsrv/config/JobsImplDataModel.java
+ com/netscape/admin/certsrv/config/WBaseKeyPage.java
+ com/netscape/admin/certsrv/config/CMSRACLMPanel.java
+ com/netscape/admin/certsrv/config/WMNResultPage.java
+ com/netscape/admin/certsrv/config/WMNOldAgent.java
+ com/netscape/admin/certsrv/config/PolicyInstanceTab.java
+ com/netscape/admin/certsrv/config/ProfileImplTab.java
+ com/netscape/admin/certsrv/config/PluginSelectionDialog.java
+ com/netscape/admin/certsrv/config/CMSCRLSettingPanel.java
+ com/netscape/admin/certsrv/config/CMSCRLIPPanel.java
+ com/netscape/admin/certsrv/config/CMSLDAPSettingPanel.java
+ com/netscape/admin/certsrv/config/PublisherImplTab.java
+ com/netscape/admin/certsrv/config/RuleImplDataModel.java
+ com/netscape/admin/certsrv/config/ProfilePolicyEditDataModel.java
+ com/netscape/admin/certsrv/config/LogInstanceTab.java
+ com/netscape/admin/certsrv/config/CMSPasswordDialog.java
+ com/netscape/admin/certsrv/config/UserCertsTab.java
+ com/netscape/admin/certsrv/config/CMSSSL3CipherPreference.java
+ com/netscape/admin/certsrv/config/WBaseManualCertRequestPage.java
+ com/netscape/admin/certsrv/config/WBaseCertRequestPage.java
+ com/netscape/admin/certsrv/config/ProfileImplDataModel.java
+ com/netscape/admin/certsrv/config/JobsSettingPanel.java
+ com/netscape/admin/certsrv/config/CMSBaseConfigDialog.java
+ com/netscape/admin/certsrv/config/ViewTableModel.java
+ com/netscape/admin/certsrv/config/OCSPStoresPluginSelectionDialog.java
+ com/netscape/admin/certsrv/config/CMSCAConnectorPanel.java
+ com/netscape/admin/certsrv/config/CMSKRASchemePanel.java
+ com/netscape/admin/certsrv/config/RuleInstanceTab.java
+ com/netscape/admin/certsrv/config/PolicyConfigDialog.java
+ com/netscape/admin/certsrv/config/ConnectorEditor.java
+ com/netscape/admin/certsrv/config/ProfilePolicyNewDialog.java
+ com/netscape/admin/certsrv/config/CMSErrorLogPanel.java
+ com/netscape/admin/certsrv/config/RulePluginSelectionDialog.java
+ com/netscape/admin/certsrv/config/AutoRecoveryModel.java
+ com/netscape/admin/certsrv/config/PublisherInstanceTab.java
+ com/netscape/admin/certsrv/config/WBaseDNValidityPage.java
+ com/netscape/admin/certsrv/config/install/WITrustDBPage.java
+ com/netscape/admin/certsrv/config/install/WIRequestResultPage.java
+ com/netscape/admin/certsrv/config/install/WIPasteOCSPCertPage.java
+ com/netscape/admin/certsrv/config/install/WIRACertExtensionPage.java
+ com/netscape/admin/certsrv/config/install/WIKRANumberPage.java
+ com/netscape/admin/certsrv/config/install/WIKRARequestResultPage.java
+ com/netscape/admin/certsrv/config/install/WIGenCAKeyCertPage.java
+ com/netscape/admin/certsrv/config/install/WICACertValidityPage.java
+ com/netscape/admin/certsrv/config/install/WIRAMessageDigestPage.java
+ com/netscape/admin/certsrv/config/install/WICloneTKSKeyCertPage.java
+ com/netscape/admin/certsrv/config/install/WIInstallCACertStatusPage.java
+ com/netscape/admin/certsrv/config/install/WIGenOCSPKeyCertPage.java
+ com/netscape/admin/certsrv/config/install/WIKeyPage.java
+ com/netscape/admin/certsrv/config/install/WIPasteSSLCertPage.java
+ com/netscape/admin/certsrv/config/install/WIKRAScheme1Page.java
+ com/netscape/admin/certsrv/config/install/WIDBEnrollPage.java
+ com/netscape/admin/certsrv/config/install/WIKRACertDNPage.java
+ com/netscape/admin/certsrv/config/install/WICertDNPage.java
+ com/netscape/admin/certsrv/config/install/WIManualKRACertRequestPage.java
+ com/netscape/admin/certsrv/config/install/WIConfigWebServerPage.java
+ com/netscape/admin/certsrv/config/install/WIGenKeyCertReqPage.java
+ com/netscape/admin/certsrv/config/install/WIKRAStorageKeyPage.java
+ com/netscape/admin/certsrv/config/install/WIClonePage.java
+ com/netscape/admin/certsrv/config/install/WILogonAllTokensPage.java
+ com/netscape/admin/certsrv/config/install/WICloneCAKeyCertPage.java
+ com/netscape/admin/certsrv/config/install/WIMigrationPage.java
+ com/netscape/admin/certsrv/config/install/WICACertPage.java
+ com/netscape/admin/certsrv/config/install/WIRACertSubmitPage.java
+ com/netscape/admin/certsrv/config/install/WICertExtensionPage.java
+ com/netscape/admin/certsrv/config/install/WIInternalTokenLogonPage.java
+ com/netscape/admin/certsrv/config/install/WIRACertDNPage.java
+ com/netscape/admin/certsrv/config/install/WIServerCertExtensionPage.java
+ com/netscape/admin/certsrv/config/install/WIInstallCert2Page.java
+ com/netscape/admin/certsrv/config/install/WIGenRAKeyCertReqPage.java
+ com/netscape/admin/certsrv/config/install/WIKRAMessageDigestPage.java
+ com/netscape/admin/certsrv/config/install/WILoggingPage.java
+ com/netscape/admin/certsrv/config/install/WIKRATokenLogonPage.java
+ com/netscape/admin/certsrv/config/install/WIRARequestResultPage.java
+ com/netscape/admin/certsrv/config/install/WIOCSPRequestResultPage.java
+ com/netscape/admin/certsrv/config/install/WIDisplayRACertPage.java
+ com/netscape/admin/certsrv/config/install/WICACertSubmitPage.java
+ com/netscape/admin/certsrv/config/install/WIInstallCAIntroPage.java
+ com/netscape/admin/certsrv/config/install/WICloneMasterPage.java
+ com/netscape/admin/certsrv/config/install/WICertSubmitPage.java
+ com/netscape/admin/certsrv/config/install/WIRATokenLogonPage.java
+ com/netscape/admin/certsrv/config/install/WICloneRAKeyCertPage.java
+ com/netscape/admin/certsrv/config/install/WIGenKRAKeyCertPage.java
+ com/netscape/admin/certsrv/config/install/WICAKeyPage.java
+ com/netscape/admin/certsrv/config/install/WIInstallIntroPage.java
+ com/netscape/admin/certsrv/config/install/WIDisplayOCSPCertPage.java
+ com/netscape/admin/certsrv/config/install/WIIntroSingleSignonPage.java
+ com/netscape/admin/certsrv/config/install/WIInstallRACertStatusPage.java
+ com/netscape/admin/certsrv/config/install/WINetworkPage.java
+ com/netscape/admin/certsrv/config/install/WIOCSPKeyPage.java
+ com/netscape/admin/certsrv/config/install/WIManualSSLCertRequestPage.java
+ com/netscape/admin/certsrv/config/install/WIGenCAKeyCertReqPage.java
+ com/netscape/admin/certsrv/config/install/WIDisplayCACertPage.java
+ com/netscape/admin/certsrv/config/install/WICAMessageDigestPage.java
+ com/netscape/admin/certsrv/config/install/WIServerCertValidityPage.java
+ com/netscape/admin/certsrv/config/install/WIKRACertValidityPage.java
+ com/netscape/admin/certsrv/config/install/WIInstallSSLIntroPage.java
+ com/netscape/admin/certsrv/config/install/WIServerKeyPage.java
+ com/netscape/admin/certsrv/config/install/WISSLRequestResultPage.java
+ com/netscape/admin/certsrv/config/install/WIServerCertDNPage.java
+ com/netscape/admin/certsrv/config/install/WIOCSPMessageDigestPage.java
+ com/netscape/admin/certsrv/config/install/WIOCSPTokenLogonPage.java
+ com/netscape/admin/certsrv/config/install/WIPasteRACertPage.java
+ com/netscape/admin/certsrv/config/install/WISSLTokenLogonPage.java
+ com/netscape/admin/certsrv/config/install/ComponentCellRenderer.java
+ com/netscape/admin/certsrv/config/install/WIInstallCertStatusPage.java
+ com/netscape/admin/certsrv/config/install/WIInstallCert1Page.java
+ com/netscape/admin/certsrv/config/install/WIGenKeyCertPage.java
+ com/netscape/admin/certsrv/config/install/WIInstallRAIntroPage.java
+ com/netscape/admin/certsrv/config/install/WIOCSPCertSubmitPage.java
+ com/netscape/admin/certsrv/config/install/WIInternalDBInfoPage.java
+ com/netscape/admin/certsrv/config/install/WICloneKRAKeyCertPage.java
+ com/netscape/admin/certsrv/config/install/WISSLMessageDigestPage.java
+ com/netscape/admin/certsrv/config/install/WIManualOCSPCertRequestPage.java
+ com/netscape/admin/certsrv/config/install/WICATokenLogonPage.java
+ com/netscape/admin/certsrv/config/install/WICACert2Page.java
+ com/netscape/admin/certsrv/config/install/WIInstallKRAIntroPage.java
+ com/netscape/admin/certsrv/config/install/WIManualRACertRequestPage.java
+ com/netscape/admin/certsrv/config/install/WITokenLogonPage.java
+ com/netscape/admin/certsrv/config/install/WIRACertValidityPage.java
+ com/netscape/admin/certsrv/config/install/WICARequestResultPage.java
+ com/netscape/admin/certsrv/config/install/WIIntroMigrationPage.java
+ com/netscape/admin/certsrv/config/install/WIRAKeyPage.java
+ com/netscape/admin/certsrv/config/install/WIGenServerKeyCertPage.java
+ com/netscape/admin/certsrv/config/install/WIKRAScheme2Page.java
+ com/netscape/admin/certsrv/config/install/WICAOCSPServicePage.java
+ com/netscape/admin/certsrv/config/install/WILDAPPublishingPage.java
+ com/netscape/admin/certsrv/config/install/WICACertDNPage.java
+ com/netscape/admin/certsrv/config/install/WIRemoteCASubsystem.java
+ com/netscape/admin/certsrv/config/install/WIRecreateDBPage.java
+ com/netscape/admin/certsrv/config/install/WIServerCertSubmitPage.java
+ com/netscape/admin/certsrv/config/install/WIAllCertsInstalledPage.java
+ com/netscape/admin/certsrv/config/install/InstallWizardInfo.java
+ com/netscape/admin/certsrv/config/install/WIManualCertRequestPage.java
+ com/netscape/admin/certsrv/config/install/WIManualCACertRequestPage.java
+ com/netscape/admin/certsrv/config/install/WIIntroPage.java
+ com/netscape/admin/certsrv/config/install/WIAdminPage.java
+ com/netscape/admin/certsrv/config/install/WIPasteKRACertPage.java
+ com/netscape/admin/certsrv/config/install/WICACertExtensionPage.java
+ com/netscape/admin/certsrv/config/install/WIGenOCSPKeyCertReqPage.java
+ com/netscape/admin/certsrv/config/install/WIInstallOCSPIntroPage.java
+ com/netscape/admin/certsrv/config/install/WICertSetupStatusPage.java
+ com/netscape/admin/certsrv/config/install/WIPasteCACertPage.java
+ com/netscape/admin/certsrv/config/install/WIKRACertExtensionPage.java
+ com/netscape/admin/certsrv/config/install/WIGenRAKeyCertPage.java
+ com/netscape/admin/certsrv/config/install/WISMTPPage.java
+ com/netscape/admin/certsrv/config/install/WIReplAgreementPage.java
+ com/netscape/admin/certsrv/config/install/WISingleSignonPage.java
+ com/netscape/admin/certsrv/config/install/WIOCSPCertDNPage.java
+ com/netscape/admin/certsrv/config/install/WIKRAKeyPage.java
+ com/netscape/admin/certsrv/config/install/WIInstallKRACertStatusPage.java
+ com/netscape/admin/certsrv/config/install/WICertValidityPage.java
+ com/netscape/admin/certsrv/config/install/WICreateInternalDBPage.java
+ com/netscape/admin/certsrv/config/install/WIRemoteKRASubsystem.java
+ com/netscape/admin/certsrv/config/install/WIDisplayCertPage.java
+ com/netscape/admin/certsrv/config/install/WIInstallOCSPCertStatusPage.java
+ com/netscape/admin/certsrv/config/install/WIInternalDBPage.java
+ com/netscape/admin/certsrv/config/install/WICACert1Page.java
+ com/netscape/admin/certsrv/config/install/WIDisplaySSLCertPage.java
+ com/netscape/admin/certsrv/config/install/WIInstallSSLCertStatusPage.java
+ com/netscape/admin/certsrv/config/install/WIExistingDBPage.java
+ com/netscape/admin/certsrv/config/install/InstallWizard.java
+ com/netscape/admin/certsrv/config/install/WIGenKRAKeyCertReqPage.java
+ com/netscape/admin/certsrv/config/install/WIMasterOrClone.java
+ com/netscape/admin/certsrv/config/install/WIServicesPage.java
+ com/netscape/admin/certsrv/config/install/WIKRACertSubmitPage.java
+ com/netscape/admin/certsrv/config/install/WICertRequestPage.java
+ com/netscape/admin/certsrv/config/install/WICloneOCSPKeyCertPage.java
+ com/netscape/admin/certsrv/config/install/WICASerialNumberPage.java
+ com/netscape/admin/certsrv/config/install/WIGenSSLKeyCertReqPage.java
+ com/netscape/admin/certsrv/config/install/WIPasteCertPage.java
+ com/netscape/admin/certsrv/config/install/WIDisplayKRACertPage.java
+ com/netscape/admin/certsrv/config/install/WICACert1CustomPage.java
+ com/netscape/admin/certsrv/config/ProfileDataTable.java
+ com/netscape/admin/certsrv/config/CMSSSL2CipherSet.java
+ com/netscape/admin/certsrv/config/CMSCACertSettingPanel.java
+ com/netscape/admin/certsrv/config/PublisherConfigDialog.java
+ com/netscape/admin/certsrv/config/CMSAuditLogPanel.java
+ com/netscape/admin/certsrv/config/ACLImplDataModel.java
+ com/netscape/admin/certsrv/config/CMSCertSettingPanel.java
+ com/netscape/admin/certsrv/config/CMSKRAAutoPanel.java
+ com/netscape/admin/certsrv/config/CMSCAGeneralPanel.java
+ com/netscape/admin/certsrv/config/CMSEncryptionPanel.java
+ com/netscape/admin/certsrv/config/CMSOCSPGeneralPanel.java
+ com/netscape/admin/certsrv/config/PublisherRegisterDialog.java
+ com/netscape/admin/certsrv/config/ProfileNonPolicySelDialog.java
+ com/netscape/admin/certsrv/config/LogImplDataModel.java
+ com/netscape/admin/certsrv/config/LogImplTab.java
+ com/netscape/admin/certsrv/config/ProfilePolicyEditDialog.java
+ com/netscape/admin/certsrv/config/CRLExtensionsRuleDataModel.java
+ com/netscape/admin/certsrv/config/CMSCALDAPPanel.java
+ com/netscape/admin/certsrv/config/CMSBlankPanel.java
+ com/netscape/admin/certsrv/config/CMSTabPanel.java
+ com/netscape/admin/certsrv/config/CACertsTab.java
+ com/netscape/admin/certsrv/config/CMSRAGeneralPanel.java
+ com/netscape/admin/certsrv/config/ViewSelfTestsDialog.java
+ com/netscape/admin/certsrv/config/CMSBaseLogPanel.java
+ com/netscape/admin/certsrv/config/CMSPluginInstanceTab.java
+ com/netscape/admin/certsrv/config/MapperConfigDialog.java
+ com/netscape/admin/certsrv/config/TKSKeysTab.java
+ com/netscape/admin/certsrv/config/ConfigTableModel.java
+ com/netscape/admin/certsrv/config/OCSPStoresInstanceTab.java
+ com/netscape/admin/certsrv/config/ProfileEditDialog.java
+ com/netscape/admin/certsrv/config/EvaluatorRegisterDialog.java
+ com/netscape/admin/certsrv/config/ACLPanel.java
+ com/netscape/admin/certsrv/config/LogRegisterDialog.java
+ com/netscape/admin/certsrv/config/OCSPStoresRuleDataModel.java
+ com/netscape/admin/certsrv/config/PanelMapperConfigDialog.java
+ com/netscape/admin/certsrv/config/LogConfigDialog.java
+ com/netscape/admin/certsrv/config/CMSKRAPasswdPanel.java
+ com/netscape/admin/certsrv/config/CMSRALDAPPanel.java
+ com/netscape/admin/certsrv/config/CMSRuleDataModel.java
+ com/netscape/admin/certsrv/config/ProfileConfigDataModel.java
+ com/netscape/admin/certsrv/config/MapperInstanceTab.java
+ com/netscape/admin/certsrv/config/JobsConfigDialog.java
+ com/netscape/admin/certsrv/config/MNSchemeWizard.java
+ com/netscape/admin/certsrv/config/RuleConfigDialog.java
+ com/netscape/admin/certsrv/config/ProfilePluginSelectionDialog.java
+ com/netscape/admin/certsrv/config/JobsInstanceTab.java
+ com/netscape/admin/certsrv/config/JobsRegisterDialog.java
+ com/netscape/admin/certsrv/config/JobsImplTab.java
+ com/netscape/admin/certsrv/config/WBaseCertExtensionPage.java
+ com/netscape/admin/certsrv/config/CMSBaseTab.java
+ com/netscape/admin/certsrv/config/ACLImplTab.java
+ com/netscape/admin/certsrv/config/KeyCreateDialog.java
+ com/netscape/admin/certsrv/config/CMSNetworkPanel.java
+ com/netscape/admin/certsrv/config/ProfileConfigDialog.java
+ com/netscape/admin/certsrv/config/MapperRuleDataModel.java
+ com/netscape/admin/certsrv/config/WBaseValidityPage.java
+ com/netscape/admin/certsrv/config/CMSSSL3CipherSet.java
+ com/netscape/admin/certsrv/config/CMSEAGeneralPanel.java
+ com/netscape/admin/certsrv/config/WBaseDNPage.java
+ com/netscape/admin/certsrv/config/CMStoAdminEncryptionPane.java
+ com/netscape/admin/certsrv/config/ListKeysModel.java
+ com/netscape/admin/certsrv/config/CMSSSL2CipherPreference.java
+ com/netscape/admin/certsrv/config/ACLEditDialog.java
+ com/netscape/admin/certsrv/config/CRLExtensionsConfigDialog.java
+ com/netscape/admin/certsrv/config/ProfilePolicySelectionDialog.java
+ com/netscape/admin/certsrv/config/WMessageDigestPage.java
+ com/netscape/admin/certsrv/config/CMSUserCertSettingPanel.java
+ com/netscape/admin/certsrv/config/MNSchemeWizardInfo.java
+ com/netscape/admin/certsrv/config/PublisherImplDataModel.java
+ com/netscape/admin/certsrv/config/CMSSMTPPanel.java
+ com/netscape/admin/certsrv/config/JobsPluginSelectionDialog.java
+ com/netscape/admin/certsrv/config/LogRuleDataModel.java
+ com/netscape/admin/certsrv/config/CMSCRLCachePanel.java
+ com/netscape/admin/certsrv/config/ProfileNonPolicyNewDialog.java
+ com/netscape/admin/certsrv/config/RuleRuleDataModel.java
+ com/netscape/admin/certsrv/config/ProfileRuleDataModel.java
+ com/netscape/admin/certsrv/config/WMNNewAgent.java
+ com/netscape/admin/certsrv/config/CMSRAConnectorPanel.java
+ com/netscape/admin/certsrv/config/PolicyRegisterDialog.java
+ com/netscape/admin/certsrv/config/PolicyImplDataModel.java
+ com/netscape/admin/certsrv/config/ProfileListDataModel.java
+ com/netscape/admin/certsrv/IDataProcessor.java
+ com/netscape/admin/certsrv/MultilineLabelUI.java
+ com/netscape/admin/certsrv/LabelCellRenderer.java
+ com/netscape/admin/certsrv/GenericCellRenderer.java
+ com/netscape/admin/certsrv/task/AuthDialog.java
+ com/netscape/admin/certsrv/task/CreateInstanceDialog.java
+ com/netscape/admin/certsrv/task/CMSStart.java
+ com/netscape/admin/certsrv/task/StatusDialog.java
+ com/netscape/admin/certsrv/task/CGITask.java
+ com/netscape/admin/certsrv/task/CMSConfigCert.java
+ com/netscape/admin/certsrv/task/CMSMigrateCreate.java
+ com/netscape/admin/certsrv/task/KeyCert.java
+ com/netscape/admin/certsrv/task/CMSStartDaemon.java
+ com/netscape/admin/certsrv/task/CMSRestart.java
+ com/netscape/admin/certsrv/task/CMSStop.java
+ com/netscape/admin/certsrv/task/CMSStatus.java
+ com/netscape/admin/certsrv/task/CMSRemove.java
+ com/netscape/admin/certsrv/task/CMSImportCert.java
+ com/netscape/admin/certsrv/task/CMSRequestCert.java
+ com/netscape/admin/certsrv/task/CMSCertRequest.java
+ com/netscape/admin/certsrv/IMenuAction.java
+ com/netscape/admin/certsrv/CMSEAUILoader.java
+ com/netscape/admin/certsrv/wizard/WizardWidget.java
+ com/netscape/admin/certsrv/wizard/IWizardDone.java
+ com/netscape/admin/certsrv/wizard/WizardInfo.java
+ com/netscape/admin/certsrv/wizard/ConfigServlet.java
+ com/netscape/admin/certsrv/wizard/IWizardPanel.java
+ com/netscape/admin/certsrv/wizard/WizardBasePanel.java
+ com/netscape/admin/certsrv/CellEditorData.java
+ com/netscape/admin/certsrv/CMSContentTableModel.java
+ com/netscape/admin/certsrv/keycert/WCAKeyPage.java
+ com/netscape/admin/certsrv/keycert/WSSLKeyPage.java
+ com/netscape/admin/certsrv/keycert/WKeyPage.java
+ com/netscape/admin/certsrv/keycert/WWarningExecute1Page.java
+ com/netscape/admin/certsrv/keycert/WTokenLogonPage.java
+ com/netscape/admin/certsrv/keycert/CertSetupWizard.java
+ com/netscape/admin/certsrv/keycert/WCertMessageDigestPage.java
+ com/netscape/admin/certsrv/keycert/WCertRequestPage.java
+ com/netscape/admin/certsrv/keycert/WWarningExecutePage.java
+ com/netscape/admin/certsrv/keycert/WPasteCertPage.java
+ com/netscape/admin/certsrv/keycert/WCertValidityPage.java
+ com/netscape/admin/certsrv/keycert/WCertExtensionPage.java
+ com/netscape/admin/certsrv/keycert/WInstallOpPage.java
+ com/netscape/admin/certsrv/keycert/WDisplayCertPage.java
+ com/netscape/admin/certsrv/keycert/WWarningPage.java
+ com/netscape/admin/certsrv/keycert/WRequestStatusPage.java
+ com/netscape/admin/certsrv/keycert/WCertTypePage.java
+ com/netscape/admin/certsrv/keycert/WIntroInstallCertPage.java
+ com/netscape/admin/certsrv/keycert/CertSetupWizardInfo.java
+ com/netscape/admin/certsrv/keycert/WInstallStatusPage.java
+ com/netscape/admin/certsrv/keycert/WExecutePage.java
+ com/netscape/admin/certsrv/keycert/WOperationSelectionPage.java
+ com/netscape/admin/certsrv/keycert/WTokenSelectionPage.java
+ com/netscape/admin/certsrv/keycert/WGenerateReqPage.java
+ com/netscape/admin/certsrv/keycert/WManualCertRequestPage.java
+ com/netscape/admin/certsrv/keycert/WInstallCertChainPage.java
+ com/netscape/admin/certsrv/keycert/WOtherCertRequest1Page.java
+ com/netscape/admin/certsrv/keycert/WExecute1Page.java
+ com/netscape/admin/certsrv/keycert/WIntroPage.java
+ com/netscape/admin/certsrv/keycert/WCertDNValidityPage.java
+ com/netscape/admin/certsrv/keycert/WCertDNPage.java
+ com/netscape/admin/certsrv/keycert/WIssueImportStatusPage.java
+ com/netscape/admin/certsrv/keycert/WCACertRequest1Page.java
+ com/netscape/admin/certsrv/keycert/WRAKeyPage.java
+ com/netscape/admin/certsrv/IRefreshTabPanel.java
+ com/netscape/admin/certsrv/status/LogDataModel.java
+ com/netscape/admin/certsrv/status/AccessLogDataModel.java
+ com/netscape/admin/certsrv/status/LogInstancePanel.java
+ com/netscape/admin/certsrv/status/DefaultLogParser.java
+ com/netscape/admin/certsrv/status/ErrorLogDataModel.java
+ com/netscape/admin/certsrv/status/CMSLogPanel.java
+ com/netscape/admin/certsrv/status/StatusPanel.java
+ com/netscape/admin/certsrv/status/LogEntryViewDialog.java
+ com/netscape/admin/certsrv/status/ILogParser.java
+ com/netscape/admin/certsrv/status/AuditLogDataModel.java
+ com/netscape/admin/certsrv/StatusItemContinuousProgress.java
+ com/netscape/admin/certsrv/CMSPassword.java
+ com/netscape/admin/certsrv/ug/AuthRuleDataModel.java
+ com/netscape/admin/certsrv/ug/AuthConfigDialog.java
+ com/netscape/admin/certsrv/ug/AuthPluginSelectionDialog.java
+ com/netscape/admin/certsrv/ug/UserDataModel.java
+ com/netscape/admin/certsrv/ug/GroupDataModel.java
+ com/netscape/admin/certsrv/ug/GroupListDialog.java
+ com/netscape/admin/certsrv/ug/UserListDataModel.java
+ com/netscape/admin/certsrv/ug/GroupListDataModel.java
+ com/netscape/admin/certsrv/ug/CMSBaseUGTab.java
+ com/netscape/admin/certsrv/ug/CMSUGTabPanel.java
+ com/netscape/admin/certsrv/ug/CertDataModel.java
+ com/netscape/admin/certsrv/ug/MemberDataModel.java
+ com/netscape/admin/certsrv/ug/UserEditor.java
+ com/netscape/admin/certsrv/ug/GroupTab.java
+ com/netscape/admin/certsrv/ug/AuthRegisterDialog.java
+ com/netscape/admin/certsrv/ug/CertImportDialog.java
+ com/netscape/admin/certsrv/ug/AuthInstanceTab.java
+ com/netscape/admin/certsrv/ug/CertViewDialog.java
+ com/netscape/admin/certsrv/ug/CertManagementDialog.java
+ com/netscape/admin/certsrv/ug/AuthImplDataModel.java
+ com/netscape/admin/certsrv/ug/UserTab.java
+ com/netscape/admin/certsrv/ug/AuthViewDialog.java
+ com/netscape/admin/certsrv/ug/AuthImplTab.java
+ com/netscape/admin/certsrv/ug/GroupEditor.java
+ com/netscape/admin/certsrv/ug/UserListDialog.java
+ com/netscape/admin/certsrv/ug/AuthBaseDialog.java
+ com/netscape/admin/certsrv/IConnectionListener.java
+ com/netscape/admin/certsrv/UIMapperRegistry.java
+ com/netscape/admin/certsrv/HourGlass.java
+ com/netscape/admin/certsrv/CMSBaseResourceModel.java
+ com/netscape/admin/certsrv/menu/CertManagementAction.java
+ com/netscape/admin/certsrv/menu/PKCS11ManagementAction.java
+ com/netscape/admin/certsrv/menu/RefreshTabPane.java
+ com/netscape/admin/certsrv/menu/KeyCertAction.java
+ com/netscape/admin/certsrv/IRefreshTab.java
+ com/netscape/admin/certsrv/CMSKernelUILoader.java
+ com/netscape/admin/certsrv/CMSMessageBox.java
+ com/netscape/admin/certsrv/DefaultTableCellEditor.java
+ com/netscape/admin/certsrv/security/GuideCreateTrustPane.java
+ com/netscape/admin/certsrv/security/SSL2CipherSet.java
+ com/netscape/admin/certsrv/security/Comm.java
+ com/netscape/admin/certsrv/security/CertBasicInfo.java
+ com/netscape/admin/certsrv/security/CRLAddCertDialog.java
+ com/netscape/admin/certsrv/security/AbstractCipherPreference.java
+ com/netscape/admin/certsrv/security/WizardObservable.java
+ com/netscape/admin/certsrv/security/CertDetailInfoDialog.java
+ com/netscape/admin/certsrv/security/IAbstractCipherSet.java
+ com/netscape/admin/certsrv/security/StatusPane.java
+ com/netscape/admin/certsrv/security/Response.java
+ com/netscape/admin/certsrv/security/ICipherConstants.java
+ com/netscape/admin/certsrv/security/MessageDialog.java
+ com/netscape/admin/certsrv/security/SSL2CipherPreference.java
+ com/netscape/admin/certsrv/security/KeyCertTaskInfo.java
+ com/netscape/admin/certsrv/security/AbstractCipher.java
+ com/netscape/admin/certsrv/security/CertInstallTypePane.java
+ com/netscape/admin/certsrv/security/CertInstallCertPane.java
+ com/netscape/admin/certsrv/security/ChangeKeyPasswordDialog.java
+ com/netscape/admin/certsrv/security/CertRequestEnterPasswordPane.java
+ com/netscape/admin/certsrv/security/CertListTableModel.java
+ com/netscape/admin/certsrv/security/KeyCertUtility.java
+ com/netscape/admin/certsrv/security/CreateTrustPane.java
+ com/netscape/admin/certsrv/security/CipherPreferenceDialog.java
+ com/netscape/admin/certsrv/security/CRLTableModel.java
+ com/netscape/admin/certsrv/security/CRLTable.java
+ com/netscape/admin/certsrv/security/EncryptionPane.java
+ com/netscape/admin/certsrv/security/PKCS11ManagementDialog.java
+ com/netscape/admin/certsrv/security/CertInfo.java
+ com/netscape/admin/certsrv/security/CRLCertInfoPane.java
+ com/netscape/admin/certsrv/security/CertRequestSelectTokenPane.java
+ com/netscape/admin/certsrv/security/GuideCertRequestPane.java
+ com/netscape/admin/certsrv/security/IKeyCertPage.java
+ com/netscape/admin/certsrv/security/SSL3CipherSet.java
+ com/netscape/admin/certsrv/security/Message.java
+ com/netscape/admin/certsrv/security/CertInstallCertInfoPane.java
+ com/netscape/admin/certsrv/security/CertListTable.java
+ com/netscape/admin/certsrv/security/CRLManagementDialog.java
+ com/netscape/admin/certsrv/security/GuideIntroPane.java
+ com/netscape/admin/certsrv/security/CertRequestTypePane.java
+ com/netscape/admin/certsrv/security/ToggleCipherPreferencePane.java
+ com/netscape/admin/certsrv/security/CertInfoDialog.java
+ com/netscape/admin/certsrv/security/CipherResourceSet.java
+ com/netscape/admin/certsrv/security/CertManagementDialog.java
+ com/netscape/admin/certsrv/security/KeyCertWizard.java
+ com/netscape/admin/certsrv/security/GuideCertInstallPane.java
+ com/netscape/admin/certsrv/security/CertRequestInfoPane.java
+ com/netscape/admin/certsrv/security/PKCS11AddModuleDialog.java
+ com/netscape/admin/certsrv/security/SSL3CipherPreference.java
+ com/netscape/admin/certsrv/security/CRLDeleteCertDialog.java
+ com/netscape/admin/certsrv/security/IEncryptionPaneListener.java
+ com/netscape/admin/certsrv/security/CipherEntry.java
+ com/netscape/admin/certsrv/security/CertRequestCertPane.java
+ com/netscape/admin/certsrv/CMSServerInfo.java
+ com/netscape/admin/certsrv/notification/RequestInQPanel.java
+ com/netscape/admin/certsrv/notification/RequestCompletePanel.java
+ com/netscape/admin/certsrv/notification/RequestRevokedPanel.java
+ com/netscape/admin/certsrv/IUIMapper.java
+ com/netscape/admin/certsrv/images/alertl.gif
+ com/netscape/admin/certsrv/images/rulesobj.gif
+ com/netscape/admin/certsrv/images/secure.gif
+ com/netscape/admin/certsrv/images/red-ball-small.gif
+ com/netscape/admin/certsrv/images/error.gif
+ com/netscape/admin/certsrv/images/UGobjs.gif
+ com/netscape/admin/certsrv/images/allfolder16n.gif
+ com/netscape/admin/certsrv/images/aclobj.gif
+ com/netscape/admin/certsrv/images/alllogfolder16n.gif
+ com/netscape/admin/certsrv/images/alluser16n.gif
+ com/netscape/admin/certsrv/images/authobj.gif
+ com/netscape/admin/certsrv/images/plugin.gif
+ com/netscape/admin/certsrv/images/LOGobjs.gif
+ com/netscape/admin/certsrv/images/acl.gif
+ com/netscape/admin/certsrv/images/messagel.gif
+ com/netscape/admin/certsrv/images/genobject.gif
+ com/netscape/admin/certsrv/images/auth.gif
+ com/netscape/admin/certsrv/images/cms-branding.gif
+ com/netscape/admin/certsrv/images/plug.gif
+ com/netscape/admin/certsrv/images/servlet-16.gif
+ com/netscape/admin/certsrv/images/CertificateServer.gif
+ com/netscape/admin/certsrv/images/ruleplugin-16.gif
+ com/netscape/admin/certsrv/images/aclplugin.gif
+ com/netscape/admin/certsrv/images/ruleDisable-16.gif
+ com/netscape/admin/certsrv/images/servletobj.gif
+ com/netscape/admin/certsrv/images/authplugin.gif
+ com/netscape/admin/certsrv/images/CertificateServerL.gif
+ com/netscape/admin/certsrv/images/alllogdoc16n.gif
+ com/netscape/admin/certsrv/images/jobplugin.gif
+ com/netscape/admin/certsrv/images/pluginfolder.gif
+ com/netscape/admin/certsrv/images/rule-16.gif
+ com/netscape/admin/certsrv/images/jobs.gif
+ com/netscape/admin/certsrv/images/cert41.gif
+ com/netscape/admin/certsrv/images/cert42.gif
+ com/netscape/admin/certsrv/images/cert24.gif
+ com/netscape/admin/certsrv/images/servlet-plugin-16.gif
+ com/netscape/admin/certsrv/images/jobobj.gif
+ com/netscape/admin/certsrv/images/alluserwithcert16n.gif
+ com/netscape/admin/certsrv/images/notsecure.gif
+ com/netscape/admin/certsrv/images/ldapub.gif
+ com/netscape/admin/certsrv/images/allgroup16n.gif
+)
+
+# set classpath
+set(CMAKE_JAVA_INCLUDE_PATH
+ ${BASE_JAR} ${LDAPJDK_JAR} ${MMC_JAR}
+ ${MMC_EN_JAR} ${NMCLF_JAR} ${NMCLF_EN_JAR}
+ ${PKI_NSUTIL_JAR}
+ ${JSS_JAR}
+ ${COMMONS_CODEC_JAR})
+
+
+# set version
+set(CMAKE_JAVA_TARGET_VERSION ${APPLICATION_VERSION})
+
+
+# build pki-console.jar
+add_jar(pki-console ${pki-console_java_SRCS})
+add_dependencies(pki-console pki-nsutil)
+install_jar(pki-console ${JAVA_JAR_INSTALL_DIR}/pki)
+set(PKI_CONSOLE_JAR ${pki-console_JAR_FILE} CACHE INTERNAL "pki-console jar file")
+
diff --git a/base/console/src/com/netscape/admin/certsrv/AttrCellRenderer.java b/base/console/src/com/netscape/admin/certsrv/AttrCellRenderer.java
new file mode 100644
index 000000000..863e42197
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/AttrCellRenderer.java
@@ -0,0 +1,60 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import java.awt.*;
+import javax.swing.*;
+import javax.swing.border.*;
+
+/**
+ * class used to crate the label to be displayed in the attr list
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public class AttrCellRenderer extends JLabel implements ListCellRenderer {
+ static Color HIGHLIGHTCOLOR = new Color(0, 0, 128);
+ static Color WHITECOLOR = Color.white;
+ static Color BLACKCOLOR = Color.black;
+
+ public AttrCellRenderer() {
+ setOpaque(true);
+ setBorder(new EmptyBorder(1,CMSAdminUtil.COMPONENT_SPACE, 1, 2));
+ JTextField temp = new JTextField();
+ setFont(temp.getFont());
+ }
+
+ public Component getListCellRendererComponent(JList list,
+ Object value, int index, boolean isSelected, boolean cellHasFocus) {
+
+ if (value instanceof JLabel) {
+ setText(((JLabel)value).getText());
+ setIcon(((JLabel)value).getIcon());
+ setHorizontalAlignment(((JLabel)value).getHorizontalAlignment());
+ } else {
+ if (value instanceof String) {
+ setText((String) value);
+ } else {
+ setText(value.toString());
+ }
+ }
+ setBackground(isSelected ? HIGHLIGHTCOLOR : WHITECOLOR);
+ setForeground(isSelected ? WHITECOLOR : BLACKCOLOR);
+ return this;
+ }
+} \ No newline at end of file
diff --git a/base/console/src/com/netscape/admin/certsrv/CMSAdmin.java b/base/console/src/com/netscape/admin/certsrv/CMSAdmin.java
new file mode 100644
index 000000000..6e88cc276
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/CMSAdmin.java
@@ -0,0 +1,969 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import java.util.*;
+import java.net.*;
+import java.awt.*;
+import javax.swing.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.topology.*;
+import com.netscape.management.client.console.*;
+import com.netscape.management.client.util.*;
+import com.netscape.admin.certsrv.config.install.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.admin.certsrv.wizard.*;
+import netscape.ldap.*;
+
+/**
+ * Netscape Certificate Server 4.0 configuration entry point. The
+ * directory server needs to contain the name of this class in order
+ * for the topology view to load this class.
+ *
+ * @author Jack Pan-Chen
+ * @author Thomas Kwan
+ * @version $Revision$, $Date$
+ * @date 01/12/97
+ */
+public class CMSAdmin extends AbstractServerObject
+ implements IWizardDone, IRemovableServerObject, IMenuInfo
+{
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PREFIX = "CMSADMIN";
+ private static final String START = "start";
+ private static final String STOP = "stop";
+ private static final String CONFIGURE = "configure";
+// private static final String START_DAEMON_CGI = "Tasks/Operation/StartDaemon";
+
+ private ConsoleInfo mConsoleInfo; // global information
+ private CMSServerInfo mServerInfo; // server-specific information
+ private ConsoleInfo mServerInstanceInfo;
+ private CMSServerInfo mStatusInfo; // server-specific information
+ private CMSUIFramework mFramework; // parent frame
+ private CMSPageFeeder mPagefeeder; // what generates tab views
+ //private CMSInfoPanel mInfoPanel; // information panel
+ private RemoteImage mIconImage = null; // server icon
+ private String mServerID, mServerVersion, mInstallationDate, mServerRoot;
+ private String mHost = null; // server name
+ private int mPort = 0; // server port
+ private String mAdminURL = null; // admin server url
+ private int mServerStatus = STATUS_UNKNOWN;
+ private StatusItemText mAuthid;
+ private JFrame mActiveFrame;
+
+ protected ResourceBundle mResource; //resource boundle
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSAdmin()
+ {
+ //Debug.setTrace(true);
+ if (mActiveFrame == null)
+ mActiveFrame = UtilConsoleGlobals.getActivatedFrame();
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ // STATUS_UPDATE_INTERVAL = 1500000;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ public int getServerLastKnownStatus() {
+ return mServerStatus;
+ }
+
+ /**
+ * Initialize the page with global information.
+ *
+ * @param info global information.
+ */
+ public void initialize(ConsoleInfo info) {
+ mConsoleInfo = info;
+ mIconImage = CMSAdminUtil.getImage(CMSAdminResources.IMAGE_CERTICON_SMALL);
+ getInfo( info.getCurrentDN());
+ //getServerStatus();
+ if (info.getCurrentDN() == null) {
+ Debug.println( "initialized CMSAdmin (Standalone mode)");
+ } else {
+ super.initialize( info );
+ }
+ Debug.println( "initialized CMSAdmin for " + mConsoleInfo.getCurrentDN() );
+ }
+
+
+ /**
+ * overwrite the base class to add admin port number
+ * Not sure we want to do this.
+ *
+ protected Vector initializeNodeDataVector(String dataKeys[]) {
+ Vector v = super.initializeNodeDataVector(dataKeys);
+ if ( mServerInfo != null ) {
+ int port = mServerInfo.getPort();
+ if ( port > 0 ) {
+ String label = mResource.getString(PREFIX+"_ADMINPORT_LABEL");
+ v.addElement(new NodeData("nsServerPort",
+ label,
+ Integer.toString(port)));
+ }
+ }
+ return v;
+ }
+ */
+
+ /**
+ * return the server instance name instead for now
+ *
+ * @return return the server name
+ *
+ */
+ public String getName() {
+ return ("Certificate Server ("+ mServerID +")");
+ }
+
+
+ /**
+ * Return the information panel. - Admin take over this already
+ *
+ * @return information panel
+ *
+ public Component getCustomPanel() {
+ if(mInfoPanel == null)
+ mInfoPanel = new CMSInfoPanel( (IServerObject)this,
+ mHost,
+ mPort,
+ mServerVersion,
+ mInstallationDate,
+ mAdminURL);
+ return mInfoPanel;
+ }
+ */
+
+ /**
+ * Return connection info for a server instance.
+ * @return Connection info for a server instance.
+ */
+ public CMSServerInfo getServerInfo() {
+ return mServerInfo;
+ }
+
+ public ConsoleInfo getServerInstanceInfo() {
+ mServerInstanceInfo = (ConsoleInfo)mConsoleInfo.clone();
+ return mServerInstanceInfo;
+ }
+
+ /**
+ * Returns the global console info.
+ *
+ * @return Global console info reference.
+ **/
+ public ConsoleInfo getConsoleInfo() {
+ return mConsoleInfo;
+ }
+
+ /**
+ * This function is called when the certificate server is deselected
+ * on the topology view.
+ */
+ public void unselect(IPage viewInstance) {
+// Debug.println( "DSAdmin unselect" );
+ super.unselect(viewInstance);
+ fireRemoveMenuItems( viewInstance, this );
+ }
+
+ /**
+ * This function is called when the directory server is selected
+ * on the topology view.
+ */
+ public void select(IPage viewInstance) {
+/*
+ if (_removed)
+ return;
+*/
+
+ HourGlass hglass = new HourGlass(mActiveFrame);
+ super.select(viewInstance); // sets _viewInstance used
+ // by getViewInstance()
+ Debug.println( "CMSAdmin.select(): viewInstance =" +
+ getViewInstance() );
+ fireAddMenuItems( viewInstance, this );
+ if (mPort == 0) {
+ fireDisableMenuItem(viewInstance, START);
+ fireDisableMenuItem(viewInstance, STOP);
+ fireEnableMenuItem(viewInstance, CONFIGURE);
+ } else if ( getServerStatus() == STATUS_STARTED ) {
+ fireDisableMenuItem( viewInstance, START );
+ fireEnableMenuItem(viewInstance, STOP);
+ fireDisableMenuItem(viewInstance, CONFIGURE);
+ } else {
+ fireEnableMenuItem( viewInstance, START );
+ fireDisableMenuItem( viewInstance, STOP );
+ fireDisableMenuItem(viewInstance, CONFIGURE);
+ }
+ if (hglass != null) {
+ hglass.setNonWaitCursor();
+ hglass = null;
+ }
+ }
+
+ /**
+ * Returns supported menu categories
+ */
+ public String[] getMenuCategoryIDs() {
+ return new String[]
+ {
+ ResourcePage.MENU_CONTEXT,
+ ResourcePage.MENU_OBJECT
+ };
+ }
+
+ /**
+ * Add menu items for this page.
+ *
+ * @param category Which menu
+ */
+ public IMenuItem[] getMenuItems(String category) {
+ /* Same for both CONTEXT and OBJECT menus */
+ return new IMenuItem[] {
+ new MenuItemText( CONFIGURE,
+ CMSAdminResources.MENU_CONFIGURE_SERVER,
+ CMSAdminResources.MENU_CONFIGURE_SERVER_DESC),
+ new MenuItemText( START,
+ CMSAdminResources.MENU_START_SERVER,
+ CMSAdminResources.MENU_START_SERVER_DESC),
+
+ new MenuItemText( STOP,
+ CMSAdminResources.MENU_STOP_SERVER,
+ CMSAdminResources.MENU_STOP_SERVER_DESC),
+ new MenuItemSeparator() };
+ }
+
+ /**
+ * Notification that a menu item has been selected.
+ */
+ public void actionMenuSelected(IPage viewInstance, IMenuItem item) {
+ if (item.getID().equals(START)) {
+ ConsoleInfo info = getServerInstanceInfo();
+ /* Fire off the Start task */
+ CMSStart task = new CMSStart();
+ mConsoleInfo.put(CMSStart.START_TASK_CGI, mServerID);
+ mConsoleInfo.put("serverRoot",mServerRoot);
+ mConsoleInfo.put("servid", mServerID);
+ task.initialize(mConsoleInfo);
+ //task.setConsoleInfo( info );
+ boolean status = task.run( null );
+ if( status ) {
+ getServerStatus();
+ enableStartStop(viewInstance);
+ }
+ } else if(item.getID().equals(STOP)) {
+ CMSStop task = new CMSStop();
+ ConsoleInfo info = getServerInstanceInfo();
+ mConsoleInfo.put(CMSStop.STOP_TASK_CGI, mServerID);
+ mConsoleInfo.put("servid", mServerID);
+ mConsoleInfo.put("serverRoot",mServerRoot);
+ task.initialize(mConsoleInfo);
+ boolean status = task.run( null );
+ if ( status ) {
+ getServerStatus();
+ enableStartStop(viewInstance);
+ }
+ } else if (item.getID().equals(CONFIGURE)) {
+ startupInstallationWizard(viewInstance);
+ }
+ }
+
+ public void updateMenu(IPage viewInstance) {
+ getInfo(getConsoleInfo().getCurrentDN());
+ if (mPort != 0) {
+ fireDisableMenuItem(viewInstance, CONFIGURE);
+ getServerStatus();
+ enableStartStop(viewInstance);
+ }
+ }
+
+ /**
+ * Enable/Disable start/stop action menu.
+ */
+ private void enableStartStop(IPage viewInstance) {
+ if (mServerStatus == STATUS_STOPPED) {
+ fireEnableMenuItem( viewInstance, START );
+ fireDisableMenuItem( viewInstance, STOP );
+ } else if (mServerStatus == STATUS_STARTED) {
+ fireEnableMenuItem( viewInstance, STOP );
+ fireDisableMenuItem( viewInstance, START );
+ }
+ }
+
+ /**
+ * Set the title bar in the following format:<p><pre>
+ * [server information] - [server type] - [nickname]</pre>
+ * Administrator id is shown at lower status bar
+ */
+ public void updateTitle () {
+ /*
+ mAuthid.setState(mResource.getString("CMSADMIN_USER_LABEL")+
+ " = "+mServerInfo.getUserId()+" ");
+ mFramework.getFramework().changeStatusItemState(mAuthid);
+ */
+ String id = mServerID;
+ int i = id.indexOf( '-' );
+ if ( (i > 0) && (i < (id.length()-1)) )
+ id = id.substring( i + 1 );
+ mFramework.getFramework().setTitle( mServerInfo.getHost()+" - "
+ + mResource.getString(CMSAdminResources.CERT_SERVER_NAME)+
+ " - "+ id );
+ }
+
+ private Hashtable createWizardInfo() {
+ Hashtable data = new Hashtable();
+ /* This does nothing
+ data.put(ConfigConstants.TASKID,TaskId.TASK_LIST_PREVIOUS_STAGES);
+ data.put(ConfigConstants.OPTYPE, OpDef.OP_READ);
+ data.put(ConfigConstants.PR_CERT_INSTANCE_NAME, mServerID);
+ data.put(ConfigConstants.PR_SERVER_ROOT, mServerRoot);
+ */
+
+ // moved from WIIntroPage.java
+ data.put(ConfigConstants.TASKID,TaskId.TASK_GET_DEFAULT_INFO);
+ data.put(ConfigConstants.OPTYPE, OpDef.OP_READ);
+ data.put(ConfigConstants.PR_CERT_INSTANCE_NAME,
+ mConsoleInfo.get(ConfigConstants.PR_CERT_INSTANCE_NAME));
+ // #344791 - help server to make up the hostname
+ data.put(ConfigConstants.PR_HOST,
+ mConsoleInfo.get(ConfigConstants.PR_HOST));
+ data.put(ConfigConstants.PR_SERVER_ROOT,
+ mConsoleInfo.get(ConfigConstants.PR_SERVER_ROOT));
+ return data;
+ }
+
+ /**
+ * This is called when the installwizard is done.
+ */
+ public void notify(WizardWidget w) {
+ Debug.println("Configuration Completed");
+ for (int i = 0; i < 10; i++) { // try to detect 10 times
+ Debug.println("Check Status #" + i);
+ if ( getServerStatus() == STATUS_STARTED ) {
+ return;
+ }
+ try {
+ Thread.currentThread().sleep(2000); // 2 seconds
+ } catch (Exception e) {
+ }
+ }
+ }
+
+ /**
+ * Start up the installation wizard
+ */
+ public void startupInstallationWizard(IPage viewInstance) {
+ Hashtable data = new Hashtable();
+ CMSStartDaemon daemon = new CMSStartDaemon();
+ mConsoleInfo.put("servid", mServerID);
+ mConsoleInfo.put(CMSStartDaemon.START_DAEMON_CGI, mServerID);
+ mConsoleInfo.put(CMSConfigCert.CONFIG_CERT_CGI, mServerID);
+ daemon.initialize(mConsoleInfo);
+ data.put(ConfigConstants.PR_CERT_INSTANCE_NAME, mServerID);
+ Debug.println("about to run Daemon");
+ boolean success = daemon.runDaemon(data);
+ Debug.println("run daemon success = "+success);
+ data.clear();
+ data = null;
+ boolean isInfoReady = false;
+
+ if (success) {
+ InstallWizardInfo wizardInfo =
+ new InstallWizardInfo(mConsoleInfo);
+ wizardInfo.setAdminFrame(mActiveFrame);
+ Debug.println("CMSAdmin: creating new configCertCgi");
+ CMSConfigCert configCertCgi = new CMSConfigCert();
+ configCertCgi.initialize(wizardInfo);
+ Debug.println("CMSAdmin: back from creating new configCertCgi");
+ data = createWizardInfo();
+ isInfoReady = configCertCgi.configCert(data);
+ Debug.println("CMSAdmin: isInfoReady = "+isInfoReady);
+
+ if (isInfoReady) {
+ JFrame frame = new JFrame();
+ Cursor cursor = new Cursor(Cursor.HAND_CURSOR);
+ frame.setCursor(cursor);
+ frame.invalidate();
+ frame.validate();
+ frame.repaint(1);
+ // XXX - checking status is too slow, dont do it now.
+ // InstallWizard wizard = new InstallWizard(
+ // mConsoleInfo.getFrame(), wizardInfo, this);
+ InstallWizard wizard = new InstallWizard(mActiveFrame,
+ wizardInfo, null);
+ wizardInfo.setAdminFrame(mActiveFrame);
+ wizardInfo.put("viewInstance", viewInstance);
+ wizardInfo.put("CMSAdmin", this);
+ new Thread(wizard).start();
+ }
+ }
+ data.clear();
+ data = null;
+ mServerStatus = STATUS_UNKNOWN;
+ }
+
+ /**
+ * This function is called when the server is double clicked on
+ * the topology view. Auth dialog is displayed to get user dn and pwd.
+ */
+ public boolean run(IPage viewInstance) {
+
+ Debug.println("The user double click the icon "+getConsoleInfo().getCurrentDN());
+ Debug.println("View instance in the run method -> "+viewInstance);
+
+ if (getConsoleInfo().getCurrentDN() == null) {
+ mServerID = (String)mConsoleInfo.get("cmsServerInstance");
+ }
+
+ mConsoleInfo.put(CMSRestart.RESTART_TASK_CGI, mServerID);
+ mConsoleInfo.put(CMSStart.START_TASK_CGI, mServerID);
+ mConsoleInfo.put(CMSStop.STOP_TASK_CGI, mServerID);
+ mConsoleInfo.put("CMSAdmin", this);
+ if (mPort == 0) {
+ getInfo(getConsoleInfo().getCurrentDN());
+ if (mPort == 0) {
+ startupInstallationWizard(viewInstance);
+ return false;
+ }
+ }
+
+ if (getConsoleInfo().getCurrentDN() == null) {
+ mHost = (String)mConsoleInfo.get("cmsHost");
+ mPort = Integer.parseInt((String)mConsoleInfo.get("cmsPort"));
+ } else {
+ try {
+ LDAPConnection ldc = mConsoleInfo.getLDAPConnection();
+ if ( ldc == null ) {
+ Debug.println( "No connection ready in ConsoelInfo" );
+ ldc = new LDAPConnection();
+ ldc.connect( mConsoleInfo.getHost(), mConsoleInfo.getPort(),
+ mConsoleInfo.getAuthenticationDN(),
+ mConsoleInfo.getAuthenticationPassword());
+ }
+ //Debug.println( "Fetching " + sBase + " from " +
+ // mConsoleInfo.getHost() + ":" + mConsoleInfo.getPort() );
+ LDAPEntry entry = ldc.read( mConsoleInfo.getCurrentDN() );
+ //Debug.println( "Got " + entry );
+
+ try {
+ String port = getAttrVal(entry, "nsserverport");
+
+ if (port == null)
+ return false;
+ else {
+ int portnum = Integer.parseInt(port);
+ if (portnum != mPort)
+ mPort = portnum;
+ }
+ } catch (Exception e) {
+ return false;
+ }
+ } catch (LDAPException ex) {
+ CMSAdminUtil.showErrorDialog(mConsoleInfo.getFrame(), mResource,
+ ex.toString(), CMSAdminUtil.ERROR_MESSAGE);
+ }
+ }
+
+ try {
+ // server off
+ if (getServerStatus() != STATUS_STARTED) {
+ CMSAdminUtil.showMessageDialog(mConsoleInfo.getFrame(), mResource, PREFIX,
+ "SERVEROFF", CMSAdminUtil.ERROR_MESSAGE);
+ return false;
+ }
+
+/*
+ mServerInfo = new CMSServerInfo(mHost, mPort, d.getUsername(),
+ d.getPassword(),
+ mServerID, mInstallationDate, mServerVersion, mServerRoot);
+*/
+ String path = (String)mConsoleInfo.get("cmsPath");
+ mServerInfo = new CMSServerInfo(mHost, mPort, "","",
+ mServerID, mInstallationDate, mServerVersion, mServerRoot, path);
+
+
+ String authType = mServerInfo.getAuthType();
+
+ // server is alive, do authenticate if the server asks for
+ // password-based authentication
+ if (authType.equals("pwd")) {
+ CMSPassword d = new CMSPassword(mActiveFrame);
+ d.show();
+ if (d.isCancel())
+ return false;
+ mServerInfo = new CMSServerInfo(mHost, mPort, d.getUsername(),
+ d.getPassword(),
+ mServerID, mInstallationDate, mServerVersion, mServerRoot, path);
+ mServerInfo.authenticate();
+ }
+ mConsoleInfo.put("serverInfo", mServerInfo);
+ } catch (EAdminException ex) {
+ System.exit(0); // exit if authentication fails
+ CMSAdminUtil.showErrorDialog(mConsoleInfo.getFrame(), mResource,
+ ex.getMessage(), CMSAdminUtil.ERROR_MESSAGE);
+ return false;
+ }
+
+
+ //LOAD UI FRAMEWORK
+ try {
+ mFramework = new CMSUIFramework(mConsoleInfo, mServerInfo);
+ } catch (EAdminException e) {
+ CMSAdminUtil.showErrorDialog(mConsoleInfo.getFrame(), mResource,
+ e.getMessage(), CMSAdminUtil.ERROR_MESSAGE);
+ return false;
+ }
+
+ //show secure status
+ StatusItemSecureMode statusSecureMode = new StatusItemSecureMode(Framework.STATUS_SECURE_MODE);
+ statusSecureMode.setSecureMode(true);
+ mFramework.getFramework().addStatusItem(statusSecureMode, IStatusItem.LEFTFIRST);
+ statusSecureMode.setToolTipText(mServerInfo.getHost()+":"+mServerInfo.getPort());
+
+ //show login status
+ updateTitle ();
+ return true;
+ }
+
+ /**
+ * Run the object
+ * @param viewInstance CMSPageFeeder object
+ * @param selectionList List of selected objects
+ */
+ public boolean run(IPage viewInstance, IResourceObject selectionList[]) {
+ return run( viewInstance );
+ }
+
+ /**
+ * perform the specified action. The command string is specified either
+ * from the content menu or the menu bar.
+ *
+ * @param command Command String
+ */
+ public void performAction(String command) {
+
+ }
+
+ /**
+ * Return the server icon.
+ *
+ * @return The Directory Server icon.
+ */
+ public Icon getIcon() {
+ return mIconImage;
+ }
+
+ public int getStatus() {
+ return mServerStatus;
+ }
+
+ /**
+ * Return the current status of the server (running or not).
+ *
+ * @return The Certificate Server status.
+ */
+ public int getServerStatus() {
+ Debug.println("Check server status");
+ if (getConsoleInfo().getCurrentDN() == null) {
+ return STATUS_STARTED;
+ } else {
+ if ( mPort == 0) {
+ mServerStatus = STATUS_UNKNOWN;
+ return STATUS_UNKNOWN;
+ }
+ try {
+ ConsoleInfo info = getServerInstanceInfo();
+ CMSStatus task = new CMSStatus();
+ mConsoleInfo.put(CMSStatus.STATUS_TASK_CGI, mServerID);
+ mConsoleInfo.put("serverRoot",mServerRoot);
+ mConsoleInfo.put("servid", mServerID);
+ task.initialize(mConsoleInfo);
+ //task.setConsoleInfo( info );
+ boolean status = task.run( null );
+ if( status) {
+ mServerStatus = STATUS_STARTED;
+ return STATUS_STARTED;
+ }
+ else{
+ mServerStatus = STATUS_STOPPED;
+ return STATUS_STOPPED;
+ }
+ }
+ catch (Exception e) {
+ String bob = e.toString();
+ Debug.println(bob);
+ if (Debug.isEnabled())
+ e.printStackTrace();
+ return STATUS_UNKNOWN;
+ }
+ }
+ }
+
+
+ /**
+ * Return the current status of the server (running or not)
+ * by pinging the agent HTTPS port.
+ *
+ * @return The Certificate Server status.
+ */
+ public boolean getStatusFromAgentPort() {
+
+ if (mPort == 0) {
+ getInfo(getConsoleInfo().getCurrentDN());
+ if (mPort == 0) {
+ //Debug.println("CMSAdmin: getServerStatus --> "+mServerStatus);
+ return false;
+ }
+ }
+
+ //check if ssl port is functional
+ try {
+ if ((mServerInfo == null) || (mServerInfo.getPort() == 0)) {
+ String path = (String)mConsoleInfo.get("cmsPath");
+ mServerInfo = new CMSServerInfo(mHost, mPort, "", "",
+ mServerID, mInstallationDate, mServerVersion, mServerRoot, path);
+ }
+
+ mServerInfo.ping();
+
+ } catch (EAdminException e) {
+ Debug.println("CMSAdmin: getServerStatus() -"+e.toString());
+ if (e.getMessageString().equals(CMSAdminResources.SERVER_NORESPONSE) ||
+ e.getMessageString().equals(CMSAdminResources.SERVER_UNREACHABLE) ||
+ e.getMessageString().equals(CMSAdminResources.IOEXCEPTION) ||
+ e.getMessageString().equals(CMSAdminResources.UNKNOWNEXCEPTION) ||
+ e.getMessageString().equals(CMSAdminResources.UNKNOWNHOST) ) {
+ // mServerStatus = STATUS_STOPPED;
+ return false;
+ }
+ Debug.println("CMSAdmin: getServerStatus() -UNKNOWN");
+ // mServerStatus = STATUS_UNKNOWN;
+ return false;
+ }
+
+ Debug.println("CMSAdmin: getServerStatus() -OK");
+ // mServerStatus = STATUS_STARTED;
+ return true;
+ }
+
+ /**
+ * The concrete class implementing this method will clone its
+ * configuration from the reference server. This supports using the
+ * GET method for cloning the server.
+ *
+ * @param referenceDN - DN of server to clone from.
+ */
+ public void cloneFrom(String referenceDN) {
+ //XXX TBD
+ }
+
+ /**
+ * Implements the IRemovableServerObject interface.
+ * @return true if the server was successfully removed, false otherwise
+ */
+
+ public boolean removeServer() {
+ Debug.println("-------------- removeServer() ==== --------------------");
+
+ Debug.println("getting console obj");
+ ConsoleInfo info = getServerInstanceInfo();
+ Debug.println("constuctor for remove");
+ /* Fire off the Remove task */
+ CMSRemove task = new CMSRemove();
+ mConsoleInfo.put(CMSRemove.REMOVE_TASK_CGI, mServerID);
+ mConsoleInfo.put("serverRoot",mServerRoot);
+ mConsoleInfo.put("servid", mServerID);
+ Debug.println("initalizing remove");
+ task.initialize(mConsoleInfo);
+ //task.setConsoleInfo( info );
+ Debug.println("about to run remove rask");
+ boolean status = task.run( null );
+ Debug.println("remove run");
+ Debug.println("Remove server status: "+ status);
+ String instance = (String) mConsoleInfo.get("ServerInstance");
+ if (null == instance) {
+ instance = "";
+ }
+
+ if (true == status) { /* successfully called remove cgi */
+ Debug.println("removing topology for the server");
+ LDAPConnection ldc = mConsoleInfo.getLDAPConnection();
+ Debug.println("got the ldap connection");
+ String[] attrs = { "*", "numsubordinates" };
+ String sieDN = mConsoleInfo.getCurrentDN();
+ Debug.println("removeServer:sieDN:" + sieDN);
+
+ LDAPEntry sieEntry = null;
+ try {
+ sieEntry = ldc.read( sieDN, attrs );
+ Debug.println("read a ldap entry");
+ } catch (Exception ex ) {
+ Debug.println( "removeServer <" + sieDN + "> " + ex);
+
+ /*
+ args[1] = ex.toString();
+ DSUtil.showErrorDialog(_info.getFrame(), "removeinstance",
+ args);
+ _removed = false; // remove failed
+ */
+ return false;
+ }
+ if (sieEntry != null ) {
+ try {
+ Debug.println("Calling delete_sieTree");
+ status = delete_sieTree(sieEntry );
+ } catch (Exception ex ) {
+ Debug.println( "removeServer:Unable to delete the " +
+ "tree");
+ /*
+ args[1] = ex.toString();
+ DSUtil.showErrorDialog(_info.getFrame(), "removesie",
+ args);
+ _removed = false; // remove failed
+ */
+ return false;
+ }
+ // Now we need to remove the reference of this server
+ Debug.println("calling remove_serverinstance");
+ status = remove_serverInstance(sieDN);
+ }
+ /*
+ if ( status == false) {
+ args[1] = "";
+ DSUtil.showErrorDialog(_info.getFrame(), "removesie",
+ args);
+ } else {
+ DSUtil.showInformationDialog(_info.getFrame(), "121",
+ (String)null) ;
+ }
+
+ */
+ }
+ // CMSAdminUtil.showMessageDialog(mConsoleInfo.getFrame(), mResource, PREFIX,
+ // "NOTIMPLEMENTED", CMSAdminUtil.ERROR_MESSAGE);
+ return status;
+ }
+
+
+
+ private boolean delete_sieTree (LDAPEntry entry )
+ throws LDAPException {
+
+ LDAPConnection ldc = mConsoleInfo.getLDAPConnection();
+ boolean ret = false;
+
+ String dn = entry.getDN();
+ if ( entryHasChildren( entry ) ) {
+ LDAPSearchResults search_results = null;
+ String[] attrs = { "numsubordinates" };
+ search_results = ldc.search( dn,
+ LDAPConnection.SCOPE_ONE,
+ "(objectClass=*)", attrs, false );
+
+ while ( search_results.hasMoreElements() ) {
+ /* Get the next child */
+ LDAPEntry child_entry =
+ (LDAPEntry)search_results.nextElement();
+ ret = delete_sieTree( child_entry );
+
+ }
+ }
+ ldc.delete(dn);
+ return true;
+ }
+
+ static boolean entryHasChildren( LDAPEntry entry ) {
+ boolean hasChildren = false;
+ LDAPAttribute attr = entry.getAttribute(
+ "numsubordinates" );
+ if ( attr != null ) {
+ Enumeration e = attr.getStringValues();
+ if ( e.hasMoreElements() ) {
+ String s = (String)e.nextElement();
+ int count = Integer.parseInt( s );
+ if ( count > 0 ) {
+ hasChildren = true;
+ }
+ }
+ }
+ return hasChildren;
+ }
+
+
+ private boolean remove_serverInstance (String sieDN ) {
+
+ LDAPSearchResults search_results = null;
+ String baseDN =(String) mConsoleInfo.get("BaseDN");
+ LDAPConnection ldc = mConsoleInfo.getLDAPConnection();
+ String[] attrs = { "*", "uniquemember" };
+ String filter = "(&(objectclass=groupOfUniquenames)(uniquemember=" +
+ sieDN+"))";
+
+ try {
+ search_results = ldc.search( baseDN, ldc.SCOPE_SUB,
+ filter, attrs, false);
+ } catch (LDAPException e) {
+ Debug.println( "Failed to search - " + e.toString() );
+ return false;
+ }
+ LDAPEntry entry = null;
+ while ( search_results.hasMoreElements() ) {
+ // need to remove the reference to the sieDN from
+ // this entry.
+
+ entry = (LDAPEntry)search_results.nextElement();
+ String eDN = (String) entry.getDN();
+ // Now we need to modify the entry to delete the
+ // reference to the serevr.
+ remove_intstanceFromEntry(ldc, eDN, sieDN);
+ }
+ return true;
+ }
+
+ private boolean remove_intstanceFromEntry ( LDAPConnection ldc,
+ String eDN, String sieDN ) {
+
+ LDAPModificationSet mods = new LDAPModificationSet();
+ LDAPAttribute attUmember = new LDAPAttribute("uniquemember", sieDN);
+ Debug.println("DSAdmin:remove_intstanceFromEntry: Modifying entry:" +
+ eDN);
+ mods.add( LDAPModification.DELETE, attUmember );
+ try {
+ ldc.modify(eDN, mods );
+ } catch ( LDAPException e ) {
+ Debug.println ( "Modifying " + eDN + ", " + e);
+ return false;
+ }
+ return true;
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+
+ /**
+ * Extract a single string
+ *
+ * @param entry A Directory entry
+ * @param name Name of attribute to fetch
+ * @return A concatenated string
+ */
+ private String getAttrVal( LDAPEntry entry, String name ) {
+ LDAPAttribute findAttr =
+ entry.getAttribute( name, LDAPUtil.getLDAPAttributeLocale() );
+ if ( findAttr != null ) {
+ return LDAPUtil.flatting(findAttr);
+ }
+/*
+ Debug.println( "Attribute " + name + " not found in " +
+ entry.getDN() );
+*/
+ return null;
+ }
+
+ /**
+ * get the attribute information to display in the information panel
+ *
+ * @param sDN DN for the entry.
+ */
+ private void getInfo(String sDN) {
+ //String sBase = "cn=configuration, " + sDN;
+ if (sDN == null) {
+ mHost = (String)mConsoleInfo.get("cmsHost");
+ mPort = Integer.parseInt((String)mConsoleInfo.get("cmsPort"));
+ } else {
+ String sBase = sDN;
+ try {
+ LDAPConnection ldc = mConsoleInfo.getLDAPConnection();
+ if ( ldc == null ) {
+ Debug.println( "No connection ready in ConsoelInfo" );
+ ldc = new LDAPConnection();
+ ldc.connect( mConsoleInfo.getHost(), mConsoleInfo.getPort(),
+ mConsoleInfo.getAuthenticationDN(),
+ mConsoleInfo.getAuthenticationPassword());
+ }
+ //Debug.println( "Fetching " + sBase + " from " +
+ // mConsoleInfo.getHost() + ":" + mConsoleInfo.getPort() );
+ LDAPEntry entry = ldc.read( sBase );
+ //Debug.println( "Got " + entry );
+
+ mHost = getAttrVal( entry, "serverHostName" );
+ try {
+ String port = getAttrVal(entry, "nsserverport");
+ if (port == null)
+ mPort = 0;
+ else
+ mPort = Integer.parseInt(port);
+ } catch (Exception e) {
+ mPort = 0;
+ }
+
+ // get the attribute information for display purposes
+ mServerVersion = getAttrVal( entry, "serverVersionNumber" );
+ mInstallationDate = getAttrVal( entry, "installationTimeStamp" );
+ mServerID = getAttrVal( entry, "nsserverid" );
+ mServerRoot = getAttrVal( entry, "serverroot" );
+ Debug.println("CMSAdmin::PR_HOST = " + mHost);
+ mConsoleInfo.put(ConfigConstants.PR_HOST, mHost);
+ mConsoleInfo.put(ConfigConstants.PR_SERVER_ROOT, mServerRoot);
+ mConsoleInfo.put(ConfigConstants.PR_CERT_INSTANCE_NAME, mServerID);
+ } catch( Exception e) {
+ Debug.println( "Fetching " + sBase + " from " +
+ mConsoleInfo.getHost() + ":" + mConsoleInfo.getPort() +
+ ", " + e );
+ }
+
+ mAdminURL = mConsoleInfo.getAdminURL();
+
+ /* Extract the username part of the admin authentication DN */
+ String[] rdns = LDAPDN.explodeDN( mConsoleInfo.getAuthenticationDN(),
+ true );
+ String s = rdns[0].trim();
+ mConsoleInfo.put( "AdminUsername", s );
+ //getServerStatus();
+ }
+ }
+
+ /**
+ * Note: it would be better if this method were declared in the superclass,
+ * but having it here is better than nothing, since I need access to it
+ * for getServerStatus() . . .
+ */
+ private IPage getViewInstance() {
+ return _viewInstance;
+ }
+
+ public boolean isCloningEnabled() {
+ return false;
+ }
+
+ public boolean isMigrationEnabled() {
+ return false;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/CMSAdminResources.java b/base/console/src/com/netscape/admin/certsrv/CMSAdminResources.java
new file mode 100644
index 000000000..af2ba4c91
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/CMSAdminResources.java
@@ -0,0 +1,197 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import com.netscape.management.client.util.*;
+import java.io.*;
+import java.util.*;
+import com.netscape.certsrv.common.Constants;
+
+/**
+ * Resource Boundle for the Certificate Server Admin Console
+ *
+ * <pre>
+ * COMPONENT NAMING CONTEXT:
+ *
+ * CONTEXT = PANELNAME + <COMPONENT> + IDENTIFIER + <SUFFIX>
+ *
+ * PANELNAME = UPPERCASE STRING IDENTIFIER
+ * <COMPONENT> = {"BORDER","BUTTON","TEXT","RADIOBUTTON","CHECKBOX","LIST","COMBOBOX","LABEL"}
+ * IDENTIFIER = UPPERCASE STRING COMPONENT IDENTIFIER
+ * <SUFFIX> = {"LABEL","TTIP", <VALUE>}
+ * <VALUE> = "VALUE" + {"0","1",...}
+ * + = "_"
+ * </pre>
+ *
+ *
+ * @author Jack Pan-Chen
+ * @author Thomas Kwan
+ * @author Christina Fu
+ * @version $Revision$, $Date$
+ */
+
+public class CMSAdminResources extends ResourceBundle {
+
+ //directory
+ static final String DEFAULT_IMAGE_DIRECTORY = "com/netscape/admin/certsrv/images";
+ static final String DEFAULT_THEME_IMAGE_DIRECTORY = "com/netscape/admin/certsrv/theme";
+
+ //image files
+ public static final String IMAGE_CERTICON_LARGE = "CertificateServerL.gif";
+ public static final String IMAGE_CERTICON_SMALL = "CertificateServer.gif";
+ public static final String IMAGE_CERTICON_MEDIUM = "cert24.gif";
+ public static final String IMAGE_LOGFOLDER = "alllogfolder16n.gif";
+ public static final String IMAGE_LOGOBJ = "LOGobjs.gif";
+ public static final String IMAGE_LOGOBJECT = "alllogdoc16n.gif";
+ public static final String IMAGE_FOLDER = "allfolder16n.gif";
+ public static final String IMAGE_USERGROUP = "allgroup16n.gif";
+ public static final String IMAGE_USER = "alluser16n.gif";
+ public static final String IMAGE_USER_WITH_CERT = "alluserwithcert16n.gif";
+ public static final String IMAGE_UGOBJECT = "UGobjs.gif";
+ public static final String IMAGE_DIRTY_TAB = "red-ball-small.gif";
+ public static final String IMAGE_BRANDING = "certmgmt.gif";
+ public static final String IMAGE_GENERICOBJ = "genobject.gif";
+ public static final String IMAGE_PLUGIN = "plug.gif";
+ public static final String IMAGE_PLUGINOBJECT = "plugin.gif";
+ public static final String IMAGE_PLUGINFOLDER = "pluginfolder.gif";
+ public static final String IMAGE_RULEOBJECT = "rulesobj.gif";
+ public static final String IMAGE_RULE = "rule-16.gif";
+ public static final String IMAGE_RULE_PLUGIN = "ruleplugin-16.gif";
+ public static final String IMAGE_RULE_DISABLE = "ruleDisable-16.gif";
+ public static final String IMAGE_SERVLETOBJECT = "servletobj.gif";
+ public static final String IMAGE_SERVLET = "servlet-16.gif";
+ public static final String IMAGE_SERVLET_PLUGIN = "servlet-plugin-16.gif";
+ public static final String IMAGE_AUTH = "auth.gif";
+ public static final String IMAGE_AUTH_PLUGIN = "authplugin.gif";
+ public static final String IMAGE_AUTHOBJECT = "authobj.gif";
+ public static final String IMAGE_JOBS = "jobs.gif";
+ public static final String IMAGE_JOBS_PLUGIN = "jobplugin.gif";
+ public static final String IMAGE_JOBSOBJECT = "jobobj.gif";
+ public static final String IMAGE_LDAPPUB = "ldapub.gif";
+ public static final String IMAGE_ACLOBJECT = "aclobj.gif";
+ public static final String IMAGE_ACL = "acl.gif";
+ public static final String IMAGE_ACLPLUGIN = "aclplugin.gif";
+
+ //dialog icons
+ public static final String IMAGE_INFO_ICON = "messagel.gif";
+ public static final String IMAGE_ERROR_ICON = "error.gif";
+ public static final String IMAGE_WARN_ICON = "alertl.gif";
+
+
+ /**
+ * Exception resources
+ */
+ public final static String IOEXCEPTION = "IOEXCEPTION";
+ public final static String UNKNOWNHOST = "UNKNOWNHOST";
+ public final static String UNKNOWNEXCEPTION = "UNKNOWNEXCEPTION";
+ public final static String AUTHENNOTSUPPORTED = "AUTHENNOTSUPPORTED";
+ public final static String AUTHENTICATION_FAILED = "AUTHENTICATION_FAILED";
+ public final static String PING_FAILED = "PING_FAILED";
+ public final static String SERVER_UNREACHABLE = "SERVER_UNREACHABLE";
+ public final static String SERVER_NORESPONSE ="SERVER_NORESPONSE";
+ public final static String SERVERCONNECTION_SERVER_CERT_IMPORTED_FAILED="SERVERCONNECTION_SERVER_CERT_IMPORTED_FAILED";
+ public final static String SERVERCONNECTION_NO_CLIENT_CERT="SERVERCONNECTION_NO_CLIENT_CERT";
+ public final static String SERVERCONNECTION_SERVER_CERT_DENIED="SERVERCONNECTION_SERVER_CERT_DENIED";
+ public final static String SERVERCONNECTION_DIFFERENT_PWD = "SERVERCONNECTION_DIFFERENT_PWD";
+ public final static String SERVERCONNECTION_TOKEN_INIT_FAILED = "SERVERCONNECTION_TOKEN_INIT_FAILED";
+ public final static String PROTOCOL_ERROR = "PROTOCOL_ERROR";
+
+ //server info panel
+ public final static String CERT_SERVER_NAME = "CMSINFOPANEL_LABEL_SERVERNAME_LABEL";
+ public final static String SERVER_STATUS = "CMSINFOPANEL_LABEL_STATUS_LABEL";
+ public final static String SERVER_STATUS_ON = "CMSINFOPANEL_LABEL_STATUSON_LABEL";
+ public final static String SERVER_STATUS_OFF = "CMSINFOPANEL_LABEL_STATUSOFF_LABEL";
+ public final static String SERVER_INFO = "CMSINFOPANEL_LABEL_SERVERINFO_LABEL";
+
+ //general items
+ public final static String GENERAL_OK = "GENERAL_OK";
+ public final static String GENERAL_BACK = "GENERAL_BACK";
+ public final static String GENERAL_DONE = "GENERAL_DONE";
+ public final static String GENERAL_NEXT = "GENERAL_NEXT";
+ public final static String GENERAL_HELP = "GENERAL_HELP";
+ public final static String GENERAL_CANCEL = "GENERAL_CANCEL";
+ public final static String GENERAL_ERROR = "GENERAL_ERROR";
+ public final static String GENERAL_QUESTION = "GENERAL_QUESTION";
+
+ //menu items
+ public final static String MENU_KEYCERT = "KEYCERT";
+ public final static String MENU_REFRESH = "REFRESH";
+ public final static String MENU_KEYCERT_MANAGEMENT = "CERTMANAGEMENT";
+ public final static String MENU_PKCS11 = "PKCS11MANAGEMENT";
+ public final static String MENU_NEWCERT = "NEWCERT";
+ public final static String MENU_NEW_EXTENSION = "NEW_EXTENSION";
+ public final static String MENU_NEW_POLICY = "NEW_POLICY";
+ public final static String MENU_PERMISSION = "PERMISSION";
+ public final static String MENU_CONFIGURE_SERVER = "Configure Server";
+ public final static String MENU_CONFIGURE_SERVER_DESC = "Configure the Server";
+ public final static String MENU_START_SERVER = "Start Server";
+ public final static String MENU_START_SERVER_DESC = "Start the Server";
+ public final static String MENU_REMOVE_SERVER = "Remove Server";
+ public final static String MENU_REMOVE_SERVER_DESC = "Remove the Server";
+ public final static String MENU_STOP_SERVER = "Stop Server";
+ public final static String MENU_STOP_SERVER_DESC = "Stop the Server";
+ public final static String MENU_RESTART_SERVER = "Restart Server";
+ public final static String MENU_RESTART_SERVER_DESC = "Restart the Server";
+
+
+ public final static String PROP_FILE =
+ "CMSAdminRS";
+
+ public CMSAdminResources()
+ {
+ mResourceSet = new ThisResourceSet(PROP_FILE);
+ mResourceBundle = mResourceSet.getThisBundle(PROP_FILE,
+ Locale.getDefault());
+ }
+
+ /**
+ * Override of ResourceBundle, same semantics
+ */
+ public Object handleGetObject(String key) {
+ Object o = mResourceBundle.handleGetObject(key);
+ if (o == null) {
+ Debug.println("**** UNDEFINED PROPERTY=" + key);
+ }
+ return o;
+ }
+
+ /**
+ * Implementation of ResourceBundle.getKeys.
+ */
+ public Enumeration getKeys() {
+ return mResourceBundle.getKeys();
+ }
+
+ // ==================privates====================
+
+ private PropertyResourceBundle mResourceBundle = null;
+ private ThisResourceSet mResourceSet = null;
+}
+
+class ThisResourceSet extends ResourceSet
+{
+ public ThisResourceSet(String s)
+ {
+ super(s);
+ }
+
+ public PropertyResourceBundle getThisBundle(String n, Locale l)
+ {
+ return super.getBundle(n, l);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/CMSAdminUtil.java b/base/console/src/com/netscape/admin/certsrv/CMSAdminUtil.java
new file mode 100644
index 000000000..107de427b
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/CMSAdminUtil.java
@@ -0,0 +1,1298 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import java.util.*;
+import java.text.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import javax.swing.border.*;
+import javax.swing.table.*;
+import javax.swing.text.*;
+import java.awt.*;
+import java.awt.event.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.admin.certsrv.misc.MessageFormatter;
+import java.text.BreakIterator;
+import java.text.Collator;
+import com.netscape.management.nmclf.*;
+
+/**
+ * Utility class for the CMSAdmin package
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @date 01/12/97
+ */
+public class CMSAdminUtil {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ public static final int DEFAULT_TEXTFIELD_WIDTH = 30;
+ public static final int COMPONENT_SPACE = SuiLookAndFeel.COMPONENT_SPACE;
+ public static final int SEPARATED_COMPONENT_SPACE =
+ SuiLookAndFeel.SEPARATED_COMPONENT_SPACE;
+ public static final int DIFFERENT_COMPONENT_SPACE =
+ SuiLookAndFeel.DIFFERENT_COMPONENT_SPACE;
+ public static final int HELP_BUTTON_OFFSET = 9;
+
+ public static final int DEFAULT_BUTTON_SIZE = 72;
+
+ final public static Dimension DEFAULT_PANEL_SIZE = new Dimension(350,440);
+ final public static int DEFAULT_PADDING = SuiLookAndFeel.COMPONENT_SPACE;
+ private static final int DEFAULT_WIDTH = 40;
+ final public static Insets DEFAULT_EMPTY_INSETS = new Insets(0,0,0,0);
+ public static final Insets DEAFULT_END_INSETS = new Insets(COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE,COMPONENT_SPACE);
+
+ public static final int WARNING_MESSAGE = JOptionPane.WARNING_MESSAGE;
+ public static final int ERROR_MESSAGE = JOptionPane.ERROR_MESSAGE;
+ public static final int INFORMATION_MESSAGE = JOptionPane.INFORMATION_MESSAGE;
+ public static final int OK_OPTION = JOptionPane.OK_OPTION;
+ public static final int NO_OPTION = JOptionPane.NO_OPTION;
+ public static final int CANCEL_OPTION = JOptionPane.CANCEL_OPTION;
+
+ private static Hashtable mPackageImages = new Hashtable(); //image container
+ private static final ResourceSet mHelpResource =
+ new ResourceSet("com.netscape.admin.certsrv.certsrv-help");
+ public static final ResourceSet mResource =
+ new ResourceSet("com.netscape.admin.certsrv.certsrv");
+ public static Collator collator = Collator.getInstance();
+
+
+
+ /*==========================================================
+ * Utilities methods
+ *==========================================================*/
+
+ /**
+ * Utility function to retrieve images from the package image
+ * class path.
+ *
+ * @param name Image name to be returned
+ * @return Image
+ */
+ public static RemoteImage getImage( String name ) {
+ String imageDir = CMSAdminResources.DEFAULT_IMAGE_DIRECTORY;
+ RemoteImage i = (RemoteImage) mPackageImages.get( name );
+ if ( i != null )
+ return i;
+ i = getSystemImage( imageDir + "/" + name );
+ if ( i != null )
+ mPackageImages.put( name, i );
+ return i;
+ }
+
+ public static RemoteImage getThemeImage( String name ) {
+ String imageDir = CMSAdminResources.DEFAULT_THEME_IMAGE_DIRECTORY;
+ RemoteImage i = (RemoteImage) mPackageImages.get( name );
+ if ( i != null )
+ return i;
+ i = getSystemImage( imageDir + "/" + name );
+ if ( i != null )
+ mPackageImages.put( name, i );
+ return i;
+ }
+
+ /**
+ * Utility function to reset the GridBagConstraints to default
+ *
+ * parameters specified below.
+ * @param GridBagConstraints to be reseted
+ */
+ public static void resetGBC(GridBagConstraints gbc)
+ {
+ gbc.gridx = gbc.RELATIVE;
+ gbc.gridy = gbc.RELATIVE;
+ gbc.gridwidth = 1;
+ gbc.gridheight = 1;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.anchor = gbc.CENTER;
+ gbc.ipadx = 0;
+ gbc.ipady = 0;
+ gbc.weightx = 0.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ 0,COMPONENT_SPACE);
+ }
+
+ public static void repaintComp(JComponent component) {
+ component.invalidate();
+ component.validate();
+ component.repaint(1);
+ }
+
+ public static void enableJTextField(JTextComponent component,
+ boolean enable, Color color) {
+ component.setEnabled(enable);
+ component.setEditable(enable);
+ component.setBackground(color);
+ component.invalidate();
+ component.validate();
+ component.repaint(1);
+ }
+
+ public static void addComponents(JPanel panel, JComponent comp1,
+ JComponent comp2, GridBagConstraints gbc) {
+ double weighty = gbc.weighty;
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.weighty = weighty;
+ panel.add(comp1, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.weighty = weighty;
+ gbc.gridwidth = gbc.REMAINDER;
+ panel.add(comp2, gbc);
+ }
+
+ public static void addComponents(JPanel panel, JComponent comp1,
+ JComponent comp2, JComponent comp3, GridBagConstraints gbc) {
+ double weighty = gbc.weighty;
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.weighty = weighty;
+ panel.add(comp1, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.weighty = weighty;
+ panel.add(comp2, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.weighty = weighty;
+ gbc.gridwidth = gbc.REMAINDER;
+ panel.add(comp3, gbc);
+ }
+
+ public static void addComponents(JPanel panel, JComponent comp1,
+ JComponent comp2, JComponent comp3, JComponent comp4,
+ GridBagConstraints gbc) {
+ double weighty = gbc.weighty;
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.weighty = weighty;
+ panel.add(comp1, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.weighty = weighty;
+ panel.add(comp2, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.weighty = weighty;
+ panel.add(comp3, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.weighty = weighty;
+ gbc.gridwidth = gbc.REMAINDER;
+ panel.add(comp4, gbc);
+ }
+
+ /**
+ * Add a label and a textfield to a panel, assumed to be using
+ * GridBagLayout.
+ */
+ public static void addEntryField(JPanel panel, JComponent label,
+ JComponent field, GridBagConstraints gbc) {
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.gridx = 0;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,0,0);
+ panel.add( label, gbc );
+
+ gbc.gridx++;
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ 0,DIFFERENT_COMPONENT_SPACE);
+ panel.add( field, gbc );
+ }
+
+ /**
+ * Add 3 components in the same row to a panel, assumed to be using
+ * GridBagLayout.
+ */
+ public static void addEntryField(JPanel panel, JComponent field1,
+ JComponent field2, JComponent field3, GridBagConstraints gbc) {
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.gridx = 0;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,0,0);
+ panel.add( field1, gbc );
+
+ gbc.gridx++;
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0,0);
+ panel.add(field2, gbc);
+
+ gbc.gridx++;
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ 0,DIFFERENT_COMPONENT_SPACE);
+ panel.add( field3, gbc );
+ }
+
+ /**
+ * Add 4 components in the same row to a panel, assumed to be using
+ * GridBagLayout.
+ */
+ public static void addEntryField(JPanel panel, JComponent field1,
+ JComponent field2, JComponent field3, JComponent field4, GridBagConstraints gbc) {
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.gridx = 0;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,0,0);
+ panel.add( field1, gbc );
+
+ gbc.gridx++;
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 0.5;
+ gbc.gridwidth = 1;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0,0);
+ panel.add(field2, gbc);
+
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.gridx++;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,0,0);
+ panel.add( field3, gbc );
+
+ gbc.gridx++;
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 0.5;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ 0,DIFFERENT_COMPONENT_SPACE);
+ panel.add( field4, gbc );
+ }
+
+ /**
+ * Add 5 components in the same row to a panel, assumed to be using
+ * GridBagLayout.
+ */
+ public static void addEntryField(JPanel panel, JComponent field1,
+ JComponent field2, JComponent field3, JComponent field4,
+ JComponent field5, GridBagConstraints gbc) {
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.gridx = 0;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,0,0);
+ panel.add( field1, gbc );
+
+ gbc.gridx++;
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.HORIZONTAL;
+ //gbc.weightx = 0.5;
+ gbc.gridwidth = 1;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0,0);
+ panel.add(field2, gbc);
+
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.gridx++;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,0,0);
+ panel.add( field3, gbc );
+
+ gbc.gridx++;
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ //gbc.weightx = 0.5;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ 0,DIFFERENT_COMPONENT_SPACE);
+ panel.add( field4, gbc );
+
+ gbc.gridx++;
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ 0,DIFFERENT_COMPONENT_SPACE);
+ panel.add( field5, gbc );
+ }
+
+ /**
+ * Add 6 components in the same row to a panel, assumed to be using
+ * GridBagLayout.
+ */
+ public static void addEntryField(JPanel panel, JComponent field1,
+ JComponent field2, JComponent field3, JComponent field4,
+ JComponent field5, JComponent field6, GridBagConstraints gbc) {
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.gridx = 0;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,0,0);
+ panel.add( field1, gbc );
+
+ gbc.gridx++;
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.HORIZONTAL;
+ //gbc.weightx = 0.5;
+ gbc.gridwidth = 1;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0,0);
+ panel.add(field2, gbc);
+
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.gridx++;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,0,0);
+ panel.add( field3, gbc );
+
+ gbc.gridx++;
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ //gbc.weightx = 0.5;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ 0,DIFFERENT_COMPONENT_SPACE);
+ panel.add(field4, gbc);
+
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.gridx++;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,0,0);
+ panel.add( field5, gbc );
+
+ gbc.gridx++;
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ 0,DIFFERENT_COMPONENT_SPACE);
+ panel.add( field6, gbc );
+ }
+
+ /**
+ * Utility function to wrap text at given width. Used mostly
+ * for displaying text in the dialog box.
+ *
+ * @param s message string
+ * @param width width per line
+ * @return string with line feeds
+ */
+ public static String wrapText(String str, int width)
+ {
+ if (str == null || str.length() < width) {
+ return str;
+ }
+ String ret = "";
+
+ StringTokenizer tokenizer = new StringTokenizer(str, "\n");
+ while (tokenizer.hasMoreTokens()) {
+ BreakIterator boundary = BreakIterator.getLineInstance();
+ String s = (String)tokenizer.nextToken();
+ boundary.setText(s);
+ int end;
+ int start = 0;
+ while ((end = boundary.next()) != BreakIterator.DONE) {
+ if (end - start > width) {
+ end = boundary.previous();
+ if (start == end) {
+ // Was too long for even one iteration
+ end = boundary.next();
+ }
+ ret += s.substring(start, end);
+ ret += "\n";
+ start = end;
+ }
+ }
+ end = boundary.last();
+ ret = ret+s.substring(start, end)+"\n";
+ }
+ return ret;
+ }
+
+ public static String certRequestWrapText(String s, int width) {
+ String ret = "";
+ StringTokenizer tokenizer = new StringTokenizer(s, "\n");
+ int numTokens = tokenizer.countTokens();
+ int index = 1;
+ String beginCert = "";
+ String endCert = "";
+ String content = "";
+ while(tokenizer.hasMoreTokens()) {
+ String sToken = (String)tokenizer.nextToken();
+ if (index == 1) {
+ beginCert = sToken;
+ } else if (index == numTokens) {
+ endCert = sToken;
+ } else {
+ content += sToken;
+ }
+
+ index++;
+ }
+
+ ret = beginCert+"\n"+wrapText(content, width, true)+"\n"+endCert;
+ return ret;
+ }
+
+ public static String wrapText(String s, int width, boolean noIterator) {
+ if (noIterator) {
+ if (s == null || s.length() <= width) {
+ return s;
+ }
+
+ String ret = "";
+ int start = 0;
+ int end = width;
+ int len = s.length();
+ while (len > width) {
+ ret += s.substring(start, end);
+ ret += "\n";
+ len -= width;
+ start += width;
+ end += width;
+ }
+ ret += s.substring(start);
+ return ret;
+ } else {
+ return wrapText(s, width);
+ }
+ }
+
+ /**
+ * Utility function to wrap text at default width. Used mostly
+ * for displaying text in the dialog box.
+ *
+ * @param s message string
+ * @return string with line feeds
+ */
+ public static String wrapText(String s) {
+ return(wrapText(s, DEFAULT_WIDTH));
+ }
+
+ /**
+ * Find out the table width to be used
+ *
+ * @table JTable object
+ */
+ public static int getTotalColumnWidth( JTable table ) {
+ Enumeration en = table.getColumnModel().getColumns();
+ int width = 0;
+ while( en.hasMoreElements() ) {
+ TableColumn col = (TableColumn)en.nextElement();
+ width += col.getWidth();
+ }
+ return width - 200;
+ }
+
+
+ /*==========================================================
+ * Component Factory
+ *==========================================================*/
+
+ //==== BORDER CREATION ====================================
+ public static Border makeEtchedBorder() {
+ Border margin = new EmptyBorder(0,0,
+ SuiLookAndFeel.VERT_WINDOW_INSET,0);
+ return new CompoundBorder(BorderFactory.createEtchedBorder(), margin);
+ }
+
+ public static Border makeTitledBorder(ResourceBundle resource,
+ String panelName,
+ String keyword) {
+ String title;
+ try {
+ title = resource.getString(panelName+"_BORDER_"+keyword+"_LABEL");
+ } catch (MissingResourceException e) {
+ title = "Missing Title";
+ }
+ return new TitledBorder(title);
+ }
+
+ //==== DIALOG CREATION ====================================
+
+ public static void showMessageDialog(ResourceBundle resource,
+ String panelName,
+ String keyword,
+ int messageType ) {
+ showMessageDialog(UtilConsoleGlobals.getActivatedFrame(), resource, panelName, keyword, messageType);
+ }
+
+ public static void showMessageDialog(JFrame frame,
+ String title,
+ String msg,
+ int messageType ) {
+ Icon icon;
+ if (messageType != ERROR_MESSAGE)
+ icon = getImage(CMSAdminResources.IMAGE_INFO_ICON);
+ else
+ icon = getImage(CMSAdminResources.IMAGE_ERROR_ICON);
+
+ JOptionPane.showMessageDialog(
+ frame,
+ CMSAdminUtil.wrapText(msg),
+ title,
+ messageType,
+ icon);
+ }
+
+ /**
+ * Creating message dialog box for display
+ */
+ public static void showMessageDialog(JFrame frame,
+ ResourceBundle resource,
+ String panelName,
+ String keyword,
+ int messageType ) {
+ String msg, title;
+ try {
+ msg = resource.getString(panelName+"_DIALOG_"+keyword+ "_MESSAGE");
+ } catch (MissingResourceException e) {
+ msg = "Missing Label";
+ }
+ try {
+ title = resource.getString(panelName+"_DIALOG_"+keyword+ "_TITLE");
+ } catch (MissingResourceException e) {
+ title = "Missing Title";
+ }
+
+ Icon icon;
+ if (messageType != ERROR_MESSAGE)
+ icon = getImage(CMSAdminResources.IMAGE_INFO_ICON);
+ else
+ icon = getImage(CMSAdminResources.IMAGE_ERROR_ICON);
+
+ JOptionPane.showMessageDialog(
+ frame,
+ CMSAdminUtil.wrapText(msg),
+ title,
+ messageType,
+ icon);
+ }
+
+ public static void showErrorDialog(ResourceBundle resource,
+ String message,
+ int messageType) {
+ showErrorDialog(new JFrame(), resource, message, messageType);
+ }
+
+ /**
+ * Creating error dialog box for display
+ */
+ public static void showErrorDialog(JFrame frame,
+ ResourceBundle resource,
+ String message,
+ int messageType) {
+ String title;
+ try {
+ title = resource.getString(CMSAdminResources.GENERAL_ERROR);
+ } catch (MissingResourceException e) {
+ title = "Missing Title";
+ }
+ JOptionPane.showMessageDialog(
+ frame,
+ CMSAdminUtil.wrapText(message),
+ title,
+ messageType,
+ getImage(CMSAdminResources.IMAGE_ERROR_ICON));
+ }
+
+ public static int showConfirmDialog( ResourceBundle resource,
+ String panelName,
+ String keyword,
+ int messageType )
+ {
+ return showConfirmDialog(new JFrame(), resource, panelName, keyword, messageType);
+ }
+
+ public static int showConfirmDialog( ResourceBundle resource,
+ String panelName,
+ String keyword, String[] params,
+ int messageType )
+ {
+ return showConfirmDialog(new JFrame(), resource, panelName, keyword,
+ params, messageType);
+ }
+
+ /**
+ * Creating confirm dialog box for display
+ */
+ public static int showConfirmDialog( JFrame frame,
+ ResourceBundle resource,
+ String panelName,
+ String keyword,
+ int messageType )
+ {
+ String msg, title;
+ try {
+ msg = resource.getString(panelName+"_DIALOG_"+keyword+ "_MESSAGE");
+ } catch (MissingResourceException e) {
+ msg = "Missing Label";
+ }
+ try {
+ title = resource.getString(panelName+"_DIALOG_"+keyword+ "_TITLE");
+ } catch (MissingResourceException e) {
+ title = "Missing Title";
+ }
+
+ return JOptionPane.showConfirmDialog(
+ frame,
+ CMSAdminUtil.wrapText(msg), title,
+ JOptionPane.YES_NO_OPTION,
+ messageType,
+ getImage(CMSAdminResources.IMAGE_WARN_ICON));
+ }
+
+ public static int showConfirmDialog(JFrame frame, ResourceBundle resource,
+ String panelName, String keyword, String[] params, int messageType )
+ {
+ String msg, title;
+ try {
+ msg = resource.getString(panelName+"_DIALOG_"+keyword+ "_MESSAGE");
+ } catch (MissingResourceException e) {
+ msg = "Missing Label";
+ }
+ try {
+ title = resource.getString(panelName+"_DIALOG_"+keyword+ "_TITLE");
+ } catch (MissingResourceException e) {
+ title = "Missing Title";
+ }
+
+ String finalmsg = msg;
+ if (params != null && params.length > 0) {
+ MessageFormat mf = new MessageFormat(msg);
+ finalmsg = mf.format(params);
+ }
+
+ return JOptionPane.showConfirmDialog(
+ frame,
+ CMSAdminUtil.wrapText(finalmsg), title,
+ JOptionPane.YES_NO_OPTION,
+ messageType,
+ getImage(CMSAdminResources.IMAGE_WARN_ICON));
+ }
+
+ //==== LABEL CREATION ================================
+
+ /**
+ * Factory Method to create LABEL using specified params
+ */
+ public static JLabel makeJLabel(ResourceBundle resource,
+ String panelName,
+ String keyword,
+ Icon icon)
+ {
+ return makeJLabel(resource, panelName, keyword, icon, -1);
+ }
+
+
+ /**
+ * Factory Method to create LABEL using specified params
+ */
+ public static JLabel makeJLabel(ResourceBundle resource,
+ String panelName,
+ String keyword,
+ Icon icon,
+ int alignment)
+ {
+ String title;
+ try {
+ title = resource.getString(panelName+"_LABEL_"+keyword+ "_LABEL");
+ } catch (MissingResourceException e) {
+ title = "Missing Label";
+ Debug.println("CMSAdminUtil - makeJLabel() - missing resource: "+panelName+"_LABEL_"+keyword+ "_LABEL");
+ }
+ JLabel label = new JLabel();
+ if (icon != null)
+ label.setIcon(icon);
+ if (title != null)
+ label.setText(title);
+ if (alignment != -1)
+ label.setHorizontalAlignment(alignment);
+ //setToolTip(resource, panelName, "LABEL_"+keyword, label);
+
+ return label;
+ }
+
+
+ //==== TEXTFIELD CREATION ================================
+
+ /**
+ * Factory Method to create TextFiled using specified params
+ */
+ public static JTextField makeJTextField(Document d,
+ String s,
+ int len,
+ Object listener) {
+
+ JTextField pf = new JTextField(DEFAULT_TEXTFIELD_WIDTH){
+ public void setEnabled( boolean enabled ) {
+ super.setEnabled( enabled );
+ //super.setEditable(enabled);
+ super.setBackground( enabled ? Color.white: SystemColor.window);
+ }
+ };
+ pf.setEnabled( true );
+
+ if (d != null)
+ pf.setDocument(d);
+ if (s != null)
+ pf.setText(s);
+ if (len != -1)
+ pf.setColumns(len);
+
+ pf.addActionListener((ActionListener)listener);
+ //detect text changes
+ pf.getDocument().addDocumentListener((DocumentListener)listener);
+ return pf;
+ }
+
+ //==== PASSWORD FIELD CREATION ================================
+
+ /**
+ * Factory Method to create Password Filed using specified params
+ */
+ public static JPasswordField makeJPasswordField(Document d,
+ String s,
+ int len,
+ Object listener) {
+ JPasswordField pf = new JPasswordField(DEFAULT_TEXTFIELD_WIDTH) {
+ public void setEnabled( boolean enabled ) {
+ super.setEnabled( enabled );
+ super.setEditable(enabled);
+ setBackground( enabled ? Color.white: SystemColor.window);
+ this.repaint();
+ }
+ };
+ pf.setEnabled( true );
+ if (d != null)
+ pf.setDocument(d);
+ if (s != null)
+ pf.setText(s);
+ if (len != -1)
+ pf.setColumns(len);
+
+ pf.addActionListener((ActionListener)listener);
+ //detect text changes
+ pf.getDocument().addDocumentListener((DocumentListener)listener);
+ return pf;
+ }
+
+
+ //==== LIST CREATION ================================
+
+ /**
+ * Factory Method to create a list box mode specified with specific
+ * visible row count. Special cell renderer is used to display each cell.
+ */
+ public static JList makeJList(DefaultListModel listModel, int visibleCount) {
+ JList listbox = new JList(listModel);
+ listbox.setCellRenderer(new AttrCellRenderer());
+ listbox.setSelectionModel(new DefaultListSelectionModel());
+ listbox.setVisibleRowCount(visibleCount);
+ if(listModel.size()!=0)
+ listbox.setSelectedIndex(0);
+ return listbox;
+ }
+
+ //===== CHECKBOX CREATION =======================
+
+ /**
+ * Factory Method to create CheckBox using specified params
+ */
+ public static JCheckBox makeJCheckBox(ResourceBundle resource,
+ String panelName,
+ String keyword,
+ Icon icon,
+ boolean select,
+ ActionListener listener)
+ {
+ String label;
+ try {
+ label = resource.getString(panelName+"_CHECKBOX_"+keyword+ "_LABEL");
+ } catch (MissingResourceException e) {
+ label = "Missing Label";
+ }
+
+ JCheckBox button = new JCheckBox();
+ if (label != null)
+ button.setText(label);
+ if (icon != null)
+ button.setIcon(icon);
+ button.setSelected(select);
+ button.addActionListener(listener);
+ //setToolTip(resource, panelName, "CHECKBOX_"+keyword, button);
+
+ return button;
+ }
+
+ //===== RADIO BUTTON CREATION =======================
+
+ /**
+ * Factory Method to create Radio Button using specified params
+ */
+ public static JRadioButton makeJRadioButton(ResourceBundle resource,
+ String panelName,
+ String keyword,
+ Icon icon,
+ boolean select,
+ ActionListener listener)
+ {
+ String label;
+ try {
+ label = resource.getString(panelName+"_RADIOBUTTON_"+keyword+ "_LABEL");
+ } catch (MissingResourceException e) {
+ label = "Missing Label";
+ }
+
+ JRadioButton button = new JRadioButton();
+ if (label != null)
+ button.setText(label);
+ if (icon != null)
+ button.setIcon(icon);
+ button.setSelected(select);
+ button.addActionListener(listener);
+ //setToolTip(resource, panelName, "RADIOBUTTON_"+keyword, button);
+
+ return button;
+ }
+
+ //===== BUTTON CREATION =======================
+
+ /**
+ * Factory Method to create Button using specified params
+ */
+ public static JButton makeJButton(ResourceBundle resource,
+ String panelName,
+ String keyword,
+ Icon icon,
+ ActionListener listener)
+ {
+ String label;
+ try {
+ label = resource.getString(panelName+"_BUTTON_"+keyword+ "_LABEL");
+ } catch (MissingResourceException e) {
+ label = "Missing Label";
+ }
+
+ JButton button = new JButton();
+ if (label != null)
+ button.setText(label);
+ if (icon != null)
+ button.setIcon(icon);
+ button.addActionListener(listener);
+ //setToolTip(resource, panelName, "BUTTON_"+keyword, button);
+
+ return button;
+ }
+
+ /**
+ * Create a panel with horizontally arranged, equally sized buttons
+ * The buttons are aligned to the right in the panel (if it is
+ * stretched beyond the length of the buttons)
+ *
+ * @param buttons An array of buttons for the panel
+ * @param isHelp Help button is the last one so pat extra space
+ * @param isConfig don't pat button
+ * @return A panel containing the buttons
+ */
+
+ public static JPanel makeJButtonPanel( JButton[] buttons) {
+ return makeJButtonPanel(buttons, false, false);
+ }
+
+ public static JPanel makeJButtonPanel( JButton[] buttons, boolean isHelp) {
+ return makeJButtonPanel(buttons, isHelp, false);
+ }
+
+ public static JPanel makeJButtonPanel( JButton[] buttons, boolean isHelp, boolean isConfig) {
+ JButtonFactory.resize( buttons );
+ JPanel buttonPanel = new JPanel();
+ GridBagConstraints gbc = new GridBagConstraints();
+ buttonPanel.setLayout(new GridBagLayout());
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.gridwidth = 1;
+ buttonPanel.add( Box.createGlue(), gbc );
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0;
+ for( int i = 0; i < buttons.length; i++ ) {
+ if ( i == buttons.length-1 ) {
+ gbc.gridwidth = gbc.REMAINDER;
+ if (isHelp)
+ buttonPanel.add( Box.createHorizontalStrut(HELP_BUTTON_OFFSET));
+ else
+ buttonPanel.add( Box.createHorizontalStrut(SuiLookAndFeel.COMPONENT_SPACE) );
+ }
+ buttonPanel.add( buttons[i], gbc );
+ if ( i < buttons.length-2 )
+ buttonPanel.add( Box.createHorizontalStrut(SuiLookAndFeel.COMPONENT_SPACE) );
+ }
+
+ JPanel p = new JPanel();
+ p.setLayout( new BorderLayout() );
+ p.add( "Center", buttonPanel );
+
+ if(!isConfig) {
+ p.add( "South",
+ Box.createVerticalStrut(DIFFERENT_COMPONENT_SPACE) );
+ p.add( "East",
+ Box.createHorizontalStrut(DIFFERENT_COMPONENT_SPACE) );
+ } else {
+ p.add( "South",
+ Box.createVerticalStrut(DIFFERENT_COMPONENT_SPACE-COMPONENT_SPACE) );
+ }
+ p.add( "North",
+ Box.createVerticalStrut(DIFFERENT_COMPONENT_SPACE) );
+
+ return p;
+ }
+
+ /**
+ * Create a panel with vertically arranged, equally sized buttons
+ * The buttons are aligned to the top in the panel (if it is
+ * stretched beyond the length of the buttons)
+ *
+ * @param buttons An array of buttons for the panel
+ * @return A panel containing the buttons
+ */
+ public static JPanel makeJButtonVPanel( JButton[] buttons ) {
+ //JButtonFactory.resize( buttons );
+ JPanel buttonPanel = new JPanel();
+ GridBagConstraints gbc = new GridBagConstraints();
+ buttonPanel.setLayout(new GridBagLayout());
+ resetGBC(gbc);
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0, DIFFERENT_COMPONENT_SPACE, 0,0);
+
+ for( int i = 0; i < buttons.length; i++ ) {
+ if ( i == buttons.length-1 )
+ gbc.gridheight = gbc.REMAINDER;
+ buttonPanel.add( buttons[i], gbc );
+ gbc.insets = new Insets(COMPONENT_SPACE, DIFFERENT_COMPONENT_SPACE,
+ 0, 0);
+ }
+
+ JPanel p = new JPanel();
+ p.setLayout( new BorderLayout() );
+ p.add( "Center", buttonPanel );
+ return p;
+ }
+
+ //===== COMBOBOX CREATION =======================
+
+ public static JComboBox makeJComboBox(ResourceBundle resource,
+ String panelName,
+ String keyword)
+ {
+ String value = null;
+ try {
+ value = resource.getString(panelName+"_COMBOBOX_"+keyword+"_DEFAULT");
+ } catch (MissingResourceException e) {
+ }
+ JComboBox jcb = new JComboBox();
+ String val = null;
+ int ii = 0;
+ do {
+ try {
+ val = resource.getString(panelName+"_COMBOBOX_"+keyword+"_VALUE_"+ii);
+ if (val != null) {
+ jcb.addItem(val);
+ }
+ ++ii;
+ } catch (MissingResourceException e) {
+ val = null;
+ }
+ } while (val != null);
+
+ if (value != null)
+ jcb.setSelectedItem(value);
+ return jcb;
+ }
+
+
+ //===== TOOL TIP CREATION =======================
+
+ /**
+ * Set tool tip on compoenent using resources passed in
+ */
+ public static void setToolTip(ResourceBundle resource,
+ String panelName,
+ String compKeyword,
+ JComponent w)
+ {
+ try {
+ String ttip = resource.getString(panelName+"_"+compKeyword+"_TTIP");
+ w.setToolTipText(ttip);
+ } catch (MissingResourceException e) {
+ //DON'T HAVE TOOT TIP
+ }
+ }
+
+ public static String[] randomize(String [] t) {
+ String[] s = new String[t.length];
+ System.arraycopy(t,0,s,0,t.length);
+ String[] result = new String[s.length];
+
+ int j=0;
+ java.util.Random r = new java.util.Random();
+
+ for (int i=0; i<s.length; i++) {
+ int x = r.nextInt();
+ if (x <0) x = -x;
+ int n = x % (s.length-i);
+ result[j] = s[n];
+ s[n] = s[s.length-i-1];
+ j++;
+ }
+ return result;
+ }
+
+ /**
+ * Sorts the array of strings using bubble sort.
+ * @param str The array of string being sorted. The str parameter contains
+ * the sorted result.
+ */
+ public static void bubbleSort(String[] str) {
+ for (int i = 0; i < str.length-1; i++) {
+ for (int j = i+1; j < str.length; j++) {
+ if( collator.compare(str[i], str[j]) > 0 ) {
+ String t = str[i];
+ str[i] = str[j];
+ str[j] = t;
+ }
+ }
+ }
+ }
+
+ public static void bubbleSort(String[] str, String[] data) {
+ for (int i = 0; i < str.length-1; i++) {
+ for (int j = i+1; j < str.length; j++) {
+ if( collator.compare(str[i], str[j]) > 0 ) {
+ String t = str[i];
+ str[i] = str[j];
+ str[j] = t;
+ String d = data[i];
+ data[i] = data[j];
+ data[j] = d;
+ }
+ }
+ }
+ }
+
+ public static void quickSort(String[] str, int low, int high) {
+ if (low >= high)
+ return;
+
+ String pivot = str[low];
+ int slow = low-1, shigh = high+1;
+
+ while (true) {
+ do
+ shigh--;
+ while (collator.compare(str[shigh], pivot) > 0);
+ do
+ slow++;
+ while (collator.compare(pivot, str[slow]) > 0);
+ if (slow >= shigh)
+ break;
+
+ String temp = str[slow];
+ str[slow] = str[shigh];
+ str[shigh] = temp;
+ }
+
+ quickSort (str, low, shigh);
+ quickSort (str, shigh+1, high);
+ }
+
+ public static void help(String token) {
+ Debug.println( "CMSAdminUtil.help: "+token);
+ new Help(mHelpResource).help(token);
+ }
+
+ //get localized string using the format
+ public static String getLocalizedString(ResourceBundle resource,
+ String keyword,
+ Object param) {
+ return MessageFormatter.getLocalizedString(resource.getClass().getName(),
+ keyword, param);
+ }
+
+ //get localized string using the format
+ public static String getLocalizedString(ResourceBundle resource,
+ String keyword,
+ Object [] params) {
+ return MessageFormatter.getLocalizedString(resource.getClass().getName(),
+ keyword, params);
+ }
+
+ public static String getPureString(String data) {
+ StringBuffer input = new StringBuffer(data);
+ StringBuffer buff = new StringBuffer();
+ for (int i=0; i< input.length(); i++) {
+ char c = input.charAt(i);
+ if ((c != '\n') && (c != '\r'))
+ buff.append(c);
+ }
+ return buff.toString();
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+
+ /**
+ * This is not necessary any more, now that RemoteImage implements
+ * the code we used to have inside this method.
+ */
+ static RemoteImage getSystemImage( String imagePath ) {
+ return new RemoteImage( imagePath );
+ }
+
+ public static JTextArea createTextArea(String str, Color color) {
+ JTextArea desc = new JTextArea(str);
+ desc.setBackground(color);
+ desc.setEditable(false);
+ desc.setCaretColor(color);
+ desc.setLineWrap(true);
+ desc.setWrapStyleWord(true);
+
+ return desc;
+ }
+
+ public static long hexToLong(String s)
+ throws NumberFormatException {
+ int len = s.length();
+ double y = 0;
+ double base = 16;
+ long num = 0;
+
+ StringBuffer buffer = new StringBuffer(s);
+
+ for (int i=0; i<len; i++) {
+ char x = buffer.charAt(i);
+ if (x >= '0' && x <= '9') {
+ y = x-48;
+ } else if (x == 'a') {
+ y = 10;
+ } else if (x == 'b') {
+ y = 11;
+ } else if (x == 'c') {
+ y = 12;
+ } else if (x == 'd') {
+ y = 13;
+ } else if (x == 'e') {
+ y = 14;
+ } else if (x == 'f') {
+ y = 15;
+ } else {
+ num = -1;
+ break;
+ }
+ num = num+(long)(y*Math.pow(base, len-1-i));
+ }
+
+ return num;
+ }
+
+ public static Object createTableCell(String syntax, String syntaxVal, String v) {
+ if (syntax.equalsIgnoreCase("string") ||
+ syntax.equalsIgnoreCase("integer")) {
+ if (v == null) {
+ return new JTextField("");
+ } else {
+ return new JTextField(v);
+ }
+ } else if (syntax.equalsIgnoreCase("choice")) {
+ if (syntaxVal != null && syntaxVal.length() > 0) {
+ StringTokenizer st = new StringTokenizer(syntaxVal, ",");
+ int num = st.countTokens();
+ String[] item = new String[num];
+ int i=0;
+ while (st.hasMoreTokens()) {
+ String token = st.nextToken();
+ // Fixes Bugscape Bug #56335: remove extraneous ';'
+ if( token.charAt(0) == ';' ) {
+ token = token.substring(1);
+ }
+ item[i++] = token;
+ }
+
+ CMSAdminUtil.bubbleSort(item);
+ JComboBox b = new JComboBox(item);
+
+ if (v != null && v.length() > 0)
+ b.setSelectedItem(v);
+ else
+ b.setSelectedIndex(0);
+ return b;
+ }
+ } else if (syntax.equalsIgnoreCase("boolean")) {
+ String[] item = {"true", "false"};
+ JComboBox b = new JComboBox(item);
+ if (v != null && v.equalsIgnoreCase("true")) {
+ b.setSelectedIndex(0);
+ } else {
+ b.setSelectedIndex(1);
+ }
+ return b;
+ }
+
+ return null;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/CMSBaseMenuInfo.java b/base/console/src/com/netscape/admin/certsrv/CMSBaseMenuInfo.java
new file mode 100644
index 000000000..cb1909f22
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/CMSBaseMenuInfo.java
@@ -0,0 +1,178 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import javax.swing.*;
+import javax.swing.tree.*;
+import javax.swing.event.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import java.util.*;
+
+/**
+ * This class represents the menu item selection and associated
+ * call back function.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv
+ */
+public class CMSBaseMenuInfo implements IMenuInfo {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ //framework level menu catagory ids
+ public static String MENU_FILE = Framework.MENU_FILE;
+ public static String MENU_VIEW = Framework.MENU_VIEW;
+ public static String MENU_OBJECT = ResourcePage.MENU_OBJECT;
+
+ //menu bar menu items
+ public static String MENU_KEYCERT = CMSAdminResources.MENU_KEYCERT;
+ public static String MENU_REFRESH = CMSAdminResources.MENU_REFRESH;
+ public static String MENU_KEYCERT_MANAGEMENT = CMSAdminResources.MENU_KEYCERT_MANAGEMENT;
+ public static String MENU_PKCS11 = CMSAdminResources.MENU_PKCS11;
+ public static String MENU_NEWCERT = CMSAdminResources.MENU_NEWCERT;
+
+ //context menu items
+
+
+ protected Vector mMenuCategoryIDs; //stores the ids
+ protected Vector mCategoryIDMenuItems; //stores the menu items associated
+ //with the specified id
+ protected Vector mMenuItemsIDs; //stores the item ids
+ protected Vector mActionListeners; //stores the action listeners
+
+ protected ResourceBundle mResource;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSBaseMenuInfo() {
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ mMenuCategoryIDs = new Vector();
+ mCategoryIDMenuItems = new Vector();
+ mMenuItemsIDs = new Vector();
+ mActionListeners = new Vector();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * Register menu items and associated action obejct
+ * @param id menu catagory ID
+ * @param item menu item
+ * @param action IMenuAction object
+ */
+ public void registerMenuItem(String id, String keyword, IMenuAction action) {
+ IMenuItem item = getMenuItemText(keyword);
+
+ //register menu item and action pair
+ int i = mMenuItemsIDs.indexOf(item.getID());
+ if (i == -1) {
+ mMenuItemsIDs.addElement(item.getID());
+ mActionListeners.addElement(action);
+ } else {
+ mActionListeners.setElementAt(action,i);
+ }
+
+ //register catgory id and associated menu items
+ i = mMenuCategoryIDs.indexOf(id);
+ if (i == -1) {
+ mMenuCategoryIDs.addElement(id);
+ mCategoryIDMenuItems.addElement(new Vector());
+ }
+ i = mMenuCategoryIDs.indexOf(id);
+ Vector items = (Vector) mCategoryIDMenuItems.elementAt(i);
+ items.addElement(item); //XXX check exist already ??
+ }
+
+ /**
+ * Add menu item separator
+ */
+ public void addMenuItemSeparator(String id) {
+ int i = mMenuCategoryIDs.indexOf(id);
+ if (i < 0 ) {
+ mMenuCategoryIDs.addElement(id);
+ Vector items = new Vector();
+ items.addElement(new MenuItemSeparator());
+ mCategoryIDMenuItems.addElement(items);
+ } else {
+ Vector items = (Vector) mCategoryIDMenuItems.elementAt(i);
+ items.addElement(new MenuItemSeparator());
+ }
+ }
+
+ /**
+ * Returns supported menu categories.
+ */
+ public String[] getMenuCategoryIDs() {
+ if (mMenuCategoryIDs.size() == 0) {
+ return null;
+ }
+ String[] id = new String[mMenuCategoryIDs.size()];
+ mMenuCategoryIDs.copyInto(id);
+ //for(int i=0; i< id.length; i++)
+ // System.out.println("ID: "+id[i]);
+ return id;
+ }
+
+ /**
+ * Returns menu items for a particular menu category.
+ */
+ public IMenuItem[] getMenuItems(String category) {
+ int i = mMenuCategoryIDs.indexOf(category);
+ if (i != -1) {
+ Vector v = (Vector) mCategoryIDMenuItems.elementAt(i);
+ IMenuItem[] items = new IMenuItem[v.size()];
+ v.copyInto(items);
+ //for(int j=0; j< items.length; j++)
+ // System.out.println("ITEM: "+items[j].getID());
+ return items;
+ }
+ return null;
+ }
+
+ /**
+ * Notification that a menu item has been selected.
+ */
+ public void actionMenuSelected(IPage viewInstance, IMenuItem item) {
+ int i = mMenuItemsIDs.indexOf(item.getID());
+ if (i == -1)
+ return;
+ IMenuAction act = (IMenuAction) mActionListeners.elementAt(i);
+ act.perform(viewInstance);
+ }
+
+ /*==========================================================
+ * priotected methods
+ *==========================================================*/
+
+ protected MenuItemText getMenuItemText(String keyword) {
+ String name = mResource.getString("GENERAL_MENU_"+keyword+"_LABEL");
+ if (name == null)
+ name = "Missing Label";
+ String desc = mResource.getString("GENERAL_MENU_"+keyword+"_DESC");
+ if (desc == null)
+ desc = " ";
+ return new MenuItemText( keyword, name, desc);
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/CMSBasePanel.java b/base/console/src/com/netscape/admin/certsrv/CMSBasePanel.java
new file mode 100644
index 000000000..3430a74d9
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/CMSBasePanel.java
@@ -0,0 +1,460 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import javax.swing.*;
+import javax.swing.event.*;
+import javax.swing.border.*;
+import javax.swing.text.*;
+import com.netscape.management.client.util.*;
+import com.netscape.management.nmclf.*;
+import java.util.*;
+import java.awt.*;
+import java.awt.event.*;
+
+/**
+ * Netscape Certificate Server 4.0 Default Base Panel
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public class CMSBasePanel extends JPanel
+ implements ActionListener, DocumentListener,
+ ItemListener, ListSelectionListener
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ public static Insets DEFAULT_CENTER_INSETS = new Insets(0,0,0,0);
+ public static Insets EMPTY_INSETS = new Insets(0,0,0,0);
+ public static final int COMPONENT_SPACE = SuiLookAndFeel.COMPONENT_SPACE;
+ public static final int SEPARATED_COMPONENT_SPACE =
+ SuiLookAndFeel.SEPARATED_COMPONENT_SPACE;
+ public static final int DIFFERENT_COMPONENT_SPACE =
+ SuiLookAndFeel.DIFFERENT_COMPONENT_SPACE;
+
+ protected static final int WARNING_MESSAGE = JOptionPane.WARNING_MESSAGE;
+ protected static final int ERROR_MESSAGE = JOptionPane.ERROR_MESSAGE;
+ protected static final int INFORMATION_MESSAGE = JOptionPane.INFORMATION_MESSAGE;
+
+ protected String mPanelName; // panel name (UPPERCASE IDENTIFIER)
+ protected ResourceBundle mResource; // resource boundle
+ public static int mNonWaitCursor = -1;
+ public static Cursor mCursor = null;
+ protected JDialog mParent;
+ protected JFrame mAdminFrame;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSBasePanel(String panelName) {
+ this(panelName, ResourceBundle.getBundle(CMSAdminResources.class.getName()));
+ }
+
+ public CMSBasePanel(String panelName, ResourceBundle rb) {
+ super();
+ mPanelName = panelName;
+ mResource = rb;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * Set Panel name
+ * @param name panel name
+ */
+ public void setPanelName(String name) {
+ mPanelName = name;
+ }
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent e) {
+ }
+
+ //== DocumentListener ==
+ public void insertUpdate(DocumentEvent e) {
+ }
+
+ public void removeUpdate(DocumentEvent e){
+ }
+
+ public void changedUpdate(DocumentEvent e){
+ }
+
+ //== ItemListener ==
+ public void itemStateChanged(ItemEvent e){
+ }
+
+ //== ListSelectionListener ==
+ public void valueChanged(ListSelectionEvent e){
+ }
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+
+ //create string using formated resource string
+ //the string format
+ protected String getLocalizedString(String keyword, Object param) {
+ return CMSAdminUtil.getLocalizedString(mResource, keyword, param);
+ }
+
+ protected String getLocalizedString(String keyword, Object [] params) {
+ return CMSAdminUtil.getLocalizedString(mResource, keyword, params);
+ }
+
+
+ //=== DIALOG MESSAGE =====================
+
+ protected void showMessageDialog(String keyword, int messageType ) {
+ CMSAdminUtil.showMessageDialog(mResource, mPanelName, keyword, messageType);
+ }
+
+ protected void showMessageDialog(String keyword) {
+ showMessageDialog(keyword, ERROR_MESSAGE);
+ }
+
+ protected int showConfirmDialog(String keyword, int messageType ) {
+ return CMSAdminUtil.showConfirmDialog(mResource, mPanelName, keyword, messageType);
+ }
+
+ protected int showConfirmDialog(String keyword, String[] params, int messageType ) {
+ return CMSAdminUtil.showConfirmDialog(mResource, mPanelName, keyword, params, messageType);
+ }
+
+ protected int showConfirmDialog(String keyword) {
+ return showConfirmDialog(keyword, WARNING_MESSAGE);
+ }
+
+ protected int showConfirmDialog(String keyword, String[] params) {
+ return showConfirmDialog(keyword, params, WARNING_MESSAGE);
+ }
+
+ /**
+ * Display Error Message dialog
+ *
+ * @param message - message to be displayed
+ */
+ protected void showErrorDialog(String message) {
+ CMSAdminUtil.showErrorDialog(mResource, message, ERROR_MESSAGE);
+ }
+
+ //=== TITLED BORDER ======================
+ protected Border makeTitledBorder(String keyword) {
+ String label;
+ try {
+ label = mResource.getString(mPanelName+"_BORDER_"+keyword+"_LABEL");
+ } catch (MissingResourceException e) {
+ label = "Missing Label";
+ }
+ TitledBorder border = BorderFactory.createTitledBorder(label);
+ Border margin = new EmptyBorder(-3,
+ 0,
+ DIFFERENT_COMPONENT_SPACE,
+ 0);
+ /*
+ Border margin = new EmptyBorder(0,
+ DIFFERENT_COMPONENT_SPACE-COMPONENT_SPACE,
+ DIFFERENT_COMPONENT_SPACE,
+ DIFFERENT_COMPONENT_SPACE-COMPONENT_SPACE);
+ */
+ return new CompoundBorder(border, margin);
+ }
+
+ //=== LABEL CREATION ====================
+ protected JLabel makeJLabel(Icon i, String s, int a) {
+ JLabel label = new JLabel();
+ if (i != null)
+ label.setIcon(i);
+ if (s != null)
+ label.setText(s);
+ if (a != -1)
+ label.setHorizontalAlignment(a);
+ return label;
+ }
+
+ protected JLabel makeJLabel() {
+ return makeJLabel((Icon)null, null, -1);
+ }
+
+ protected JLabel makeJLabel(String keyword) {
+ return makeJLabel(keyword, (Icon) null, -1);
+ }
+
+ protected JLabel makeJLabel(String keyword, Icon i, int a) {
+ return CMSAdminUtil.makeJLabel(mResource, mPanelName, keyword, i, a);
+ }
+
+ //===== TEXT FIELD CREATION ================
+ protected JTextField makeJTextField(Document d, String s, int len) {
+ return CMSAdminUtil.makeJTextField(d, s,len, this);
+ }
+
+ protected JTextField makeJTextField() {
+ return makeJTextField(null, null, -1);
+ }
+
+ protected JTextField makeJTextField(int len) {
+ return makeJTextField(null, null, len);
+ }
+
+ protected JTextField makeJTextField(String s) {
+ return makeJTextField(null, s, -1);
+ }
+
+ protected JTextField makeJTextField(String s, int len) {
+ return makeJTextField(null, s, len);
+ }
+
+ //==== PASSWORD FIELD CREATION ======================
+ protected JPasswordField makeJPasswordField() {
+ return makeJPasswordField(null, null, -1);
+ }
+
+ protected JPasswordField makeJPasswordField(Document d, String s, int len) {
+ return CMSAdminUtil.makeJPasswordField(d, s,len, this);
+ }
+
+ protected JPasswordField makeJPasswordField(int len) {
+ return makeJPasswordField(null, null, len);
+ }
+
+ protected JPasswordField makeJPasswordField(String s) {
+ return makeJPasswordField(null, s, -1);
+ }
+
+ protected JPasswordField makeJPasswordField(String s, int len) {
+ return makeJPasswordField(null, s, len);
+ }
+
+ //====== BUTTON CREATION ===========================
+ protected JButton makeJButton(Icon i, String s) {
+ JButton button = new JButton();
+ if (s != null)
+ button.setText(s);
+ if (i != null)
+ button.setIcon(i);
+
+ button.addActionListener(this);
+ return button;
+ }
+
+ protected JButton makeJButton() {
+ return makeJButton((Icon)null, null);
+ }
+
+ protected JButton makeJButton(Icon i) {
+ return makeJButton(i, null);
+ }
+
+ protected JButton makeJButton(String keyword) {
+ return makeJButton(keyword, (Icon)null);
+ }
+
+ protected JButton makeJButton(String keyword, ActionListener listener) {
+ return makeJButton(keyword, (Icon)null, listener);
+ }
+
+ protected JButton makeJButton(String keyword, Icon i) {
+ return makeJButton(keyword, i, this);
+ }
+
+ protected JButton makeJButton(String keyword, Icon i, ActionListener listener) {
+ return CMSAdminUtil.makeJButton(mResource, mPanelName, keyword, i, listener);
+ }
+
+ //===== CHECKBOX CREATION ========================
+ protected JCheckBox makeJCheckBox(Icon i, String s, boolean b) {
+ JCheckBox cb = new JCheckBox();
+ if (s != null)
+ cb.setText(s);
+ if (i != null)
+ cb.setIcon(i);
+ cb.setSelected(b);
+ cb.addActionListener(this);
+
+ return cb;
+ }
+
+ protected JCheckBox makeJCheckBox() {
+ return makeJCheckBox((Icon)null, null, false);
+ }
+
+ protected JCheckBox makeJCheckBox(Icon i) {
+ return makeJCheckBox(i, null, false);
+ }
+
+ protected JCheckBox makeJCheckBox(Icon i, boolean b) {
+ return makeJCheckBox(i, null, b);
+ }
+
+ protected JCheckBox makeJCheckBox(String keyword) {
+ return makeJCheckBox(keyword, (Icon)null, false);
+ }
+
+ protected JCheckBox makeJCheckBox(String keyword, boolean b) {
+ return makeJCheckBox(keyword, (Icon)null, b);
+ }
+
+ protected JCheckBox makeJCheckBox(String keyword, Icon i) {
+ return makeJCheckBox(keyword, i, false);
+ }
+
+ protected JCheckBox makeJCheckBox(String keyword, Icon i, boolean val) {
+ return CMSAdminUtil.makeJCheckBox(mResource, mPanelName, keyword, i, val, this);
+ }
+
+ //====== COMBOBOX CREATION ==========================
+ protected JComboBox makeJComboBox(ComboBoxModel cbm) {
+ JComboBox cb = new JComboBox();
+ if (cbm != null)
+ cb.setModel(cbm);
+ cb.addItemListener(this);
+ return cb;
+ }
+
+ protected JComboBox makeJComboBox() {
+ return makeJComboBox((ComboBoxModel)null);
+ }
+
+ protected JComboBox makeJComboBox(String keyword) {
+ String value = null;
+ try {
+ value = mResource.getString(mPanelName+"_COMBOBOX_"+keyword+"_DEFAULT");
+ } catch (MissingResourceException e) {
+ }
+ JComboBox jcb = makeJComboBox((ComboBoxModel)null);
+ String val = null;
+ int ii = 0;
+ do {
+ try {
+ val = mResource.getString(mPanelName+"_COMBOBOX_"+keyword+"_VALUE_"+ii);
+ if (val != null) {
+ jcb.addItem(val);
+ }
+ ++ii;
+ } catch (MissingResourceException e) {
+ val = null;
+ }
+ } while (val != null);
+
+ if (value != null)
+ jcb.setSelectedItem(value);
+ return jcb;
+ }
+
+
+ //==== LIST CREATION ============================
+
+ protected JList makeJList(DefaultListModel listModel, int visibleCount) {
+ return CMSAdminUtil.makeJList(listModel, visibleCount);
+ }
+
+ //===== RADIO BUTTON CREATION =======================
+ protected JRadioButton makeJRadioButton(Icon i, String s, boolean b) {
+ JRadioButton rb = new JRadioButton();
+ if (s != null)
+ rb.setText(s);
+ if (i != null)
+ rb.setIcon(i);
+ rb.setSelected(b);
+ rb.addActionListener(this);
+
+ return rb;
+ }
+
+ protected JRadioButton makeJRadioButton() {
+ return makeJRadioButton((Icon)null, null, false);
+ }
+
+ protected JRadioButton makeJRadioButton(Icon i) {
+ return makeJRadioButton(i, null, false);
+ }
+
+ protected JRadioButton makeJRadioButton(Icon i, boolean b) {
+ return makeJRadioButton(i, null, b);
+ }
+
+ protected JRadioButton makeJRadioButton(String keyword) {
+ return makeJRadioButton(keyword, (Icon)null, false);
+ }
+
+ protected JRadioButton makeJRadioButton(String keyword, boolean b) {
+ return makeJRadioButton(keyword, (Icon)null, b);
+ }
+
+ protected JRadioButton makeJRadioButton(String keyword, Icon i, boolean b) {
+ return CMSAdminUtil.makeJRadioButton(mResource, mPanelName, keyword, i, b, this);
+ }
+
+ /**
+ * Create a panel with horizontally arranged, equally sized buttons
+ * The buttons are aligned to the right in the panel (if it is
+ * stretched beyond the length of the buttons)
+ *
+ * @param buttons An array of buttons for the panel
+ *
+ * @return A panel containing the buttons
+ */
+ public static JPanel makeJButtonPanel( JButton[] buttons ) {
+ return CMSAdminUtil.makeJButtonPanel(buttons);
+ }
+
+ public static JPanel makeJButtonPanel( JButton[] buttons, boolean isHelp) {
+ return CMSAdminUtil.makeJButtonPanel(buttons, isHelp);
+ }
+
+ public static JPanel makeJButtonPanel( JButton[] buttons, boolean isHelp, boolean isConfig) {
+ return CMSAdminUtil.makeJButtonPanel(buttons, isHelp, isConfig);
+ }
+
+ protected void startProgressStatus() {
+ if (mNonWaitCursor == -1) {
+ mCursor = mParent.getCursor();
+ mNonWaitCursor = mCursor.getType();
+ }
+ mCursor = new Cursor(Cursor.WAIT_CURSOR);
+ mParent.setCursor(mCursor);
+ if (mAdminFrame != null)
+ mAdminFrame.setCursor(mCursor);
+ //UtilConsoleGlobals.getActivatedFrame().setCursor(mCursor);
+ }
+
+ protected void endProgressStatus() {
+ if (mNonWaitCursor == -1)
+ mNonWaitCursor = 0;
+ mCursor = new Cursor(mNonWaitCursor);
+ mParent.setCursor(mCursor);
+ if (mAdminFrame != null)
+ mAdminFrame.setCursor(mCursor);
+ //UtilConsoleGlobals.getActivatedFrame().setCursor(mCursor);
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+ private void setToolTip(String compKeyword, JComponent w) {
+ CMSAdminUtil.setToolTip(mResource, mPanelName, compKeyword, w);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/CMSBaseResourceModel.java b/base/console/src/com/netscape/admin/certsrv/CMSBaseResourceModel.java
new file mode 100644
index 000000000..b7ec04e3a
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/CMSBaseResourceModel.java
@@ -0,0 +1,263 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import java.util.*;
+import java.io.*;
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.management.client.console.*;
+import com.netscape.admin.certsrv.config.*;
+import com.netscape.admin.certsrv.menu.*;
+
+/**
+ * Netscape Certificate Server 4.0 BASE resource model.<br>
+ *
+ * This class represtents the tree node objects displayed
+ * in the right tree-view.<p>
+ *
+ * Menu Event are now handled by extenal IMenuInfo object.
+ *
+ * @author Jack Pan-Chen
+ * @author Thomas Kwan
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv
+ */
+public class CMSBaseResourceModel extends ResourceModel {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+
+ private CMSResourcePage mPage; // physical page representation
+ protected ConsoleInfo mConsoleInfo; // console info
+ protected CMSServerInfo mServerInfo; // server info
+ protected IResourceObject[] mSelection; // selected objects
+ protected Vector mSelectionListeners; // listener list
+ protected ResourceBundle mResource; // resource boundle
+ protected Hashtable mNickNameRegistry; // storing the obejct nickname pair
+ protected RefreshTabPane mRefreshPane;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+
+ /**
+ * Constructor - create all panels.
+ *
+ * @param info Global console connection information
+ * @param serverInfo Server instance connection information
+ */
+ public CMSBaseResourceModel( ConsoleInfo info, CMSServerInfo serverInfo ) {
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ mConsoleInfo = info;
+ mServerInfo = serverInfo;
+ mNickNameRegistry = new Hashtable();
+ mSelectionListeners = new Vector();
+ init();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * Set the physical page associated with this model
+ * @param page CMSResourcePage instance
+ */
+ public void setResourcePage(CMSResourcePage page) {
+ mPage = page;
+ }
+
+ public CMSResourcePage getResourcePage() {
+ return mPage;
+ }
+
+ /**
+ * Return the global console information reference.
+ *
+ * @return The global console information reference.
+ **/
+ public ConsoleInfo getConsoleInfo() {
+ return mConsoleInfo;
+ }
+
+ /**
+ * Return the Server information reference.
+ *
+ * @return The server information reference.
+ **/
+ public CMSServerInfo getServerInfo() {
+ return mServerInfo;
+ }
+
+
+ /**
+ * Get Parent Frame
+ * @return frame to be usd in dialogs
+ */
+ public JFrame getFrame() {
+ return UtilConsoleGlobals.getActivatedFrame();
+ }
+
+ /**
+ * Tree Nodes selected call back
+ */
+ public void actionObjectSelected( IPage viewInstance,
+ IResourceObject[] selection,
+ IResourceObject[] previousSelection) {
+
+ //Debug.println("CMSResourceModel: actionObjectSelected()");
+ mSelection = selection;
+ if ( mSelection == null )
+ mSelection = new IResourceObject[0];
+ Vector selected = new Vector();
+ Vector toNotify = new Vector();
+ /* Signal all selected objects, keep track of which ones */
+ for( int i = 0; i < mSelection.length; i++ ) {
+ IResourceObject sel = mSelection[i];
+ Component c = sel.getCustomPanel();
+ if (mRefreshPane != null) {
+ mRefreshPane.select(c);
+ }
+ if ( (c != null) && (mSelectionListeners.indexOf( c ) >= 0) ) {
+ toNotify.addElement( sel );
+ }
+ selected.addElement( c );
+ }
+
+ /* All other listeners must be unselected */
+ boolean canMove = true;
+ if ( previousSelection != null ) {
+ for( int i = 0; i < previousSelection.length; i++ ) {
+ IResourceObject sel = previousSelection[i];
+ Component c = sel.getCustomPanel();
+ if ( (mSelectionListeners.indexOf( c ) >= 0) &&
+ (selected.indexOf( c ) < 0) ) {
+ try {
+ IResourceSelectionListener l =
+ (IResourceSelectionListener)c;
+ if (!l.unselect( sel, viewInstance ))
+ canMove = false;
+ } catch ( Exception e ) {
+ //System.err.println( e );
+ Debug.println( e.toString() );
+ }
+ }
+ }
+ }
+
+ if (!canMove)
+ return;
+
+ for( int i = 0; i < toNotify.size(); i++ ) {
+ IResourceObject sel =
+ (IResourceObject)toNotify.elementAt( i );
+ Component c = sel.getCustomPanel();
+ IResourceSelectionListener l =
+ (IResourceSelectionListener)c;
+ l.select( sel, viewInstance );
+ }
+
+ //change menu
+ super.actionObjectSelected(viewInstance, selection, previousSelection);
+ }
+
+ public void setRefreshCallback(RefreshTabPane pane) {
+ mRefreshPane = pane;
+ }
+
+ /**
+ * Adds a listener that is interested in receiving selection events.
+ * Called by panels
+ */
+ public void addIResourceSelectionListener(IResourceSelectionListener l) {
+ mSelectionListeners.addElement(l);
+ }
+
+ /**
+ * Removes previously added IDSResourceSelectionListener.
+ * Called by panels
+ */
+ public void removeIResourceSelectionListener(IResourceSelectionListener l) {
+ mSelectionListeners.removeElement(l);
+ }
+
+ /**
+ * Returns list of listeners for this model.
+ */
+ public Enumeration getSelectionListeners() {
+ return mSelectionListeners.elements();
+ }
+
+ /**
+ * The SubSystemUILoader should use this function to add
+ * subsystem node into the root node. SubSystemLoader is responsible
+ * for setting up the subtrees.
+ */
+ public void addSubSystemNode(CMSResourceObject node) {
+ ((CMSResourceObject)getRoot()).add(node);
+ }
+
+ /**
+ * Register the nick name of the resource object, so other sub system
+ * can look up and retrieve the corresponding resource object.
+ */
+ public void registerNickName(String nickName, CMSResourceObject node) {
+ mNickNameRegistry.put(nickName, node);
+ }
+
+ /**
+ * Retrieve the resource obejct associated with this nickname
+ */
+ public CMSResourceObject getByNickName(String nickName) {
+ return (CMSResourceObject) mNickNameRegistry.get(nickName);
+ }
+
+ /**
+ * Start the zipping status bar
+ */
+ public void progressStart() {
+ mPage.progressStart();
+ }
+
+ /**
+ * Stop the zipping status bar
+ */
+ public void progressStop() {
+ mPage.progressStop();
+ }
+
+ /*==========================================================
+ * priotected methods
+ *==========================================================*/
+
+ protected void init() {
+ CMSResourceObject root = new CMSResourceObject();
+ root.setName(mResource.getString(CMSAdminResources.CERT_SERVER_NAME)+":" + mServerInfo.getPort());
+ root.setCustomPanel( new CMSBlankPanel(this));
+ root.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_CERTICON_SMALL));
+ root.setAllowsChildren(true);
+ super.setRoot( root );
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/CMSCAUILoader.java b/base/console/src/com/netscape/admin/certsrv/CMSCAUILoader.java
new file mode 100644
index 000000000..f967d28e0
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/CMSCAUILoader.java
@@ -0,0 +1,373 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.admin.certsrv.config.*;
+import com.netscape.admin.certsrv.ug.*;
+import com.netscape.admin.certsrv.menu.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.notification.*;
+import java.util.*;
+
+/**
+ * Netscape Certificate Server 4.0 Certificate Authority UI Loader.
+ *
+ * This class is responsible for the loading of UI components associated with
+ * the ca functionality.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @date 03/30/97
+ */
+public class CMSCAUILoader implements ISubSystemUILoader {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private CMSUIFramework mUIFramework; //parent framework
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSCAUILoader(CMSUIFramework framework) {
+ mUIFramework = framework;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public void register() {
+ //register subsystem UI
+ try {
+
+ //task tab
+ IPage task = mUIFramework.getPage(CMSPageFeeder.TASK_TAB_TYPE,"");
+
+ //config tab
+ CMSResourcePage page = (CMSResourcePage) mUIFramework.getPage(CMSPageFeeder.RESOURCE_TAB_TYPE,"CONFIGURATION");
+ CMSBaseResourceModel model = (CMSBaseResourceModel) page.getModel();
+ model.setResourcePage(page);
+ populateConfigContent(model);
+
+ /*repos tab
+ page = (CMSResourcePage) mUIFramework.getPage(CMSPageFeeder.RESOURCE_TAB_TYPE,"CONTENT");
+ model = (CMSBaseResourceModel) page.getModel();
+ populateRepositoryContent(model);
+ populateRepositoryMenu(page);
+ */
+
+ /*acl tab
+ page = (CMSResourcePage) mUIFramework.getPage(CMSPageFeeder.RESOURCE_TAB_TYPE,"ACCESSCONTROLLIST");
+ model = (CMSBaseResourceModel) page.getModel();
+ populateACLContent(model);
+ */
+
+ }catch(Exception e) {
+ Debug.println("CMSCAUILoader: register() config - "+e.toString());
+ }
+ }
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+ protected void populateConfigContent(CMSBaseResourceModel model) {
+ CMSResourceObject list, node;
+ CMSTabPanel tabPane;
+
+ CMSResourceObject authnode = new CMSResourceObject("AUTH");
+ CMSUGTabPanel tabPane1 = new CMSUGTabPanel(model, authnode);
+ tabPane1.addTab(new AuthInstanceTab(model));
+ tabPane1.addTab(new AuthImplTab(model));
+ authnode.setCustomPanel(tabPane1);
+ authnode.setIcon( CMSAdminUtil.getImage(
+ CMSAdminResources.IMAGE_AUTHOBJECT));
+ authnode.setAllowsChildren(false);
+ model.addSubSystemNode(authnode);
+
+ // jobs scheduler node
+ CMSResourceObject jobsnode = new CMSResourceObject("JOBSCHED");
+ tabPane = new CMSTabPanel(model, jobsnode);
+ tabPane.addTab(new JobsSettingPanel("JOBSGENERAL", tabPane));
+
+ jobsnode.setCustomPanel(tabPane);
+ jobsnode.setIcon( CMSAdminUtil.getImage(
+ CMSAdminResources.IMAGE_JOBSOBJECT));
+
+ jobsnode.setAllowsChildren(true);
+ CMSResourceObject cnode = new CMSResourceObject("JOBS");
+
+ tabPane1 = new CMSUGTabPanel(model, cnode);
+ tabPane1.addTab(new JobsInstanceTab(model));
+ tabPane1.addTab(new JobsImplTab(model));
+ cnode.setCustomPanel(tabPane1);
+ cnode.setIcon( CMSAdminUtil.getImage(
+ CMSAdminResources.IMAGE_JOBSOBJECT));
+ jobsnode.add(cnode);
+ cnode.setAllowsChildren(false);
+ model.addSubSystemNode(jobsnode);
+
+ //ca node
+ list = new CMSResourceObject("CACONFIG");
+ tabPane = new CMSTabPanel(model, list);
+ tabPane.addTab(new CMSCAGeneralPanel(tabPane));
+ //tabPane.addTab(new CMSCRLSettingPanel(tabPane));
+ tabPane.addTab(new CMSCAConnectorPanel(model,tabPane));
+ //tabPane.addTab(new CMSCACLMPanel(tabPane));
+ list.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_FOLDER));
+ list.setAllowsChildren(true);
+ list.setCustomPanel(tabPane);
+
+ //policies sub node
+ //CMSResourceObject node2;
+ node = new CMSResourceObject("POLICIES");
+ CMSUGTabPanel tabPane2 = new CMSUGTabPanel(model, node);
+ tabPane2.addTab(new PolicyInstanceTab(model, DestDef.DEST_CA_POLICY_ADMIN));
+ tabPane2.addTab(new PolicyImplTab(model, DestDef.DEST_CA_POLICY_ADMIN));
+ node.setCustomPanel(tabPane2);
+ node.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULEOBJECT));
+ node.setAllowsChildren(false);
+ //list.add(node);
+
+ // profiles
+ node = new CMSResourceObject("PROFILES");
+ CMSUGTabPanel tabPane3 = new CMSUGTabPanel(model, node);
+ tabPane3.addTab(new ProfileInstanceTab(model, DestDef.DEST_CA_PROFILE_ADMIN));
+ tabPane3.addTab(new ProfileImplTab(model, DestDef.DEST_REGISTRY_ADMIN));
+ node.setCustomPanel(tabPane3);
+ node.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULEOBJECT));
+ node.setAllowsChildren(false);
+ list.add(node);
+
+
+ // notification
+ CMSResourceObject notificationNode = new CMSResourceObject("NOTIFICATION");
+ tabPane = new CMSTabPanel(model, notificationNode);
+ tabPane.addTab(new RequestCompletePanel("NOTIFYREQCOMPLETE",
+ tabPane,
+ DestDef.DEST_CA_ADMIN));
+ tabPane.addTab(new RequestRevokedPanel("NOTIFYREVCOMPLETE",
+ tabPane,
+ DestDef.DEST_CA_ADMIN));
+ tabPane.addTab(new RequestInQPanel("NOTIFYREQINQ", tabPane,
+ DestDef.DEST_CA_ADMIN));
+
+ notificationNode.setCustomPanel(tabPane);
+ notificationNode.setIcon( CMSAdminUtil.getImage(
+ CMSAdminResources.IMAGE_JOBSOBJECT));
+
+ notificationNode.setAllowsChildren(false);
+ list.add(notificationNode);
+
+
+ /* servlet sub node - XXX NOT FOR B1
+ Servlet Instance Tab code is under config/servlet. It has
+ been 'cvs removed'. It needs porting to new UI.
+ CMSResourceObject node3;
+ node3 = new CMSResourceObject("SERVLET");
+ CMSUGTabPanel tabPane3 = new CMSUGTabPanel(model, node3);
+ tabPane3.addTab(new ServletInstanceTab(model,
+ DestDef.DEST_CA_SERVLET_ADMIN));
+ tabPane3.addTab(new ServletImplTab(model,
+ DestDef.DEST_CA_SERVLET_ADMIN));
+ node3.setCustomPanel(tabPane3);
+ node3.setIcon(CMSAdminUtil.getImage(CMSAdminResources.IMAGE_SERVLETOBJECT));
+ node3.setAllowsChildren(false);
+ list.add(node3);
+ */
+
+ /*extensions sub node
+ node = new CMSResourceObject("EXTENSIONS");
+ tabPane = new CMSTabPanel(model, node);
+ tabPane.addTab(new CMSBlankPanel(model,tabPane,"Configuration"));
+ tabPane.addTab(new CMSBlankPanel(model,tabPane,"Registration"));
+ node.setCustomPanel(tabPane);
+ node.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_PLUGIN));
+ node.setAllowsChildren(false);
+ list.add(node);
+ */
+
+ /* crl extensions sub node
+ node = new CMSResourceObject("CRLEXTENSIONS");
+ CMSUGTabPanel crlExtTabPane = new CMSUGTabPanel(model, node);
+ crlExtTabPane.addTab(new CRLExtensionsInstanceTab(model, DestDef.DEST_CA_ADMIN));
+ node.setCustomPanel(crlExtTabPane);
+ node.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULEOBJECT));
+ node.setAllowsChildren(false);
+ list.add(node);
+ */
+
+ // crl issuing points
+ node = new CMSResourceObject("CRLIPS");
+ CMSTabPanel crlIPsTabPane = new CMSTabPanel(model, node);
+ crlIPsTabPane.addTab(new CMSCRLIPPanel(model, crlIPsTabPane));
+ node.setCustomPanel(crlIPsTabPane);
+ node.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULEOBJECT));
+ node.setAllowsChildren(true);
+ list.add(node);
+
+ CMSResourceObject crlsNode = node;
+ AdminConnection ac = model.getServerInfo().getAdmin();
+ NameValuePairs nvps = null;
+ try {
+ nvps = ac.search(DestDef.DEST_CA_ADMIN, ScopeDef.SC_CRLIPS,
+ new NameValuePairs());
+ } catch (EAdminException e) {
+ }
+
+ if (nvps != null && nvps.size() > 0) {
+ for (String name : nvps.keySet()) {
+ if (name.indexOf('.') == -1) {
+ node = new CMSResourceObject();
+ node.setName(name);
+ CMSTabPanel crlIPTabPane = new CMSTabPanel(model, node);
+ crlIPTabPane.addTab(new CMSCRLSettingPanel(crlIPTabPane, name));
+ crlIPTabPane.addTab(new CMSCRLCachePanel(crlIPTabPane, name));
+ crlIPTabPane.addTab(new CMSCRLFormatPanel(crlIPTabPane, name));
+ node.setCustomPanel(crlIPTabPane);
+ node.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULEOBJECT));
+ node.setAllowsChildren(true);
+ crlsNode.add(node);
+
+ CMSResourceObject crlNode = node;
+
+ node = new CMSResourceObject("CRLEXTENSIONS");
+ CMSUGTabPanel crlExtTabPane1 = new CMSUGTabPanel(model, node);
+ crlExtTabPane1.addTab(new CRLExtensionsInstanceTab(model, DestDef.DEST_CA_ADMIN, name));
+ node.setCustomPanel(crlExtTabPane1);
+ node.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULEOBJECT));
+ node.setAllowsChildren(false);
+ crlNode.add(node);
+ }
+ }
+ }
+
+ /*backup restore sub node
+ node = new CMSResourceObject("BACKUP");
+ tabPane = new CMSTabPanel(model, node);
+ tabPane.addTab(new CMSBlankPanel(model,tabPane,"Backup"));
+ tabPane.addTab(new CMSBlankPanel(model,tabPane,"Restore"));
+ node.setCustomPanel(tabPane);
+ node.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_BACKUPFOLDER));
+ node.setAllowsChildren(false);
+ list.add(node);
+ */
+
+ //ldap publishing
+ node = new CMSResourceObject("PUBLISHING");
+ tabPane = new CMSTabPanel(model, node);
+ tabPane.addTab(new CMSCALDAPPanel(tabPane));
+ // tabPane.addTab(new CMSCACertSettingPanel(tabPane));
+ // tabPane.addTab(new CMSUserCertSettingPanel("CAUSERCERTSETTING", tabPane));
+ node.setCustomPanel(tabPane);
+ node.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_LDAPPUB));
+ node.setAllowsChildren(true);
+ list.add(node);
+
+ CMSResourceObject publishingNode = node;
+
+ // allow mappers
+ node = new CMSResourceObject("MAPPERS");
+ CMSUGTabPanel ugtabPane = new CMSUGTabPanel(model, node);
+ ugtabPane.addTab(new MapperInstanceTab(model,
+ DestDef.DEST_CA_PUBLISHER_ADMIN));
+ ugtabPane.addTab(new MapperImplTab(model,
+ DestDef.DEST_CA_PUBLISHER_ADMIN));
+ node.setCustomPanel(ugtabPane);
+ node.setIcon(CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULEOBJECT));
+ node.setAllowsChildren(false);
+ publishingNode.add(node);
+
+ // allow LDAP publisher and mapper plugins
+ node = new CMSResourceObject("PUBLISHERS");
+ ugtabPane = new CMSUGTabPanel(model, node);
+ ugtabPane.addTab(new PublisherInstanceTab(model,
+ DestDef.DEST_CA_PUBLISHER_ADMIN));
+ ugtabPane.addTab(new PublisherImplTab(model,
+ DestDef.DEST_CA_PUBLISHER_ADMIN));
+ node.setCustomPanel(ugtabPane);
+ node.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULEOBJECT));
+ node.setAllowsChildren(false);
+ publishingNode.add(node);
+
+ // allow rules
+ node = new CMSResourceObject("RULES");
+ ugtabPane = new CMSUGTabPanel(model, node);
+ ugtabPane.addTab(new RuleInstanceTab(model,
+ DestDef.DEST_CA_PUBLISHER_ADMIN));
+ // XXX just support one publishing rule type
+ // ugtabPane.addTab(new RuleImplTab(model,
+ // DestDef.DEST_CA_PUBLISHER_ADMIN));
+ node.setCustomPanel(ugtabPane);
+ node.setIcon(CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULEOBJECT));
+ node.setAllowsChildren(false);
+ publishingNode.add(node);
+
+
+ model.addSubSystemNode(list);
+ }
+
+ /*
+ protected void populateRepositoryContent(CMSBaseResourceModel model) {
+ CMSResourceObject list, node;
+
+ //ca repositories node
+ list = new CMSResourceObject("CAREPOSITORIES");
+ list.setCustomPanel(new CMSBlankPanel(model));
+ list.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_DBCONATINER));
+ list.setAllowsChildren(true);
+ node = new CMSResourceObject("CAREQUESTS");
+ node.setCustomPanel(new CertificateRequestPanel(model, node));
+ node.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_DBOBJECT));
+ node.setAllowsChildren(false);
+ list.add(node);
+ node = new CMSResourceObject("CACERTIFICATE");
+ node.setCustomPanel(new CertificateRepositoryPanel(model,node));
+ node.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_DBOBJECT));
+ node.setAllowsChildren(false);
+ list.add(node);
+ model.addSubSystemNode(list);
+ }
+
+ protected void populateRepositoryMenu(CMSResourcePage page) {
+ CMSBaseResourceModel model = (CMSBaseResourceModel) page.getModel();
+ CMSBaseMenuInfo menuInfo = (CMSBaseMenuInfo)page.getMenuInfo();
+ try {
+ menuInfo.registerMenuItem(CMSBaseMenuInfo.MENU_FILE,
+ CMSBaseMenuInfo.MENU_NEWCERT,
+ new CertRequestAction(model.getConsoleInfo(),model.getServerInfo()));
+ } catch(Exception e) {
+ Debug.println("menuinfo register()"+e.toString());
+ }
+ }
+ */
+ protected void populateACLContent(CMSBaseResourceModel model) {
+ /*
+ CMSResourceObject list, node;
+ list = model.getByNickName("ACL");
+ node = new CMSResourceObject("CAACL");
+ node.setCustomPanel(new CMSBlankPanel(model));
+ node.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_DOCUMENT));
+ node.setAllowsChildren(false);
+ list.add(node);
+ */
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/CMSCCMUILoader.java b/base/console/src/com/netscape/admin/certsrv/CMSCCMUILoader.java
new file mode 100644
index 000000000..785514ac2
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/CMSCCMUILoader.java
@@ -0,0 +1,107 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.admin.certsrv.config.*;
+import com.netscape.admin.certsrv.ug.*;
+
+
+/**
+ * Netscape Certificate Server 4.0 CCM UI Loader.
+ *
+ * This class is responsible for the loading of UI components associated with
+ * the ccm functionality.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @date 03/30/97
+ */
+public class CMSCCMUILoader implements ISubSystemUILoader {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private CMSUIFramework mUIFramework; //parent framework
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSCCMUILoader(CMSUIFramework framework) {
+ mUIFramework = framework;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public void register() {
+ //register subsystem UI
+ try {
+
+ //task tab
+ IPage task = mUIFramework.getPage(CMSPageFeeder.TASK_TAB_TYPE,"");
+
+ //config tab
+ CMSResourcePage page = (CMSResourcePage) mUIFramework.getPage(CMSPageFeeder.RESOURCE_TAB_TYPE,"CONFIGURATION");
+ CMSBaseResourceModel model = (CMSBaseResourceModel) page.getModel();
+ populateConfigContent(model);
+
+ /*acl tab
+ page = (CMSResourcePage) mUIFramework.getPage(CMSPageFeeder.RESOURCE_TAB_TYPE,"ACCESSCONTROLLIST");
+ model = (CMSBaseResourceModel) page.getModel();
+ populateACLContent(model);
+ */
+
+ }catch(Exception e) {
+ Debug.println("CMSCCMUILoader: register() config - "+e.toString());
+ }
+
+ }
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+ protected void populateConfigContent(CMSBaseResourceModel model) {
+ CMSResourceObject node;
+ CMSTabPanel tabPane;
+
+ //ccm node
+ node = new CMSResourceObject("CCMCONFIG");
+ tabPane = new CMSTabPanel(model, node);
+ tabPane.addTab(new CMSBlankPanel(model,tabPane,"Service Ports"));
+ tabPane.addTab(new CMSBlankPanel(model,tabPane,"Password Distribution"));
+ node.setCustomPanel(tabPane);
+ node.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_FOLDER));
+ node.setAllowsChildren(true);
+
+ model.addSubSystemNode(node);
+ }
+
+ /*
+ protected void populateACLContent(CMSBaseResourceModel model) {
+ CMSResourceObject list, node;
+ list = model.getByNickName("ACL");
+ node = new CMSResourceObject("CCMACL");
+ node.setCustomPanel(new CMSBlankPanel(model));
+ node.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_DOCUMENT));
+ node.setAllowsChildren(false);
+ list.add(node);
+ }
+ */
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/CMSContentTableModel.java b/base/console/src/com/netscape/admin/certsrv/CMSContentTableModel.java
new file mode 100644
index 000000000..15bc29665
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/CMSContentTableModel.java
@@ -0,0 +1,100 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import java.util.*;
+import javax.swing.table.*;
+import com.netscape.management.client.util.*;
+import com.netscape.management.client.logging.*;
+
+/**
+ * Generic base class for the JTable data container that will
+ * CACHE the data object retrieved.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv
+ * @see javax.swing.table.AbstractTableModel
+ */
+public class CMSContentTableModel extends CMSTableModel {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ protected Vector mObjectContainer = new Vector(); // object container
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSContentTableModel() {
+ super();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * Returns the number of rows in the table
+ * @return number of rows
+ */
+ public int getRowCount() {
+ return mObjectContainer.size();
+ }
+
+ /**
+ * Add data row and data object associated with this row
+ * @param values row values for the table
+ * @param obj data object
+ */
+ public void addRow(Vector values, Object obj) {
+ super.addRow(values);
+ mObjectContainer.addElement(obj);
+ }
+
+ /**
+ * Remove row at the specified index position
+ * @param index row index to be removed
+ */
+ public void removeRow(int index)
+ throws ArrayIndexOutOfBoundsException
+ {
+ Debug.println("CMSContentDataModel: removeRow() - start");
+ mObjectContainer.removeElementAt(index);
+ super.removeRow(index);
+ Debug.println("CMSContentDataModel: removeRow() - end");
+ }
+
+ /**
+ * clean up the table including the datat objects
+ */
+ public void removeAllRows() {
+ super.removeAllRows();
+ mObjectContainer.removeAllElements();
+ }
+
+ /**
+ * retrieve data object associated with specified row
+ * @param row table row number
+ * @return data object
+ */
+ public Object getObjectValueAt(int row) {
+ return mObjectContainer.elementAt(row);
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/CMSEAUILoader.java b/base/console/src/com/netscape/admin/certsrv/CMSEAUILoader.java
new file mode 100644
index 000000000..9c3ae6e01
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/CMSEAUILoader.java
@@ -0,0 +1,136 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.admin.certsrv.config.*;
+import com.netscape.admin.certsrv.ug.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.notification.*;
+
+/**
+ * Netscape Certificate Server 4.0 Escrow Authority UI Loader.
+ *
+ * This class is responsible for the loading of UI components associated with
+ * the ea functionality.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @date 03/30/97
+ */
+public class CMSEAUILoader implements ISubSystemUILoader {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private CMSUIFramework mUIFramework; //parent framework
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSEAUILoader(CMSUIFramework framework) {
+ mUIFramework = framework;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public void register() {
+ //register subsystem UI
+ try {
+
+ //task tab
+ IPage task = mUIFramework.getPage(CMSPageFeeder.TASK_TAB_TYPE,"");
+
+ //config tab
+ CMSResourcePage page = (CMSResourcePage) mUIFramework.getPage(CMSPageFeeder.RESOURCE_TAB_TYPE,"CONFIGURATION");
+ CMSBaseResourceModel model = (CMSBaseResourceModel) page.getModel();
+ populateConfigContent(model);
+
+ /*repos tab
+ page = (CMSResourcePage) mUIFramework.getPage(CMSPageFeeder.RESOURCE_TAB_TYPE,"CONTENT");
+ model = (CMSBaseResourceModel) page.getModel();
+ populateRepositoryContent(model);
+ */
+
+ /*acl tab
+ page = (CMSResourcePage) mUIFramework.getPage(CMSPageFeeder.RESOURCE_TAB_TYPE,"ACCESSCONTROLLIST");
+ model = (CMSBaseResourceModel) page.getModel();
+ populateACLContent(model);
+ */
+
+ }catch(Exception e) {
+ Debug.println("CMSEAUILoader: register() config - "+e.toString());
+ }
+
+ }
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+ protected void populateConfigContent(CMSBaseResourceModel model) {
+ CMSResourceObject list, node;
+ CMSTabPanel tabPane;
+
+ //ca node
+ list = new CMSResourceObject("EACONFIG");
+ tabPane = new CMSTabPanel(model, list);
+ tabPane.addTab(new CMSEAGeneralPanel(tabPane));
+ list.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_FOLDER));
+ list.setAllowsChildren(false);
+ list.setCustomPanel(tabPane);
+
+ model.addSubSystemNode(list);
+ }
+
+ /*
+ protected void populateRepositoryContent(CMSBaseResourceModel model) {
+ CMSResourceObject list, node;
+
+ //ca repositories node
+ list = new CMSResourceObject("EAREPOSITORIES");
+ list.setCustomPanel(new CMSBlankPanel(model));
+ list.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_DBCONATINER));
+ list.setAllowsChildren(true);
+ node = new CMSResourceObject("EAREQUESTS");
+ node.setCustomPanel(new KeyRequestPanel(model, node));
+ node.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_DBOBJECT));
+ node.setAllowsChildren(false);
+ list.add(node);
+ node = new CMSResourceObject("EAKEY");
+ node.setCustomPanel(new KeyRepositoryPanel(model, node));
+ node.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_DBOBJECT));
+ node.setAllowsChildren(false);
+ list.add(node);
+ model.addSubSystemNode(list);
+ }
+ */
+ /*
+ protected void populateACLContent(CMSBaseResourceModel model) {
+ CMSResourceObject list, node;
+ list = model.getByNickName("ACL");
+ node = new CMSResourceObject("EAACL");
+ node.setCustomPanel(new CMSBlankPanel(model));
+ node.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_DOCUMENT));
+ node.setAllowsChildren(false);
+ list.add(node);
+ }
+ */
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/CMSKernelUILoader.java b/base/console/src/com/netscape/admin/certsrv/CMSKernelUILoader.java
new file mode 100644
index 000000000..cb232c527
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/CMSKernelUILoader.java
@@ -0,0 +1,319 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.management.client.console.*;
+import com.netscape.admin.certsrv.security.*;
+import com.netscape.admin.certsrv.menu.*;
+import com.netscape.admin.certsrv.config.*;
+import com.netscape.admin.certsrv.ug.*;
+import com.netscape.admin.certsrv.status.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.CMSUIFramework;
+import java.util.*;
+import javax.swing.*;
+
+/**
+ * Netscape Certificate Server Kernel UI Loader.
+ *
+ * This class registers tabs (tasks,configuraiton,status)
+ * into the UI framework.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @date 03/30/97
+ */
+public class CMSKernelUILoader implements ISubSystemUILoader {
+
+ protected static final int ERROR_MESSAGE = JOptionPane.ERROR_MESSAGE;
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private CMSUIFramework mUIFramework; //parent framework
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSKernelUILoader(CMSUIFramework framework) {
+ mUIFramework = framework;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public void register() {
+
+ //register subsystem UI
+ try {
+ //task tab - this holds icons such as start server, stop server, etc
+ IPage task = mUIFramework.getPage(CMSPageFeeder.TASK_TAB_TYPE,"");
+ }catch(Exception e) {
+ Debug.println("CMSKernelUILoader: register() config tab - "+e.toString());
+ }
+ CMSResourcePage page;
+ CMSBaseResourceModel model;
+
+ try {
+ //configuration tab - (holds main UI tree)
+ page = (CMSResourcePage) mUIFramework.getPage(CMSPageFeeder.RESOURCE_TAB_TYPE,"CONFIGURATION");
+ model = (CMSBaseResourceModel) page.getModel();
+ populateConfigContent(model);
+ populateConfigMenu(page);
+
+ } catch(Exception e) {
+ Debug.println("CMSKernelUILoader: register() config tab - "+e.toString());
+ }
+
+ try {
+ //status tab - allows user to view CMS log files
+ page = (CMSResourcePage) mUIFramework.getPage(CMSPageFeeder.RESOURCE_TAB_TYPE,"STATUS");
+ populateStatusContent(page);
+ populateStatusMenu(page);
+ } catch(Exception e) {
+ Debug.println("CMSKernelUILoader: register() status - "+e.toString());
+ }
+ }
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+
+ /**
+ * This method creates the configuration tree
+ */
+
+ protected void populateConfigContent(CMSBaseResourceModel model) {
+
+ CMSResourceObject root = (CMSResourceObject) model.getRoot();
+ CMSTabPanel tabPane = new CMSTabPanel(model, root);
+ tabPane.addTab(new CMSLDAPSettingPanel(tabPane));
+ tabPane.addTab(new CMSSMTPPanel(tabPane));
+ tabPane.addTab(new CMSSelfTestsPanel(tabPane));
+
+ // The log panel would only really be useful if we were able to
+ // enable or disable debug without restarting. If we can do this,
+ // then we can enable this tab.
+ //
+ // tabPane.addTab(new GeneralLogPanel(tabPane));
+
+ root.setCustomPanel(tabPane);
+
+
+ CMSResourceObject usernode = new CMSResourceObject("USERGROUPS");
+ CMSUGTabPanel tabPane1 = new CMSUGTabPanel(model, usernode);
+ tabPane1.addTab(new UserTab(model));
+ tabPane1.addTab(new GroupTab(model));
+ usernode.setCustomPanel(tabPane1);
+ usernode.setAllowsChildren(false);
+ usernode.setIcon(CMSAdminUtil.getImage(CMSAdminResources.IMAGE_UGOBJECT));
+ model.addSubSystemNode(usernode);
+
+// This ACL configuration may be revived in a future version
+ CMSResourceObject aclnode = new CMSResourceObject("ACL");
+ CMSUGTabPanel aclTabPane = new CMSUGTabPanel(model, aclnode);
+ aclTabPane.addTab(new ACLPanel(aclTabPane));
+ aclTabPane.addTab(new ACLImplTab(aclTabPane));
+ aclnode.setCustomPanel(aclTabPane);
+ aclnode.setIcon(CMSAdminUtil.getImage(
+ CMSAdminResources.IMAGE_ACLOBJECT));
+ aclnode.setAllowsChildren(false);
+ model.addSubSystemNode(aclnode);
+
+ // Authentication subsystem
+/*
+ CMSResourceObject authnode = new CMSResourceObject("AUTH");
+ tabPane1 = new CMSUGTabPanel(model, authnode);
+ tabPane1.addTab(new AuthInstanceTab(model));
+ tabPane1.addTab(new AuthImplTab(model));
+ authnode.setCustomPanel(tabPane1);
+ authnode.setIcon( CMSAdminUtil.getImage(
+ CMSAdminResources.IMAGE_AUTHOBJECT));
+ authnode.setAllowsChildren(false);
+ model.addSubSystemNode(authnode);
+
+ // jobs scheduler node
+ CMSResourceObject jobsnode = new CMSResourceObject("JOBSCHED");
+ tabPane = new CMSTabPanel(model, jobsnode);
+ tabPane.addTab(new JobsSettingPanel("JOBSGENERAL", tabPane));
+
+ jobsnode.setCustomPanel(tabPane);
+ jobsnode.setIcon( CMSAdminUtil.getImage(
+ CMSAdminResources.IMAGE_JOBSOBJECT));
+
+ jobsnode.setAllowsChildren(true);
+ CMSResourceObject cnode = new CMSResourceObject("JOBS");
+
+ tabPane1 = new CMSUGTabPanel(model, cnode);
+ tabPane1.addTab(new JobsInstanceTab(model));
+ tabPane1.addTab(new JobsImplTab(model));
+ cnode.setCustomPanel(tabPane1);
+ cnode.setIcon( CMSAdminUtil.getImage(
+ CMSAdminResources.IMAGE_JOBSOBJECT));
+ jobsnode.add(cnode);
+ cnode.setAllowsChildren(false);
+ model.addSubSystemNode(jobsnode);
+*/
+
+ // log config node
+ CMSResourceObject node = new CMSResourceObject("LOG");
+
+ CMSUGTabPanel tabPane2 = new CMSUGTabPanel(model, node);
+ tabPane2.addTab(new LogInstanceTab(model, DestDef.DEST_LOG_ADMIN));
+ tabPane2.addTab(new LogImplTab(model, DestDef.DEST_LOG_ADMIN));
+ node.setCustomPanel(tabPane2);
+ node.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_LOGOBJ));
+ node.setAllowsChildren(false);
+ model.addSubSystemNode(node);
+
+ // encryption config node
+ CMSResourceObject encryptionnode = new CMSResourceObject("ENCRYPTION");
+ CMSUGTabPanel tabPane3 = new CMSUGTabPanel(model, encryptionnode);
+ tabPane3.addTab(new CACertsTab(model, DestDef.DEST_SERVER_ADMIN));
+ tabPane3.addTab(new UserCertsTab(model, DestDef.DEST_SERVER_ADMIN));
+ NameValuePairs response;
+/*
+ try
+ {
+ AdminConnection connection = model.getServerInfo().getAdmin();
+
+ response = connection.search(DestDef.DEST_SERVER_ADMIN,
+ ScopeDef.SC_SUBSYSTEM, new NameValuePairs());
+ Debug.println(response.toString());
+ String tempString = response.toString();
+ if(tempString.length()==0) // tempString should equals tks=tks in CMSAdminServlet::readSubsystem
+ tabPane3.addTab(new TKSKeysTab(model, DestDef.DEST_SERVER_ADMIN));
+ }catch (Exception e) {
+ Debug.println("bad admin servlet connection ");
+ }
+*/
+
+ encryptionnode.setCustomPanel(tabPane3);
+ encryptionnode.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_AUTHOBJECT));
+ encryptionnode.setAllowsChildren(false);
+ model.addSubSystemNode(encryptionnode);
+ }
+
+
+ /**
+ * Modifies the window menu (File, Edit, View, etc) to add some
+ * things which are specific to CMS configuration
+ */
+ protected void populateConfigMenu(CMSResourcePage page) {
+ CMSBaseResourceModel model = (CMSBaseResourceModel) page.getModel();
+ CMSBaseMenuInfo menuInfo = (CMSBaseMenuInfo)page.getMenuInfo();
+ try {
+ //menuInfo.registerMenuItem(CMSBaseMenuInfo.MENU_FILE,
+ // CMSBaseMenuInfo.MENU_PKCS11,
+ // new PKCS11ManagementAction(model.getConsoleInfo()));
+ // reference Bug 613851 Manage PKCS#11 shows a blank window.
+ menuInfo.addMenuItemSeparator(CMSBaseMenuInfo.MENU_FILE);
+ menuInfo.addMenuItemSeparator(CMSBaseMenuInfo.MENU_VIEW);
+ menuInfo.registerMenuItem(CMSBaseMenuInfo.MENU_VIEW,
+ CMSBaseMenuInfo.MENU_REFRESH,
+ new RefreshTabPane(model));
+ } catch(Exception e) {
+ Debug.println("menuinfo register()"+e.toString());
+ }
+ }
+
+
+ /**
+ * creates the tree view seen in the left panel when the user selects
+ * the status tab. This typically looks like this:
+ * 1 Netscape Certificate Management System
+ * 2 + Log
+ * 3 System
+ * 4 Transactions
+ * [ this method creates 1,2. The updateLogInstance() method creates 3,4 ]
+ */
+
+ protected void populateStatusContent(CMSResourcePage page) {
+ CMSBaseResourceModel model = (CMSBaseResourceModel) page.getModel();
+ CMSResourceObject root = (CMSResourceObject) model.getRoot();
+
+ //set general stat panel
+ root.setCustomPanel(new StatusPanel(model));
+
+ CMSResourceObject list, node;
+ CMSTabPanel tabPane;
+
+ //log content
+ list = new CMSResourceObject("LOG");
+ list.setCustomPanel(new CMSBlankPanel(model));
+ list.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_LOGFOLDER));
+ list.setAllowsChildren(true);
+
+ // get the log instance name list
+ updateLogInstance(page, list);
+
+ model.addSubSystemNode(list);
+ }
+
+ protected void populateStatusMenu(CMSResourcePage page) {
+ CMSBaseResourceModel model = (CMSBaseResourceModel) page.getModel();
+ CMSBaseMenuInfo menuInfo = (CMSBaseMenuInfo)page.getMenuInfo();
+ try {
+ menuInfo.addMenuItemSeparator(CMSBaseMenuInfo.MENU_VIEW);
+ menuInfo.registerMenuItem(CMSBaseMenuInfo.MENU_VIEW,
+ CMSBaseMenuInfo.MENU_REFRESH,
+ new RefreshTabPane(model));
+ } catch(Exception e) {
+ Debug.println("menuinfo register()"+e.toString());
+ }
+ }
+
+ /**
+ * retrieve log instance listing from the server
+ * side and populate the index
+ */
+ protected void updateLogInstance(CMSResourcePage page, CMSResourceObject list) {
+ CMSBaseResourceModel model = (CMSBaseResourceModel) page.getModel();
+ AdminConnection connection = model.getServerInfo().getAdmin();
+
+ //get the list of log instances from the server
+ NameValuePairs response;
+ model.progressStart();
+ try {
+ response = connection.search(DestDef.DEST_LOG_ADMIN,
+ ScopeDef.SC_LOG_INSTANCES,
+ new NameValuePairs());
+ } catch (EAdminException e) {
+ //display error dialog
+ CMSAdminUtil.showErrorDialog(model.getFrame(),
+ ResourceBundle.getBundle(
+ CMSAdminResources.class.getName()
+ ), e.getMessage(), ERROR_MESSAGE);
+ model.progressStop();
+ return;
+ }
+
+ //update the index
+ for (String entry : response.keySet()) {
+ CMSResourceObject node = new CMSResourceObject(entry);
+ node.setCustomPanel(new LogInstancePanel(entry, model));
+ node.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_LOGOBJECT));
+ node.setAllowsChildren(false);
+ list.add(node);
+ }
+ model.progressStop();
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/CMSMessageBox.java b/base/console/src/com/netscape/admin/certsrv/CMSMessageBox.java
new file mode 100644
index 000000000..2eef61cb2
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/CMSMessageBox.java
@@ -0,0 +1,124 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import java.util.*;
+import java.awt.*;
+import javax.swing.*;
+
+/*
+ A basic implementation of the JDialog class.
+*/
+
+public class CMSMessageBox extends JDialog
+{
+ private Label message;
+ protected ResourceBundle mResource;
+
+ public CMSMessageBox(JFrame parent, String title, String messageString, int width) {
+ super(parent, title, false);
+ setSize( width, 100 );
+ setResizable( false );
+ setLocationRelativeTo(parent);
+
+ message = new Label( messageString, Label.CENTER );
+ getContentPane().add( message, BorderLayout.CENTER );
+ setVisible(true);
+ }
+
+ public CMSMessageBox(JFrame parent, String panelName, String keyword) {
+ super(parent, "Status", false);
+ int width = 300;
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ String messageString = mResource.getString(panelName+"_DIALOG_PROGRESS_"+keyword);
+
+ setSize( width, 100 );
+ setResizable( false );
+ setLocationRelativeTo(parent);
+
+ message = new Label( messageString, Label.CENTER );
+ getContentPane().add( message, BorderLayout.CENTER );
+ setVisible(true);
+ }
+
+ public CMSMessageBox(Frame parent)
+ {
+ super(parent);
+
+ // This code is automatically generated by Visual Cafe when you add
+ // components to the visual environment. It instantiates and initializes
+ // the components. To modify the code, only use code syntax that matches
+ // what Visual Cafe can generate, or Visual Cafe may be unable to back
+ // parse your Java file into its visual environment.
+ //{{INIT_CONTROLS
+ getContentPane().setLayout(null);
+ setSize(405,305);
+ setVisible(false);
+ label1.setText("text");
+ getContentPane().add(label1);
+ label1.setBounds(96,96,206,52);
+ //}}
+ }
+
+ public CMSMessageBox()
+ {
+ this((Frame)null);
+ }
+
+ public CMSMessageBox(String sTitle)
+ {
+ this();
+ setTitle(sTitle);
+ }
+
+ public void setVisible(boolean b)
+ {
+ super.setVisible(b);
+ }
+
+ static public void main(String args[])
+ {
+ (new CMSMessageBox()).setVisible(true);
+ }
+
+ public void addNotify()
+ {
+ // Record the size of the window prior to calling parents addNotify.
+ Dimension size = getSize();
+
+ super.addNotify();
+
+ if (frameSizeAdjusted)
+ return;
+ frameSizeAdjusted = true;
+
+ // Adjust size of frame according to the insets
+ Insets insets = getInsets();
+ setSize(insets.left + insets.right + size.width, insets.top + insets.bottom + size.height);
+ }
+
+ // Used by addNotify
+ boolean frameSizeAdjusted = false;
+
+ //{{DECLARE_CONTROLS
+ java.awt.Label label1 = new java.awt.Label();
+ //}}
+
+}
+
+
diff --git a/base/console/src/com/netscape/admin/certsrv/CMSOCSPUILoader.java b/base/console/src/com/netscape/admin/certsrv/CMSOCSPUILoader.java
new file mode 100644
index 000000000..3c8d5dba0
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/CMSOCSPUILoader.java
@@ -0,0 +1,100 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.admin.certsrv.config.*;
+import com.netscape.admin.certsrv.ug.*;
+import com.netscape.admin.certsrv.menu.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.notification.*;
+
+/**
+ * Netscape Certificate Server 4.0 Certificate Authority UI Loader.
+ *
+ * This class is responsible for the loading of UI components associated with
+ * the ca functionality.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @date 03/30/97
+ */
+public class CMSOCSPUILoader implements ISubSystemUILoader {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private CMSUIFramework mUIFramework; //parent framework
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSOCSPUILoader(CMSUIFramework framework) {
+ mUIFramework = framework;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public void register() {
+ //register subsystem UI
+ try {
+
+ //task tab
+ IPage task = mUIFramework.getPage(CMSPageFeeder.TASK_TAB_TYPE,"");
+
+ //config tab
+ CMSResourcePage page = (CMSResourcePage) mUIFramework.getPage(CMSPageFeeder.RESOURCE_TAB_TYPE,"CONFIGURATION");
+ CMSBaseResourceModel model = (CMSBaseResourceModel) page.getModel();
+ populateConfigContent(model);
+
+ }catch(Exception e) {
+ Debug.println("CMSCAUILoader: register() config - "+e.toString());
+ }
+ }
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+ protected void populateConfigContent(CMSBaseResourceModel model) {
+ CMSResourceObject list, node;
+ CMSTabPanel tabPane;
+
+ //ca node
+ list = new CMSResourceObject("OCSPCONFIG");
+ tabPane = new CMSTabPanel(model, list);
+ tabPane.addTab(new CMSOCSPGeneralPanel(tabPane));
+ list.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_FOLDER));
+ list.setAllowsChildren(true);
+ list.setCustomPanel(tabPane);
+
+ // crl extensions sub node
+ node = new CMSResourceObject("OCSPSTORES");
+ CMSUGTabPanel storeTabPane = new CMSUGTabPanel(model, node);
+ storeTabPane.addTab(new OCSPStoresInstanceTab(model, DestDef.DEST_OCSP_ADMIN));
+ node.setCustomPanel(storeTabPane);
+ node.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULEOBJECT))
+;
+ node.setAllowsChildren(false);
+ list.add(node);
+
+ model.addSubSystemNode(list);
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/CMSPageFeeder.java b/base/console/src/com/netscape/admin/certsrv/CMSPageFeeder.java
new file mode 100644
index 000000000..0abd28f29
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/CMSPageFeeder.java
@@ -0,0 +1,150 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import java.util.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.console.*;
+import com.netscape.management.client.topology.*;
+import com.netscape.management.client.util.*;
+import com.netscape.admin.certsrv.config.*;
+import netscape.ldap.*;
+
+/**
+ * Netscape Certificate Server 4.0 page model.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public class CMSPageFeeder extends FrameworkInitializer {
+//public class CMSPageFeeder extends PageFeeder {
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ public static String RESOURCE_TAB_TYPE = "RESOURCE_TAB_TYPE";
+ public static String TASK_TAB_TYPE = "TASK_TAB_TYPE";
+
+ private static String PREFIX = "CMSPAGEFEEDER_";
+
+ private ConsoleInfo mConsoleInfo; // global information
+ private CMSServerInfo mServerInfo; // instance information
+
+ //private TaskPage mTaskPage; // task page
+ private Hashtable mPages; // resource pages
+ //private ResourcePage mResourcePage; // resource page
+ //private ResourcePage mContentPage; // content page
+ //private ResourcePage mUGPage; // identity and roles page
+
+ private ResourceBundle mResource; // resource boundle
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+
+ /**
+ * Constructor.
+ *
+ * @param admin The server instance.
+ * @param info Global console connection information
+ * @param serverInfo Server instance connection information
+ */
+ public CMSPageFeeder( ConsoleInfo info, CMSServerInfo serverInfo ) {
+ mConsoleInfo = info;
+ mServerInfo = serverInfo;
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ mPages = new Hashtable();
+
+ setFrameTitle(mResource.getString(PREFIX+"SERVERNAME"));
+ setMinimizedImage(CMSAdminUtil.getImage(CMSAdminResources.IMAGE_CERTICON_MEDIUM).getImage());
+ setBannerImage(CMSAdminUtil.getThemeImage(CMSAdminResources.IMAGE_BRANDING).getImage());
+ setBannerText("");
+ //setFrameImage(CMSAdminUtil.getImage(CMSAdminResources.IMAGE_CERTICON_SMALL).getImage());
+ }
+
+ /**
+ * Retrieve the tab page as needed. If the tab page type not found
+ * throws exceptions. If the tab page with the specified name already
+ * exist, simply return that page.
+ */
+ public IPage getPage(String type, String name) throws EAdminException {
+ //Debug.println("CMSPageFeeder: getPage() -"+type+"-"+name);
+ if (type.trim().equals(TASK_TAB_TYPE)) {
+ return null;
+/*
+ //XXX Support multiple task tab ???
+ if (mPages.containsKey("TASK"))
+ return (IPage) mPages.get("TASK");
+ TaskPage task = createTaskPage();
+
+ // TAKE THIS ONE OUT FOR BETA-1
+ mPages.put("TASK", task);
+ addPage(task);
+ return task;
+*/
+ }
+
+ if (!type.trim().equals(RESOURCE_TAB_TYPE)) {
+ throw new EAdminException(mResource.getString(PREFIX+"RESOURCE_TAB_NOT_FOUND"), true);
+ }
+
+ if (mPages.containsKey(name.trim())) {
+ return (IPage) mPages.get(name.trim());
+ } else {
+ CMSResourcePage page = new CMSResourcePage(new CMSBaseResourceModel(mConsoleInfo,mServerInfo));
+ String title;
+ try {
+ title = mResource.getString(PREFIX+name.trim());
+ } catch (MissingResourceException e) {
+ title = "Missing Title";
+ }
+ page.setPageTitle(title);
+ mPages.put(name.trim(), page);
+ addPage(page);
+ return page;
+ }
+ }
+
+
+ /**
+ * Expend resource trees insde each individual pages
+ */
+ public void expendPages() {
+ for (Enumeration e = mPages.keys() ; e.hasMoreElements() ;) {
+ String name = (String)e.nextElement();
+ IPage page = (IPage)mPages.get(name);
+ if (page instanceof CMSResourcePage)
+ ((CMSResourcePage)page).getTree().expandRow(0);
+ }
+ }
+
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+
+ /**
+ * Create the directory server task tab page by finding all task
+ * entries in the directory for this instance.
+ */
+ private TaskPage createTaskPage() {
+ TaskModel model = new CMSTaskModel(mConsoleInfo, mServerInfo);
+ return new TaskPage( model );
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/CMSPassword.java b/base/console/src/com/netscape/admin/certsrv/CMSPassword.java
new file mode 100644
index 000000000..4fbca9011
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/CMSPassword.java
@@ -0,0 +1,301 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import java.awt.*;
+import java.util.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import javax.swing.border.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.connection.*;
+
+/**
+ * Display this dialog to get a password.
+ *
+ * @author chrisho
+ * @version $Revision$, $Date$
+ * @date 07/21/98
+ */
+
+public class CMSPassword extends JDialog
+ implements ActionListener, DocumentListener, MouseListener
+{
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final int WIDTH = 300;
+ private static final int HEIGHT = 150;
+ private static final String HELPINDEX =
+ "authentication-certsrv-auth-dialog-help";
+
+ private JTextField mUsernameField; // username textfield
+ private JPasswordField mPasswordField; // password field
+ private boolean mCanceled = true; // exit state of the dialog
+ private String mUsername; // username
+ private String mPassword; // password
+ private static final String PREFIX = "CMSPASSWORD";
+ private JFrame mParentFrame;
+ private ResourceBundle mResource;
+ private JButton mOK, mCancel, mHelp;
+ private KeyListener mTextFieldKeyListener;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+
+ /**
+ * @param parent parent frame
+ */
+ public CMSPassword(JFrame parent) {
+ super(parent, true);
+ mParentFrame = parent;
+ mResource =
+ ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ mTextFieldKeyListener = new TextFieldKeyListener();
+ setTitle(mResource.getString(PREFIX+"_TITLE"));
+ setLocationRelativeTo(parent);
+
+ JPanel center = new JPanel();
+ getContentPane().setLayout(new BorderLayout());
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ center.setLayout(gb);
+
+ JPanel contentPanel = new JPanel();
+ GridBagLayout gb1 = new GridBagLayout();
+ contentPanel.setLayout(gb1);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(contentPanel, gbc);
+ center.add(contentPanel);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel lUsername =
+ new JLabel(mResource.getString(PREFIX+"_LABEL_UID_LABEL"));
+ lUsername.setToolTipText(
+ mResource.getString(PREFIX+"_LABEL_UID_TTIP"));
+
+ mUsernameField = new JTextField();
+ mUsernameField.addKeyListener(mTextFieldKeyListener);
+ mUsernameField.getDocument().addDocumentListener(this);
+ mUsernameField.addMouseListener(this);
+
+ CMSAdminUtil.addEntryField(contentPanel, lUsername, mUsernameField,
+ gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel lPassword=
+ new JLabel(mResource.getString(PREFIX+"_LABEL_PWD_LABEL"));
+ lPassword.setToolTipText(
+ mResource.getString(PREFIX+"_LABEL_PWD_TTIP"));
+ mPasswordField = new JPasswordField();
+ mPasswordField.addKeyListener(mTextFieldKeyListener);
+ mPasswordField.getDocument().addDocumentListener(this);
+ mPasswordField.addMouseListener(this);
+ CMSAdminUtil.addEntryField(contentPanel, lPassword, mPasswordField,
+ gbc);
+
+ JPanel actionPanel = makeActionPane();
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints(actionPanel, gbc);
+ center.add(actionPanel);
+
+ getContentPane().add("Center",center);
+
+ mCanceled=false;
+ mUsername="";
+ mPassword="";
+
+ setSize( WIDTH, HEIGHT );
+
+ addWindowListener(
+ new WindowAdapter() {
+ public void windowClosing(WindowEvent e) {
+ //setVisible(false);
+ dispose();
+ mCanceled = true;
+ }
+ }
+ );
+
+ addWindowListener(
+ new WindowAdapter() {
+ public void windowOpened(WindowEvent e) {
+ mUsernameField.requestFocus();
+ }
+ }
+ );
+
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * return the exit status of the dialog
+ *
+ * @return true if the user hits the cancel button.
+ */
+ public boolean isCancel() {
+ return mCanceled;
+ }
+
+ /**
+ * Returns the username typed in by the user, on OK.
+ *
+ * @return The selected username, if the user hits the OK button.
+ */
+ public String getUsername() {
+ return mUsername;
+ }
+
+ /**
+ * Return the password typed in by the user, on OK.
+ *
+ * @return The selected password, if the user hits the OK button.
+ */
+ public String getPassword() {
+ return mPassword;
+ }
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+ public void actionPerformed(ActionEvent evt) {
+ if (evt.getSource().equals(mOK)) {
+ mUsername = mUsernameField.getText().trim();
+ mPassword = mPasswordField.getText().trim();
+
+ /* USE PROACTIVE VERIFICATION
+ if (userid.equals("") || newpassword.equals("")) {
+ CMSAdminUtil.showMessageDialog(mParentFrame, mResource,
+ PREFIX, "EMPTYFIELD", CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ */
+
+ mCanceled = false;
+ //setVisible(false);
+ this.dispose();
+ return;
+
+ }
+ if (evt.getSource().equals(mCancel)) {
+ //setVisible(false);
+ mCanceled = true;
+ this.dispose();
+ return;
+ }
+ if (evt.getSource().equals(mHelp)) {
+ CMSAdminUtil.help(HELPINDEX);
+ return;
+ }
+ }
+
+ //== DocumentListener ==
+ public void insertUpdate(DocumentEvent e) {
+ setButtons();
+ }
+
+ public void removeUpdate(DocumentEvent e){
+ setButtons();
+ }
+
+ public void changedUpdate(DocumentEvent e){
+ setButtons();
+ }
+
+ //==== MOUSELISTENER ======================
+ public void mouseClicked(MouseEvent e) {
+ setButtons();
+ }
+
+ public void mousePressed(MouseEvent e) {}
+ public void mouseReleased(MouseEvent e) {}
+ public void mouseEntered(MouseEvent e) {}
+ public void mouseExited(MouseEvent e) {
+ setButtons();
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+
+ private JPanel makeActionPane() {
+ mOK = CMSAdminUtil.makeJButton(mResource, PREFIX, "OK", null,
+ this);
+ mOK.setEnabled(false);
+ mCancel = CMSAdminUtil.makeJButton(mResource, PREFIX, "CANCEL",
+ null, this);
+ mHelp = CMSAdminUtil.makeJButton(mResource, PREFIX, "HELP",
+ null, this);
+
+ //JButton[] buttons = { mOK, mCancel, mHelp};
+ JButton[] buttons = { mOK, mCancel};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonPanel(buttons, true);
+ }
+
+ //set buttons
+ private void setButtons() {
+ if ( (mUsernameField.getText().trim().equals("")) ||
+ (mPasswordField.getText().trim().equals("")) ) {
+ mOK.setEnabled(false);
+ } else {
+ mOK.setEnabled(true);
+ getRootPane().setDefaultButton(mOK);
+ }
+ }
+
+ /**
+ * Inner class which handles key events for JTextField components.
+ */
+ class TextFieldKeyListener implements KeyListener
+ {
+ public void keyTyped(KeyEvent e) {
+ }
+
+ public void keyPressed(KeyEvent e) {
+ }
+
+ public void keyReleased(KeyEvent e) {
+ if(e.getKeyCode() == KeyEvent.VK_ENTER) {
+ if ( (!mUsernameField.getText().trim().equals("")) &&
+ (!mPasswordField.getText().trim().equals("")) ) {
+ mOK.doClick();
+ }
+ }
+ }
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/CMSRAUILoader.java b/base/console/src/com/netscape/admin/certsrv/CMSRAUILoader.java
new file mode 100644
index 000000000..b2103a34e
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/CMSRAUILoader.java
@@ -0,0 +1,266 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.admin.certsrv.config.*;
+import com.netscape.admin.certsrv.ug.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.notification.*;
+
+/**
+ * Netscape Certificate Server 4.0 Kernel UI Loader.
+ *
+ * This class is responsible for the loading of UI components associated with
+ * the kernel functionality.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @date 03/30/97
+ */
+public class CMSRAUILoader implements ISubSystemUILoader {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private CMSUIFramework mUIFramework; //parent framework
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSRAUILoader(CMSUIFramework framework) {
+ mUIFramework = framework;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public void register() {
+ //register subsystem UI
+ try {
+
+ //task tab
+ IPage task = mUIFramework.getPage(CMSPageFeeder.TASK_TAB_TYPE,"");
+
+ //config tab
+ CMSResourcePage page = (CMSResourcePage) mUIFramework.getPage(CMSPageFeeder.RESOURCE_TAB_TYPE,"CONFIGURATION");
+ CMSBaseResourceModel model = (CMSBaseResourceModel) page.getModel();
+ populateConfigContent(model);
+
+ /*repos tab
+ page = (CMSResourcePage) mUIFramework.getPage(CMSPageFeeder.RESOURCE_TAB_TYPE,"CONTENT");
+ model = (CMSBaseResourceModel) page.getModel();
+ populateRepositoryContent(model);
+ */
+
+ /*acl tab
+ page = (CMSResourcePage) mUIFramework.getPage(CMSPageFeeder.RESOURCE_TAB_TYPE,"ACCESSCONTROLLIST");
+ model = (CMSBaseResourceModel) page.getModel();
+ populateACLContent(model);
+ */
+
+ }catch(Exception e) {
+ Debug.println("CMSRAUILoader: register() config - "+e.toString());
+ }
+
+ }
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+ protected void populateConfigContent(CMSBaseResourceModel model) {
+ CMSResourceObject list, node;
+ CMSTabPanel tabPane;
+
+ CMSResourceObject authnode = new CMSResourceObject("AUTH");
+ CMSUGTabPanel tabPane1 = new CMSUGTabPanel(model, authnode);
+ tabPane1.addTab(new AuthInstanceTab(model));
+ tabPane1.addTab(new AuthImplTab(model));
+ authnode.setCustomPanel(tabPane1);
+ authnode.setIcon( CMSAdminUtil.getImage(
+ CMSAdminResources.IMAGE_AUTHOBJECT));
+ authnode.setAllowsChildren(false);
+ model.addSubSystemNode(authnode);
+
+ // jobs scheduler node
+ CMSResourceObject jobsnode = new CMSResourceObject("JOBSCHED");
+ tabPane = new CMSTabPanel(model, jobsnode);
+ tabPane.addTab(new JobsSettingPanel("JOBSGENERAL", tabPane));
+
+ jobsnode.setCustomPanel(tabPane);
+ jobsnode.setIcon( CMSAdminUtil.getImage(
+ CMSAdminResources.IMAGE_JOBSOBJECT));
+
+ jobsnode.setAllowsChildren(true);
+ CMSResourceObject cnode = new CMSResourceObject("JOBS");
+
+ tabPane1 = new CMSUGTabPanel(model, cnode);
+ tabPane1.addTab(new JobsInstanceTab(model));
+ tabPane1.addTab(new JobsImplTab(model));
+ cnode.setCustomPanel(tabPane1);
+ cnode.setIcon( CMSAdminUtil.getImage(
+ CMSAdminResources.IMAGE_JOBSOBJECT));
+ jobsnode.add(cnode);
+ cnode.setAllowsChildren(false);
+ model.addSubSystemNode(jobsnode);
+
+ //ra node
+ list = new CMSResourceObject("RACONFIG");
+ tabPane = new CMSTabPanel(model, list);
+// tabPane.addTab(new CMSRAGeneralPanel(tabPane));
+ tabPane.addTab(new CMSRAConnectorPanel(model,tabPane));
+ list.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_FOLDER));
+ list.setAllowsChildren(true);
+ list.setCustomPanel(tabPane);
+
+ //policies sub node
+ CMSResourceObject node2;
+ node = new CMSResourceObject("POLICIES");
+ CMSUGTabPanel tabPane2 = new CMSUGTabPanel(model, node);
+ tabPane2.addTab(new PolicyInstanceTab(model, DestDef.DEST_RA_POLICY_ADMIN));
+ tabPane2.addTab(new PolicyImplTab(model, DestDef.DEST_RA_POLICY_ADMIN));
+ node.setCustomPanel(tabPane2);
+ node.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULEOBJECT));
+ node.setAllowsChildren(false);
+ list.add(node);
+
+ // profiles
+ node = new CMSResourceObject("PROFILES");
+ CMSUGTabPanel tabPane3 = new CMSUGTabPanel(model, node);
+ tabPane3.addTab(new ProfileInstanceTab(model, DestDef.DEST_RA_PROFILE_ADMIN));
+ tabPane3.addTab(new ProfileImplTab(model, DestDef.DEST_REGISTRY_ADMIN));
+ node.setCustomPanel(tabPane3);
+ node.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULEOBJECT))
+;
+ node.setAllowsChildren(false);
+ list.add(node);
+
+ // notification
+ CMSResourceObject notificationNode = new CMSResourceObject("NOTIFICATION");
+ tabPane = new CMSTabPanel(model, notificationNode);
+ tabPane.addTab(new RequestCompletePanel("NOTIFYREQCOMPLETE",
+ tabPane,
+ DestDef.DEST_RA_ADMIN));
+ tabPane.addTab(new RequestInQPanel("NOTIFYREQINQ", tabPane,
+ DestDef.DEST_RA_ADMIN));
+
+ notificationNode.setCustomPanel(tabPane);
+ notificationNode.setIcon( CMSAdminUtil.getImage(
+ CMSAdminResources.IMAGE_JOBSOBJECT));
+
+ notificationNode.setAllowsChildren(false);
+ list.add(notificationNode);
+
+
+ /* servlet sub node - XXX NOT FOR B1
+ CMSResourceObject node3;
+ node3 = new CMSResourceObject("SERVLET");
+ CMSUGTabPanel tabPane3 = new CMSUGTabPanel(model, node3);
+ tabPane3.addTab(new ServletInstanceTab(model,
+ DestDef.DEST_RA_SERVLET_ADMIN));
+ tabPane3.addTab(new ServletImplTab(model,
+ DestDef.DEST_RA_SERVLET_ADMIN));
+ node3.setCustomPanel(tabPane3);
+ node3.setIcon(CMSAdminUtil.getImage(CMSAdminResources.IMAGE_SERVLETOBJECT));
+ node3.setAllowsChildren(false);
+ list.add(node3);
+ */
+
+ /*extensions sub node
+ node = new CMSResourceObject("EXTENSIONS");
+ tabPane = new CMSTabPanel(model, node);
+ tabPane.addTab(new CMSBlankPanel(model,tabPane,"Configuration"));
+ tabPane.addTab(new CMSBlankPanel(model,tabPane,"Registartion"));
+ node.setCustomPanel(tabPane);
+ node.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_PLUGIN));
+ node.setAllowsChildren(false);
+ list.add(node);
+ */
+
+ /*backup restore sub node
+ node = new CMSResourceObject("BACKUP");
+ tabPane = new CMSTabPanel(model, node);
+ tabPane.addTab(new CMSBlankPanel(model,tabPane,"Backup"));
+ tabPane.addTab(new CMSBlankPanel(model,tabPane,"Restore"));
+ node.setCustomPanel(tabPane);
+ node.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_GENERICOBJ));
+ node.setAllowsChildren(false);
+ list.add(node);
+ */
+
+ //ldap publishing
+ //node = new CMSResourceObject("PUBLISHING");
+ //tabPane = new CMSTabPanel(model, node);
+ //tabPane.addTab(new CMSRALDAPPanel(tabPane));
+ //tabPane.addTab(new CMSUserCertSettingPanel("RAUSERCERTSETTING",tabPane));
+ //node.setCustomPanel(tabPane);
+ //node.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_LDAPPUB));
+ //node.setAllowsChildren(false);
+ //list.add(node);
+
+ /*webgateway
+ node = new CMSResourceObject("GATEWAY");
+ tabPane = new CMSTabPanel(model, node);
+ tabPane.addTab(new CMSBlankPanel(model,tabPane,"VGI Setting"));
+ tabPane.addTab(new CMSBlankPanel(model,tabPane,"Error Responses"));
+ node.setCustomPanel(tabPane);
+ node.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_FOLDER));
+ node.setAllowsChildren(false);
+ list.add(node);
+ */
+
+ model.addSubSystemNode(list);
+ }
+
+ /*
+ protected void populateRepositoryContent(CMSBaseResourceModel model) {
+ CMSResourceObject list, node;
+
+ //ra repositories node
+ list = new CMSResourceObject("RAREPOSITORIES");
+ list.setCustomPanel(new CMSBlankPanel(model));
+ list.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_DBCONATINER));
+ list.setAllowsChildren(true);
+ node = new CMSResourceObject("RAREQUESTS");
+ node.setCustomPanel(new CMSBlankPanel(model));
+ node.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_DBOBJECT));
+ node.setAllowsChildren(false);
+ list.add(node);
+ node = new CMSResourceObject("RACERTIFICATE");
+ node.setCustomPanel(new CMSBlankPanel(model));
+ node.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_DBOBJECT));
+ node.setAllowsChildren(false);
+ list.add(node);
+ model.addSubSystemNode(list);
+ }
+ */
+
+ /*
+ protected void populateACLContent(CMSBaseResourceModel model) {
+ CMSResourceObject list, node;
+ list = model.getByNickName("ACL");
+ node = new CMSResourceObject("RAACL");
+ node.setCustomPanel(new CMSBlankPanel(model));
+ node.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_DOCUMENT));
+ node.setAllowsChildren(false);
+ list.add(node);
+ }
+ */
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/CMSRemoteClassLoader.java b/base/console/src/com/netscape/admin/certsrv/CMSRemoteClassLoader.java
new file mode 100644
index 000000000..f389aedda
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/CMSRemoteClassLoader.java
@@ -0,0 +1,109 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import java.util.Hashtable;
+import java.io.IOException;
+import com.netscape.admin.certsrv.connection.AdminConnection;
+
+/**
+ * The CMSRemoteClassLoader is designed to load classes from remote
+ * Certificate Servers. Classes are acquired via the admin channel
+ * used by the Certificate Server console.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @date 02/13/97
+ * @see ClassLoader
+ */
+class CMSRemoteClassLoader extends ClassLoader {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private Hashtable mCache = new Hashtable(); // stores classes
+ private AdminConnection mAdmin; // srever entry point
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSRemoteClassLoader(CMSServerInfo info) {
+ //mAdmin = info.getAdmin();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * Attempts to load the named class.
+ *
+ * @param name the fully-qualified class name, in '.' form.
+ * @return the Class object of the named class.
+ * @throws ClassNotFoundException if the class cannot be found.
+ */
+ public synchronized Class loadClass(String name, boolean resolve)
+ throws ClassNotFoundException
+ {
+ Class c = (Class) mCache.get(name);
+
+ if (c == null) {
+ String path = name.replace('.', '/') + ".class";
+ try {
+ byte data[] = loadClassData(path);
+ c = defineClass(name,data, 0, data.length);
+ mCache.put(name, c);
+ } catch (Exception e) {
+ }
+ }
+ if (resolve)
+ resolveClass(c);
+ return c;
+
+ }
+
+ /**
+ * Attempts to load the named class.
+ *
+ * @param name the fully-qualified class name, in '.' form.
+ * @return the Class object of the named class.
+ * @throws ClassNotFoundException if the class cannot be found.
+ */
+ public Class loadClass(String name) throws ClassNotFoundException {
+ return this.loadClass(name, true);
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+
+ /**
+ * Retrieves the class specified by path from the server side.
+ *
+ * @param class name
+ * @return an InputStream for the resource.
+ * @throws Exception on any error while loading the resource.
+ */
+ private byte[] loadClassData(String path)
+ throws EAdminException
+ {
+ //load the class here from server side
+ return null;
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/CMSResourceObject.java b/base/console/src/com/netscape/admin/certsrv/CMSResourceObject.java
new file mode 100644
index 000000000..f0f5d38b0
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/CMSResourceObject.java
@@ -0,0 +1,126 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import java.util.*;
+import java.awt.*;
+import javax.swing.*;
+import javax.swing.tree.*;
+import com.netscape.management.client.util.*;
+import com.netscape.management.client.*;
+
+/**
+ * Netscape Certificate Server 4.0 Node Object.<br>
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv
+ */
+public class CMSResourceObject extends ResourceObject {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private final String PREFIX = "CMSRESOURCEOBJECT_";
+ private JPanel mRightPane;
+ private String mNickName;
+ protected ResourceBundle mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+
+ /**
+ * Creates empty resource object.
+ */
+ public CMSResourceObject() {
+ super();
+ mNickName = "";
+ }
+
+ /**
+ * Creates resource object with specified keyword/nickname.
+ */
+ public CMSResourceObject(String keyword) {
+ this();
+ mNickName = keyword;
+ String sDisplayName;
+ try {
+ sDisplayName = mResource.getString(PREFIX+keyword+"_TITLE");
+ } catch(MissingResourceException e) {
+ sDisplayName = keyword;
+ }
+ setName(sDisplayName);
+ }
+
+ /**
+ * Creates resource object with specified keyword/nickname and icons.
+ */
+ public CMSResourceObject(String keyword, Icon icon, Icon largeIcon) {
+ this();
+ mNickName = keyword;
+ String sDisplayName;
+ try {
+ sDisplayName = mResource.getString(PREFIX+keyword+"_TITLE");
+ } catch(MissingResourceException e) {
+ sDisplayName = "MissingTitle";
+ }
+ setName(sDisplayName);
+ setIcon(icon);
+ setLargeIcon(largeIcon);
+ }
+
+ /**
+ * Returns the internal nickname for this resource object
+ */
+ public String getNickName() {
+ return mNickName;
+ }
+
+ /**
+ * Returns the AWT Component that is displayed in the right hand pane
+ * of the resource page.
+ * @return a new instantiation of the component for each view.
+ * Called by: ResourceModel
+ */
+ public Component getCustomPanel()
+ {
+ return mRightPane;
+ }
+
+ /**
+ * Set the right hand panel to be shown
+ * @param panel right hand panel
+ */
+ public void setCustomPanel(JPanel panel) {
+ mRightPane = panel;
+ }
+
+ protected MenuItemText getMenuItemText(String keyword) {
+ ResourceBundle mResource = ResourceBundle.getBundle(
+ CMSAdminResources.class.getName());
+ String name = mResource.getString("GENERAL_MENU_"+keyword+"_LABEL");
+ if (name == null)
+ name = "Missing Label";
+ String desc = mResource.getString("GENERAL_MENU_"+keyword+"_DESC");
+ if (desc == null)
+ desc = " ";
+ return new MenuItemText( keyword, name, desc);
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/CMSResourcePage.java b/base/console/src/com/netscape/admin/certsrv/CMSResourcePage.java
new file mode 100644
index 000000000..9ad03515d
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/CMSResourcePage.java
@@ -0,0 +1,154 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import javax.swing.*;
+import javax.swing.tree.*;
+import javax.swing.event.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * This page creates the resource view
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv
+ */
+public class CMSResourcePage extends ResourcePage implements Cloneable {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ protected IMenuInfo mMenuInfo; // menu information delegation
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+
+ /**
+ * Return ResourcePage using the data model specified.
+ */
+ public CMSResourcePage(CMSBaseResourceModel resourceModel) {
+ super(resourceModel);
+ resourceModel.setResourcePage(this);
+ //we will only support single selection model
+ TreeSelectionModel selectionModel = _tree.getSelectionModel();
+ selectionModel.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION );
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * Need to overwrite this one to clone
+ * DSResourcePage instead of ResourcePage
+ * @return copy of resource page
+ */
+ public Object clone() {
+ CMSResourcePage rp = new CMSResourcePage((CMSBaseResourceModel)_model);
+ rp.setCellRenderer( _treeRenderer );
+ rp.setPageTitle(getPageTitle());
+ rp.setMenuInfo(mMenuInfo);
+ return rp;
+ }
+
+ /**
+ * Retrieve JTree Obejct
+ * @return JTree obejct in the resource page
+ */
+ public JTree getTree() {
+ return (JTree)_tree;
+ }
+
+ /**
+ * Implements TreeSelectionListener. Called when an object is selected
+ * in the resource tree. Informs IResourceModelListeners of this event.
+ */
+ public void valueChanged(TreeSelectionEvent ev)
+ {
+ IResourceObject[] selection = getSelection();
+ if(selection != null) {
+ if(selection.length == 1) // single selection {
+ setCustomPanel(_model.getCustomPanel(this, selection[0]));
+ }
+ _model.actionObjectSelected(this, selection, getPreviousSelection());
+
+ //the selected node not necessary the original selection
+ //in case of not allow to change
+ _previousSelection = getSelection();
+ }
+
+ /**
+ * Called internally when page is unselected
+ */
+ public void pageUnselected(IFramework framework) {
+ super.pageUnselected(framework);
+ //check if the data is not saved
+ }
+
+ /**
+ * Initializes page. Called after construction or after clonePage().
+ * The reference to IFramework allows this page to set menu items, status
+ * bars, and add event notification listeners. COVERWRITES the method in
+ * the ResourcePage class to provide the menu contain separartion.
+ */
+ public void initialize(IFramework framework) {
+ //Debug.println("CMSResourcePage - initialize() "+mMenuInfo);
+ super.initialize(framework);
+ if (mMenuInfo != null)
+ addMenuItems(mMenuInfo , _menuInfoAction);
+ }
+
+ /**
+ * Set and replace the existing menuInfo delegation object
+ */
+ public void setMenuInfo(IMenuInfo menuInfo) {
+ //Debug.println("CMSResourcePage - setMenuInfo() "+menuInfo);
+ mMenuInfo = menuInfo;
+ }
+
+ /**
+ * Retrieve IMenuInfo object
+ */
+ public IMenuInfo getMenuInfo() {
+ if (mMenuInfo == null) {
+ mMenuInfo = new CMSBaseMenuInfo();
+ }
+ return mMenuInfo;
+ }
+
+ /**
+ * Start the zipping status bar
+ */
+ public void progressStart() {
+ //XXX COMEBACK AFTER UPGRADE
+ _statusItemProgress.start();
+ }
+
+ /**
+ * Stop the zipping status bar
+ */
+ public void progressStop() {
+ //XXX COMEBACK AFTER UPGRADE
+ _statusItemProgress.stop();
+ }
+
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/CMSServerInfo.java b/base/console/src/com/netscape/admin/certsrv/CMSServerInfo.java
new file mode 100644
index 000000000..d2d64b3fc
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/CMSServerInfo.java
@@ -0,0 +1,172 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import java.util.*;
+import javax.swing.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.connection.*;
+
+/**
+ * Certificate server information. Store all relevant
+ * information that allows this client to connect to
+ * the certificate server.
+ *
+ * @author Jack Pan-Chen
+ * @author Thomas Kwan
+ * @version $Revision$, $Date$
+ */
+public class CMSServerInfo implements IConnectionListener {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PREFIX = "SERVER";
+ private AdminConnection mAdmin = null; // srever entry point
+ private String mHost = null; // server host
+ private int mPort; // server port
+ private String mServerId = null; // server id
+ private String mServerRoot = null;
+ private String mServerVersion = null; // server version
+ private String mUserid = null; // user id
+ private String mInstallDate = null; // server install date
+ private String mPassword = null; // user password
+ private String mPath = null;
+ private Vector mSubsystem = new Vector();
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSServerInfo(String host, int port, String userid, String password,
+ String serverid, String installDate, String version,
+ String serverRoot, String path)
+ throws EAdminException
+ {
+
+ mHost = host;
+ mPort = port;
+ mUserid = userid;
+ mPassword = password;
+ mServerId = serverid;
+ mServerVersion = version;
+ mInstallDate = installDate;
+ mServerRoot = serverRoot;
+ mPath = path;
+
+ Debug.println("CMSServerInfo: host "+mHost+" port "+mPort+
+ " userid "+mUserid+" serverRoot "+mServerRoot+" serverid "+mServerId);
+ mAdmin = new AdminConnection(
+ new BasicAuthenticator(mUserid, mPassword),
+ new SSLConnectionFactory(SSLConnectionFactory.JSS_CONNECTION),
+ true /* KeepAlive */, mHost, mPort, mPath);
+ mAdmin.setConnectionListener(this);
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ public void restartCallback() {
+ JFrame frame = UtilConsoleGlobals.getActivatedFrame();
+ if (frame != null) {
+ ResourceBundle bundle =
+ ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ CMSAdminUtil.showMessageDialog(frame, bundle, PREFIX, "RESTART",
+ CMSAdminUtil.WARNING_MESSAGE);
+ }
+ }
+
+ public void ping() throws EAdminException {
+
+ // Need to do authentication here
+ NameValuePairs config = new NameValuePairs();
+ config.put(Constants.PR_PING, "");
+
+ NameValuePairs response;
+
+ response = mAdmin.read(DestDef.DEST_AUTH_ADMIN,
+ ScopeDef.SC_AUTH,
+ Constants.RS_ID_CONFIG,
+ config);
+
+ if (!response.get(Constants.PR_PING).equalsIgnoreCase(Constants.TRUE)) {
+ Debug.println("Ping failed -> Server off");
+ throw new EAdminException("PING_FAILED",false);
+ }
+ }
+
+ public void authenticate() throws EAdminException {
+ mAdmin.auth(DestDef.DEST_AUTH_ADMIN, ScopeDef.SC_AUTH);
+ }
+
+ public String getAuthType() throws EAdminException {
+ return mAdmin.authType(DestDef.DEST_AUTH_ADMIN, ScopeDef.SC_AUTHTYPE);
+ }
+
+ public AdminConnection getAdmin() {
+ return mAdmin;
+ }
+
+ public String getHost() {
+ return mHost;
+ }
+
+ public int getPort() {
+ return mPort;
+ }
+
+ public String getUserId() {
+ return mUserid;
+ }
+
+ public String getServerId() {
+ return mServerId;
+ }
+
+ public String getServerRoot() {
+ return mServerRoot;
+ }
+
+ public String getServerVersion() {
+ return mServerVersion;
+ }
+
+ public String getInstallDate() {
+ return mInstallDate;
+ }
+
+ public Object clone() {
+ try {
+ return new CMSServerInfo(mHost, mPort, mUserid, mPassword,
+ mServerId, mServerVersion, mInstallDate, mServerRoot, mPath);
+ } catch (EAdminException e) {
+ return null;
+ }
+ }
+
+ public Vector getInstalledSubsystems() {
+ return mSubsystem;
+ }
+
+ public void setInstalledSubsystems(Vector subsystem) {
+ mSubsystem = subsystem;
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/CMSTableModel.java b/base/console/src/com/netscape/admin/certsrv/CMSTableModel.java
new file mode 100644
index 000000000..0afd3d0a5
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/CMSTableModel.java
@@ -0,0 +1,256 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+
+import java.util.*;
+import javax.swing.table.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Generic base class for the JTable data container
+ * It provides <B>FORWARD</B> listing of the data.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv
+ * @see javax.swing.table.AbstractTableModel
+ */
+public class CMSTableModel extends AbstractTableModel {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+
+ //log
+ protected static String DATE = "DATE";
+ protected static String TIME = "TIME";
+ protected static String DETAILS = "DETAILS";
+ protected static String SEVERITY = "SEVERITY";
+ protected static String SOURCE = "SOURCE";
+
+ //property table
+ protected static String ATTRIBUTE = "ATTRIBUTE";
+ protected static String VALUE = "VALUE";
+
+ //repository
+ protected static String REQUESTNO = "REQUESTNO";
+ protected static String REQUESTSTATUS = "REQUESTSTATUS";
+ protected static String REQUESTTYPE = "REQUESTTYPE";
+ protected static String RECORDNUMBER = "RECORDNUMBER";
+ protected static String STATUS = "STATUS";
+ protected static String SERIALNO = "SERIALNO";
+ protected static String VERSION = "VERSION";
+ protected static String SUBJECT = "SUBJECT";
+ protected static String SIGNALG = "SIGNALG";
+ protected static String NOTBEFORE = "NOTBEFORE";
+ protected static String NOTAFTER = "NOTAFTER";
+ protected static String NAME = "NAME";
+ protected static String DEPARTMENT = "DEPARTMENT";
+ protected static String EMAIL = "EMAIL";
+ protected static String PHONE = "PHONE";
+ protected static String OID = "OID";
+ protected static String CLASSNAME = "CLASSNAME";
+ protected static String DESC = "DESC";
+ protected static String UIMAPPER = "UIMAPPER";
+ protected static String USERID = "USERID";
+ protected static String FULLNAME = "FULLNAME";
+ protected static String CERTIFICATE = "CERTIFICATE";
+ protected static String POLICY_IMPL = "POLICY_IMPL";
+ protected static String POLICY_TYPE = "POLICY_TYPE";
+ protected static String POLICY_RULE = "POLICY_RULE";
+ protected static String PROFILE_IMPL = "PROFILE_IMPL";
+ protected static String PROFILE_RULE = "PROFILE_RULE";
+ protected static String JOBS_IMPL = "JOBS_IMPL";
+ protected static String JOBS_RULE = "JOBS_RULE";
+ protected static String PUBLISHER_IMPL = "PUBLISHER_IMPL";
+ protected static String PUBLISHER_RULE = "PUBLISHER_RULE";
+ protected static String MAPPER_IMPL = "MAPPER_IMPL";
+ protected static String MAPPER_RULE = "MAPPER_RULE";
+ protected static String RULE_IMPL = "RULE_IMPL";
+ protected static String RULE_RULE = "RULE_RULE";
+ protected static String CRLEXTS_RULE = "CRLEXTS_RULE";
+ protected static String OCSPSTORES_RULE = "OCSPSTORES_RULE";
+ protected static String LOG_IMPL = "LOG_IMPL";
+ protected static String LOG_RULE = "LOG_RULE";
+ protected static String PLUGIN = "PLUGIN";
+ protected static String RULE = "RULE";
+ protected static String CONFIG = "CONFIG";
+ protected static String SERVLETNAME = "SERVLETNAME";
+
+ //user and group
+ protected static String DEFAULTGROUP = "DEFAULTGROUP";
+ protected static String GROUPNAME = "GROUPNAME";
+ protected static String GROUPDESC = "GROUPDESC";
+ protected static String MEMBER = "MEMBER";
+
+ protected Vector _columnNames = new Vector(); // name container
+ protected Vector _tableColumns = new Vector(); // column container
+ protected ResourceBundle mResource; // resource boundle
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSTableModel() {
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ }
+
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ public int getColumnCount() {
+ return _columnNames.size();
+ }
+
+ public int getRowCount() {
+ if (getColumnCount() > 0 ) {
+ Vector v = (Vector)_tableColumns.elementAt(0);
+ return v.size();
+ }
+ return 0;
+ }
+
+ public String getColumnName(int column) {
+ if (column >= _columnNames.size())
+ return "";
+ return (String)_columnNames.elementAt(column);
+ }
+
+ public boolean isCellEditable(int row, int col) {
+ return false;
+ }
+
+ public synchronized void setValueAt(Object aValue, int row, int column) {
+ Vector col = (Vector)_tableColumns.elementAt(column);
+ col.setElementAt(aValue, row);
+ }
+
+ public synchronized Object getValueAt(int row, int col) {
+ if ( getColumnCount() > 0 ) {
+ Vector v = (Vector)_tableColumns.elementAt(col);
+ return v.elementAt(row);
+ }
+ return null;
+ }
+
+ public synchronized void removeAllRows() {
+ for (int i=0; i<_tableColumns.size(); i++) {
+ Vector v = (Vector)_tableColumns.elementAt(i);
+ v.removeAllElements();
+ }
+ fireTableDataChanged();
+ }
+
+ /**
+ * add specified data to the end of the table
+ */
+ public synchronized void addRow(Vector values) {
+ for (int i=0; i < values.size(); i++) {
+ Vector v = (Vector)_tableColumns.elementAt(i);
+ v.addElement(values.elementAt(i));
+ }
+ fireTableDataChanged();
+ }
+
+ /**
+ * remove specified row at index position
+ */
+ public void removeRow(int index)
+ throws ArrayIndexOutOfBoundsException
+ {
+ for (int i=0; i < _tableColumns.size(); i++) {
+ Vector v = (Vector)_tableColumns.elementAt(i);
+ v.removeElementAt(index);
+ }
+ fireTableDataChanged();
+ }
+
+ public synchronized void addColumn(String name) {
+ _columnNames.addElement(name);
+ _tableColumns.addElement(new Vector());
+ }
+
+ public Class getColumnClass(int c) {
+ return getValueAt(0, c).getClass();
+ }
+
+ /**
+ * Returns detail information for a given cell. If the Object
+ * is a Component, it is set in the detail pane, otherwise the
+ * toString() value of object is displayed as text.
+ * Called by LogViewer
+ */
+ public Object getDetailInfo(int column, int row) {
+ return null;
+ }
+
+ /**
+ * Returns a boolean value indicating whether any log data
+ * has detail information.
+ * Called by LogViewer
+ */
+ public boolean hasDetailInfo() {
+ return false;
+ }
+
+ /**
+ * Returns a component that displays a log filter.
+ * Called by LogViewer
+ *
+ public IFilterComponent getFilterComponent(Object viewInstance) {
+ return (IFilterComponent)null;
+ }
+ */
+
+ /**
+ * Sets an object representing a log filter. This object
+ * is obtained from the IFilterComponent.
+ * Called by LogViewer
+ */
+ public void setFilter(Object viewInstance, Object filter) {
+ }
+
+ /**
+ * Notification that the log should be updated.
+ * Called by LogViewer
+ */
+ public void updateNow(Object viewInstance) {
+ }
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+
+ /**
+ * Initialize the column headings
+ */
+ protected void init(String[] column ) {
+ for( int i = 0; i < column.length; i++ ) {
+ String name;
+ try {
+ name = mResource.getString("LOG_COLUMN_"+column[i]+"_LABEL");
+ } catch (MissingResourceException e) {
+ name = "Missing Label";
+ }
+ //Debug.println("LogDataModel: init() - add Column: "+name);
+ addColumn( name );
+ }
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/CMSTaskModel.java b/base/console/src/com/netscape/admin/certsrv/CMSTaskModel.java
new file mode 100644
index 000000000..c3451609d
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/CMSTaskModel.java
@@ -0,0 +1,288 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import java.util.*;
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.tree.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.console.*;
+import com.netscape.management.client.util.*;
+import com.netscape.admin.certsrv.security.KeyCertWizard;
+import com.netscape.admin.certsrv.security.CertManagementDialog;
+import com.netscape.admin.certsrv.security.PKCS11ManagementDialog;
+import com.netscape.management.client.preferences.*;
+import netscape.ldap.*;
+
+/**
+ * Certificate Server 4.0 Task Model
+ *
+ * @author Jack Pan-Chen
+ * @author Thomas Kwan
+ * @version $Revision$, $Date$
+ * @date 02/04/97
+ */
+public class CMSTaskModel extends TaskModel implements IMenuInfo {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static String PREFIX = "CMSTASKMODEL_NODE_";
+
+ private static final String PREFERENCES_TASK_TAB = "TaskTab";
+ private static final String PREFERENCES_TASK_LIST = "TaskList";
+
+ static public String MENU_KEYCERT = CMSAdminResources.MENU_KEYCERT;
+ static public String MENU_KEYCERT_MANAGEMENT =
+ CMSAdminResources.MENU_KEYCERT_MANAGEMENT;
+ static public String MENU_PKCS11 = CMSAdminResources.MENU_PKCS11;
+ static public String REF_TASKMODEL = "CMSTASKMODEL";
+
+ protected ITaskObject mSelection;
+ private ConsoleInfo mConsoleInfo;
+ private ResourceBundle mResource;
+ private CMSServerInfo mServerInfo = null;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+
+ public CMSTaskModel(ConsoleInfo ci, CMSServerInfo serverInfo) {
+ mServerInfo = serverInfo;
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ mConsoleInfo = ci;
+ init();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * getServerInfo()
+ */
+ public CMSServerInfo getServerInfo() {
+ return mServerInfo;
+ }
+
+ /**
+ * Returns supported menu categories
+ */
+ public String[] getMenuCategoryIDs() {
+ return new String[] {
+ Framework.MENU_FILE
+ };
+ }
+
+ /**
+ * add menu items for this page.
+ */
+ public IMenuItem[] getMenuItems(String categoryID) {
+ if(categoryID.equals(Framework.MENU_FILE)) {
+ return new IMenuItem[] {
+ //getMenuItemText(MENU_KEYCERT),
+ //getMenuItemText(MENU_KEYCERT_MANAGEMENT),
+ // getMenuItemText(MENU_PKCS11),
+ new MenuItemSeparator()
+ };
+ }
+ return null;
+ }
+
+ public void actionObjectSelected(IPage viewInstance,
+ ITaskObject selection,
+ ITaskObject previousSelection) {
+ super.actionObjectSelected(viewInstance, selection, previousSelection);
+ mSelection = selection;
+ }
+
+ /**
+ * Notification that a menu item has been selected.
+ */
+ public void actionMenuSelected(IPage viewInstance, IMenuItem item) {
+
+ if(item.getID().equals(MENU_KEYCERT)) {
+ KeyCertWizard wizard = new KeyCertWizard(mConsoleInfo);
+ } else if(item.getID().equals(MENU_KEYCERT_MANAGEMENT)) {
+ (new CertManagementDialog( mConsoleInfo )).showModal();
+ } else if(item.getID().equals(MENU_PKCS11)){
+ (new PKCS11ManagementDialog( mConsoleInfo )).showModal();
+ }
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+
+ private MenuItemText getMenuItemText(String keyword) {
+ String name = mResource.getString("GENERAL_MENU_"+keyword+"_LABEL");
+ if (name == null)
+ name = "Missing Label";
+ String desc = mResource.getString("GENERAL_MENU_"+keyword+"_DESC");
+ if (desc == null)
+ desc = " ";
+ return new MenuItemText( keyword, name, desc);
+ }
+
+ private void init() {
+ TaskObject root = new TaskObject( "root", mConsoleInfo );
+ root.setAllowsChildren(true);
+ String serverDN = mConsoleInfo.getCurrentDN();
+ if ( serverDN != null ) {
+ /* Check if there is a list of tasks */
+ String order = findTaskOrder( serverDN );
+
+ /* Accumulate tasks in a hash table */
+ Hashtable list = new Hashtable();
+ Debug.println( "CMSTaskModel.init: Searching for tasks under " +
+ serverDN );
+ findTasks(root, serverDN, list );
+ /* Need to go up one from the instance entry, to get non-instance-
+ specific task entries. */
+ serverDN = "cn=Tasks," +
+ new netscape.ldap.util.DN(
+ mConsoleInfo.getCurrentDN() ).getParent().toString();
+ Debug.println( "CMSTaskModel.init: Searching for tasks under " +
+ serverDN );
+ findTasks(root, serverDN, list );
+
+ /* Now sort them by preferred order, or just list them as found */
+ if ( order != null ) {
+ StringTokenizer st = new StringTokenizer( order, " " );
+ while( st.hasMoreTokens() ) {
+ TaskObject task = (TaskObject)list.get( st.nextToken() );
+ if ( task != null ) {
+ root.add(task);
+ }
+ }
+ } else {
+ Enumeration en = list.elements();
+ while( en.hasMoreElements() ) {
+ root.add( (TaskObject)en.nextElement() );
+ }
+ }
+ } else {
+ Debug.println( "CMSTaskModel.init: no currentDN" );
+ }
+ setRoot(root);
+ }
+
+ private void findTasks(TaskObject root, String base, Hashtable list ) {
+ // connect to the DS and search for task information
+ LDAPConnection ldc = mConsoleInfo.getLDAPConnection();
+ if ( ldc == null)
+ return;
+ try {
+ String[] attrs = {"nsclassname", "nsexecref"};
+ LDAPSearchResults result =
+ ldc.search( base, ldc.SCOPE_SUB,
+ "(objectclass=nstask)",
+ attrs, false );
+
+ while ( result.hasMoreElements() ) {
+ String sJavaClassName = null;
+ LDAPEntry findEntry = (LDAPEntry)result.nextElement();
+ Debug.println( "Found task " + findEntry.getDN() );
+ LDAPAttribute anAttr =
+ findEntry.getAttribute( attrs[0] );
+ if ( anAttr != null )
+ sJavaClassName =
+ LDAPUtil.flatting( anAttr.getStringValues() );
+ if ( sJavaClassName != null ) {
+ // load the associated task class file
+ try {
+ Class c =
+ ClassLoaderUtil.getClass(mConsoleInfo,
+ sJavaClassName);
+ TaskObject task = (TaskObject)c.newInstance();
+ ConsoleInfo taskConsoleInfo =
+ (ConsoleInfo)mConsoleInfo.clone();
+ taskConsoleInfo.setCurrentDN(findEntry.getDN());
+ /* Add a listener interface for
+ authentication changes */
+ Vector v = new Vector(1);
+ anAttr = findEntry.getAttribute( attrs[1] );
+ if ( anAttr != null ) {
+ String s = LDAPUtil.flatting(
+ anAttr.getStringValues() );
+ taskConsoleInfo.put( "execref", s );
+ }
+ taskConsoleInfo.put(REF_TASKMODEL, this );
+ task.setConsoleInfo(taskConsoleInfo);
+ Debug.println( "CMSSTaskModel.init: Found task " +
+ task );
+ String[] rdns =
+ LDAPDN.explodeDN( findEntry.getDN(), true );
+ list.put( rdns[0], task );
+ } catch (Exception e) {
+ Debug.println("CMSTaskModel.findTasks: could not " +
+ "load class: " + sJavaClassName + ", " +
+ e);
+ // This implicitly means that this task should
+ // not show up in
+ // in the Task list.
+ }
+ }
+ }
+ } catch ( LDAPException e ) {
+ Debug.println( "CMSTaskModel.findTasks: " + e.toString() );
+ }
+ }
+
+ //get task orders
+ private String findTaskOrder( String base ) {
+ String order = null;
+ /* See if there is a personal preference set */
+ PreferenceManager pm =
+ PreferenceManager.getPreferenceManager(Framework.IDENTIFIER,
+ Framework.VERSION);
+ Preferences p = pm.getPreferences(PREFERENCES_TASK_TAB);
+ if ( p != null ) {
+ order = p.getString( PREFERENCES_TASK_LIST );
+ if ( (order != null) && (order.trim().length() > 0) ) {
+ return order;
+ } else {
+ order = null;
+ }
+ }
+
+ LDAPConnection ldc = mConsoleInfo.getLDAPConnection();
+ if ( ldc == null ) {
+ return null;
+ }
+ /* Check if there is a list */
+ try {
+ String dn = "cn=task summary, cn=Operation, cn=Tasks," + base;
+ String[] attrs = {"description"};
+ LDAPEntry entry = ldc.read( dn, attrs );
+ if ( entry != null ) {
+ LDAPAttribute attr = entry.getAttribute( attrs[0] );
+ if ( attr != null ) {
+ order = (String)attr.getStringValues().nextElement();
+ }
+ }
+ } catch ( LDAPException ex ) {
+ Debug.println( "CMSTaskModel.findTaskOrder: no list of tasks, " +
+ ex );
+ }
+ return order;
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/CMSTaskObject.java b/base/console/src/com/netscape/admin/certsrv/CMSTaskObject.java
new file mode 100644
index 000000000..5999ab833
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/CMSTaskObject.java
@@ -0,0 +1,71 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import javax.swing.*;
+import javax.swing.event.*;
+import com.netscape.management.client.console.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+/**
+ * Represents the task entry on the task Tab.
+ *
+ * @author Thomas Kwan
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.management.client.TaskObject
+ */
+public class CMSTaskObject extends TaskObject
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private CMSServerInfo mServerInfo = null; // server info
+ protected ResourceBundle mResource;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSTaskObject() {
+ super();
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ }
+
+ public CMSTaskObject(CMSServerInfo serverInfo, String name,
+ ConsoleInfo info) {
+ super(name, info);
+ mServerInfo = serverInfo;
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public void setServerInfo(CMSServerInfo i) {
+ mServerInfo = i;
+ }
+
+ public CMSServerInfo getServerInfo() {
+ return mServerInfo;
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/CMSUIFramework.java b/base/console/src/com/netscape/admin/certsrv/CMSUIFramework.java
new file mode 100644
index 000000000..13028b003
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/CMSUIFramework.java
@@ -0,0 +1,242 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.management.client.console.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.connection.*;
+
+/**
+ * Netscape Certificate Server 4.0 UI Framework
+ *
+ * This class is responsible for the loading of UI components associated with
+ * the certificate server.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @date 03/30/97
+ */
+public class CMSUIFramework {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private ConsoleInfo mConsoleInfo; // global information
+ private CMSServerInfo mServerInfo; // server-specific information
+ private CMSPageFeeder mPageFeeder; // KP PageFeeder
+ private Framework mFramework; // KP Framework
+ private ISubSystemLocator mSubSystemLocator = null; // subsystem locator
+ private UILoaderRegistry mUILoaders;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSUIFramework(ConsoleInfo info, CMSServerInfo serverInfo)
+ throws EAdminException
+ {
+ mConsoleInfo = info;
+ mServerInfo = serverInfo;
+ mPageFeeder = new CMSPageFeeder(info, serverInfo);
+ setSubSystemLocator( new HTTPSSubSystemLocator(serverInfo.getAdmin()));
+ init();
+ //framework must be created as the last components
+ //we are not able to change the components of the
+ //pages after creating the framework.
+ mFramework = new Framework(mPageFeeder);
+ mPageFeeder.expendPages();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public void setSubSystemLocator(ISubSystemLocator locator) {
+ mSubSystemLocator = locator;
+ }
+
+ public IPage getPage(String type, String name) throws EAdminException {
+ return mPageFeeder.getPage(type, name);
+ }
+
+ public Framework getFramework() {
+ return mFramework;
+ }
+
+ public boolean isNTEnv() throws EAdminException {
+ Debug.println("CMSUIFramework - isNTEnv()");
+ NameValuePairs response;
+ AdminConnection conn = mServerInfo.getAdmin();
+ response = conn.search(DestDef.DEST_SERVER_ADMIN,
+ ScopeDef.SC_PLATFORM, new NameValuePairs());
+ if (response == null)
+ throw new EAdminException("PROTOCOL_ERROR",false);
+ if (response.get(Constants.PR_NT).equals(Constants.TRUE))
+ return true;
+ return false;
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+ private void init() throws EAdminException {
+ //initialize the kernel UI
+ CMSKernelUILoader kernelUI = new CMSKernelUILoader(this);
+ kernelUI.register();
+
+ //load subsystem information. if no locator specified use default
+ if (mSubSystemLocator == null)
+ mSubSystemLocator = new DefaultSubSystemLocator();
+ SubSystemInfo[] subsystems = mSubSystemLocator.getInstalledSubSystem();
+
+ //delegate UI loading to each subsystem loader
+ UILoaderRegistry registry = new UILoaderRegistry(this);
+ Vector subsystemList = new Vector();
+ for (int i=0; i< subsystems.length; i++) {
+ try {
+ subsystemList.addElement(subsystems[i].mType);
+ ISubSystemUILoader loader = registry.getUILoader(subsystems[i].mType);
+ loader.register();
+ } catch (Exception e) {
+ Debug.println("Error loading subsystem UI - "+e.toString());
+ }
+ }
+
+ //set subsystem setting
+ mServerInfo.setInstalledSubsystems(subsystemList);
+ }
+
+}
+
+//=====================================================================
+
+/**
+ * Registry for the Subsystem UI loader.
+ * Only single instance of the UI loader should be created.
+ */
+class UILoaderRegistry {
+ private final String PREFIX = "UILOADERREGISTRY_";
+ private Hashtable mContent = new Hashtable();
+ private ResourceBundle mResource; // resource boundle
+
+ public UILoaderRegistry(CMSUIFramework uiFramework) {
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ mContent.put(Constants.PR_CA_INSTANCE,new CMSCAUILoader(uiFramework));
+ mContent.put(Constants.PR_KRA_INSTANCE,new CMSEAUILoader(uiFramework));
+ mContent.put(Constants.PR_RA_INSTANCE,new CMSRAUILoader(uiFramework));
+ mContent.put(Constants.PR_OCSP_INSTANCE,new CMSOCSPUILoader(uiFramework));
+ //mContent.put("ccm",new CMSCCMUILoader(uiFramework));
+ }
+
+ public ISubSystemUILoader getUILoader(String type) throws EAdminException {
+ if (!mContent.containsKey(type)) {
+ Debug.println("Error Loading Subsystem UI Loader");
+ return null;
+ }
+ return (ISubSystemUILoader) mContent.get(type);
+ }
+}
+
+//============================================================================
+
+/**
+ * Info container for the sub system
+ */
+class SubSystemInfo {
+ String mType;
+ String mNickName;
+}
+
+/**
+ * Interface for the sub system UI loader
+ */
+interface ISubSystemLocator {
+ public SubSystemInfo[] getInstalledSubSystem() throws EAdminException;
+}
+
+//XXX DUMMY that just returned with all components
+//XXX installed on the srever side
+class DefaultSubSystemLocator implements ISubSystemLocator {
+
+ public SubSystemInfo[] getInstalledSubSystem() throws EAdminException {
+ SubSystemInfo[] subsystems = new SubSystemInfo[4];
+ for (int i=0; i< subsystems.length; i++)
+ subsystems[i] = new SubSystemInfo();
+ subsystems[0].mType=Constants.PR_CA_INSTANCE;
+ subsystems[1].mType=Constants.PR_RA_INSTANCE;
+ subsystems[2].mType=Constants.PR_KRA_INSTANCE;
+ subsystems[3].mType=Constants.PR_OCSP_INSTANCE;
+ //subsystems[3].mType="ccm";
+ if (true)
+ return subsystems;
+ //this should never be called
+ throw new EAdminException("DefaultSubSystemLocator - error loading",true);
+ }
+}
+
+/**
+ * This is the one actually used to communicate with the
+ * server side and retreive the subsystem actually loaded
+ */
+class HTTPSSubSystemLocator implements ISubSystemLocator {
+ private AdminConnection mConnection;
+
+ public HTTPSSubSystemLocator(AdminConnection conn) {
+ mConnection = conn;
+ }
+
+ public SubSystemInfo[] getInstalledSubSystem() throws EAdminException {
+ NameValuePairs input = getSubSystem();
+ Debug.println("getInstalledSubSystem() - "+input.toString());
+ SubSystemInfo[] subsystems = new SubSystemInfo[input.size()];
+ int i =0;
+ for (String entry : input.keySet()) {
+ entry = entry.trim();
+ String value = input.get(entry);
+ subsystems[i] = new SubSystemInfo();
+ subsystems[i].mType = value;
+ subsystems[i].mNickName = entry;
+ i++;
+ }
+ return subsystems;
+ }
+
+ private NameValuePairs getSubSystem() throws EAdminException {
+ Debug.println("CMSUIFramework - getSubSystem() - started");
+ NameValuePairs response;
+ response = mConnection.search(DestDef.DEST_SERVER_ADMIN,
+ ScopeDef.SC_SUBSYSTEM,
+ new NameValuePairs());
+ if (response == null) {
+ throw new EAdminException("PROTOCOL_ERROR",false);
+ }
+ Debug.println("CMSUIFramework - getSubSystem() - completed");
+ return response;
+ }
+
+}
+
+/*
+//XXX TBD Read the SubSystem installation information
+//XXX from the SIE entry.
+class SIESubSystemLocator implements ISubSystemLocator {
+ public SubSystemInfo[] getInstalledSubSystem() {
+ }
+}
+*/
diff --git a/base/console/src/com/netscape/admin/certsrv/CellEditorData.java b/base/console/src/com/netscape/admin/certsrv/CellEditorData.java
new file mode 100644
index 000000000..4aeb9219a
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/CellEditorData.java
@@ -0,0 +1,32 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+/**
+ * Table Cell Editor Data Structure. Since we need to display different
+ * editor depending on serverside input. We will use this editor
+ * data to specify data and UI type
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv
+ */
+public class CellEditorData {
+ public Object mData;
+ public String mType;
+} \ No newline at end of file
diff --git a/base/console/src/com/netscape/admin/certsrv/Console.java b/base/console/src/com/netscape/admin/certsrv/Console.java
new file mode 100644
index 000000000..c9684583a
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/Console.java
@@ -0,0 +1,1861 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import java.io.*;
+import java.text.MessageFormat;
+import java.net.URL;
+import java.net.MalformedURLException;
+
+import javax.swing.*;
+import javax.swing.event.*;
+import javax.swing.border.*;
+
+import com.netscape.management.client.console.*;
+import com.netscape.management.nmclf.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.preferences.*;
+import com.netscape.management.client.components.*;
+import com.netscape.management.client.topology.*;
+import com.netscape.management.client.util.*;
+import com.netscape.management.client.cmd.*;
+import com.netscape.management.client.ug.*;
+import com.netscape.management.client.comm.*;
+
+import netscape.ldap.*;
+import netscape.ldap.util.DN;
+
+/**
+ * To start standard CS console, issue the following command
+ *
+ * /export/nkwan/s71/bin/base/jre/bin/java -ms8m -mx64m -cp .:./ldapjdk.jar:./base.jar:./jss3.jar:./mcc70_en.jar:./mcc70.jar:./nmclf70_en.jar:./nmclf70.jar:./jars/cms71.jar:./jars/cms71_en.jar -Djava.library.path=/export/nkwan/s71/lib/jss -Djava.util.prefs.systemRoot=/export/nkwan/s71/java/.java -Djava.util.prefs.userRoot=/export/nkwan/s71/java com.netscape.admin.certsrv.Console -D -s instanceID -a http://water:8200
+ *
+ */
+public class Console implements CommClient {
+ // Capture the time before any class is loaded so that we can measure JVM load time
+ static long _t0 = System.currentTimeMillis();
+
+ //
+ // preference information
+ //
+ public static final String IDENTIFIER = "Console";
+ public static final String VERSION = "4.0";
+ public static final String PREFERENCES_LOGIN =
+ IDENTIFIER + "." + VERSION + ".Login.preferences";
+
+ public static final String PREFERENCE_UID = "UserID";
+ public static final String PREFERENCE_REMEMBER_UID =
+ "Remember" + PREFERENCE_UID;
+ public static final String PREFERENCE_URL = "HostURL";
+ public static final String PREFERENCE_LOCAL = "StorePrefsToDisk";
+ public static final String PREFERENCE_X = "X";
+ public static final String PREFERENCE_Y = "Y";
+
+ public static final String OPTION_NOWINPOS = "nowinpos";
+ public static final String OPTION_NOLOGO = "nologo";
+ public static final String OPTION_JAVALAF = "javalaf";
+
+ public static final int MAX_RECENT_URLS = 5;
+
+ protected static final double MIN_CONTEXT_HELP_VERSION = 4.5;
+
+ //
+ // global values
+ //
+ public static Preferences _preferences;
+ public static ConsoleInfo _info;
+ public static String _consoleAdminURL;
+ public static ResourceSet _resource = new ResourceSet("com.netscape.management.client.console.console");
+
+ //
+ // private values
+ //
+ private String _adminServerSIE;
+ private JFrame _frame = null;
+ private com.netscape.management.client.console.SplashScreen _splashScreen = null;
+ private static boolean _showSplashScreen = true;
+ private static boolean _useJavaLookAndFeel = false;
+
+ // return valued from LDAPinitialization() method
+ private static final int LDAP_INIT_OK = 0;
+ private static final int LDAP_INIT_FAILED = 1;
+ private static final int LDAP_INIT_DS_RESTART = 2;
+ //user password expired, or removed on DS, but admin
+ //server still cached the user (user login before the
+ //passowrd expired, or invalid).
+ private static final int LDAP_INIT_BIND_FAIL = 3;
+
+ // A flag used by LDAPinitialization() to know whether to try to restart DS
+ // if ConsoleInfo.setLDAPConnection() has failed
+ private boolean _dsHasBeenRestarted = false;
+
+ // Track the version of the admin server
+ private String _adminVersion = null;
+
+ //
+ // check whether the preference file exist or not
+ //
+ static {
+ if (_preferences == null)
+ _preferences = new FilePreferences(PREFERENCES_LOGIN);
+ }
+
+ private static final boolean _isWindows =
+ System.getProperty("os.name").startsWith("Windows");
+
+ public static void loadFontPreferences() {
+ return;
+ }
+
+ /**
+ * common initialization routine.
+ *
+ * @param language language string. For example, "en" for english
+ */
+ protected static void common_init(String language) {
+ Locale.setDefault(
+ new Locale(language, Locale.getDefault().getCountry()));
+
+ try {
+
+ // bug 115085: init calls needs to be inside the try block as, on Unix, during
+ // initialization any call to java.awt.* will cause an exception to be thrown
+ // if Xserver is not accessable. The jvm prints correctly the error message about
+ // unaccessable Xserver but exception stack trace makes it less readable
+
+ if (_info == null)
+ _info = new ConsoleInfo();
+
+ PreferenceManager.setLocalStorageFlag(
+ _preferences.getBoolean(PREFERENCE_LOCAL, false));
+
+ if (!_useJavaLookAndFeel) {
+ SuiLookAndFeel nmclf = new SuiLookAndFeel();
+ UIManager.setLookAndFeel(nmclf);
+
+ // With JDK1.4 on Unix, the first instance of JFileChooser
+ // has an incorrect layout for some of the buttons. Create
+ // and discard an instance.
+ if (!_isWindows) {
+ Object o = new JFileChooser();
+ o = null;
+ }
+ }
+ FontFactory.initializeLFFonts(); // load default customized fonts for login/splash
+
+ } catch (InternalError ie) {
+ System.err.println("Console: " + ie.getMessage());
+ System.exit(1);
+ }
+ catch (Exception e) {
+ Debug.println("Console.common_init: Cannot init " + e);
+ }
+ }
+
+ /**
+ * return the console info object
+ *
+ * @return return the global console info object
+ */
+ public static ConsoleInfo getConsoleInfo() {
+ return _info;
+ }
+
+ /**
+ * set the global console info object.
+ *
+ * @param info consoleInfo object to be set as global console info
+ */
+ public static void setConsoleInfo(ConsoleInfo info) {
+ _info = info;
+ }
+
+ /**
+ * return whether the preferences is set or not
+ *
+ * @return true is the preference is set. false otherwise.
+ */
+ public static boolean canSetLocalPreferencesFlag() {
+ return (_preferences != null);
+ }
+
+ /**
+ * set the local preference flag
+ *
+ * @param b preference flag
+ */
+ public static void setLocalPreferencesFlag(boolean b) {
+ if (_preferences != null) {
+ _preferences.set(PREFERENCE_LOCAL, b);
+ _preferences.save();
+ }
+ }
+
+ /**
+ * return the local preference flag
+ *
+ * @return local preference flag
+ */
+ public static boolean getLocalPreferencesFlag() {
+ if (_preferences != null)
+ return _preferences.getBoolean(PREFERENCE_LOCAL);
+ return true;
+ }
+
+ /**
+ * by given the ldap connection and the server DN, it will find out the admin server for that server.
+ *
+ * @param ldc ldap connection
+ * @param serverDN dn of the server
+ * @return full URL of the admin server. It will return null if it cannot find uidthe admin server.
+ */
+ protected String getInstanceAdminURL(LDAPConnection ldc,
+ String serverDN) {
+ ServiceLocator sl = new ServiceLocator(_info);
+ String dn=null;
+ try {
+ String productDN =
+ serverDN.substring(serverDN.indexOf(',') + 1);
+ String ss40DN = productDN.substring(productDN.indexOf(',') + 1);
+ String adminServerDN = sl.getAdminServer(ss40DN);
+ if (adminServerDN == null) {
+ Debug.println(
+ "ERROR ConsoleInfo.getInstanceAdminURL: could not get admin server entry = " +
+ ss40DN);
+ return null;
+ }
+
+ String configDN = "cn=configuration," + adminServerDN;
+ LDAPEntry configEntry = ldc.read(dn=configDN);
+ if (configEntry == null) {
+ Debug.println(
+ "ERROR ConsoleInfo.getInstanceAdminURL: could not get admin server config entry = " +
+ configDN);
+ return null;
+ }
+
+ String host = LDAPUtil.flatting(
+ configEntry.getAttribute("nsserveraddress"));
+ String port = LDAPUtil.flatting(
+ configEntry.getAttribute("nsServerport"));
+ boolean securityOn = (LDAPUtil.flatting(
+ configEntry.getAttribute("nsServersecurity"))).
+ equalsIgnoreCase("on");
+
+ /*
+ * nsserveraddress might not be defined, which means that the
+ * admin server should listen on all interfaces rather than on
+ * a specific one. Read serverhostname from the SIE entry.
+ */
+ if (host == null || host.trim().length() == 0) {
+ LDAPEntry sieEntry = ldc.read(dn=adminServerDN, new String[] {"serverhostname"});
+ if (sieEntry == null) {
+ Debug.println("ERROR Console.getInstanceAdminURL: " +
+ "could not get serverhostname from " + adminServerDN);
+ return null;
+ }
+ host = LDAPUtil.flatting(sieEntry.getAttribute("serverhostname"));
+ }
+
+ String url = "http";
+ if (securityOn) {
+ url = url + "s";
+ }
+ url = url + "://" + host + ":" + port + "/";
+ return url;
+ } catch (LDAPException e) {
+ Debug.println("ERROR Console.getInstanceAdminURL: " +
+ "LDAP error " + e + " dn=" + dn);
+ }
+ return null;
+ }
+
+ /**
+ * get the OS type of the admin server.
+ *
+ * @param ldc ldap connection
+ * @param serverDN DN of the admin server
+ * @return os type of the admin server
+ */
+ protected String getInstanceAdminOS(LDAPConnection ldc,
+ String serverDN) {
+ try {
+ String productDN =
+ serverDN.substring(serverDN.indexOf(',') + 1);
+ String ss40DN = productDN.substring(productDN.indexOf(',') + 1);
+ String hostDN = ss40DN.substring(ss40DN.indexOf(',') + 1);
+
+ LDAPEntry hostEntry = ldc.read(hostDN);
+ if (hostEntry == null) {
+ Debug.println(
+ "ERROR ConsoleInfo.getInstanceAdminOS: could not get host entry = " +
+ hostDN);
+ return null;
+ }
+
+ String osVersion = LDAPUtil.flatting(
+ hostEntry.getAttribute("nsosversion",
+ LDAPUtil.getLDAPAttributeLocale()));
+ return osVersion;
+ } catch (LDAPException e) {
+ Debug.println(
+ "ERROR ConsoleInfo.getInstanceAdminOS: LDAP error " + e);
+ }
+ return null;
+ }
+
+ /**
+ * A helper method to find an SIE DN from its ID. See -s Console option.
+ * Called by createPerInstanceUI().
+ */
+ private String serverIDtoDN(String id) {
+
+ LDAPConnection ldc = _info.getLDAPConnection();
+ Vector instances = new Vector();
+
+ try {
+ LDAPSearchResults res = ldc.search(
+ "o=netscapeRoot",
+ LDAPConnection.SCOPE_SUB,
+ "(nsServerID=" + id + ")",
+ new String[]{"dn"}, false);
+
+ while (res.hasMoreElements()) {
+ LDAPEntry hostEntry = res.next();
+ instances.addElement(hostEntry.getDN());
+ }
+
+ if (instances.size() == 0) {
+ System.err.println("Server instance " + id + " does not exist.");
+ System.exit(0);
+ }
+ else if (instances.size() == 1) {
+ id = (String) instances.elementAt(0);
+ }
+ else {
+
+ if (_splashScreen != null) {
+ _splashScreen.setVisible(false);
+ }
+
+ int idx = -1;
+ while (idx == -1) {
+ System.out.println("\nThere are multiple instances of server \"" + id + "\":\n");
+ for (int i=0; i < instances.size(); i++) {
+ System.out.println( (i+1) + ") " + instances.elementAt(i));
+ }
+ System.out.print("\nPlease select an instance form the above list [1]: ");
+ try {
+ String rsp = new BufferedReader(new InputStreamReader(System.in)).readLine();
+ if (rsp.length() == 0) {
+ idx = 1;
+ }
+ else {
+ try {
+ idx = Integer.parseInt(rsp);
+ }
+ catch (Exception ignore) {}
+ }
+
+ if (idx >=1 && idx <= instances.size()) {
+ idx = idx - 1;
+ }
+ else {
+ idx = -1;
+ }
+ }
+ catch (Exception e) {
+ break;
+ }
+ }
+ id = (String) instances.elementAt(idx);
+ }
+ }
+ catch (Exception e) {
+ if (Debug.isEnabled()) {
+ e.printStackTrace();
+ }
+ }
+ return id;
+ }
+
+ protected void createPerInstanceUI(String host) {
+
+ if (!DN.isDN(host)) {
+ host = serverIDtoDN(host);
+ }
+
+ LDAPConnection ldc = _info.getLDAPConnection();
+ String configDN = "cn=configuration," + host;
+ try {
+ LDAPEntry configEntry = ldc.read(configDN);
+ String className = LDAPUtil.flatting(
+ configEntry.getAttribute("nsclassname",
+ LDAPUtil.getLDAPAttributeLocale()));
+ if (className == null) {
+ Debug.println(
+ "ERROR Console: no 'nsclassname' attribute in " +
+ configDN);
+ System.exit(0);
+ }
+
+ String adminURL = getInstanceAdminURL(ldc, host);
+ if (adminURL == null) {
+ Debug.println(
+ "ERROR Console: could not set the adminURL for " +
+ host);
+ } else {
+ _info.setAdminURL(adminURL);
+ }
+
+ String adminOS = getInstanceAdminOS(ldc, host);
+ if (adminOS == null) {
+ Debug.println(
+ "ERROR Console.constructor: could not set the adminOS for " +
+ host);
+ } else {
+ _info.setAdminOS(adminOS);
+ }
+ _info.setCurrentDN(host);
+
+ Class c = ClassLoaderUtil.getClass(_info, className);
+ if (c == null) {
+ Debug.println(
+ "ERROR Console.constructor: could not get class " +
+ className);
+ System.exit(0);
+ }
+
+ try {
+ Hashtable topologyplugin =
+ TopologyInitializer.getTopologyPluginFromDS( _info);
+ Enumeration ePlugins = topologyplugin.elements();
+ while (ePlugins.hasMoreElements()) {
+ ITopologyPlugin plugin =
+ (ITopologyPlugin) ePlugins.nextElement();
+ ResourceObject resObj =
+ plugin.getResourceObjectByID(host);
+ if (resObj != null) {
+ if (resObj instanceof ServerNode) {
+
+ ServerNode srvNode = ((ServerNode) resObj);
+ IServerObject srvObj = null;
+
+ // ServerNode is loaded asynchronously
+ srvNode.reload();
+ while ((srvObj=srvNode.getServerObject()) == null) {
+ try { Thread.sleep(200); } catch (Exception e) {}
+ }
+ IResourceObject sel[] = new IResourceObject[1];
+ sel[0] = srvObj;
+ srvObj.run((IPage) null, sel);
+ return;
+ } else if (resObj instanceof ServerNode) {
+ }
+ }
+ }
+ Debug.println("ERROR Console.constructor: cannot find associated plugin for "+
+ host);
+ } catch (Exception e) {
+ if (Debug.isEnabled()) {
+ e.printStackTrace();
+ }
+ Debug.println(
+ "ERROR Console.constructor: could not create " +
+ className);
+ Debug.println(" Exception: " + e);
+ }
+ } catch (LDAPException e) {
+ if (Debug.isEnabled()) {
+ e.printStackTrace();
+ }
+ Debug.println("ERROR Console.constructor: createServerInstance failed");
+ Debug.println(" LDAPException: " + e);
+ }
+ System.exit(0);
+ }
+
+ public Console(String adminURL, String localAdminURL, String language, String host, String uid, String passwd) {
+ Vector recentURLs = new Vector();
+ String lastUsedURL;
+ common_init(language);
+ String userid = uid;
+ String password = passwd;
+
+ if (userid == null) {
+ userid = _preferences.getString(PREFERENCE_UID);
+ }
+
+ lastUsedURL = _preferences.getString(PREFERENCE_URL);
+ if(lastUsedURL != null) {
+ recentURLs.addElement(lastUsedURL);
+ if(adminURL == null) {
+ adminURL = lastUsedURL;
+ }
+ }
+
+ if(adminURL == null) {
+ adminURL = localAdminURL;
+ }
+
+ for(int count = 1; count < MAX_RECENT_URLS; count++) {
+ String temp;
+ temp = _preferences.getString(PREFERENCE_URL+Integer.toString(count));
+ if(temp != null && temp.length() > 0)
+ recentURLs.addElement(temp);
+ }
+
+ _frame = new JFrame();
+ // Set the icon image so that login dialog will inherit it
+ _frame.setIconImage( new RemoteImage("com/netscape/management/client/images/logo16.gif").getImage());
+
+ ModalDialogUtil.setWindowLocation(_frame);
+
+ //enable server auth
+ UtilConsoleGlobals.setServerAuthEnabled(true);
+
+ _splashScreen = new com.netscape.management.client.console.SplashScreen(_frame);
+ _splashScreen.addWindowListener (new WindowAdapter() {
+ public void windowClosing(WindowEvent e) {
+ System.exit(0);
+ }
+ }
+ );
+ if (_showSplashScreen)
+ _splashScreen.showWindow();
+
+ boolean fSecondTry = false;
+
+ while (true) {
+ LoginDialog dialog = null;
+
+ _splashScreen.setStatusText(_resource.getString("splash","PleaseLogin"));
+ _splashScreen.setCursor(
+ Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+ if ((adminURL == null) || (userid == null) ||
+ (password == null) || (fSecondTry)) {
+ dialog = new LoginDialog(_frame, userid, adminURL, recentURLs);
+ Dimension paneSize = dialog.getSize();
+ Dimension screenSize = dialog.getToolkit().getScreenSize();
+ int centerX = (screenSize.width - paneSize.width) / 2;
+ int centerY = (screenSize.height - paneSize.height) / 2;
+ int x = _preferences.getInt(PREFERENCE_X, centerX);
+ int y = _preferences.getInt(PREFERENCE_Y, centerY);
+ UtilConsoleGlobals.setAdminURL(adminURL);
+ UtilConsoleGlobals.setAdminHelpURL(adminURL);
+ dialog.setInitialLocation(x, y);
+ _splashScreen.setCursor(
+ Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ dialog.showModal();
+ if (dialog.isCancel())
+ System.exit(0);
+ _splashScreen.setCursor(
+ Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+
+ userid = dialog.getUsername();
+ adminURL = dialog.getURL();
+ if(!adminURL.startsWith("http://") && !adminURL.startsWith("https://"))
+ adminURL = "http://" + adminURL;
+ password = dialog.getPassword();
+ }
+ fSecondTry = true;
+ UtilConsoleGlobals.setAdminURL(adminURL);
+ UtilConsoleGlobals.setAdminHelpURL(adminURL);
+ _consoleAdminURL = adminURL;
+
+ _splashScreen.setStatusText( MessageFormat.format(_resource.getString("splash", "authenticate"), new Object[]{ userid}));
+
+ if (authenticate_user(adminURL, _info, userid, password)) {
+ _splashScreen.setStatusText(
+ _resource.getString("splash","initializing"));
+
+ /**
+ * Initialize ldap. In the case config DS is down, the user can restart
+ * the DS from the Console. The Console will need to re-authenticate
+ * the user if that's the case.
+ */
+ int ldapInitResult = LDAPinitialization(_info);
+ if (ldapInitResult == LDAP_INIT_FAILED) {
+ Debug.println("Console: LDAPinitialization() failed.");
+ System.exit(1);
+ } else if (ldapInitResult == LDAP_INIT_DS_RESTART) {
+ Debug.println("Console: LDAPinitialization() DS restarted.");
+
+ // Need to re-authenticate the user
+ _splashScreen.setStatusText( MessageFormat.format(_resource.getString("splash", "authenticate"), new Object[]{ userid}));
+ if (authenticate_user(adminURL, _info, userid,
+ password)) {
+ _splashScreen.setStatusText(
+ _resource.getString("splash","initializing"));
+ if (LDAPinitialization(_info) == LDAP_INIT_FAILED) {
+ Debug.println("Console: LDAPinitialization() failed.");
+ System.exit(1);
+ }
+ } else {
+ continue; // Autentication faled, try again
+ }
+ } else if (ldapInitResult == LDAP_INIT_BIND_FAIL) {
+ continue;
+ }
+
+ boolean rememberUserid = _preferences.getBoolean(
+ PREFERENCE_REMEMBER_UID, true);
+ if (rememberUserid) {
+ _preferences.set(PREFERENCE_UID, userid);
+ _preferences.set(PREFERENCE_URL, adminURL);
+
+ String recentlyUsedURL;
+ int count = 1;
+ Enumeration urlEnum = recentURLs.elements();
+ while (urlEnum.hasMoreElements()) {
+ recentlyUsedURL = (String)urlEnum.nextElement();
+ if(!recentlyUsedURL.equals(adminURL))
+ _preferences.set(PREFERENCE_URL+Integer.toString(count++), recentlyUsedURL);
+ }
+
+ for(; count < MAX_RECENT_URLS; count++) {
+ _preferences.remove(PREFERENCE_URL+Integer.toString(count));
+ }
+
+ if (dialog != null) {
+ Point p = dialog.getLocation();
+ _preferences.set(PREFERENCE_X, p.x);
+ _preferences.set(PREFERENCE_Y, p.y);
+ dialog.dispose();
+ dialog = null;
+ }
+ _preferences.save();
+ }
+
+ initialize(_info);
+ if (host == null) {
+ Framework framework = createTopologyFrame();
+ UtilConsoleGlobals.setRootFrame(framework.getJFrame());
+ } else {
+ // popup the per server configuration UI
+ // first get the java class name
+ createPerInstanceUI(host);
+ }
+
+ _frame.dispose();
+ _splashScreen.dispose();
+ com.netscape.management.client.console.SplashScreen.removeInstance();
+ _splashScreen = null;
+
+ break;
+ }
+ }
+ }
+
+ static public Framework createTopologyFrame() {
+ if (_info != null) {
+ TopologyInitializer initializer = new TopologyInitializer(_info);
+ Framework f = new Framework(initializer);
+ UtilConsoleGlobals.setRootTopologyFrame(f.getJFrame());
+ return f;
+ }
+ return null;
+ }
+
+ public void setDomainSuffix(String adminServerSIE) {
+ String location = "";
+ if (adminServerSIE != null) {
+ String temp = adminServerSIE;
+ int index = 0;
+ for (int i = 0; i < 4; i++) {
+ index = temp.indexOf(',',index);
+ index++;
+ }
+ location = temp.substring(index);
+ LDAPUtil.setInstalledSoftwareDN(location);
+ }
+ }
+
+ /**
+ * get the user and group information.
+ *
+ * @param info console info
+ */
+ public void initialize(ConsoleInfo info) {
+ setDomainSuffix(_adminServerSIE);
+
+ LDAPConnection ldc = _info.getLDAPConnection();
+
+ if (ldc != null) {
+ String sName;
+ String sValue;
+ int iFirstQuote;
+ int iSecondQuote;
+ int iThirdQuote;
+ int iFourthQuote;
+ LDAPAttribute attribute;
+ Enumeration eAttributes;
+ String ldapLocation = "";
+ LDAPEntry entry;
+ LDAPSearchResults result;
+ LDAPSearchConstraints cons;
+
+ // get default object classes container
+ try {
+ ldapLocation = "cn=user, cn=DefaultObjectClassesContainer,"+
+ LDAPUtil.getAdminGlobalParameterEntry();
+ entry = ldc.read(ldapLocation);
+ if (entry != null) {
+ // get the new user / group class information
+ attribute = entry.getAttribute("nsDefaultObjectClass",
+ LDAPUtil.getLDAPAttributeLocale());
+
+ if (attribute != null) {
+ Vector vUserObjectClasses = new Vector();
+ eAttributes = attribute.getStringValues();
+ while (eAttributes.hasMoreElements()) {
+ String sUserObjectClass =
+ (String) eAttributes.nextElement();
+ vUserObjectClasses.addElement(
+ sUserObjectClass);
+ }
+
+ ResourceEditor.getNewObjectClasses().put(
+ ResourceEditor.KEY_NEW_USER_OBJECTCLASSES,
+ vUserObjectClasses);
+ }
+ }
+ } catch (LDAPException e) {
+ Debug.println("Console: Cannot open: "+ldapLocation);
+ }
+ if (ResourceEditor.getNewObjectClasses().get(
+ ResourceEditor.KEY_NEW_USER_OBJECTCLASSES) == null) {
+ Vector vObject = new Vector();
+ vObject.addElement("top");
+ vObject.addElement("person");
+ vObject.addElement("organizationalPerson");
+ vObject.addElement("inetorgperson");
+ ResourceEditor.getNewObjectClasses().put(
+ ResourceEditor.KEY_NEW_USER_OBJECTCLASSES, vObject);
+ }
+
+ try {
+ ldapLocation =
+ "cn=group, cn=DefaultObjectClassesContainer,"+
+ LDAPUtil.getAdminGlobalParameterEntry();
+ entry = ldc.read(ldapLocation);
+ if (entry != null) {
+ attribute = entry.getAttribute("nsDefaultObjectClass",
+ LDAPUtil.getLDAPAttributeLocale());
+
+ if (attribute != null) {
+ Vector vGroupObjectClasses = new Vector();
+ eAttributes = attribute.getStringValues();
+ while (eAttributes.hasMoreElements()) {
+ String sGroupObjectClass =
+ (String) eAttributes.nextElement();
+ vGroupObjectClasses.addElement(
+ sGroupObjectClass);
+ }
+
+ ResourceEditor.getNewObjectClasses().put(
+ ResourceEditor.KEY_NEW_GROUP_OBJECTCLASSES,
+ vGroupObjectClasses);
+ }
+ }
+ } catch (LDAPException e) {
+ Debug.println("Console: Cannot open "+ldapLocation);
+ }
+ if (ResourceEditor.getNewObjectClasses().get(
+ ResourceEditor.KEY_NEW_GROUP_OBJECTCLASSES) == null) {
+ Vector vObject = new Vector();
+ vObject.addElement("top");
+ vObject.addElement("groupofuniquenames");
+ ResourceEditor.getNewObjectClasses().put(
+ ResourceEditor.KEY_NEW_GROUP_OBJECTCLASSES,
+ vObject);
+ }
+
+ try {
+ ldapLocation = "cn=OU, cn=DefaultObjectClassesContainer,"+
+ LDAPUtil.getAdminGlobalParameterEntry();
+ entry = ldc.read(ldapLocation);
+ if (entry != null) {
+ attribute = entry.getAttribute("nsDefaultObjectClass",
+ LDAPUtil.getLDAPAttributeLocale());
+
+ if (attribute != null) {
+ Vector vOUObjectClasses = new Vector();
+ eAttributes = attribute.getStringValues();
+ while (eAttributes.hasMoreElements()) {
+ String sOUObjectClass =
+ (String) eAttributes.nextElement();
+ vOUObjectClasses.addElement(sOUObjectClass);
+ }
+
+ ResourceEditor.getNewObjectClasses().put(
+ ResourceEditor.KEY_NEW_OU_OBJECTCLASSES,
+ vOUObjectClasses);
+ }
+ }
+ } catch (LDAPException e) {
+ Debug.println("Console: Cannot open "+ldapLocation);
+ }
+ if (ResourceEditor.getNewObjectClasses().get(
+ ResourceEditor.KEY_NEW_OU_OBJECTCLASSES) == null) {
+ Vector vObject = new Vector();
+ vObject.addElement("top");
+ vObject.addElement("organizationalunit");
+ ResourceEditor.getNewObjectClasses().put(
+ ResourceEditor.KEY_NEW_OU_OBJECTCLASSES, vObject);
+ }
+
+ try {
+ cons = ldc.getSearchConstraints();
+ cons.setBatchSize(1);
+ // then get the resource editor extension
+ ldapLocation = "cn=ResourceEditorExtension,"+
+ LDAPUtil.getAdminGlobalParameterEntry();
+ result = ldc.search(ldapLocation,
+ LDAPConnection.SCOPE_ONE, "(Objectclass=nsAdminResourceEditorExtension)",
+ null, false, cons);
+ Hashtable hResourceEditorExtension = new Hashtable();
+ Hashtable deleteResourceEditorExtension = new Hashtable();
+
+ if (result != null) {
+ while (result.hasMoreElements()) {
+ LDAPEntry ExtensionEntry;
+ try {
+ ExtensionEntry = (LDAPEntry) result.next();
+ } catch (Exception e) {
+ // ldap exception
+ continue;
+ }
+
+ attribute = ExtensionEntry.getAttribute("cn",
+ LDAPUtil.getLDAPAttributeLocale());
+ Enumeration eValues = attribute.getStringValues();
+ String sCN = "";
+ while (eValues.hasMoreElements()) {
+ sCN = (String) eValues.nextElement(); // Take the first CN
+ break;
+ }
+
+ attribute =
+ ExtensionEntry.getAttribute("nsClassname",
+ LDAPUtil.getLDAPAttributeLocale());
+ if (attribute != null) {
+ eValues = attribute.getStringValues();
+ Vector vClass = new Vector();
+ while (eValues.hasMoreElements()) {
+ String sJarClassName =
+ (String) eValues.nextElement();
+ Class c = ClassLoaderUtil.getClass(
+ _info, sJarClassName);
+
+ if (c != null) {
+ vClass.addElement(c);
+ }
+ }
+ hResourceEditorExtension.put(
+ sCN.toLowerCase(), vClass);
+ }
+
+ attribute =
+ ExtensionEntry.getAttribute("nsDeleteClassname",
+ LDAPUtil.getLDAPAttributeLocale());
+ if (attribute != null) {
+ Enumeration deleteClasses =
+ attribute.getStringValues();
+ Vector deleteClassesVector = new Vector();
+ while (deleteClasses.hasMoreElements()) {
+ String jarClassname = (String)
+ deleteClasses.nextElement();
+ Class c = ClassLoaderUtil.getClass(
+ _info, jarClassname);
+ if (c != null) {
+ deleteClassesVector.addElement(c);
+ }
+ }
+ deleteResourceEditorExtension.put(
+ sCN.toLowerCase(), deleteClassesVector);
+ }
+ }
+ ResourceEditor.setResourceEditorExtension(
+ hResourceEditorExtension);
+ ResourceEditor.setDeleteResourceEditorExtension(
+ deleteResourceEditorExtension);
+ }
+
+ // set up resource editor attribute
+ ResourceEditor.setUniqueAttribute(
+ LDAPUtil.getUniqueAttribute(
+ _info.getLDAPConnection(),
+ LDAPUtil.getCommonGlobalParameterEntry()));
+
+ String sLocation = LDAPUtil.getCommonGlobalParameterEntry();
+ entry = ldc.read(sLocation);
+
+ if (entry != null) {
+ attribute = entry.getAttribute("nsUserRDNComponent");
+ String sAttribute = LDAPUtil.flatting(attribute);
+ ResourceEditor.setUserRDNComponent(sAttribute);
+ attribute = entry.getAttribute("nsUserIDFormat");
+ sAttribute = LDAPUtil.flatting(attribute);
+ ResourceEditor.setUserIDFormat(sAttribute);
+ attribute = entry.getAttribute("nsGroupRDNComponent");
+ sAttribute = LDAPUtil.flatting(attribute);
+ ResourceEditor.setGroupRDNComponent(sAttribute);
+ }
+
+ ResourceEditor.setAccountPlugin(
+ buildAccountPluginHashtable());
+
+
+ }
+ catch (LDAPException e) {
+ Debug.println("Console: Cannot open "+ldapLocation);
+ }
+
+ // this *should* already be created at install time, but just in case
+ // note: if this entry is created here, then ACIs (for non-admins) will break
+ String userPreferenceDN = LDAPUtil.createEntry(ldc,
+ LDAPUtil.getUserPreferenceOU(),
+ LDAPUtil.getInstalledSoftwareDN());
+ userPreferenceDN = LDAPUtil.createEntry(ldc,
+ "\""+_info.getAuthenticationDN() + "\"",
+ userPreferenceDN, true);
+ _info.setUserPreferenceDN(userPreferenceDN);
+ }
+ checkHelpSystem();
+ }
+
+ /**
+ * Check if the Admin Server version supports context-sensitive
+ * Help. That is the case if the version is greater than 4.2.
+ */
+ protected void checkHelpSystem() {
+ boolean hasContextHelp = false;
+ if ( _adminVersion != null ) {
+ hasContextHelp = ( Double.parseDouble( _adminVersion ) >=
+ MIN_CONTEXT_HELP_VERSION );
+ Debug.println( "Console.checkHelpSystem: contextHelp=" +
+ hasContextHelp );
+ } else {
+ Debug.println( "Console.checkHelpSystem: cannot determine " +
+ "Admin Version" );
+ }
+ UtilConsoleGlobals.setContextHelpEnabled( hasContextHelp );
+ }
+
+ /**
+ * build up the resource editor extension plugin.
+ *
+ * @return hashtable which contain all the resource editor plugin.
+ */
+ private Hashtable buildAccountPluginHashtable() {
+ Hashtable HTAccountPlugin = new Hashtable();
+ try {
+ LDAPConnection ldc = _info.getLDAPConnection();
+ String sExtension = "cn=ResourceEditorExtension, "+
+ LDAPUtil.getAdminGlobalParameterEntry();
+ String reqAttrs[] = {"cn","nsadminaccountInfo"};
+ LDAPSearchResults results =
+ ldc.search(sExtension, LDAPConnection.SCOPE_ONE, "(nsadminaccountInfo=*)",
+ reqAttrs, false);
+ if (results != null) {
+ while (results.hasMoreElements()) {
+ LDAPEntry entry;
+ try {
+ entry = (LDAPEntry) results.next();
+ } catch (Exception e) {
+ // ldap exception
+ continue;
+ }
+ LDAPAttributeSet entryAttrs = entry.getAttributeSet();
+ Enumeration attrsInSet = entryAttrs.getAttributes();
+ String sName = "";
+ Vector vJavaClass = new Vector();
+ while (attrsInSet.hasMoreElements()) {
+ LDAPAttribute nextAttr =
+ (LDAPAttribute) attrsInSet.nextElement();
+ if (nextAttr.getName().equalsIgnoreCase("cn")) {
+ sName = LDAPUtil.flatting(
+ nextAttr.getStringValues());
+ } else if (
+ nextAttr.getName().equalsIgnoreCase("nsadminaccountInfo")) {
+ String sJavaClass = LDAPUtil.flatting(
+ nextAttr.getStringValues());
+ // parse it
+ // assume it is in [xxx][xxx].. format
+ boolean fFinish = false;
+ do {
+ int iOpenBucket = sJavaClass.indexOf('[');
+ if (iOpenBucket < 0) {
+ fFinish = true;
+ } else {
+ int iCloseBucket =
+ sJavaClass.indexOf(']',
+ iOpenBucket + 1);
+ String sClassString =
+ sJavaClass.substring(
+ iOpenBucket + 1, iCloseBucket);
+ vJavaClass.addElement(sClassString);
+ sJavaClass = sJavaClass.substring(
+ iCloseBucket + 1);
+ }
+ } while (!fFinish)
+ ;
+ }
+ }
+ if (sName != null) {
+ HTAccountPlugin.put(sName.toLowerCase(),
+ vJavaClass);
+ }
+ }
+ }
+ } catch (LDAPException e) {
+ Debug.println("Console.buildAccountPluginHashtable: ResEditorAccountPage LDAP Exception: "+e);
+ }
+ return HTAccountPlugin;
+ }
+
+
+ /**
+ * New authentication method, via CGI. Authenticate the user through the admin server CGI.
+ *
+ * @param adminServerURL url of the admin server
+ * @param info console info
+ * @param user user dn
+ * @param pw user password
+ * @return true if successful. false otherwise.
+ */
+ private synchronized final boolean authenticate_user(
+ String adminServerURL, ConsoleInfo info, String user,
+ String pw) {
+ URL url;
+
+ try {
+ // DT 5/14/98 This method of URL construction provides some limited
+ // validation of the URL, and eliminates any preexisting uri component.
+ url = new URL(new URL(adminServerURL), "/admin-serv/authenticate");
+ } catch (MalformedURLException mue) {
+ Debug.println("Console:authenticate_user():Unable to create authentication URL");
+ return false;
+ }
+
+ Hashtable ht = new Hashtable();
+
+ boolean successfulAuth = invoke_task(url, user, pw, ht);
+
+ String param;
+
+ // DT 6/29/98 Check Password Expiration data
+ if ((param = (String)(ht.get("NW_PASSWD_EXPIRING"))) != null) {
+ int secondsToExpiration = Integer.parseInt(param);
+
+ if (secondsToExpiration == 0) {
+ // Password expired. For now, show error and exit.
+ // Later, this should jump to a UI.
+ String msg = _resource.getString("error","pwExpired");
+ System.err.println(msg);
+ JOptionPane.showMessageDialog(
+ com.netscape.management.client.console.SplashScreen.getInstance(), msg,
+ _resource.getString("error","pwTitle"),
+ JOptionPane.ERROR_MESSAGE);
+ ModalDialogUtil.sleep();
+ System.exit(1);
+ } else {
+ double days = (secondsToExpiration / (1.0 * 3600 * 24));
+ String msg = MessageFormat.format(
+ _resource.getString("warning","pwExpireSoon"),
+ new Object[]{ new Double(days)});
+ Debug.println("Console: " + msg);
+ JOptionPane.showMessageDialog(
+ com.netscape.management.client.console.SplashScreen.getInstance(), msg,
+ _resource.getString("warning","title"),
+ JOptionPane.ERROR_MESSAGE);
+ ModalDialogUtil.sleep();
+ }
+ }
+
+ if (!successfulAuth)
+ return false;
+
+ if ((param = (String)(ht.get("UserDN"))) != null)
+ info.setAuthenticationDN(param);
+ else {
+ Debug.println("Console:authenticate_user():UserDN not found");
+ info.setAuthenticationDN(user);
+ }
+
+ info.setAuthenticationPassword(pw);
+ info.setAuthenticationValues(ht);
+
+ return true;
+ }
+
+ /**
+ * return the directory server
+ *
+ * @param user username
+ * @param pw password
+ * @param baseURL url of the admin server
+ * @return true if successful. false otherwise.
+ */
+ protected boolean restartDirectoryServer(String user, String pw,
+ String baseURL) {
+ URL url;
+
+ try {
+ // DT 5/14/98 This method of URL construction provides some limited
+ // validation of the URL, and eliminates any preexisting uri component.
+ url = new URL(new URL(baseURL), "/admin-serv/tasks/operation/StartConfigDS");
+ } catch (MalformedURLException mue) {
+ Debug.println("Console:restartDirectoryServer():Unable to create start task URL");
+ return false;
+ }
+
+ return invoke_task(url, user, pw, new Hashtable());
+ }
+
+ /**
+ * invoking a task
+ *
+ * @param url URL of the task
+ * @param user username
+ * @param pw password
+ * @param ht hashtable which contain the returned result
+ * @return true if successful. false otherwise.
+ */
+
+ private synchronized final boolean invoke_task(URL url,
+ String user, String pw, Hashtable ht) {
+ HttpManager h = new HttpManager();
+
+ InputStream is;
+ Response r;
+ Exception e = null;
+
+ try {
+ h.get(url, this, r = new Response(user, pw),
+ h.FORCE_BASIC_AUTH);
+ } catch (Exception ioe) {
+ String _url;
+ try {
+ _url = (new URL(url, "/")).toString();
+ } catch (MalformedURLException mue) {
+ _url = url.toString();
+ }
+
+ String msg = MessageFormat.format(
+ _resource.getString("error","connectAS"),
+ new Object[]{ _url});
+ JOptionPane.showMessageDialog(com.netscape.management.client.console.SplashScreen.getInstance(),
+ msg, _resource.getString("error","title"),
+ JOptionPane.ERROR_MESSAGE);
+ ModalDialogUtil.sleep();
+
+ return false;
+ }
+
+ try {
+ while (((is = r.getInputStream()) == null) &&
+ ((e = r.getError()) == null))
+ wait();
+ } catch (InterruptedException ie) {
+ Debug.println("Console:invoke_task():task response interrupted");
+ return false;
+ }
+
+ if (e != null) {
+ String msg = MessageFormat.format(
+ _resource.getString("error","task"),
+ new Object[]{ e.toString()});
+ JOptionPane.showMessageDialog(com.netscape.management.client.console.SplashScreen.getInstance(),
+ msg, _resource.getString("error","title"),
+ JOptionPane.ERROR_MESSAGE);
+ ModalDialogUtil.sleep();
+
+ if (!(e instanceof HttpException))
+ Debug.println("Console:invoke_task():error:" + e);
+ return false;
+ }
+
+ // parse response
+ BufferedReader br;
+ try {
+ br = new BufferedReader(new InputStreamReader(is, "UTF8"));
+ } catch (Exception ioe) {
+ br = new BufferedReader(new InputStreamReader(is));
+ Debug.println("Console:BufferedReader(UTF8) Error");
+ }
+
+ try {
+ String line;
+
+ while ((line = br.readLine()) != null) {
+ int i = line.indexOf(':');
+
+ if (i == -1)
+ continue;
+
+ // each line is of the form "name: value" (note spacing)
+ ht.put(line.substring(0, i), line.substring(i + 2));
+ }
+ } catch (Exception e2) {
+ }
+
+ String status = (String)(ht.get("NMC_Status"));
+
+ if ((status == null) || (Integer.parseInt(status) != 0)) {
+ Debug.println("Console:invoke_task():invocation failed");
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * initialize the ldap connection according to all the information. If the directory server is
+ * not running, try to start the directory server.
+ *
+ * @param info ConsoleInfo which store the global information.
+ * @return true if successfull. false otherwise.
+ */
+ private final int LDAPinitialization(ConsoleInfo info) {
+ // Set DS information;
+
+ Hashtable ht = _info.getAuthenticationValues();
+
+ String param;
+
+ // set up configuration data base information
+
+ if ((param = (String)(ht.get("SIE"))) != null)
+ _adminServerSIE = param;
+ else
+ Debug.println("Console:authenticate_user():SIE not found");
+
+ if ((param = (String)(ht.get("ldapHost"))) != null)
+ info.setHost(param);
+ else
+ Debug.println("Console:authenticate_user():ldapHost not found");
+
+ if ((param = (String)(ht.get("ldapPort"))) != null)
+ info.setPort(Integer.parseInt(param));
+ else
+ Debug.println("Console:authenticate_user():ldapPort not found");
+
+ if ((param = (String)(ht.get("ldapBaseDN"))) != null)
+ info.setBaseDN(param);
+ else
+ Debug.println("Console:authenticate_user():ldapBaseDN not found");
+
+ param = (String)(ht.get("ldapSecurity"));
+ boolean fLdapSecurity = false;
+ if ((param != null) && (param.equals("on"))) {
+ info.put("ldapSecurity","on");
+ fLdapSecurity = true;
+ } else {
+ info.put("ldapSecurity","off");
+ }
+
+ // Need to open an LDAPConnection for the ConsoleInfo object.
+
+ try {
+ LDAPConnection ldapConnection = createLDAPConnection(info);
+ if (ldapConnection == null) {
+ return LDAP_INIT_BIND_FAIL;
+ }
+ info.setLDAPConnection(ldapConnection);
+
+ } catch (LDAPException le) {
+
+ // DT 5/19/98 Prompt user to restart the registry DS if ldc.connect() failed
+ String dsURL = (fLdapSecurity ? "ldaps" : "ldap") + "://" +
+ info.getHost() + ":" + info.getPort();
+ String msg = MessageFormat.format(
+ _resource.getString("error","connectDS"),
+ new Object[]{dsURL, le.getMessage()});
+ Debug.println("Console:authenticate_user():" + msg);
+
+
+ if (_dsHasBeenRestarted) {
+ // DS has already been restarted, return an error
+ JOptionPane.showMessageDialog(
+ com.netscape.management.client.console.SplashScreen.getInstance(), msg,
+ _resource.getString("error","title"),
+ JOptionPane.ERROR_MESSAGE);
+ ModalDialogUtil.sleep();
+ return LDAP_INIT_FAILED;
+ }
+
+ Object[] choices = { _resource.getString("error", "restartDSButton"),
+ _resource.getString("error", "cancelButton")};
+ Object[] msgs = { msg, " ",
+ _resource.getString("error", "restartDSMessage"), " "};
+
+ int selection = JOptionPane.showOptionDialog(
+ com.netscape.management.client.console.SplashScreen.getInstance(), msgs,
+ _resource.getString("error","inittitle"),
+ JOptionPane.DEFAULT_OPTION,
+ JOptionPane.QUESTION_MESSAGE, null, choices,
+ choices[0]);
+
+ if (selection == 1)
+ System.exit(1); // cancel
+
+ // Pop a new login dialog, but this is for the Registry DS AS
+
+/*
+ RestartDialog rd = new RestartDialog(_frame);
+ rd.setDialogLocation(_frame);
+ rd.showModal();
+ if (rd.isCancel())
+ System.exit(0);
+ _splashScreen.toFront();
+
+ if (!restartDirectoryServer(rd.getUsername(),
+ rd.getPassword(), rd.getURL())) {
+ return LDAP_INIT_FAILED;
+ } else {
+ msg = _resource.getString("info","restartDS");
+ JOptionPane.showMessageDialog(
+ com.netscape.management.client.console.SplashScreen.getInstance(), msg,
+ _resource.getString("info","restartDSTitle"),
+ JOptionPane.INFORMATION_MESSAGE);
+ _dsHasBeenRestarted = true;
+ return LDAP_INIT_DS_RESTART;
+ }
+*/
+ }
+
+ // set up user data base information
+ // If config DS is unaccessable when authenticate CGI is called, the CGI returns ? for UserDirectory
+ if ((param = (String)(ht.get("UserDirectory"))) != null &&
+ !param.equals("?")) {
+ // this caused I18n problem - param=param.toLowerCase();
+ LDAPConnection ldc = null;
+ boolean fSSL = false;
+ String sHost = info.getHost();
+ int iPort = info.getPort();
+ String sBaseDN = info.getBaseDN();
+ int iStartSearch = 7;
+ if (param.startsWith("ldaps://")) {
+ fSSL = true;
+ iStartSearch = 8;
+ }
+
+ int iNextSlash = param.indexOf('/',8);
+ int iNextColon = param.indexOf(':',8);
+ int iNextSpace = param.indexOf(' ',8); //for failover list
+
+ // if failover list, use the first host and port in the list
+
+ if ((iNextSlash > iNextColon) && (iNextColon != (-1))) {
+ // has a port number
+ if ((iNextSpace != (-1))&&(iNextSpace<iNextSlash)) {
+ // failover list
+ iPort = Integer.parseInt(
+ param.substring(iNextColon + 1, iNextSpace));
+ } else {
+ iPort = Integer.parseInt(
+ param.substring(iNextColon + 1, iNextSlash));
+ }
+ sHost = param.substring(iStartSearch, iNextColon);
+ } else {
+ sHost = param.substring(iStartSearch, iNextSlash);
+ }
+
+ sBaseDN = param.substring(iNextSlash + 1);
+ info.setUserHost(sHost);
+ info.setUserPort(iPort);
+ info.setUserBaseDN(sBaseDN);
+
+ if (fSSL) {
+ ldc = new KingpinLDAPConnection(
+ UtilConsoleGlobals.getLDAPSSLSocketFactory(),
+ info.getAuthenticationDN(),
+ info.getAuthenticationPassword());
+ } else {
+ ldc = new KingpinLDAPConnection( info.getAuthenticationDN(),
+ info.getAuthenticationPassword());
+ }
+
+ try {
+ ldc.connect(info.getUserHost(), info.getUserPort());
+ ldc.authenticate(LDAPUtil.LDAP_VERSION,
+ info.getAuthenticationDN(),
+ info.getAuthenticationPassword());
+ } catch (Exception e) {
+ // catch no user exception
+ Debug.println("Console: cannot connect to the user database");
+ }
+ info.setUserLDAPConnection(ldc);
+ } else
+ Debug.println("Console.authenticate_user():UserDirectory value not found");
+
+
+ return LDAP_INIT_OK;
+ }
+
+ /**
+ * create an ldap connection.
+ *
+ * @param info ConsoleInfo object.
+ * @exception LDAPException Throws LDAPException if it cannot create a LDAP connection.
+ */
+
+ protected LDAPConnection createLDAPConnection(ConsoleInfo info)
+ throws LDAPException {
+ LDAPConnection ldc = null;
+
+ if (info.get("ldapSecurity").equals("on")) {
+ ldc = new KingpinLDAPConnection(
+ UtilConsoleGlobals.getLDAPSSLSocketFactory(),
+ info.getAuthenticationDN(),
+ info.getAuthenticationPassword());
+ } else {
+ ldc = new KingpinLDAPConnection(info.getAuthenticationDN(),
+ info.getAuthenticationPassword());
+ }
+
+ ldc.connect(info.getHost(), info.getPort());
+ try {
+ ldc.authenticate(LDAPUtil.LDAP_VERSION,
+ info.getAuthenticationDN(),
+ info.getAuthenticationPassword());
+ } catch (Exception e) {
+ // unable to auth the user, either password expired or account didn't exist.
+ // perhpas directory server is down.
+ JOptionPane.showMessageDialog(null, /*_info.getFrame(),*/
+
+ _resource.getString("error","cannotconnect") + e,
+ _resource.getString("error","title"),
+ JOptionPane.ERROR_MESSAGE);
+ ldc = null;
+ }
+
+ return ldc;
+ }
+
+ /**
+ * The CommClient interface for authentication.
+ */
+
+ /**
+ * reply the response
+ *
+ * @param is input stream for the response
+ * @param cr communication record
+ */
+ public synchronized void replyHandler(InputStream is, CommRecord cr) {
+ HttpChannel channel = (HttpChannel)cr.getChannel();
+ if (channel != null) {
+ _adminVersion = channel.getAdminVersion();
+ Debug.println("Console.replyHandler: adminVersion = " +
+ _adminVersion );
+ } else {
+ Debug.println("Console.replyHandler: no channel");
+ }
+ ((Response)(cr.getArg())).setInputStream(is);
+ notifyAll();
+ }
+
+ /**
+ * error exception handler
+ *
+ * @param e exception
+ * @param cr communication record
+ */
+ public synchronized void errorHandler(Exception e, CommRecord cr) {
+ ((Response)(cr.getArg())).setError(e);
+ notifyAll();
+ }
+
+ /**
+ * return the responsed username
+ *
+ * @param realm authenicate object
+ * @param cr communication record
+ * @return username
+ */
+ public String username(Object realm, CommRecord cr) {
+ return ((Response)(cr.getArg())).getUsername();
+ }
+
+ /**
+ * return the responsed password
+ *
+ * @param realm authenicate object
+ * @param cr communication record
+ * @return password
+ */
+ public String password(Object realm, CommRecord cr) {
+ return ((Response)(cr.getArg())).getPassword();
+ }
+
+ static Console _console;
+
+ private static void waitForKeyPress() {
+ // On Windows, startconsole window disappears immediately on exit, so
+ // we wait for keyboard input to allow the user to read the message
+ if (System.getProperty("os.name").startsWith("Win")) {
+ System.out.print("\nPress Enter key to continue ...");
+ try {
+ System.in.read();
+ } catch (Exception e) {}
+ }
+ }
+
+ /**
+ * main routine. It will pass the command line parameters then call the Console constructor
+ * to create a console instance.
+ *
+ * @param parameters list
+ */
+
+ static public void main(String argv[]) {
+ GetOpt opt = new GetOpt("h:a:A:f:l:u:w:s:D:x:", argv);
+
+ if (opt.hasOption('f')) {
+ String outFile = opt.getOptionParam('f');
+ try {
+ TeeStream.tee(outFile);
+ }
+ catch (Exception e) {
+ System.err.println("Missing or invalid output file specification for the -f option: " + e);
+ System.exit(1);
+ }
+ }
+
+ if (opt.hasOption('D')) {
+ Debug.setApplicationStartTime(_t0);
+ String extraParam = opt.getOptionParam('D');
+ if (extraParam != null) {
+ if (extraParam.equals("?") ||
+ !Debug.setTraceMode(extraParam)) {
+ System.out.println(Debug.getUsage());
+ waitForKeyPress(); // allow the user to read the msg on Win NT
+ System.exit(0);
+ }
+ } else {
+ Debug.setTraceMode(null);
+ }
+
+ // Show all system proprties if debug level is 9
+ if (Debug.getTraceLevel() == 9) {
+ try {
+ Properties props = System.getProperties();
+ for (Enumeration e = props.keys();
+ e.hasMoreElements();) {
+ String key = (String) e.nextElement();
+ String val = (String) props.get(key);
+ Debug.println(9, key + "="+val);
+ }
+ } catch (Exception e) {}
+ }
+ }
+
+ Debug.println(0,
+ "Management-Console/" +
+ _resource.getString("console","displayVersion") +
+ " B" + VersionInfo.getBuildNumber());
+
+ if (opt.hasOption('x')) {
+ String extraParam = opt.getOptionParam('x');
+ boolean supportedOption = false;
+
+ if (extraParam == null)
+ extraParam = "";
+
+ if (extraParam.indexOf(OPTION_NOLOGO) != -1) {
+ _showSplashScreen = false;
+ supportedOption = true;
+ }
+ if (extraParam.indexOf(OPTION_NOWINPOS) != -1) {
+ Framework.setEnableWinPositioning(false);
+ supportedOption = true;
+ }
+ if (extraParam.indexOf(OPTION_JAVALAF) != -1) {
+ _useJavaLookAndFeel= true;
+ supportedOption = true;
+ }
+
+ if (supportedOption == false) {
+ opt = new GetOpt("h:", new String[]{ "-h"});
+ }
+ }
+
+ if (opt.hasOption('h'))// help
+ {
+ System.err.println("Syntax: Console [-a <URL>] [-l <Language Code>] [-s <SIE DN>] [-x <options>]");
+ System.err.println(" -a admin server base URL");
+ System.err.println(" -l language code (en fr gr)");
+ System.err.println(" -f <file> capture stderr and stdout to <file> (like Unix tee command)");
+ System.err.println(" -s server DN (cn=...) or instance ID (e.g. slapd-host)");
+ System.err.println(" -x extra options (javalaf,nowinpos,nologo)");
+ System.err.println("\nExample: Console -a https://hostname:10021 -l en");
+ waitForKeyPress(); // allow the user to read the msg on Win NT
+ System.exit(0);
+ }
+
+ // bug 353403: -a option intended for end-user to
+ // specify default admin url. This option overrides
+ // -A option.
+ String sAdminURL = null;
+ if (opt.hasOption('a')) {
+ sAdminURL = opt.getOptionParam('a');
+ }
+
+ // bug 353403, -A option intended for startconsole to
+ // specify local admin server url, if one exists.
+ String localAdminURL = null;
+ if (opt.hasOption('A')) {
+ localAdminURL = opt.getOptionParam('A');
+ }
+
+ String instanceID = null;
+ if (opt.hasOption('s')) {
+ instanceID = opt.getOptionParam('s');
+ }
+
+ String sLang = "en";
+ if (opt.hasOption('l')) {
+ sLang = opt.getOptionParam('l');
+ }
+
+ String host = null;
+ if (opt.hasOption('s')) {
+ host = opt.getOptionParam('s');
+ }
+
+ String uid = null;
+ if (opt.hasOption('u')) {
+ uid = opt.getOptionParam('u');
+ }
+
+ String password = null;
+ if (opt.hasOption('w')) {
+ password = opt.getOptionParam('w');
+ }
+
+
+ ConsoleInfo cinfo = new ConsoleInfo();
+ CMSAdmin admin = new CMSAdmin();
+ URL url = null;
+ try {
+ url = new URL(sAdminURL);
+ } catch (Exception e) {
+ String es = e.toString();
+ String ep = "java.net.MalformedURLException:";
+ if (es != null && es.startsWith(ep)) {
+ es = es.substring(ep.length());
+ }
+ System.err.println("\nURL error: "+es+"\n");
+ waitForKeyPress(); // allow the user to read the msg on Win NT
+ System.exit(1);
+ }
+ if (url == null) {
+ System.err.println("\nIncorrect URL: "+sAdminURL+"\n");
+ waitForKeyPress(); // allow the user to read the msg on Win NT
+ System.exit(1);
+ }
+ cinfo.put("cmsServerInstance", instanceID);
+
+ String protocol = url.getProtocol();
+ String hostName = url.getHost();
+ String path = url.getPath();
+ /* Protocol part of URL is required only by URL class. Console assumes URL protocol. */
+ if (protocol == null || protocol.length() == 0 ||
+ ((!protocol.equalsIgnoreCase("https")) && (!protocol.equalsIgnoreCase("http"))) ) {
+ System.err.println("\nIncorrect protocol"+
+ ((protocol != null && protocol.length() > 0)?": "+protocol:".")+
+ "\nDefault supported protocol is 'https'.\n");
+ waitForKeyPress(); // allow the user to read the msg on Win NT
+ System.exit(1);
+ }
+
+ if (hostName == null || hostName.length() == 0) {
+ System.err.println("\nMissing hostName: "+sAdminURL+"\n");
+ waitForKeyPress(); // allow the user to read the msg on Win NT
+ System.exit(1);
+ }
+ if (path == null || path.length() < 2 ) {
+ System.err.println("\nMissing URL path: "+sAdminURL+
+ "\nDefault supported URL paths are 'ca', 'kra', 'ocsp', and 'tks'.\n");
+ waitForKeyPress(); // allow the user to read the msg on Win NT
+ System.exit(1);
+ }
+ path = path.substring(1);
+ if ((!path.equals("ca")) && (!path.equals("kra")) &&
+ (!path.equals("ocsp")) && (!path.equals("tks"))) {
+ System.err.println("\nWarning: Potentially incorrect URL path: "+path+
+ "\n Default supported URL paths are 'ca', 'kra', 'ocsp', and 'tks'.\n");
+ }
+ int portNumber = url.getPort();
+ if (portNumber < 0) {
+ System.err.println("\nWarning: Unspecified port number: "+sAdminURL+"\n");
+ /* Add warning about using non default port numbers after port separation is done.
+ "\n Default port number is 9443.\n");
+ } else if (portNumber != 9443) {
+ System.err.println("\nWarning: Attempt to connect to non default port number: "+sAdminURL+
+ "\n Default port number is 9443.\n");
+ */
+ }
+ cinfo.put("cmsHost", url.getHost());
+ cinfo.put("cmsPort", Integer.toString(portNumber));
+ cinfo.put("cmsPath", path);
+ admin.initialize(cinfo);
+ admin.run(null, null);
+/*
+ _console = new Console(sAdminURL, localAdminURL, sLang, host, uid, password);
+*/
+ return;
+ }
+}
+
+
+/**
+ * A class that makes a PrintStream act like a Unix tee command
+ */
+class TeeStream extends PrintStream {
+ static OutputStream logfile;
+
+ private TeeStream(PrintStream ps) {
+ super(ps);
+ }
+
+ // Redirects stdout and stderr to the logfile
+ public static void tee(String f) throws IOException {
+
+ // Create/Open logfile.
+ logfile = new PrintStream(
+ new BufferedOutputStream(
+ new FileOutputStream(f)),
+ /*autoFlush=*/true);
+
+ // Start redirecting the output.
+ System.setOut(new TeeStream(System.out));
+ System.setErr(new TeeStream(System.err));
+ }
+
+
+ // PrintStream override.
+ public void write(int b) {
+ try {
+ logfile.write(b);
+ } catch (Exception e) {
+ e.printStackTrace();
+ setError();
+ }
+ super.write(b);
+ }
+
+ // PrintStream override.
+ public void write(
+ byte buf[], int off, int len) {
+ try {
+ logfile.write(buf, off, len);
+ } catch (Exception e) {
+ e.printStackTrace();
+ setError();
+ }
+ super.write(buf, off, len);
+ }
+}
+
+/**
+ * An internal class used to wrap the parameters of an
+ * authentication request.
+ *
+ * @author David Tompkins, 12/13/97
+ */
+class Response {
+ private InputStream is;
+ private Exception ex;
+ private String user;
+ private String pw;
+
+ /**
+ * constructor for the response object.
+ *
+ * @param _user username
+ * @param _pw password
+ */
+ public Response(String _user, String _pw) {
+ user = _user;
+ pw = _pw;
+ is = null;
+ ex = null;
+ }
+
+ /**
+ * set the input stream
+ *
+ * @param _is input stream to be set
+ */
+ protected void setInputStream(InputStream _is) {
+ is = _is;
+ }
+
+ /**
+ * set the response error
+ *
+ * @param e error of the exception
+ */
+ protected void setError(Exception e) {
+ ex = e;
+ }
+
+ /**
+ * return the response input stream
+ *
+ * @return return the response input stream.
+ */
+ protected InputStream getInputStream() {
+ return is;
+ }
+
+ /**
+ * return the error exception
+ *
+ * @return error exception
+ */
+ protected Exception getError() {
+ return ex;
+ }
+
+ /**
+ * return the username
+ *
+ * @return username
+ */
+ protected String getUsername() {
+ return user;
+ }
+
+ /**
+ * return the password
+ *
+ * @return password
+ */
+ protected String getPassword() {
+ return pw;
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/CustomComboBox.java b/base/console/src/com/netscape/admin/certsrv/CustomComboBox.java
new file mode 100644
index 000000000..c76c36006
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/CustomComboBox.java
@@ -0,0 +1,78 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import javax.swing.event.*;
+
+/**
+ * General Purpose Custom Combo Box
+ *
+ * @author jpanchen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv
+ * @see CustomComboBoxModel
+ */
+public class CustomComboBox extends JComboBox {
+
+ public CustomComboBox(ComboBoxModel m) {
+ super(m);
+ super.setRenderer( new CustomCellRenderer(this));
+ }
+}
+
+class CustomCellRenderer extends JLabel implements ListCellRenderer {
+
+ final static Color selectedCellBackground = new Color(0,0,128);
+ final static Color selectedCellForeground = Color.white;
+ final static Color defaultCellBackground = Color.white;
+ final static Color defaultCellForeground = Color.black;
+ final static String SELECTION_TITLE = CustomComboBoxModel.SELECTION_TITLE;
+ final static String SELECTION_ICON = CustomComboBoxModel.SELECTION_ICON;
+
+ CustomComboBox combobox;
+
+ public CustomCellRenderer(CustomComboBox x) {
+ combobox = x;
+ setOpaque(true);
+ }
+
+ public Component getListCellRendererComponent(
+ JList listbox, Object value, int index,
+ boolean isSelected, boolean cellHasFocus)
+ {
+ Hashtable h = (Hashtable) value;
+ if(value == null) {
+ setText("");
+ setIcon(null);
+ setBackground(selectedCellBackground);
+ setForeground(selectedCellForeground);
+ } else {
+ setIcon((ImageIcon)h.get(SELECTION_ICON));
+ setText((String)h.get(SELECTION_TITLE));
+ setBackground(defaultCellBackground);
+ setForeground(defaultCellForeground);
+ }
+
+ return this;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/CustomComboBoxModel.java b/base/console/src/com/netscape/admin/certsrv/CustomComboBoxModel.java
new file mode 100644
index 000000000..c97beeb5b
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/CustomComboBoxModel.java
@@ -0,0 +1,169 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import javax.swing.event.*;
+
+/**
+ * Custom Combo Box Model
+ * Let you specify an icon and title to be displayed.
+ *
+ * @author jpanchen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv
+ * @see CustomComboBox
+ */
+class CustomComboBoxModel extends AbstractListModel implements ComboBoxModel {
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CustomComboBoxModel() {
+ _cache = new Vector();
+ _index = new Vector();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * set selected item
+ * DO NOT USE!!!
+ * use JComboBox.setSelectedIndex()
+ */
+ public void setSelectedItem(Object anObject) {
+ _currentValue = anObject;
+ fireContentsChanged(this,-1,-1);
+ }
+
+ /**
+ * Get selected Item.
+ * DO NOT USE !!!
+ * use JComboBox.getItemAt(JComboBox.getSelectedIndex())
+ */
+ public Object getSelectedItem() {
+ return _currentValue;
+ }
+
+ /**
+ * Return size
+ * @return size
+ */
+ public int getSize() {
+ return _cache.size();
+ }
+
+ /**
+ * Retrieve element at index position
+ * @param index location
+ * @Object Hashtable obejct with "icon" and "title" field
+ */
+ public Object getElementAt(int index) {
+ try {
+ return _cache.elementAt(index);
+ } catch(ArrayIndexOutOfBoundsException e) {
+ return null;
+ }
+ }
+
+ /**
+ * set default icon
+ * @param icon new icon to be used
+ */
+ public void setIcon(ImageIcon icon) {
+ _icon = icon;
+ }
+
+ /**
+ * Add new list entry into model
+ * @param icon new icon associated
+ * @param title text associated
+ */
+ public void addItem(ImageIcon icon, String title, Object data) {
+ Hashtable newItem = new Hashtable();
+ newItem.put(SELECTION_ICON,icon);
+ newItem.put(SELECTION_TITLE, title);
+ newItem.put(SELECTION_DATA, data);
+ _cache.addElement(newItem);
+ _index.addElement(title.toUpperCase());
+ }
+
+ /**
+ * Add new list entry into model
+ * @param icon new icon associated
+ * @param title text associated
+ */
+ public void addItem(ImageIcon icon, String title) {
+ Hashtable newItem = new Hashtable();
+ newItem.put(SELECTION_ICON,icon);
+ newItem.put(SELECTION_TITLE, title);
+ _cache.addElement(newItem);
+ _index.addElement(title.toUpperCase());
+ }
+
+ /**
+ * Add new list entry into model.
+ * Default icon used
+ * @param title text associated
+ */
+ public void addItem(String title) {
+ Hashtable newItem = new Hashtable();
+ newItem.put(SELECTION_ICON,_icon);
+ newItem.put(SELECTION_TITLE, title);
+ _cache.addElement(newItem);
+ _index.addElement(title.toUpperCase());
+ }
+
+ /**
+ * Remove all entries from the model
+ */
+ public void removeAll() {
+ _cache.removeAllElements();
+ }
+
+ /**
+ * Remove specific entry from the model
+ * @param key key string associated with the entry
+ */
+ public void removeEntry(String key) {
+ int x = _index.indexOf(key.toUpperCase());
+ if ((x != -1) && (x < _cache.size()) ) {
+ _cache.removeElementAt(x);
+ _index.removeElementAt(x);
+ }
+ }
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+
+ public static final String SELECTION_TITLE = "title";
+ public static final String SELECTION_ICON = "icon";
+ public static final String SELECTION_DATA = "data";
+
+ private Object _currentValue;
+ private Vector _cache;
+ private Vector _index;
+ private ImageIcon _icon;
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/DefaultTableCellEditor.java b/base/console/src/com/netscape/admin/certsrv/DefaultTableCellEditor.java
new file mode 100644
index 000000000..638494326
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/DefaultTableCellEditor.java
@@ -0,0 +1,238 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import com.netscape.certsrv.common.*;
+import java.awt.Component;
+import java.awt.event.*;
+import java.awt.AWTEvent;
+import java.lang.Boolean;
+import javax.swing.table.*;
+import javax.swing.event.*;
+import java.util.EventObject;
+import javax.swing.*;
+import javax.swing.tree.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Default Table Cell Editor. Since we need to display different
+ * editor depending on serverside input. We will use this editor
+ * that takes specific data object.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv
+ */
+public class DefaultTableCellEditor
+ implements TableCellEditor, ActionListener
+{
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+
+ /** Event listeners */
+ protected EventListenerList listenerList = new EventListenerList();
+ transient protected ChangeEvent changeEvent = null;
+ protected CellEditorData mValue;
+
+ protected JTextField mTextField = new JTextField();
+ protected JPasswordField mPasswordField = new JPasswordField();
+ protected JTextField mEditorComponent;
+ protected int clickCountToStart = 2;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public DefaultTableCellEditor() {
+ mTextField = new JTextField();
+ mTextField.addActionListener(this);
+ mPasswordField = new JPasswordField();
+ mPasswordField.addActionListener(this);
+ mValue = new CellEditorData();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ public Component getComponent() {
+ return mEditorComponent;
+ }
+
+ /**
+ * clickCountToStart controls the number of clicks required to start
+ * editing if the event passed to isCellEditable() or startCellEditing() is
+ * a MouseEvent. For example, by default the clickCountToStart for
+ * a JTextField is set to 2, so in a JTable the user will need to
+ * double click to begin editing a cell.
+ */
+ public void setClickCountToStart(int count) {
+ clickCountToStart = count;
+ }
+
+ /**
+ * clickCountToStart controls the number of clicks required to start
+ * editing if the event passed to isCellEditable() or startCellEditing() is
+ * a MouseEvent. For example, by default the clickCountToStart for
+ * a JTextField is set to 2, so in a JTable the user will need to
+ * double click to begin editing a cell.
+ */
+ public int getClickCountToStart() {
+ return clickCountToStart;
+ }
+
+ //Interface javax.swing.CellEditor
+ public Object getCellEditorValue() {
+ mValue.mData = mEditorComponent.getText();
+ return mValue;
+ }
+
+ public boolean isCellEditable(EventObject anEvent) {
+ if (anEvent instanceof MouseEvent) {
+ if (((MouseEvent)anEvent).getClickCount() < clickCountToStart)
+ return false;
+ }
+ return true;
+ }
+
+ public boolean shouldSelectCell(EventObject anEvent) {
+ boolean retValue = true;
+
+ if (this.isCellEditable(anEvent)) {
+ if (anEvent == null || ((MouseEvent)anEvent).getClickCount() >=
+ clickCountToStart)
+ retValue = startCellEditing(anEvent);
+ }
+
+ // By default we want the cell the be selected so
+ // we return true
+ return retValue;
+
+ }
+
+ public boolean startCellEditing(EventObject anEvent) {
+ if(anEvent == null)
+ mEditorComponent.requestFocus();
+ return true;
+ }
+
+ public boolean stopCellEditing() {
+ fireEditingStopped();
+ return true;
+ }
+
+ public void cancelCellEditing() {
+ fireEditingCanceled();
+ }
+
+ // Handle the event listener bookkeeping
+ public void addCellEditorListener(CellEditorListener l) {
+ listenerList.add(CellEditorListener.class, l);
+ }
+
+ public void removeCellEditorListener(CellEditorListener l) {
+ listenerList.remove(CellEditorListener.class, l);
+ }
+
+ // Implementing ActionListener interface
+ public void actionPerformed(ActionEvent e) {
+ fireEditingStopped();
+ }
+
+ public Component getTableCellEditorComponent(JTable table,
+ Object value,
+ boolean isSelected,
+ int row, int column) {
+
+ Debug.println("DefaultTableCellEditor: getTableCellEditorComponent() -");
+ if(value != null) {
+ Debug.println(" data: "+(String)((CellEditorData)value).mData);
+ Debug.println(" type: "+((CellEditorData)value).mType);
+ }
+ Debug.println(" isSelected: "+isSelected);
+ Debug.println(" row:"+row +" col:"+column);
+
+ mEditorComponent = mTextField;
+ if(value != null) {
+ mValue = (CellEditorData)value;
+
+ if (mValue.mType.equals(Constants.TYPE_PASSWORD))
+ mEditorComponent = mPasswordField;
+ mEditorComponent.setText((String)mValue.mData);
+ } else {
+ mEditorComponent.setText("");
+ }
+ return mEditorComponent;
+ }
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+
+ /*
+ * Notify all listeners that have registered interest for
+ * notification on this event type. The event instance
+ * is lazily created using the parameters passed into
+ * the fire method.
+ * @see EventListenerList
+ */
+ protected void fireEditingStopped() {
+ // Guaranteed to return a non-null array
+ Object[] listeners = listenerList.getListenerList();
+ // Process the listeners last to first, notifying
+ // those that are interested in this event
+ for (int i = listeners.length-2; i>=0; i-=2) {
+ if (listeners[i]==CellEditorListener.class) {
+ // Lazily create the event:
+ if (changeEvent == null)
+ changeEvent = new ChangeEvent(this);
+ ((CellEditorListener)listeners[i+1]).editingStopped(changeEvent);
+ }
+ }
+ }
+
+
+ /*
+ * Notify all listeners that have registered interest for
+ * notification on this event type. The event instance
+ * is lazily created using the parameters passed into
+ * the fire method.
+ * @see EventListenerList
+ */
+ protected void fireEditingCanceled() {
+ // Guaranteed to return a non-null array
+ Object[] listeners = listenerList.getListenerList();
+ // Process the listeners last to first, notifying
+ // those that are interested in this event
+ for (int i = listeners.length-2; i>=0; i-=2) {
+ if (listeners[i]==CellEditorListener.class) {
+ // Lazily create the event:
+ if (changeEvent == null)
+ changeEvent = new ChangeEvent(this);
+ ((CellEditorListener)listeners[i+1]).editingCanceled(changeEvent);
+ }
+ }
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/EAdminException.java b/base/console/src/com/netscape/admin/certsrv/EAdminException.java
new file mode 100644
index 000000000..acb5ab6ce
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/EAdminException.java
@@ -0,0 +1,142 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ * A class represents an administartive exception. By
+ * using this exception, the locale conversion can be
+ * delayed until it is necessary. THIS CLASS DOES NOT
+ * SUPPORT MESSAGE FORMAT.
+ * <P>
+ *
+ * @author jpanchen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv
+ */
+public class EAdminException extends Exception {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ public static final String RESOURCES = CMSAdminResources.class.getName();
+ private boolean mIsLocalized = false;
+ private ResourceBundle mResource;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+
+ /**
+ * Constructs an exception.
+ * <P>
+ *
+ * @param msgFormat exception details
+ * @param isLocalized true if the string is localized already
+ */
+ public EAdminException(String msgFormat, boolean isLocalized) {
+ super(msgFormat);
+ mResource = ResourceBundle.getBundle(RESOURCES);
+ mIsLocalized = isLocalized;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * Check if the original message is localized already
+ *
+ * @return true if the message is localized
+ */
+ public boolean isLocalized() {
+ return mIsLocalized;
+ }
+
+ /**
+ * Returns localized exception string. This method should
+ * only be called if a localized string is necessary.
+ * <P>
+ *
+ * @return details message
+ */
+ public String toString() {
+ return getMessage();
+ }
+
+ /**
+ * Returns the string based on the given locale.
+ * This is costly since resource boundle is created each time. Use
+ * this only when it is necessary.
+ *
+ * @param locale locale
+ * @return details message
+ */
+ public String toString(Locale locale) {
+ ResourceBundle resource = ResourceBundle.getBundle(RESOURCES, locale);
+ try {
+ return resource.getString(super.getMessage());
+ } catch (MissingResourceException e) {
+ return super.getMessage()+"-"+e.toString();
+ } catch (Exception ex) {
+ return super.getMessage();
+ }
+ }
+
+ /**
+ * Returns the message based on the given locale.If the original message
+ * is mark localized, the orginal message will be returned without
+ * converstion. This is costly since resource boundle is created each time.Use
+ * this only when it is necessary.<P>
+ *
+ * @param locale user specify local
+ * @return string representation in specified local
+ */
+ public String getMessage(Locale locale){
+ return toString(locale);
+ }
+
+ /**
+ * Returns the message in default locale. If the original message
+ * is mark localized, the orginal message will be returned without
+ * converstion.<P>
+ *
+ * @return localized detial exception string
+ */
+ public String getMessage(){
+ if (mIsLocalized)
+ return super.getMessage();
+ try {
+ return mResource.getString(super.getMessage());
+ } catch (MissingResourceException e) {
+ return super.getMessage()+"-"+e.toString();
+ } catch (Exception ex) {
+ return super.getMessage();
+ }
+ }
+
+ /**
+ * Returns the message or message tag unconvrted
+ */
+ public String getMessageString() {
+ return super.getMessage();
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/GenericCellEditor.java b/base/console/src/com/netscape/admin/certsrv/GenericCellEditor.java
new file mode 100644
index 000000000..b26b9f9f9
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/GenericCellEditor.java
@@ -0,0 +1,223 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.lang.*;
+import java.util.*;
+import javax.swing.table.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import java.io.Serializable;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.connection.*;
+
+/**
+ * Class that will edit components correctly in table
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv
+ */
+public class GenericCellEditor implements TableCellEditor, Serializable {
+
+ protected EventListenerList listenerList = new EventListenerList();
+ transient protected ChangeEvent changeEvent = null;
+ protected JComponent editorComponent;
+ protected JTextField mTextField = new JTextField();
+ protected JPasswordField mPasswordField = new JPasswordField();
+
+ protected EditorDelegate delegate = new EditorDelegate();
+ protected int clickCounts = 2;
+
+ public GenericCellEditor() {
+ mTextField.addActionListener(delegate);
+ mPasswordField.addActionListener(delegate);
+ }
+
+ public Component getTableCellEditorComponent(JTable table, Object value,
+ boolean isSelected, int row, int column) {
+
+ TableModel model = table.getModel();
+
+ Vector v = (Vector)(((CMSContentTableModel)model).getObjectValueAt(row));
+ delegate.setValue(value, v);
+
+ return editorComponent;
+ }
+
+ public Component getComponent() {
+ return editorComponent;
+ }
+
+ public Object getCellEditorValue() {
+ return delegate.getCellEditorValue();
+ }
+
+ public boolean isCellEditable(EventObject anEvent) {
+ if (anEvent instanceof MouseEvent) {
+ if (((MouseEvent)anEvent).getClickCount() < clickCounts)
+ return false;
+ }
+ return delegate.isCellEditable(anEvent);
+ }
+
+ public boolean shouldSelectCell(EventObject anEvent) {
+ boolean retValue = true;
+
+ if (this.isCellEditable(anEvent)) {
+ if (anEvent == null || ((MouseEvent)anEvent).getClickCount() >=
+ clickCounts)
+ retValue = delegate.startCellEditing(anEvent);
+ }
+ // By default we want the cell the be selected so
+ // we return true
+ return retValue;
+ }
+
+ public boolean stopCellEditing() {
+ boolean stopped = delegate.stopCellEditing();
+
+ if (stopped) {
+ fireEditingStopped();
+ }
+
+ return stopped;
+ }
+
+ public void cancelCellEditing() {
+ delegate.cancelCellEditing();
+ fireEditingCanceled();
+ }
+
+ public void addCellEditorListener(CellEditorListener l) {
+ listenerList.add(CellEditorListener.class, l);
+ }
+
+ public void removeCellEditorListener(CellEditorListener l) {
+ listenerList.remove(CellEditorListener.class, l);
+ }
+
+ /*
+ * Notify all listeners that have registered interest for
+ * notification on this event type. The event instance
+ * is lazily created using the parameters passed into
+ * the fire method.
+ * @see EventListenerList
+ */
+ protected void fireEditingStopped() {
+ // Guaranteed to return a non-null array
+ Object[] listeners = listenerList.getListenerList();
+ // Process the listeners last to first, notifying
+ // those that are interested in this event
+ for (int i = listeners.length-2; i>=0; i-=2) {
+ if (listeners[i]==CellEditorListener.class) {
+ // Lazily create the event:
+ if (changeEvent == null)
+ changeEvent = new ChangeEvent(this);
+ ((CellEditorListener)listeners[i+1]).editingStopped(changeEvent);
+ }
+ }
+ }
+
+ /*
+ * Notify all listeners that have registered interest for
+ * notification on this event type. The event instance
+ * is lazily created using the parameters passed into
+ * the fire method.
+ * @see EventListenerList
+ */
+ protected void fireEditingCanceled() {
+ // Guaranteed to return a non-null array
+ Object[] listeners = listenerList.getListenerList();
+ // Process the listeners last to first, notifying
+ // those that are interested in this event
+ for (int i = listeners.length-2; i>=0; i-=2) {
+ if (listeners[i]==CellEditorListener.class) {
+ // Lazily create the event:
+ if (changeEvent == null)
+ changeEvent = new ChangeEvent(this);
+ ((CellEditorListener)listeners[i+1]).editingCanceled(changeEvent);
+ }
+ }
+ }
+
+ protected class EditorDelegate implements ActionListener, ItemListener,
+ Serializable {
+ protected Object value;
+
+ public Object getCellEditorValue() {
+ if (editorComponent instanceof JPasswordField)
+ return mPasswordField.getText();
+ else if (editorComponent instanceof JTextField)
+ return mTextField.getText();
+
+ return null;
+ }
+
+ public void setValue(Object x, Vector v) {
+ String type = (String)v.elementAt(0);
+ this.value = x;
+
+ if (type.equals(Constants.TEXTTYPE)) {
+ if (mTextField == null)
+ mTextField = new JTextField();
+ editorComponent = mTextField;
+ if (x != null)
+ mTextField.setText(x.toString());
+ else
+ mTextField.setText("");
+ } else if (type.equals(Constants.PASSWORDTYPE)) {
+ if (mPasswordField == null)
+ mPasswordField = new JPasswordField();
+ editorComponent = mPasswordField;
+ if (x != null)
+ mPasswordField.setText(x.toString());
+ else
+ mPasswordField.setText("");
+ //((JPasswordField)editorComponent).setCaretPosition(0);
+ }
+ }
+
+ public boolean isCellEditable(EventObject anEvent) {
+ return true;
+ }
+
+ public boolean startCellEditing(EventObject anEvent) {
+ if (anEvent == null)
+ editorComponent.requestFocus();
+ return true;
+ }
+
+ public boolean stopCellEditing() {
+ return true;
+ }
+
+ public void cancelCellEditing() {
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ fireEditingStopped();
+ }
+
+ public void itemStateChanged(ItemEvent e) {
+ fireEditingStopped();
+ }
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/GenericCellRenderer.java b/base/console/src/com/netscape/admin/certsrv/GenericCellRenderer.java
new file mode 100644
index 000000000..34d69e37e
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/GenericCellRenderer.java
@@ -0,0 +1,153 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import java.awt.*;
+import java.lang.*;
+import java.util.*;
+import javax.swing.table.*;
+import javax.swing.*;
+import java.io.Serializable;
+import com.netscape.certsrv.common.*;
+import javax.swing.border.*;
+import com.netscape.admin.certsrv.connection.*;
+
+/**
+ * Class that will render components correctly in table
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv
+ */
+public class GenericCellRenderer
+ implements TableCellRenderer, Serializable
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ protected JComponent component;
+ private JPasswordField mPasswordField;
+ private JLabel mLabel;
+ private JCheckBox mCheckBox;
+ private JComboBox mComboBox;
+ protected ValueProperty value;
+ static Color HIGHLIGHTCOLOR = new Color(0, 0, 128);
+ static Color WHITECOLOR = Color.white;
+ static Color BLACKCOLOR = Color.black;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+
+ public GenericCellRenderer() {
+ value = new ValueProperty();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ public void setToolTipText(String text) {
+ if (component instanceof JComponent)
+ ((JComponent)component).setToolTipText(text);
+ }
+
+ public Component getComponent() {
+ return component;
+ }
+
+ //==== Implementing TableCellRenderer =========
+ public Component getTableCellRendererComponent(JTable table, Object value,
+ boolean isSelected,
+ boolean hasFocus,
+ int row, int column) {
+ TableModel model = table.getModel();
+ if(value == null) {
+
+ value = model.getValueAt(row, column);
+ }
+ Vector v = (Vector)(((CMSContentTableModel)model).getObjectValueAt(row));
+ this.value.setValue(value, v);
+ component.setBackground(isSelected ? HIGHLIGHTCOLOR : WHITECOLOR);
+ component.setForeground(isSelected ? WHITECOLOR : BLACKCOLOR);
+ return component;
+ }
+
+
+ protected class ValueProperty implements Serializable {
+
+ public void setValue(Object x, Vector v) {
+ String type = (String)v.elementAt(0);
+ if (type.equals(Constants.PASSWORDTYPE)) {
+ if (mLabel == null) {
+ mLabel = new JLabel();
+ mLabel.setOpaque(true);
+ mLabel.setBorder(new EmptyBorder(1,CMSAdminUtil.COMPONENT_SPACE, 1, 2));
+ JPasswordField temp = new JPasswordField();
+ mLabel.setFont(temp.getFont());
+ }
+ component = mLabel;
+
+ StringBuffer buf = new StringBuffer();
+ for(int i=0; i< ((String)x).length(); i++)
+ buf.append("*");
+ ((JLabel)component).setText(buf.toString());
+ } else if (type.equals(Constants.TEXTTYPE)) {
+ if (mLabel == null) {
+ mLabel = new JLabel();
+ mLabel.setOpaque(true);
+ mLabel.setBorder(new EmptyBorder(1,CMSAdminUtil.COMPONENT_SPACE, 1, 2));
+ JTextField temp = new JTextField();
+ mLabel.setFont(temp.getFont());
+ }
+ component = mLabel;
+ ((JLabel)component).setText((String)x);
+ } else if (type.equals(Constants.CHECKBOXTYPE)) {
+ if (mCheckBox == null)
+ mCheckBox = new JCheckBox();
+ component = mCheckBox;
+ if (x instanceof Boolean) {
+ Boolean bool = (Boolean)x;
+ mCheckBox.setHorizontalAlignment(JCheckBox.CENTER);
+ mCheckBox.setSelected(bool.booleanValue());
+ }
+ } else if (type.equals(Constants.COMBOTYPE)) {
+ String[] items = (String[])v.elementAt(1);
+
+ if (mComboBox == null)
+ mComboBox = new JComboBox(items);
+ else {
+ mComboBox.removeAllItems();
+ for (int i=0; i<items.length; i++) {
+ mComboBox.insertItemAt(items[i], i);
+ }
+ }
+ component = mComboBox;
+ String str = (String)x;
+
+ if (str.equals(""))
+ mComboBox.setSelectedIndex(0);
+ else
+ mComboBox.setSelectedItem(str);
+ }
+ }
+
+ }
+}
+
+
diff --git a/base/console/src/com/netscape/admin/certsrv/HourGlass.java b/base/console/src/com/netscape/admin/certsrv/HourGlass.java
new file mode 100644
index 000000000..a0c582761
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/HourGlass.java
@@ -0,0 +1,52 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import javax.swing.*;
+import java.awt.*;
+
+/**
+ * This class changes the cursor to the busy mode.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @date 03/19/99
+ */
+public class HourGlass extends Thread {
+
+ private JFrame mActiveFrame;
+ private int mNonWaitType;
+
+ public HourGlass(JFrame frame) {
+ mActiveFrame = frame;
+ mNonWaitType = frame.getCursor().getType();
+ start();
+ }
+
+ public void run() {
+ Cursor cursor = new Cursor(Cursor.WAIT_CURSOR);
+ mActiveFrame.setCursor(cursor);
+ }
+
+ public void setNonWaitCursor() {
+ Cursor cursor = new Cursor(mNonWaitType);
+ mActiveFrame.setCursor(cursor);
+ this.stop();
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/IAttributeContent.java b/base/console/src/com/netscape/admin/certsrv/IAttributeContent.java
new file mode 100644
index 000000000..f467b38a1
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/IAttributeContent.java
@@ -0,0 +1,30 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+/**
+ * Interface for the attribute content
+ *
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv
+ */
+public interface IAttributeContent {
+
+} \ No newline at end of file
diff --git a/base/console/src/com/netscape/admin/certsrv/IConnectionListener.java b/base/console/src/com/netscape/admin/certsrv/IConnectionListener.java
new file mode 100644
index 000000000..c6275b403
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/IConnectionListener.java
@@ -0,0 +1,29 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+/**
+ * Listener interface
+ *
+ * @author chrisho
+ * @version $Revision$, $Date$
+ */
+public interface IConnectionListener {
+ public void restartCallback();
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/IDataProcessor.java b/base/console/src/com/netscape/admin/certsrv/IDataProcessor.java
new file mode 100644
index 000000000..1aa4b9049
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/IDataProcessor.java
@@ -0,0 +1,36 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+/**
+ * this class represents the callback interface between
+ * the client package and the data storage object (data model)
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public interface IDataProcessor {
+
+ /**
+ * This method will be callby the client package each time
+ * data object arrived from the server side.
+ * @param data data object expected by the interface implementor
+ */
+ public void processData(Object data);
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/IDisplayPanel.java b/base/console/src/com/netscape/admin/certsrv/IDisplayPanel.java
new file mode 100644
index 000000000..1a855ef22
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/IDisplayPanel.java
@@ -0,0 +1,43 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+/**
+ * Display Panel Interface
+ *
+ * The Display Panel is plugable UI intended for the displaying of the
+ * certificate attributes. It will contain displaying components only.
+ * No editing should be allowed.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv
+ */
+public interface IDisplayPanel {
+
+ /**
+ * Set the data associated with this ui
+ */
+ public boolean setDisplayPanelContent(IAttributeContent content);
+
+ /**
+ * Retrieve the error message to be displayed to the user
+ */
+ public String getErrorMessage();
+
+} \ No newline at end of file
diff --git a/base/console/src/com/netscape/admin/certsrv/IEditorPanel.java b/base/console/src/com/netscape/admin/certsrv/IEditorPanel.java
new file mode 100644
index 000000000..c04f66549
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/IEditorPanel.java
@@ -0,0 +1,60 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+/**
+ * Editor Panel Interface
+ *
+ * The Editor Panel is plugable UI intended for the editing of the
+ * certificate attributes. It will contain editing components only.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv
+ */
+public interface IEditorPanel {
+
+ /**
+ * Set the data associated with this ui
+ */
+ public void setEditorPanelContent(IAttributeContent content);
+
+ /**
+ * validate the content contained in this panel. Called when
+ * the user pressed ok button.
+ *
+ * this method should return false if the selections
+ * made by the user is not acceptable. ie. no selection made.
+ *
+ * getErrorMessage() will be called to retrieve the message
+ * and displayed to the user.
+ */
+ public boolean validateEditorPanelContent();
+
+ /**
+ * retrieve the attribute content from the editing panel.
+ * this method will be called after the validation has been
+ * performed.
+ */
+ public IAttributeContent getEditorPanelContent();
+
+ /**
+ * Retrieve the error message to be displayed to the user
+ */
+ public String getErrorMessage();
+} \ No newline at end of file
diff --git a/base/console/src/com/netscape/admin/certsrv/IFilterPanel.java b/base/console/src/com/netscape/admin/certsrv/IFilterPanel.java
new file mode 100644
index 000000000..2758e7152
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/IFilterPanel.java
@@ -0,0 +1,67 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+/**
+ * Filter Panel Interface
+ *
+ * The Filter Panel is plugable UI intended for constructing search filter for
+ * the certificate attributes. It will contain the Filter type, operation type,
+ * and construct the filter string to be used by the database mapper.
+ *
+ * <XXX DOCUMENT PANEL SIZE>
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv
+ */
+public interface IFilterPanel {
+
+ /**
+ * validate the content contained in this panel. Called when
+ * the user pressed ok button.
+ *
+ * this method should return false if the selections
+ * made by the user is not acceptable. ie. no selection made.
+ *
+ * getErrorMessage() will be called to retrieve the message
+ * and displayed to the user.
+ */
+ public boolean validateFilterPanelContent();
+
+ /**
+ * name of this filter type. should be the same as attribute name.
+ */
+ public String getFilterIdentifier();
+
+ /**
+ * string representation of operation type
+ */
+ public String getFilterOperation();
+
+ /**
+ * Actual filter string to be passed on to the server side.
+ * ie. (KeyUsage==1000111)
+ */
+ public String getFilterString();
+
+ /**
+ * Retrieve the error message to be displayed to the user
+ */
+ public String getErrorMessage();
+} \ No newline at end of file
diff --git a/base/console/src/com/netscape/admin/certsrv/IMenuAction.java b/base/console/src/com/netscape/admin/certsrv/IMenuAction.java
new file mode 100644
index 000000000..59ff0562a
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/IMenuAction.java
@@ -0,0 +1,40 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import com.netscape.management.client.*;
+
+/**
+ * This class represents the interface for the menu action listener
+ * that will be called based on the menu selection.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv
+ */
+public interface IMenuAction {
+
+ /**
+ * Perform the action for the menu item
+ */
+ public void perform(IPage viewInstance);
+
+}
+
+
+
diff --git a/base/console/src/com/netscape/admin/certsrv/IRefreshTab.java b/base/console/src/com/netscape/admin/certsrv/IRefreshTab.java
new file mode 100644
index 000000000..c69bedc4c
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/IRefreshTab.java
@@ -0,0 +1,41 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+/**
+ * The interface for refreshing the tab.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ *
+ * @see com.netscape.admin.certsrv.IRefreshTabPanel
+ * @see com.netscape.admin.certsrv.menu.RefreshTabPane
+ * @see com.netscape.admin.certsrv.CMSBaseResourceModel
+ */
+public interface IRefreshTab {
+
+ /**
+ * fresh the panel. The panel should IGNOR all
+ * modification made, retrieve the old value
+ * from the server side, and populate the UI
+ * components on this panel.
+ */
+ public void refresh();
+
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/IRefreshTabPanel.java b/base/console/src/com/netscape/admin/certsrv/IRefreshTabPanel.java
new file mode 100644
index 000000000..bc657b0db
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/IRefreshTabPanel.java
@@ -0,0 +1,38 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+/**
+ * The interface to get selected tab from the tab panel.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.IRefreshTab
+ * @see com.netscape.admin.certsrv.menu.RefreshTabPane
+ * @see com.netscape.admin.certsrv.CMSBaseResourceModel
+ */
+public interface IRefreshTabPanel {
+
+ /**
+ * Get Selected Tab from Tab panel
+ */
+ public CMSBasePanel getSelectedTab();
+
+
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/IResourceSelectionListener.java b/base/console/src/com/netscape/admin/certsrv/IResourceSelectionListener.java
new file mode 100644
index 000000000..1f1c3deee
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/IResourceSelectionListener.java
@@ -0,0 +1,39 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import com.netscape.management.client.*;
+
+/**
+ * Resource Selection Notification
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public interface IResourceSelectionListener
+{
+ /**
+ * Called when the object is selected.
+ */
+ public abstract void select( IResourceObject parent, Object viewInstance);
+
+ /**
+ * Called when the object is unselected.
+ */
+ public abstract boolean unselect( IResourceObject parent, Object viewInstance);
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/ISubSystemUILoader.java b/base/console/src/com/netscape/admin/certsrv/ISubSystemUILoader.java
new file mode 100644
index 000000000..1bf05dfd6
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/ISubSystemUILoader.java
@@ -0,0 +1,33 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+/**
+ * Netscape Certificate Server 4.0 SubSystem UI Loader interface
+ *
+ * This class represents the interface for the loading of UI components
+ * associated with each subsystem.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @date 03/30/97
+ */
+public interface ISubSystemUILoader {
+ public void register();
+
+} \ No newline at end of file
diff --git a/base/console/src/com/netscape/admin/certsrv/IUIMapper.java b/base/console/src/com/netscape/admin/certsrv/IUIMapper.java
new file mode 100644
index 000000000..e24e38664
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/IUIMapper.java
@@ -0,0 +1,89 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+/**
+ * UI Mapper Interface
+ *
+ * The UIMapper is intended for the editing and
+ * the display of the certificate attributes. This
+ * includes most the certificate attributes and extensions
+ * defined in PKCS and PKIX.
+ *
+ * Each Individual UI Mapper should provide the methods
+ * defined in this interface. It must extends the
+ * JFC JPanel object. The UI Mapper should not exceeds
+ * the size of 400(Width)x450(Height). Use of LayoutManager
+ * is recommended.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv
+ */
+public interface IUIMapper {
+
+ /**
+ * Retrieve the attr name.
+ * The name will be presented to the user (i.e. Key Usage, Basic Constraints)
+ *
+ * @return attribute name
+ */
+ public String getName();
+
+ /**
+ * Retrieve the attr description.
+ * The description will be use as tool tip on the extension selection
+ * screen.
+ *
+ * @return description or null if none
+ */
+ public String getDesc();
+
+ /**
+ * Is this UI provide edit panel
+ */
+ public boolean isEditable();
+
+ /**
+ * Is this UI Provide display panel
+ */
+ public boolean isDisplayable();
+
+ /**
+ * Is this UI provide search filter panel
+ */
+ public boolean isFilterable();
+
+ /**
+ * retrieve Editor Panel
+ * isEditable() will be called before this operation is
+ * used.
+ */
+ public IEditorPanel getEditorPanel();
+
+ /**
+ * retrieve Display Panel
+ */
+ public IDisplayPanel getDisplayPanel();
+
+ /**
+ * Retrieve Filter Panel
+ */
+ public IFilterPanel getFilterPanel();
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/LabelCellRenderer.java b/base/console/src/com/netscape/admin/certsrv/LabelCellRenderer.java
new file mode 100644
index 000000000..ea41f6b45
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/LabelCellRenderer.java
@@ -0,0 +1,116 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import java.awt.*;
+import java.lang.*;
+import javax.swing.table.*;
+import javax.swing.border.*;
+import javax.swing.*;
+import java.io.Serializable;
+
+/**
+ * Class that will render label correctly in table
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv
+ */
+public class LabelCellRenderer
+ implements TableCellRenderer, Serializable
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ protected JComponent component;
+ protected ValueProperty value;
+ public final static Color HIGHLIGHTCOLOR = new Color(0, 0, 128);
+ public final static Color WHITECOLOR = Color.white;
+ public final static Color BLACKCOLOR = Color.black;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+
+ public LabelCellRenderer(JLabel x) {
+ component = x;
+ x.setOpaque(true);
+ x.setBorder(new EmptyBorder(1,CMSAdminUtil.COMPONENT_SPACE, 1, 2));
+ JTextField temp = new JTextField();
+ x.setFont(temp.getFont());
+ value = new ValueProperty();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ public void setToolTipText(String text) {
+ if (component instanceof JComponent)
+ ((JComponent)component).setToolTipText(text);
+ }
+
+ public Component getComponent() {
+ return component;
+ }
+
+ //==== Implementing TableCellRenderer =========
+
+ public Component getTableCellRendererComponent(JTable table, Object value,
+ boolean isSelected,
+ boolean hasFocus,
+ int row, int column) {
+
+ if(value == null) {
+ value = table.getModel().getValueAt(row, column);
+ }
+ this.value.setValue(value);
+ component.setBackground(isSelected ? HIGHLIGHTCOLOR : WHITECOLOR);
+ component.setForeground(isSelected ? WHITECOLOR : BLACKCOLOR);
+ return component;
+ }
+
+
+ public class ValueProperty implements Serializable {
+ public Object value;
+
+ public void setValue(Object x) {
+ if (x == null) {
+ value = "";
+ //System.out.println("SetValue: x is null");
+ } else {
+ value = x;
+ }
+ if (x instanceof Icon)
+ ((JLabel)component).setIcon((Icon)x);
+ if (x instanceof String)
+ ((JLabel)component).setText(x.toString());
+ if (x instanceof JLabel) {
+ //System.out.println("SetValue: TTIP="+((JLabel)x).getToolTipText());
+ ((JLabel)component).setIcon(((JLabel)x).getIcon());
+ ((JLabel)component).setText(((JLabel)x).getText());
+ ((JLabel)component).setHorizontalAlignment(((JLabel)x).getHorizontalAlignment());
+ ((JLabel)component).setToolTipText(((JLabel)x).getToolTipText());
+ }
+ }
+
+ }
+
+}
+
+
diff --git a/base/console/src/com/netscape/admin/certsrv/MultilineLabelUI.java b/base/console/src/com/netscape/admin/certsrv/MultilineLabelUI.java
new file mode 100644
index 000000000..931732675
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/MultilineLabelUI.java
@@ -0,0 +1,534 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import java.util.*;
+import javax.swing.*;
+import javax.swing.plaf.basic.*; //<JFC1.0>
+//<JFC0.7>import javax.swing.basic.*;
+import javax.swing.plaf.*;
+import java.awt.event.ActionEvent;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Rectangle;
+import java.awt.Insets;
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.io.Serializable;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import javax.swing.AbstractAction;
+
+/**
+ * Specific UI to handle to the line wrap for the multi-line log entries.
+ *
+ * This UI component extends the BasicLabelUI to handle multi-line label.
+ * NOTE:
+ * [1] This class does not break up the lines automatically. It relies on
+ * '\n' in input text.
+ * [2] This UI implementation can NOT be shared between components. Each
+ * JLabel instance needs to install its own instance of MultilineLabelUI.
+ * TODO:
+ * [1] clipping, append "..."
+ * [2] auto wrapping
+ *
+ * @version $Revision$, $Date$
+ */
+public class MultilineLabelUI extends BasicLabelUI {
+
+ /**
+ * Replaced with our own layout routine.
+ *
+ * @see SwingUtilities#layoutCompoundLabel
+ */
+ protected String layoutCL(
+ JLabel label,
+ FontMetrics fontMetrics,
+ String text,
+ Icon icon,
+ Rectangle viewR,
+ Rectangle iconR,
+ Rectangle textR)
+ {
+ return layoutCompoundLabel(
+ fontMetrics,
+ text,
+ icon,
+ label.getVerticalAlignment(),
+ label.getHorizontalAlignment(),
+ label.getVerticalTextPosition(),
+ label.getHorizontalTextPosition(),
+ viewR,
+ iconR,
+ textR,
+ label.getIconTextGap());
+ }
+
+ /**
+ * Paint the label text in the foreground color, if the label
+ * is opaque then paint the entire background with the background
+ * color. The Label text is drawn by paintEnabledText() or
+ * paintDisabledText(). The locations of the label parts are computed
+ * by layoutCL.
+ *
+ * @see #paintEnabledText
+ * @see #paintDisabledText
+ * @see #layoutCL
+ */
+ public void paint(Graphics g, JComponent c) {
+ JLabel label = (JLabel)c;
+ String text = label.getText();
+ Icon icon = (label.isEnabled()) ? label.getIcon() : label.getDisabledIcon();
+ int i;
+
+ if ((icon == null) && (text == null)) {
+ return;
+ }
+
+ //g.setFont(label.getFont());
+ FontMetrics fm = g.getFontMetrics();
+ Rectangle iconR = new Rectangle();
+ Rectangle textR = new Rectangle();
+ Rectangle viewR = new Rectangle(c.getSize());
+ Insets viewInsets = c.getInsets();
+
+ viewR.x = viewInsets.left;
+ viewR.y = viewInsets.top;
+ viewR.width -= (viewInsets.left + viewInsets.right);
+ viewR.height -= (viewInsets.top + viewInsets.bottom);
+
+ //Debug.println("---> Calling layoutCL from paint");
+ layoutCL(label, fm, text, icon, viewR, iconR, textR);
+
+ if (icon != null) {
+ icon.paintIcon(null, g, iconR.x, iconR.y);
+ }
+
+ int horizontalAlignment = ((JLabel)c).getHorizontalAlignment();
+
+ if (text != null) {
+ int textX = textR.x;
+ int textY = textR.y + fm.getAscent();
+ char accChar = (char)label.getDisplayedMnemonic(); //<JFC1.0>
+ //<JFC0.7>char accChar = (char)label.getDisplayedKeyAccelerator();
+ char tmpChar;
+ int h = fm.getHeight();
+
+ int firstAccCharLine = findAccChar(textVector, accChar);
+
+ /* NOTE: draws each string in the textVector */
+ if (label.isEnabled()) {
+ g.setColor(label.getForeground());
+ for (i = 0; i < textVector.size(); i++) {
+ if (i == firstAccCharLine) {
+ tmpChar = accChar;
+ }
+ else {
+ tmpChar = '\0';
+ }
+ BasicGraphicsUtils.drawString(g,
+ (String)textVector.elementAt(i), tmpChar,
+ offsetArray[0], textY+h*i);
+ //offsetArray[i], textY+h*i);
+ }
+ }
+ else {
+ g.setColor(Color.gray);
+ for (i = 0; i < textVector.size(); i++) {
+ if (i == firstAccCharLine) {
+ tmpChar = accChar;
+ }
+ else {
+ tmpChar = '\0';
+ }
+ BasicGraphicsUtils.drawString(g,
+ (String)textVector.elementAt(i), tmpChar,
+ offsetArray[i], textY+h*i);
+ }
+ g.setColor(Color.white);
+ for (i = 0; i < textVector.size(); i++) {
+ if (i == firstAccCharLine) {
+ tmpChar = accChar;
+ }
+ else {
+ tmpChar = '\0';
+ }
+ BasicGraphicsUtils.drawString(g,
+ (String)textVector.elementAt(i), tmpChar,
+ offsetArray[i] + 1, textY + 1 + h*i);
+ }
+ }
+ }
+ }
+
+ public Dimension getPreferredSize(JComponent c) {
+ Dimension realSize = super.getPreferredSize(c);
+ //Debug.println("MultilineLabelUI: realSize " + realSize);
+ int width, height;
+
+ /* if preferred width is set, always use the preferred width
+ */
+ if (preferredSize != null) {
+ width = preferredSize.width;
+ }
+ else {
+ width = realSize.width;
+ }
+ /* compare computed height with the preferred height,
+ * return whichever is larger
+ */
+ height = realSize.height;
+ if (preferredSize != null) {
+ height = preferredSize.height > height ?
+ preferredSize.height : height;
+ }
+ Dimension result = new Dimension(width, height);
+ //Debug.println("MultilineLabelUI: preferredSize " + result);
+ return result;
+ }
+
+ private final int computeStringVWidth(FontMetrics fm, Vector strV, int[] widthA) {
+ int w = 0, width = 0;
+ //Debug.println("computeStringWidth: vsize " + strV.size());
+ for (int i = 0; i < strV.size(); i++) {
+ w = SwingUtilities.computeStringWidth(fm, (String)strV.elementAt(i));
+ //Debug.println("computeStringWidth: w for " + (String)strV.elementAt(i) + " is " + w);
+ widthA[i] = w;
+ if (w > width) width = w;
+ }
+ //Debug.println("computeStringWidth: width " + width);
+ return width;
+ }
+
+ public static ComponentUI createUI(JComponent c) {
+ return new MultilineLabelUI();
+ }
+
+ /* NOTE: " " has to be the first entry */
+ static final String[] SEPARATORS = {" ", ".", ",", "?", "-", ":", ";", "!", "/", "\\"};
+ Vector textVector;
+ int[] widthArray;
+ int[] offsetArray;
+
+ protected Dimension preferredSize;
+
+ boolean _parsed = false;
+
+ public void parse() {
+ _parsed = false;
+ }
+
+ /**
+ * Only the preferred width is observed. MultilineLabelUI will break
+ * the input text into multiple lines by calling wrapString. Derived
+ * class should overrid wrapString to provide different parsing behavior.
+ * The result of wrapString will determine the preferred height of this
+ * component.
+ */
+ public void setWrap(int width) {
+ if (preferredSize == null) {
+ preferredSize = new Dimension();
+ }
+ preferredSize.width = width;
+ }
+
+ /**
+ * This method break the input text into a vector of strings.
+ * The default implementation is based on '\n' in the text.
+ * Override this method to provide different parsing behavior.
+ * wrapString expects the input string to be the last element
+ * in the vector.
+ */
+ protected void wrapString(Vector v, FontMetrics fm, int w, String[] separators) {
+ String s = (String)v.lastElement();
+ //Debug.println("----> calling wrapString with " + s);
+ if ((null == s) || ("".equals(s))) {
+ return;
+ }
+ if (fm.stringWidth(s) > w) {
+ String s1 = s, s2 = "";
+ int i = -1;
+ int j;
+ int k;
+ while (fm.stringWidth(s1) > w) {
+ for (j = 0; j < separators.length; j++) {
+ i = s1.lastIndexOf(separators[j]);
+ if (i != -1 && i != (s1.length()-1)) {
+ break;
+ }
+ }
+ if (i == -1) {
+ for (k = s1.length()-1; k > 1; k--) {
+ String test = s1.substring(0, k-1);
+ if (fm.stringWidth(test) < w) {
+ s1 = test;
+ s2 = s.substring(s1.length());
+ break;
+ }
+ }
+ }
+ else {
+ s1 = (s1.substring(0, i+1)).trim();
+ s2 = s.substring(i+1);
+ }
+ }
+ v.removeElementAt(v.size() - 1);
+ v.addElement(s1);
+ v.addElement(s2.trim());
+ wrapString(v, fm, w, separators);
+ }
+ else {
+ return;
+ }
+ }
+
+ protected void parseTextV(String text, Vector textV) {
+ if (text == null || "".equals(text)) {
+ textV.addElement("");
+ return;
+ }
+
+ char[] textContent = text.toCharArray();
+ int begin = 0, end = 0;
+ for (end = 0; end < textContent.length; end++) {
+ if (textContent[end] == '\n') {
+ textV.addElement(new String(textContent, begin, end - begin));
+ begin = end + 1;
+ }
+ }
+ if (begin != textContent.length) {
+ textV.addElement(new String(textContent, begin, end - begin));
+ }
+ }
+
+ public String layoutCompoundLabel(
+ FontMetrics fm,
+ String text,
+ Icon icon,
+ int verticalAlignment,
+ int horizontalAlignment,
+ int verticalTextPosition,
+ int horizontalTextPosition,
+ Rectangle viewR,
+ Rectangle iconR,
+ Rectangle textR,
+ int textIconGap)
+ {
+ /* Initialize the icon bounds rectangle iconR.
+ */
+
+ if (icon != null) {
+ iconR.width = icon.getIconWidth();
+ iconR.height = icon.getIconHeight();
+ }
+ else {
+ iconR.width = iconR.height = 0;
+ }
+
+ /* Initialize the text bounds rectangle textR. If a null
+ * or and empty String was specified we substitute "" here
+ * and use 0,0,0,0 for textR.
+ */
+
+ boolean textIsEmpty = (text == null) || text.equals("");
+
+ /* Unless both text and icon are non-null, we effectively ignore
+ * the value of textIconGap. The code that follows uses the
+ * value of gap instead of textIconGap.
+ */
+
+ int gap = (textIsEmpty || (icon == null)) ? 0 : textIconGap;
+
+ /* NOTE: break up the text into multiple lines */
+ /* TODO: clean up parseTextV and wrapString */
+ if (!_parsed) {
+ textVector = new Vector();
+ if (preferredSize != null) {
+ /* remove newline before calling wrapString
+ if (!textIsEmpty) {
+ text = text.replace('\n', ' ');
+ }
+ textVector.addElement(text);
+ */
+
+ int iconW;
+ iconW = (icon == null) ? 0 : icon.getIconWidth();
+
+ Vector tmp = new Vector();
+ //Debug.println("calling parseTextV with " + text);
+ parseTextV(text, tmp);
+ for (Enumeration e = tmp.elements(); e.hasMoreElements(); ) {
+ String subs = (String)e.nextElement();
+ //Debug.println("parseTextV returns " + subs);
+ textVector.addElement(subs);
+ wrapString(textVector, fm, preferredSize.width - gap - iconW, SEPARATORS);
+ }
+ }
+ else {
+ parseTextV(text, textVector);
+ }
+ _parsed = true;
+ }
+ widthArray = new int[textVector.size()];
+ offsetArray = new int[widthArray.length];
+
+ if (textIsEmpty) {
+ textR.width = textR.height = 0;
+ text = "";
+ }
+ else {
+ textR.width = computeStringVWidth(fm,textVector,widthArray);
+ textR.height = fm.getHeight() * textVector.size();
+ }
+
+ /* NOTE: we need to handle clipped case
+ if (!textIsEmpty) {
+
+ int availTextWidth;
+
+ if (horizontalTextPosition == CENTER) {
+ availTextWidth = viewR.width;
+ }
+ else {
+ availTextWidth = viewR.width - (iconR.width + gap);
+ }
+
+
+ if (textR.width > availTextWidth) {
+ String clipString = "...";
+ int totalWidth = computeStringWidth(fm,clipString);
+ int nChars;
+ for(nChars = 0; nChars < text.length(); nChars++) {
+ totalWidth += fm.charWidth(text.charAt(nChars));
+ if (totalWidth > availTextWidth) {
+ break;
+ }
+ }
+ text = text.substring(0, nChars) + clipString;
+ textR.width = computeStringWidth(fm,text);
+ }
+ }
+ */
+
+
+ /* Compute textR.x,y given the verticalTextPosition and
+ * horizontalTextPosition properties
+ */
+
+ if (verticalTextPosition == SwingUtilities.TOP) {
+ if (horizontalTextPosition != SwingUtilities.CENTER) {
+ textR.y = 0;
+ }
+ else {
+ textR.y = -(textR.height + gap);
+ }
+ }
+ else if (verticalTextPosition == SwingUtilities.CENTER) {
+ textR.y = (iconR.height / 2) - (textR.height / 2);
+ }
+ else { // (verticalTextPosition == SwingUtilities.BOTTOM)
+ if (horizontalTextPosition != SwingUtilities.CENTER) {
+ textR.y = iconR.height - textR.height;
+ }
+ else {
+ textR.y = (iconR.height + gap);
+ }
+ }
+
+ if (horizontalTextPosition == SwingUtilities.LEFT) {
+ textR.x = -(textR.width + gap);
+ }
+ else if (horizontalTextPosition == SwingUtilities.CENTER) {
+ textR.x = (iconR.width / 2) - (textR.width / 2);
+ }
+ else { // (verticalTextPosition == SwingUtilities.RIGHT)
+ textR.x = (iconR.width + gap);
+ }
+
+ /* labelR is the rectangle that contains iconR and textR.
+ * Move it to its proper position given the labelAlignment
+ * properties.
+ */
+
+ Rectangle labelR = iconR.union(textR);
+ int dx, dy;
+
+ if (verticalAlignment == SwingUtilities.TOP) {
+ dy = viewR.y - labelR.y;
+ }
+ else if (verticalAlignment == SwingUtilities.CENTER) {
+ dy = (viewR.y + (viewR.height / 2)) - (labelR.y + (labelR.height / 2));
+ }
+ else { // (verticalAlignment == SwingUtilities.BOTTOM)
+ dy = (viewR.y + viewR.height) - (labelR.y + labelR.height);
+ }
+
+ if (horizontalAlignment == SwingUtilities.LEFT) {
+ dx = viewR.x - labelR.x;
+ }
+ else if (horizontalAlignment == SwingUtilities.CENTER) {
+ dx = (viewR.x + (viewR.width / 2)) - (labelR.x + (labelR.width / 2));
+ }
+ else { // (horizontalAlignment == SwingUtilities.RIGHT)
+ dx = (viewR.x + viewR.width) - (labelR.x + labelR.width);
+ }
+
+ /* Translate textR and glypyR by dx,dy.
+ */
+ textR.x += dx;
+ textR.y += dy;
+
+ iconR.x += dx;
+ iconR.y += dy;
+
+ /* NOTE: calculate string offsets based on the string width and
+ * horizontal alignment
+ */
+ computeOffset(textR, horizontalAlignment, widthArray, offsetArray);
+
+ //Debug.println("layoutCompound: " + text + " " + textR);
+ return text;
+ }
+
+ final void computeOffset(Rectangle textR, int horizontalAlignment, int[] widthA, int[] offsetA) {
+ for (int i = 0; i < widthA.length; i++) {
+ if (SwingConstants.LEFT == horizontalAlignment) {
+ offsetA[i] = textR.x;
+ }
+ else if (SwingConstants.RIGHT == horizontalAlignment) {
+ offsetA[i] = textR.x + textR.width - widthA[i];
+ }
+ else if (SwingConstants.CENTER == horizontalAlignment) {
+ offsetA[i] = textR.x + (int)((textR.width - widthA[i]) * 0.5);
+ }
+ }
+ }
+
+ final int findAccChar(Vector strV, char c) {
+ for (int i = 0; i < strV.size(); i++) {
+ String s = (String)strV.elementAt(i);
+ if (s.indexOf(c) != -1) {
+ return i;
+ }
+ }
+ return 0;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/PasswordCellRenderer.java b/base/console/src/com/netscape/admin/certsrv/PasswordCellRenderer.java
new file mode 100644
index 000000000..172f0499e
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/PasswordCellRenderer.java
@@ -0,0 +1,71 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import java.awt.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import javax.swing.table.*;
+
+/**
+ * class used to creat the password label
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public class PasswordCellRenderer extends JLabel
+ implements ListCellRenderer, TableCellRenderer
+{
+ static Color HIGHLIGHTCOLOR = new Color(0, 0, 128);
+ static Color WHITECOLOR = Color.white;
+ static Color BLACKCOLOR = Color.black;
+
+ public PasswordCellRenderer() {
+ super();
+ setOpaque(true);
+ setBorder(new EmptyBorder(1,CMSAdminUtil.COMPONENT_SPACE, 1, 2));
+ JPasswordField temp = new JPasswordField();
+ setFont(temp.getFont());
+ }
+
+ public Component getListCellRendererComponent(JList list,
+ Object value, int index, boolean isSelected, boolean cellHasFocus) {
+ StringBuffer buf = new StringBuffer();
+ for(int i=0; i< ((String)value).length(); i++)
+ buf.append("*");
+ setText(buf.toString());
+ setBackground(isSelected ? HIGHLIGHTCOLOR : WHITECOLOR);
+ setForeground(isSelected ? WHITECOLOR : BLACKCOLOR);
+ return this;
+ }
+
+ public Component getTableCellRendererComponent(JTable table, Object value,
+ boolean isSelected, boolean hasFocus, int row, int column) {
+ if (value!=null) {
+ StringBuffer buf = new StringBuffer();
+ for(int i=0; i< ((String)value).length(); i++)
+ buf.append("*");
+ setText(buf.toString());
+ setBackground(isSelected ? HIGHLIGHTCOLOR : WHITECOLOR);
+ setForeground(isSelected ? WHITECOLOR : BLACKCOLOR);
+ }
+ return this;
+
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/StatusItemContinuousProgress.java b/base/console/src/com/netscape/admin/certsrv/StatusItemContinuousProgress.java
new file mode 100644
index 000000000..6945456f1
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/StatusItemContinuousProgress.java
@@ -0,0 +1,97 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import java.lang.*;
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Status bar item for continuous progress feedback
+ * [This one is borrowed from directory server]
+ *
+ * @author kirwin
+ * @version %I%, %G%
+ * @date 4/8/98
+ * @see com.netscape.admin.certsrv
+ */
+public class StatusItemContinuousProgress extends StatusItemProgress
+{
+ private int _val = 0;
+ private static int VALUE_INCREMENT = 9;
+ private static int UPDATE_INTERVAL = 50;
+ private static int INITIAL_DELAY = 0;
+ private ProgressTracker _thread;
+ private boolean _running = false;
+
+ public StatusItemContinuousProgress(String id) {
+ super(id, 0);
+ _thread = new ProgressTracker();
+ _thread.start();
+ }
+
+ public void start() {
+ if (!_running) {
+ _running = true;
+ _val = 0;
+ setValue(0);
+ _thread.resume();
+ }
+ }
+
+ public void stop() {
+ if (_running) {
+ _running = false;
+ _val = 0;
+ setValue(0);
+ }
+ }
+
+ private void increment() {
+ Graphics g = getGraphics();
+ if ((_val += VALUE_INCREMENT) > 99) {
+ _val = 0;
+ if (g != null) {
+ Rectangle r = getBounds();
+ g.clearRect(0, 0, r.width, r.height);
+ }
+ }
+ setValue(_val);
+ update(g);
+ }
+
+ private class ProgressTracker extends Thread {
+
+ public void run() {
+ while (true) {
+ while (_running) {
+ increment();
+ try {
+ sleep(UPDATE_INTERVAL);
+ } catch (InterruptedException e) {
+ Debug.println("sleep exception");
+ }
+ }
+ suspend();
+ }
+ }
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/UIMapperRegistry.java b/base/console/src/com/netscape/admin/certsrv/UIMapperRegistry.java
new file mode 100644
index 000000000..531a0b5fc
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/UIMapperRegistry.java
@@ -0,0 +1,121 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv;
+
+import com.netscape.management.client.util.*;
+import java.security.cert.CertificateException;
+import netscape.security.x509.*;
+import java.util.*;
+
+/**
+ * UIMapper Registry
+ *
+ * This Registry keeps track of the mappings between the certificate
+ * attribute class and the UI Mapper.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.IUIMapper
+ */
+public class UIMapperRegistry {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static UIMapperRegistry mSelf = null;
+ private static Hashtable mAttrContent = new Hashtable();
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * register new certificate attribute.
+ *
+ * @param className fully qualified class name implementing CertAttrSet
+ * @param oid the string representation of the object identifier
+ * @param extentionName the name of the attribute.
+ * @param mapperClassName fully qualified class name implementing UI
+ */
+ /* XXX WE DON'T NEED THIS
+ public static void registerCertAttrUI(String className, String oid,
+ String attrName, String mapperClassName)
+ throws ClassNotFoundException, CertificateException
+ {
+ Class extClass, mapClass;
+ extClass = Class.forName(className);
+ mapClass = Class.forName(mapperClassName);
+ OIDMap.addAttribute(className,oid,attrName);
+ registerCertAttrUI(attrName,mapperClassName);
+ }
+ */
+
+ /**
+ * internal register new cert attr
+ *
+ * @param className fully qualified class name implementing CertAttrSet
+ * @param extentionName the name of the attribute.
+ * @param mapperClassName fully qualified class name implementing UI
+ */
+ public static void registerCertAttrUI(String attrName, String mapperClassName) {
+ mAttrContent.put(attrName, mapperClassName);
+ }
+
+ /**
+ * Retrieve all certificate attribute name
+ */
+ public static Enumeration getCertAttrNames() {
+ return mAttrContent.keys();
+ }
+
+ /**
+ * Retrieve all extension UI Mappers
+ */
+ public static Enumeration getCertAttrUIs() {
+ return mAttrContent.elements();
+ }
+
+ /**
+ * Get instance of UI Mapper by certificate attribute name
+ *
+ * @param certAttrClassName certificate attribute name
+ */
+ public static IUIMapper getCertAttrUI(String certAttrClassName)
+ throws InstantiationException, IllegalAccessException, ClassNotFoundException
+ {
+ String mapperClassName = (String) mAttrContent.get(certAttrClassName);
+ Class mapClass = Class.forName(mapperClassName);
+ IUIMapper instance = (IUIMapper) mapClass.newInstance();
+ return instance;
+ }
+
+ //load the static stuff here
+ static {
+ loadUIMappings();
+ }
+
+ //loads the standard UI components
+ private static void loadUIMappings() {
+ /*
+ UIMapperRegistry registry = UIMapperRegistry.getUIMapperRegistry();
+ registry.addExtensionMapping
+ */
+ }
+
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/certsrv-help.properties b/base/console/src/com/netscape/admin/certsrv/certsrv-help.properties
new file mode 100644
index 000000000..1faf8ef68
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/certsrv-help.properties
@@ -0,0 +1,534 @@
+;Last update: Aug 19, 1998
+
+; CA General Setting
+configuration-ca-general-help = cert
+configuration-ca-connector-help = cert
+configuration-ca-connector-editor-help = cert
+
+; Notification
+notification-ra-reqinq-help = cert
+notification-ra-certissued-help = cert
+notification-ca-reqinq-help = cert
+notification-ca-certissued-help = cert
+
+; Job scheduling
+jobsscheduler-certsrv-setting-jobrule-help = cert
+jobsscheduler-certsrv-jobrules-help = cert
+jobsscheduler-certsrv-add-jobrule-dbox-help = cert
+jobsscheduler-certsrv-edit-jobrule-dbox-help = cert
+jobsscheduler-certsrv-jobplugin-help = cert
+jobsscheduler-certsrv-register-jobplugin-dbox-help = cert
+;OOTB job plugins
+configuration-jobrules-renewalnotification = cert
+configuration-jobrules-requestinqueuejob = cert
+configuration-jobrules-unpublishexpiredjobs = cert
+
+;Certificate server configuration settings
+;
+;Network configuration
+configuration-system-network-help = cert
+;Database configuration
+configuration-database-settings-help = cert
+;Encryption configuration
+configuration-system-encryption-help = cert
+;SNMP configuration
+configuration-system-snmp-help = cert
+;SMTP configuration
+configuration-system-smtp-help = cert
+;System log configuration
+configuration-logs-system-help = cert
+;Error log configuration
+configuration-logs-error-help = cert
+;Transactions log configuration
+configuration-logs-audit-help = cert
+;log instance configuration
+configuration-loginstances-help = cert
+;log plugin configuration
+configuration-log-plugin-help = cert
+;add log plugin configuration
+configuration-add-logrule-dbox-help = cert
+configuration-logrules-logfile = cert
+configuration-logrules-rollinglogfile = cert
+configuration-logrules-nteventlog = cert
+
+;RA configuration settings
+;
+;General settings
+configuration-ra-general-help = cert
+;RA connector
+configuration-ra-connector-help = cert
+;RA connector editor
+configuration-ra-connector-editor-help = cert
+;Certificate life cycle management configuration
+configuration-ra-clm-help = cert
+;Policy rules management
+configuration-ra-policyrules-help = cert
+;Add policy rules management
+configuration-ra-add-policyrule-dbox-help = cert
+;Edit policy rules management
+configuration-ra-edit-policyrule-dbox-help = cert
+;Reorder policy rules management
+configuration-ra-reorder-policyrule-dbox-help = cert
+;Policy plugin registration
+configuration-ra-policyplugin-help = cert
+;Register policy plugin registration
+configuration-ra-register-policyplugin-dbox-help = cert
+;Servlet management
+configuration-ra-servletmgt-help = cert
+;Add servlet plugin implementation
+configuration-ra-add-servletplugin-dbox-help = cert
+;Edit servlet instance
+configuration-ra-edit-servlet-dbox-help = cert
+;Servlet plugin registration
+configuration-ra-servletplugin-help = cert
+;Register plugin registration
+configuration-ra-register-servletplugin-dbox-help = cert
+
+;CRL Extensions configuration settings
+configuration-ca-crlextensioninstances-help = cert
+configuration-ca-edit-crlextensionrule-dbox-help = cert
+configuration-ca-add-crlextensionrule-dbox-help = cert
+;CRL Extensions
+configuration-ca-edit-crlextension-authoritykeyidentifier = cert
+configuration-ca-edit-crlextension-issueralternativename = cert
+configuration-ca-edit-crlextension-crlnumber = cert
+configuration-ca-edit-crlextension-issuingdistributionpoint = cert
+;CRL Entry Extensions
+configuration-ca-edit-crlextension-crlreason = cert
+configuration-ca-edit-crlextension-holdinstruction = cert
+configuration-ca-edit-crlextension-invaliditydate = cert
+configuration-ca-edit-crlextension-certificateissuer = cert
+;CRL Extensions Management
+configuration-ca-crlinstances-help = cert
+
+;Destination for LDAP publishing
+configuration-ra-ldappublish-destination-help = cert
+;User certificate for LDAP publishing
+configuration-ra-ldappublish-usercert-help = cert
+;Mapper configuration for CA LDAP publishing
+configuration-ldappublish-camapper-dbox-help = cert
+;Mapper configuration for RA LDAP publishing
+configuration-ldappublish-ramapper-dbox-help = cert
+
+;LDAP publishing mappers 12/29/99
+configuration-ca-edit-mapperrule-dbox-help = cert
+configuration-ca-mapperinstances-help = cert
+configuration-ca-mapperplugin-help = cert
+configuration-ca-add-mapperrule-dbox-help = cert
+configuration-ldappublish-mapper-simplemapper = cert
+configuration-ldappublish-mapper-casimplemapper = cert
+configuration-ldappublish-mapper-certexactmapper = cert
+configuration-ldappublish-mapper-certsubjmapper = cert
+configuration-ldappublish-mapper-dncompsmapper = cert
+
+;LDAP publishers 12/29/99
+configuration-ca-edit-publisherrule-dbox-help = cert
+configuration-ca-publisherinstances-help = cert
+configuration-ca-publisherplugin-help = cert
+configuration-ca-add-publisherrule-dbox-help = cert
+configuration-ldappublish-publisher-filepublisher = cert
+configuration-ldappublish-publisher-cacertpublisher = cert
+configuration-ldappublish-publisher-certsubjpublisher = cert
+configuration-ldappublish-publisher-crlpublisher = cert
+configuration-ldappublish-publisher-usercertpublisher = cert
+configuration-ldappublish-publisher-ocsppublisher = cert
+
+;LDAP publish rule 01/25/00
+configuration-ca-ruleinstances-help = cert
+configuration-ca-edit-rulerule-dbox-help = cert
+configuration-ca-add-rulerule-dbox-help = cert
+
+
+;Policies 12/29/99
+configuration-policyrules-authkeyid = cert
+configuration-policyrules-basicconstraints = cert
+configuration-policyrules-crldistributionpoints = cert
+configuration-policyrules-certificatepolicies = cert
+configuration-policyrules-certificatescopeofuse = cert
+configuration-policyrules-dsakeyconstraints = cert
+configuration-policyrules-extendedkeyusage = cert
+configuration-policyrules-genericasn1ext = cert
+configuration-policyrules-issueraltname = cert
+configuration-policyrules-issuerconstraints = cert
+configuration-policyrules-keyalgorithmconstraints = cert
+configuration-policyrules-keyusage = cert
+configuration-policyrules-nameconstraints = cert
+configuration-policyrules-nsccomment = cert
+configuration-policyrules-nscerttype = cert
+configuration-policyrules-ocspnocheck = cert
+configuration-policyrules-pinpresent = cert
+configuration-policyrules-privatekeyusageperiod = cert
+configuration-policyrules-renewalconstraints = cert
+configuration-policyrules-renewalvalidityconstraints = cert
+configuration-policyrules-revocationconstraints = cert
+configuration-policyrules-rsakeyconstraints = cert
+configuration-policyrules-subcanamecheck = cert
+configuration-policyrules-subjaltname = cert
+configuration-policyrules-subjectdirectoryattributes = cert
+configuration-policyrules-subjectkeyidentifier = cert
+configuration-policyrules-uniquesubjectname = cert
+configuration-policyrules-validityconstraints = cert
+configuration-policyrules-defaultrevocation = cert
+configuration-policyrules-policyconstraints = cert
+configuration-policyrules-signingalgconstraints = cert
+configuration-policyrules-policymappings = cert
+configuration-policyrules-authinfoaccess = cert
+configuration-policyrules-certificaterenewalwindow = cert
+
+;CA configuration settings
+;
+;Policy rules management
+configuration-ca-policyrules-help = cert
+;Add policy rules management
+configuration-ca-add-policyrule-dbox-help = cert
+;Edit policy rules management
+configuration-ca-edit-policyrule-dbox-help = cert
+;Reorder policy rules management
+configuration-ca-reorder-policyrule-dbox-help = cert
+;Policy plugin registration
+configuration-ca-policyplugin-help = cert
+;Register policy plugin registration
+configuration-ca-register-policyplugin-dbox-help = cert
+;Servlet management
+configuration-ca-servletmgt-help = cert
+;Add servlet plugin implementation
+configuration-ca-add-servletplugin-dbox-help = cert
+;Edit servlet instance
+configuration-ca-edit-servlet-dbox-help = cert
+;Servlet plugin registration
+configuration-ca-servletplugin-help = cert
+;Register plugin registration
+configuration-ca-register-servletplugin-dbox-help = cert
+;Destination for LDAP publishing
+configuration-ca-ldappublish-destination-help = cert
+;CRL setting for LDAP publishing
+configuration-ca-ldappublish-crl-help = cert
+;CA certificate for LDAP publishing
+configuration-ca-ldappublish-cacert-help = cert
+;User certificate for LDAP publishing
+configuration-ca-ldappublish-usercert-help = cert
+
+;OCSP configuration
+;
+;Online Certificate Status Manager
+configuration-ocsp-general-help = cert
+;Revocation Info Stores
+configuration-ocsp-storeinstances-help = cert
+
+;KRA configuration settings
+;
+;Auto recovery
+configuration-kra-autorecovery-help = cert
+;User ids and passwords for auto recovery
+configuration-kra-autorecovery-agents-dbox-help = cert
+;Scheme management
+configuration-kra-schememgt-help = cert
+;Change recovery key scheme
+configuration-kra-wizard-change-keyscheme-help = cert
+;Enter existing recovery agent password
+configuration-kra-wizard-agentpwd-keyscheme-help = cert
+;Enter new recovery agent password
+configuration-kra-wizard-newagentpwd-keyscheme-help = cert
+;Recovery agent password
+configuration-kra-agentpwd-help = cert
+;Change agent password
+configuration-kra-change-agentpwd-dbox-help = cert
+;Policy rules management
+configuration-kra-policyrules-help = cert
+;Add policy rules management
+configuration-kra-add-policyrule-dbox-help = cert
+;Edit policy rules management
+configuration-kra-edit-policyrule-dbox-help = cert
+;Reorder policy rules management
+configuration-kra-reorder-policyrule-dbox-help = cert
+;Policy plugin registration
+configuration-kra-policyplugin-help = cert
+;Register policy plugin registration
+configuration-kra-register-policyplugin-dbox-help = cert
+
+;ACL configuration settings
+;
+;ACL
+configuration-acl-resourceobjects-help = cert
+configuration-acl-evaluators-help = cert
+configuration-acl-edit-help = cert
+configuration-acl-aci-edit-help = cert
+
+;Keys and certificates settings
+;
+;Keys and certs
+configuration-keycert-wizard-introduction-help = cert
+configuration-keycert-wizard-operationselection-help = cert
+configuration-keycert-wizard-certtype-help = cert
+configuration-keycert-wizard-key-help = cert
+configuration-keycert-wizard-subjectdn-help = cert
+configuration-keycert-wizard-validityperiod-help = cert
+configuration-keycert-wizard-certrequest-help = cert
+configuration-keycert-wizard-extension-help = cert
+configuration-keycert-wizard-selfsignedcert-help = cert
+configuration-keycert-wizard-selfsignedstatus-help = cert
+configuration-keycert-wizard-displaycertrequest-help = cert
+configuration-keycert-wizard-certrequeststatus-help = cert
+configuration-keycert-wizard-installcerttype-help = cert
+configuration-keycert-wizard-pastecert-help = cert
+configuration-keycert-wizard-displaycert-help = cert
+configuration-keycert-wizard-installcertstatus-help = cert
+configuration-keycert-wizard-tokenlogon-help = cert
+configuration-keycert-wizard-messagedigest-help = cert
+
+;Manage certificate
+;
+configuration-managecert-wizard-certlists-help = cert
+configuration-managecert-wizard-trustcert-help = cert
+
+;Certificate server authentication
+;
+;Users
+usersgroups-certsrv-users-help = cert
+;Add user
+usersgroups-certsrv-add-user-dbox-help = cert
+;Edit user information
+usersgroups-certsrv-edit-user-dbox-help = cert
+usersgroups-certsrv-select-user-dbox-help = cert
+;Manage user certificates
+usersgroups-certsrv-manage-usercert-dbox-help = cert
+;Groups
+usersgroups-certsrv-groups-help = cert
+;Add group
+usersgroups-certsrv-add-group-dbox-help = cert
+;Edit group
+usersgroups-certsrv-edit-group-dbox-help = cert
+
+;Authentication
+;Authenticaton rules management
+authentication-certsrv-authrules-help = cert
+;Add auth rules
+authentication-certsrv-add-authrule-dbox-help = cert
+;Edit auth rules
+authentication-certsrv-edit-authrule-dbox-help = cert
+authentication-certsrv-view-authrule-dbox-help = cert
+;Authentication plugin registration
+authentication-certsrv-authplugin-help = cert
+;Register auth plugin
+authentication-certsrv-register-authplugin-dbox-help = cert
+;Auth dialog
+authentication-certsrv-auth-dialog-help = cert
+;OOTB Auth plugins
+configuration-authrules-kerberosauth = cert
+configuration-authrules-nisauth = cert
+configuration-authrules-portalauth = cert
+configuration-authrules-uidpwddirauth = cert
+configuration-authrules-uidpwdpindirauth = cert
+
+;authentication implementations 1/1/2000
+authentication-certsrv-impl-ldap = cert
+authentication-certsrv-impl-ldappin = cert
+authentication-certsrv-impl-nis = cert
+authentication-certsrv-impl-portal= cert
+
+;Certificate server status
+;
+;Display status
+status-certsrv-help = cert
+status-logs-help = cert
+;System log content
+status-logs-system-help = cert
+;Error log content
+status-logs-error-help = cert
+;Transactions log content
+status-logs-audit-help = cert
+
+
+Last update: Jan 26, 1999
+
+;Installation Wizard
+;
+
+install-general-intro-wizard-help = cert
+install-internaldb-createdbagain-help = cert
+install-internaldb-configuration-wizard-help = cert
+install-network-configuration-wizard-help = cert
+install-administrator-configuration-wizard-help = cert
+install-internaldb-logon-wizard-help = cert
+install-services-configuration-wizard-help = cert
+install-ca-migration-enable-wizard-help = cert
+install-cakra-migration-enable-wizard-help = cert
+install-ca-migration-configuration-wizard-help = cert
+install-cakra-migration-configuration-wizard-help = cert
+install-catype-wizard-help = cert
+install-cakeylocal-configuration-wizard-help = cert
+install-cakeysub-configuration-wizard-help = cert
+install-cakrakeylocal-configuration-wizard-help = cert
+install-cakra-krakeylocal-configuration-wizard-help = cert
+install-cakrakeysub-configuration-wizard-help = cert
+install-cakra-krakeysub-configuration-wizard-help = cert
+install-cacert-subjectdn-wizard-help = cert
+install-cacertlocal-subjectdn-wizard-help = cert
+install-cacert-validity-wizard-help = cert
+install-cacert-extension-wizard-help = cert
+install-cacert-creation-wizard-help = cert
+install-cacert-request-wizard-help = cert
+install-cacertrequest-manual-wizard-help = cert
+install-cacert-installintro-wizard-help = cert
+install-cacert-paste-wizard-help = cert
+install-cacert-display-wizard-help = cert
+install-cacert-status-wizard-help = cert
+install-ratype-wizard-help = cert
+install-rakey-configuration-wizard-help = cert
+install-racert-subjectdn-wizard-help = cert
+install-racert-validity-wizard-help = cert
+install-racert-extension-wizard-help = cert
+install-racert-creation-wizard-help = cert
+install-racert-request-wizard-help = cert
+install-racertrequest-manual-wizard-help = cert
+install-racert-installintro-wizard-help = cert
+install-racert-paste-wizard-help = cert
+install-racert-display-wizard-help = cert
+install-racert-status-wizard-help = cert
+install-kratype-wizard-help = cert
+install-krakeysub-configuration-wizard-help = cert
+install-kracertsub-subjectdn-wizard-help = cert
+install-kracert-validity-wizard-help = cert
+install-kracert-extension-wizard-help = cert
+install-kracert-creation-wizard-help = cert
+install-kracert-request-wizard-help = cert
+install-kracertrequest-manual-wizard-help = cert
+install-kracert-installintro-wizard-help = cert
+install-kracert-paste-wizard-help = cert
+install-kracert-display-wizard-help = cert
+install-kracert-status-wizard-help = cert
+install-cassltypelocal-wizard-help = cert
+install-cassltypesub-wizard-help = cert
+install-cakrassltypelocal-wizard-help = cert
+install-cakrassltypesub-wizard-help = cert
+install-serverkeylocal-configuration-wizard-help = cert
+install-serverkeysub-configuration-wizard-help = cert
+install-sslcertlocal-subjectdn-wizard-help = cert
+install-sslcertsub-subjectdn-wizard-help = cert
+install-sslcert-validity-wizard-help = cert
+install-sslcert-extension-wizard-help = cert
+install-sslcert-creation-wizard-help = cert
+install-sslcert-request-wizard-help = cert
+install-sslcertrequest-manual-wizard-help = cert
+install-sslcert-installintro-wizard-help = cert
+install-sslcert-paste-wizard-help = cert
+install-sslcert-display-wizard-help = cert
+install-sslcert-status-wizard-help = cert
+install-cakratype-wizard-help = cert
+install-cakrakeylocal-configuration-wizard-help = cert
+install-cakrakeysub-configuration-wizard-help = cert
+install-cakracertlocal-subjectdn-wizard-help = cert
+install-cakra-kracertlocal-subjectdn-wizard-help = cert
+install-cakracertsub-subjectdn-wizard-help = cert
+install-cakra-kracertsub-subjectdn-wizard-help = cert
+install-cakracert-validity-wizard-help = cert
+install-cakra-kracert-validity-wizard-help = cert
+install-cakracert-extension-wizard-help = cert
+install-cakra-kracert-extension-wizard-help = cert
+install-cakracert-creation-wizard-help = cert
+install-cakra-kracert-creation-wizard-help = cert
+install-cakracert-request-wizard-help = cert
+install-cakra-kracert-request-wizard-help = cert
+install-cakracertrequest-manual-wizard-help = cert
+install-cakra-kracertrequest-manual-wizard-help = cert
+install-cakracert-installintro-wizard-help = cert
+install-cakra-kracert-installintro-wizard-help = cert
+install-cakracert-paste-wizard-help = cert
+install-cakra-kracert-paste-wizard-help = cert
+install-cakracert-display-wizard-help = cert
+install-cakra-kracert-display-wizard-help = cert
+install-cakracert-status-wizard-help = cert
+install-cakra-kracert-status-wizard-help = cert
+install-rakratype-wizard-help = cert
+install-rakrakey-configuration-wizard-help = cert
+install-rakra-krakeysub-configuration-wizard-help = cert
+install-rakracert-subjectdn-wizard-help = cert
+install-rakra-kracertsub-subjectdn-wizard-help = cert
+install-rakracert-validity-wizard-help = cert
+install-rakracert-extension-wizard-help = cert
+install-rakracert-creation-wizard-help = cert
+install-rakracert-request-wizard-help = cert
+install-rakra-kracert-request-wizard-help = cert
+install-rakracertrequest-manual-wizard-help = cert
+install-rakra-kracertrequest-manual-wizard-help = cert
+install-rakracert-installintro-wizard-help = cert
+install-rakra-kracert-installintro-wizard-help = cert
+install-rakracert-paste-wizard-help = cert
+install-rakra-kracert-paste-wizard-help = cert
+install-rakracert-display-wizard-help = cert
+install-rakra-kracert-display-wizard-help = cert
+install-rakracert-status-wizard-help = cert
+install-rakra-kracert-status-wizard-help = cert
+install-single-signon-enable-wizard-help = cert
+install-single-signon-wizard-help = cert
+install-certsetup-status-wizard-help = cert
+install-kra-storagekey-wizard-help = cert
+install-cakra-storagekey-wizard-help = cert
+install-rakra-storagekey-wizard-help = cert
+install-kra-mnscheme-wizard-help = cert
+install-cakra-mnscheme-wizard-help = cert
+install-rakra-mnscheme-wizard-help = cert
+install-kra-scheme-usrpwds-wizard-help = cert
+install-cakra-scheme-usrpwds-wizard-help = cert
+install-rakra-scheme-usrpwds-wizard-help = cert
+install-ca-remote-kra-wizard-help = cert
+install-ra-remote-kra-wizard-help = cert
+install-remote-ca-wizard-help = cert
+install-rakra-remote-ca-wizard-help = cert
+install-allcerts-getinstalled-wizard-help = cert
+install-catoken-logon-wizard-help = cert
+install-ratoken-logon-wizard-help = cert
+install-kratoken-logon-wizard-help = cert
+install-ssltoken-logon-wizard-help = cert
+install-internaltoken-logon-wizard-help = cert
+install-cacertclone-wizard-help = cert
+install-cakracertclone-wizard-help = cert
+install-racertclone-wizard-help = cert
+install-rakracertclone-wizard-help = cert
+install-kracertclone-wizard-help = cert
+install-rakracertclone-wizard-help = cert
+install-sslcertclone-wizard-help = cert
+install-ca-serialnumber-wizard-help = cert
+install-request-result-wizard-help = cert
+install-cert-mda-wizard-help = cert
+install-ca-clone-master-wizard-help = cert
+install-ca-ocspservice-wizard-help = cert
+install-ocsptype-wizard-help = cert
+install-ocspcert-subjectdn-wizard-help = cert
+install-ocspkey-configuration-wizard-help = cert
+install-ocspcert-request-wizard-help = cert
+install-ocspcertrequest-manual-wizard-help = cert
+install-ocspcert-installintro-wizard-help = cert
+install-ocsptoken-logon-wizard-help = cert
+install-ocspcert-paste-wizard-help = cert
+install-ocspcert-display-wizard-help = cert
+install-ocspcert-status-wizard-help = cert
+
+; additional tokens for admin guide
+configuration-overview = cert
+configuration-installation = cert
+configuration-certificatemanager = cert
+configuration-registrationmanager = cert
+configuration-ocsp = cert
+configuration-datarecoverymanager = cert
+configuration-adminbasics = cert
+configuration-authorization = cert
+configuration-authentication = cert
+configuration-certificateprofiles = cert
+configuration-policies = cert
+configuration-notifications = cert
+configuration-jobs = cert
+configuration-revocation = cert
+configuration-publishing = cert
+configuration-appendixA = cert
+configuration-appendixB = cert
+configuration-appendixC = cert
+
+; additional tokens for agent guide
+agent-overallservices = cert
+agent-certificateprofiles = cert
+agent-certificaterequests = cert
+agent-revokecertificates = cert
+agent-publishing = cert
+agent-recoverencrypteddata = cert
+agent-ocsp = cert
diff --git a/base/console/src/com/netscape/admin/certsrv/config/ACIDialog.java b/base/console/src/com/netscape/admin/certsrv/config/ACIDialog.java
new file mode 100644
index 000000000..e6085f820
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/ACIDialog.java
@@ -0,0 +1,517 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * ACL Editor
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class ACIDialog extends JDialog
+ implements ActionListener, MouseListener
+{
+ private final static String PREFIX = "ACIDIALOG";
+ private static final String HELPINDEX =
+ "configuration-authorization";
+ private JFrame mParentFrame;
+ private JButton mOK, mCancel, mHelp;
+ private ResourceBundle mResource;
+ private boolean mDone = false;
+ private JTextArea mACIText, mHelpArea;
+ private String mOperations;
+ private JList mList;
+ private JScrollPane mScrollPane;
+ private DefaultListModel mDataModel;
+ private JRadioButton mAllowBtn, mDenyBtn;
+ private String mHelpToken;
+ private AdminConnection mConnection;
+
+ public ACIDialog(JFrame parent, String ops, AdminConnection adminConn) {
+ super(parent,true);
+ mParentFrame = parent;
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ mDataModel = new DefaultListModel();
+ mConnection = adminConn;
+ mOperations = ops;
+ mHelpToken = HELPINDEX;
+ setSize(360, 350);
+ setTitle(mResource.getString(PREFIX+"_TITLE"));
+ setLocationRelativeTo(parent);
+ getRootPane().setDoubleBuffered(true);
+ setDisplay();
+ }
+
+ public void actionPerformed(ActionEvent evt) {
+ if (evt.getSource().equals(mCancel)) {
+ mDone = false;
+ this.hide();
+ } else if (evt.getSource().equals(mOK)) {
+ String acl = mACIText.getText().trim();
+ Vector v = parseExpressions(acl);
+
+ NameValuePairs response;
+ try {
+ response = mConnection.search(DestDef.DEST_ACL_ADMIN,
+ ScopeDef.SC_EVALUATOR_TYPES,
+ new NameValuePairs());
+ } catch (EAdminException e) {
+ //display error dialog
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ e.getMessage(), CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+
+ Enumeration enum1 = v.elements();
+ boolean allCorrect = true;
+ while (enum1.hasMoreElements()) {
+ String element = (String)enum1.nextElement();
+ boolean correctSyntax = validateSyntax(element, response);
+ if (correctSyntax) {
+ continue;
+ } else {
+ allCorrect = false;
+ break;
+ }
+ }
+
+ if (allCorrect) {
+ mDone = true;
+ this.hide();
+ } else {
+ String msg = mResource.getString(
+ PREFIX+"_DIALOG_INCORRECTSYNTAX_MESSAGE");
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ msg ,CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ } else if (evt.getSource().equals(mHelp)) {
+ CMSAdminUtil.help(mHelpToken);
+ }
+ }
+
+ private Vector parseExpressions(String s) {
+ String str = s;
+ Vector v = new Vector();
+
+ while (str.length() > 0) {
+ int orIndex = str.indexOf("||");
+ int andIndex = str.indexOf("&&");
+
+ if (orIndex == -1 && andIndex == -1) {
+ if (str.length() > 0)
+ v.addElement(str.trim());
+ return v;
+
+ // || first
+ } else if (andIndex == -1 || (orIndex != -1 && orIndex < andIndex)) {
+ v.addElement(str.substring(0, orIndex).trim());
+
+ str = str.substring(orIndex+2);
+ // && first
+ } else {
+ v.addElement(str.substring(0, andIndex).trim());
+ str = str.substring(andIndex+2);
+ }
+ }
+
+ return v;
+ }
+
+ public void showDialog(String aci, boolean newACI) {
+ if (newACI) {
+ mList.clearSelection();
+ mList.invalidate();
+ mList.validate();
+ mList.repaint(1);
+ mAllowBtn.setSelected(true);
+ mAllowBtn.invalidate();
+ mAllowBtn.validate();
+ mAllowBtn.repaint(1);
+ mDenyBtn.setSelected(false);
+ mDenyBtn.invalidate();
+ mDenyBtn.validate();
+ mDenyBtn.repaint(1);
+ mACIText.setText("");
+ if (mList.getSelectedIndex() < 0)
+ mOK.setEnabled(false);
+ else
+ mOK.setEnabled(true);
+ } else {
+ if (aci.startsWith("allow")) {
+ mAllowBtn.setSelected(true);
+ } else if (aci.startsWith("deny")) {
+ mDenyBtn.setSelected(true);
+ }
+ int startIndex = aci.indexOf("(");
+ int endIndex = aci.indexOf(")");
+ if ((startIndex > 0) && (endIndex > 0)) {
+ String str = aci.substring(startIndex+1, endIndex);
+ StringTokenizer tokenizer = new StringTokenizer(str,",");
+ int[] indices = new int[tokenizer.countTokens()];
+ int i = 0;
+ while (tokenizer.hasMoreElements()) {
+ indices[i++] = mDataModel.indexOf(tokenizer.nextElement());
+ }
+ mList.setSelectedIndices(indices);
+ }
+ String text = aci.substring(endIndex+1).trim();
+ mACIText.setText(text);
+ }
+
+ this.show();
+ }
+
+ public boolean getOK() {
+ return mDone;
+ }
+
+ public String getValue() {
+ Object[] values = mList.getSelectedValues();
+ String result = "";
+ if (!mAllowBtn.isSelected() && !mDenyBtn.isSelected())
+ return "";
+ if (mAllowBtn.isSelected())
+ result = result+"allow"+" (";
+ else if (mDenyBtn.isSelected())
+ result = result+"deny"+" (";
+ if ((values == null) || (values.length == 0))
+ return "";
+
+ for (int i=0; i<values.length; i++) {
+ if (i > 0)
+ result = result+","+(String)values[i];
+ else if (i == 0)
+ result = result+(String)values[i];
+ if (i == values.length-1)
+ result = result+") ";
+ }
+ result = result+mACIText.getText();
+ return result;
+ }
+
+ public void mouseClicked(MouseEvent e) {
+ if (e.getSource() == mList) {
+ if (mList.getSelectedIndex() < 0)
+ mOK.setEnabled(false);
+ else
+ mOK.setEnabled(true);
+ return;
+ }
+
+ Component comp = (Component)e.getSource();
+ String str = comp.getName();
+ String text = "";
+ if (str.equals("access")) {
+ text = mResource.getString(PREFIX+"_ACCESS_HELP");
+ } else if (str.equals("rights")) {
+ text = mResource.getString(PREFIX+"_RIGHTS_HELP");
+ } else if (str.equals("syntax")) {
+ text = mResource.getString(PREFIX+"_SYNTAX_HELP");
+ }
+ mHelpArea.setText(text);
+ }
+
+ public void mousePressed(MouseEvent e) {}
+ public void mouseReleased(MouseEvent e) {
+ }
+ public void mouseEntered(MouseEvent e) {}
+ public void mouseExited(MouseEvent e) {
+ }
+
+ private boolean validateSyntax(String str, NameValuePairs nvps) {
+ for (String name : nvps.keySet()) {
+ if (str.startsWith(name)) {
+ int len = name.length();
+ String leftover = str.substring(len).trim();
+ String operators = nvps.get(name);
+ StringTokenizer st = new StringTokenizer(operators, ",");
+ while (st.hasMoreTokens()) {
+ String token = st.nextToken();
+ if (leftover.startsWith(token))
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ private void setDisplay() {
+ getContentPane().setLayout(new BorderLayout());
+ JPanel center = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ center.setLayout(gb);
+
+ //content panel
+ JPanel content = makeContentPanel();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.fill = gbc.BOTH;
+ gb.setConstraints(content, gbc);
+ center.add(content);
+
+ // Help Panel
+ JPanel helpPanel = makeHelpPanel();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.fill = gbc.BOTH;
+ gbc.insets = new Insets(CMSAdminUtil.DIFFERENT_COMPONENT_SPACE,
+ CMSAdminUtil.DIFFERENT_COMPONENT_SPACE,
+ 0,CMSAdminUtil.DIFFERENT_COMPONENT_SPACE);
+ gb.setConstraints(helpPanel, gbc);
+ center.add(helpPanel);
+
+ //action panel
+ JPanel action = makeActionPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints(action, gbc);
+ center.add(action);
+
+ getContentPane().add("Center",center);
+ }
+
+ //create botton action panel
+ private JPanel makeActionPane() {
+ mOK = CMSAdminUtil.makeJButton(mResource, PREFIX, "OK", null, this);
+ mCancel = CMSAdminUtil.makeJButton(mResource, PREFIX, "CANCEL", null, this);
+ mHelp = CMSAdminUtil.makeJButton(mResource, PREFIX, "HELP", null, this);
+ //JButton[] buttons = { mOK, mCancel, mHelp};
+ JButton[] buttons = { mOK, mCancel};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonPanel( buttons, true);
+ }
+
+ private JPanel makeHelpPanel() {
+ JPanel helpPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ helpPanel.setBorder(CMSAdminUtil.makeEtchedBorder());
+ helpPanel.setLayout(gb);
+
+ mHelpArea = new JTextArea();
+ mHelpArea.setRows(20);
+ mHelpArea.setLineWrap(true);
+ mHelpArea.setWrapStyleWord(true);
+ mHelpArea.setBackground(helpPanel.getBackground());
+ mHelpArea.setEditable(false);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.fill=gbc.BOTH;
+ gbc.insets = CMSAdminUtil.DEFAULT_EMPTY_INSETS;
+/*
+ gbc.insets = new Insets(0,
+ CMSAdminUtil.DIFFERENT_COMPONENT_SPACE,
+ 0,CMSAdminUtil.DIFFERENT_COMPONENT_SPACE);
+*/
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ // gbc.gridx = 1;
+ // gbc.gridy = 1;
+ gb.setConstraints(mHelpArea, gbc);
+ helpPanel.add(mHelpArea);
+ mHelpArea.setText(mResource.getString(PREFIX+"_INTRO_HELP"));
+ return helpPanel;
+ }
+
+ private JPanel makeListPane() {
+ JPanel listPanel = new JPanel();
+
+ GridBagConstraints gbc = new GridBagConstraints();
+ GridBagLayout gb = new GridBagLayout();
+ listPanel.setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel opsLabel = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "RIGHTS", null);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gb.setConstraints(opsLabel, gbc);
+ listPanel.add(opsLabel);
+
+ mList = CMSAdminUtil.makeJList(mDataModel, 3);
+ mScrollPane = new JScrollPane(mList,
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mList.addMouseListener(this);
+ mScrollPane.setBackground(Color.white);
+ mScrollPane.setBorder(BorderFactory.createLoweredBevelBorder());
+
+ if (!mOperations.equals("")) {
+ StringTokenizer tokenizer = new StringTokenizer(mOperations, ",");
+ while (tokenizer.hasMoreElements()) {
+ mDataModel.addElement(tokenizer.nextElement());
+ }
+ }
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gb.setConstraints(mScrollPane, gbc);
+ listPanel.add(mScrollPane);
+
+ return listPanel;
+ }
+
+ private JPanel makeContentPanel() {
+ JPanel mainPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mainPanel.setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel accessLbl = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "ACCESS", null);
+ gbc.anchor = gbc.NORTHWEST;
+ gb.setConstraints(accessLbl, gbc);
+ mainPanel.add(accessLbl);
+ accessLbl.addMouseListener(this);
+ accessLbl.setName("access");
+ ButtonGroup group = new ButtonGroup();
+
+ CMSAdminUtil.resetGBC(gbc);
+ //mAllowBtn = new JRadioButton("allow");
+ mAllowBtn = CMSAdminUtil.makeJRadioButton(mResource, PREFIX,
+ "ALLOW", null, true, this);
+ group.add(mAllowBtn);
+ gbc.anchor = gbc.NORTHWEST;
+ gb.setConstraints(mAllowBtn, gbc);
+ mainPanel.add(mAllowBtn);
+
+ CMSAdminUtil.resetGBC(gbc);
+ //mDenyBtn = new JRadioButton("deny");
+ mDenyBtn = CMSAdminUtil.makeJRadioButton(mResource, PREFIX,
+ "DENY", null, false, this);
+ group.add(mDenyBtn);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gb.setConstraints(mDenyBtn, gbc);
+ mainPanel.add(mDenyBtn);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel opsLabel = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "RIGHTS", null);
+ gbc.anchor = gbc.NORTHWEST;
+ //gbc.gridwidth = gbc.REMAINDER;
+ gb.setConstraints(opsLabel, gbc);
+ mainPanel.add(opsLabel);
+ opsLabel.addMouseListener(this);
+ opsLabel.setName("rights");
+
+ mList = CMSAdminUtil.makeJList(mDataModel, 3);
+ mScrollPane = new JScrollPane(mList,
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mList.addMouseListener(this);
+ mScrollPane.setBackground(Color.white);
+ mScrollPane.setBorder(BorderFactory.createLoweredBevelBorder());
+
+ if (!mOperations.equals("")) {
+ StringTokenizer tokenizer = new StringTokenizer(mOperations, ",");
+ while (tokenizer.hasMoreElements()) {
+ mDataModel.addElement(tokenizer.nextElement());
+ }
+ }
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gb.setConstraints(mScrollPane, gbc);
+ mainPanel.add(mScrollPane);
+/*
+ JPanel listPane = makeListPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gb.setConstraints(listPane, gbc);
+ mainPanel.add(listPane);
+*/
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel attrLabel = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "SYNTAX", null);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gb.setConstraints(attrLabel, gbc);
+ mainPanel.add(attrLabel);
+ attrLabel.addMouseListener(this);
+ attrLabel.setName("syntax");
+
+ CMSAdminUtil.resetGBC(gbc);
+ mACIText = new JTextArea();
+ mACIText.setRows(20);
+ mACIText.setLineWrap(true);
+ mACIText.setWrapStyleWord(true);
+ JScrollPane scrollPane = createScrollPane(mACIText);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.fill=gbc.BOTH;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ // gbc.gridx = 1;
+ // gbc.gridy = 1;
+ gb.setConstraints(scrollPane, gbc);
+ mainPanel.add(scrollPane);
+
+ return mainPanel;
+ }
+
+ private JScrollPane createScrollPane(JComponent component) {
+
+ JScrollPane scrollPane = new JScrollPane(component,
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
+ scrollPane.setBackground(getBackground());
+ scrollPane.setAlignmentX(LEFT_ALIGNMENT);
+ scrollPane.setAlignmentY(TOP_ALIGNMENT);
+ scrollPane.setBorder(BorderFactory.createLoweredBevelBorder());
+ return scrollPane;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/ACLDataModel.java b/base/console/src/com/netscape/admin/certsrv/config/ACLDataModel.java
new file mode 100644
index 000000000..4adf6c4d3
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/ACLDataModel.java
@@ -0,0 +1,47 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * ACL data model - represents the access control information
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ */
+public class ACLDataModel extends CMSTableModel {
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ public static final String COL1 = "ACLNAME";
+ public static final String COL2 = "ACLDESC";
+
+ private static String[] mColumns = {COL1, COL2};
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public ACLDataModel() {
+ super();
+ init(mColumns);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/ACLEditDialog.java b/base/console/src/com/netscape/admin/certsrv/config/ACLEditDialog.java
new file mode 100644
index 000000000..b3bcb72e1
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/ACLEditDialog.java
@@ -0,0 +1,557 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * ACL Editor
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class ACLEditDialog extends JDialog
+ implements ActionListener, MouseListener
+{
+ private final static String PREFIX = "ACLEDITDIALOG";
+ private final static String HELPINDEX =
+ "configuration-authorization";
+ private JScrollPane mScrollPane;
+ private JList mList;
+ private JFrame mParentFrame;
+ private JButton mOK, mCancel, mHelp;
+ private JButton mAdd, mEdit, mDelete;
+ private ResourceBundle mResource;
+ private String mResourceName, mDesc;
+ private DefaultListModel mDataModel;
+ private String mOperations;
+ private AdminConnection mAdmin;
+ private ACIDialog mDialog;
+ private String mHelpToken;
+ private JTextArea mDescArea, mHelpArea;
+ private JTextField mResourceText, mRightsText;
+ private boolean mIsNew = false;
+ private Color mActiveColor;
+
+ public ACLEditDialog(AdminConnection admin, JFrame parent) {
+ this(admin, parent, null, null);
+ }
+
+ public ACLEditDialog(AdminConnection admin, JFrame parent,
+ String name, String desc) {
+ super(parent,true);
+ mParentFrame = parent;
+ mResource = ResourceBundle.getBundle(
+ CMSAdminResources.class.getName());
+ mDesc = desc;
+ mResourceName = name;
+ if (mResourceName == null)
+ mIsNew = true;
+ mAdmin = admin;
+ mHelpToken = HELPINDEX;
+ mDataModel = new DefaultListModel();
+ setSize(460, 420);
+ setTitle(mResource.getString(PREFIX+"_TITLE"));
+ setLocationRelativeTo(parent);
+ getRootPane().setDoubleBuffered(true);
+ setDisplay();
+ }
+
+ public void actionPerformed(ActionEvent evt) {
+ if (evt.getSource().equals(mCancel)) {
+ if (mDialog != null) {
+ mDialog.dispose();
+ mDialog = null;
+ }
+ this.dispose();
+ } else if (evt.getSource().equals(mDelete)) {
+ int index = mList.getSelectedIndex();
+ if (index >= 0) {
+ int i = CMSAdminUtil.showConfirmDialog(mParentFrame,
+ mResource, PREFIX, "DELETE", CMSAdminUtil.WARNING_MESSAGE);
+ if (i == JOptionPane.YES_OPTION) {
+ mDataModel.removeElementAt(index);
+ Debug.println("Deleted");
+ if (mDataModel.size() > 0)
+ mList.setSelectedIndex(0);
+ }
+ }
+ } else if (evt.getSource().equals(mOK)) {
+ if (mIsNew) {
+ mResourceName = mResourceText.getText().trim();
+ if (mResourceName.equals("")) {
+ String msg = mResource.getString(
+ PREFIX+"_DIALOG_EMPTYRESOURCEID_MESSAGE");
+ CMSAdminUtil.showErrorDialog(mParentFrame,
+ mResource, msg, CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ }
+
+ String rights = mRightsText.getText().trim();
+
+ NameValuePairs pairs = new NameValuePairs();
+ if (!rights.equals("")) {
+ String str = "";
+ int size=mDataModel.getSize();
+ if (size == 0) {
+ String msg = mResource.getString(
+ PREFIX+"_DIALOG_EMPTYACIS_MESSAGE");
+ CMSAdminUtil.showErrorDialog(mParentFrame,
+ mResource, msg, CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+
+ String desc = mDescArea.getText().trim();
+ if (desc.equals("")) {
+ String msg = mResource.getString(
+ PREFIX+"_DIALOG_EMPTYDESC_MESSAGE");
+ CMSAdminUtil.showErrorDialog(mParentFrame,
+ mResource, msg, CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+
+ for (int i=0; i<size; i++) {
+ if (i > 0)
+ str = str+";"+(String)mDataModel.elementAt(i);
+ else
+ str = str+(String)mDataModel.elementAt(i);
+ }
+ pairs.put(Constants.PR_ACI, str);
+ pairs.put(Constants.PR_ACL_DESC, desc);
+ pairs.put(Constants.PR_ACL_RIGHTS, rights);
+ }
+
+ try {
+ mAdmin.modify(DestDef.DEST_ACL_ADMIN, ScopeDef.SC_ACL,
+ mResourceName, pairs);
+ if (mDialog != null) {
+ mDialog.dispose();
+ mDialog = null;
+ }
+ this.dispose();
+ } catch (EAdminException e) {
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource, e.getMessage(),
+ CMSAdminUtil.ERROR_MESSAGE);
+ }
+ } else if (evt.getSource().equals(mAdd)) {
+ String rights = mRightsText.getText().trim();
+ if (rights.equals("")) {
+ String msg = mResource.getString(
+ PREFIX+"_DIALOG_EMPTYRIGHTS_MESSAGE");
+ CMSAdminUtil.showErrorDialog(mParentFrame,
+ mResource, msg, CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ mOperations = rights;
+ mDialog = new ACIDialog(mParentFrame, mOperations, mAdmin);
+ mDialog.showDialog("", true);
+ if (mDialog.getOK()) {
+ mDataModel.addElement(mDialog.getValue());
+ mList.setSelectedIndex(mDataModel.size()-1);
+ mDelete.setEnabled(true);
+ mEdit.setEnabled(true);
+ }
+ mDialog = null;
+ } else if (evt.getSource().equals(mEdit)) {
+ mDialog = new ACIDialog(mParentFrame, mOperations, mAdmin);
+ int index = mList.getSelectedIndex();
+ if (index >= 0) {
+ String aci = (String)mDataModel.elementAt(index);
+ mDialog.showDialog(aci, false);
+
+ if (mDialog.getOK())
+ mDataModel.setElementAt(mDialog.getValue(), index);
+ }
+ mDialog = null;
+ } else if (evt.getSource().equals(mHelp)) {
+ CMSAdminUtil.help(mHelpToken);
+ }
+ }
+
+ public void showDialog() {
+ mEdit.setEnabled(false);
+ mDelete.setEnabled(false);
+ this.show();
+ }
+
+ public void showDialog(NameValuePairs data) {
+ String aci = data.get(Constants.PR_ACI);
+ mOperations = data.get(Constants.PR_ACL_OPS);
+
+ if ((aci != null) && (!aci.trim().equals(""))) {
+ StringTokenizer tokenizer = new StringTokenizer(aci, ";");
+ while (tokenizer.hasMoreElements())
+ mDataModel.addElement(tokenizer.nextElement());
+ }
+ if (mList.getSelectedIndex() < 0) {
+ mEdit.setEnabled(false);
+ mDelete.setEnabled(false);
+ } else {
+ mEdit.setEnabled(true);
+ mDelete.setEnabled(true);
+ }
+
+ if (!mIsNew)
+ mRightsText.setText(mOperations);
+
+ this.show();
+ }
+
+ private void setDisplay() {
+ getContentPane().setLayout(new BorderLayout());
+ JPanel center = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ center.setLayout(gb);
+
+ //content panel
+ JPanel content = makeContentPanel();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.fill = gbc.BOTH;
+ gbc.insets = CMSAdminUtil.DEFAULT_EMPTY_INSETS;
+ gb.setConstraints(content, gbc);
+ center.add(content);
+
+ // Help Panel
+ JPanel helpPanel = makeHelpPanel();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.fill = gbc.BOTH;
+ gbc.insets = new Insets(CMSAdminUtil.DIFFERENT_COMPONENT_SPACE,
+ CMSAdminUtil.DIFFERENT_COMPONENT_SPACE,
+ 0,CMSAdminUtil.DIFFERENT_COMPONENT_SPACE);
+ gb.setConstraints(helpPanel, gbc);
+ center.add(helpPanel);
+
+ //action panel
+ JPanel action = makeActionPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints(action, gbc);
+ center.add(action);
+
+ getContentPane().add("Center",center);
+ }
+
+ public void mouseClicked(MouseEvent e) {
+ if (e.getSource() == mList) {
+ if (mList.getSelectedIndex() < 0) {
+ mDelete.setEnabled(false);
+ mEdit.setEnabled(false);
+ } else {
+ mDelete.setEnabled(true);
+ mEdit.setEnabled(true);
+ }
+
+ return;
+ }
+
+ Component comp = (Component)e.getSource();
+ String str = comp.getName();
+ String text = "";
+ if (str.equals("resourceID")) {
+ text = mResource.getString(PREFIX+"_RESOURCEID_HELP");
+ } else if (str.equals("rights")) {
+ text = mResource.getString(PREFIX+"_RIGHTS_HELP");
+ } else if (str.equals("aci")) {
+ text = mResource.getString(PREFIX+"_ACI_HELP");
+ } else if (str.equals("description")) {
+ text = mResource.getString(PREFIX+"_DESC_HELP");
+ }
+ mHelpArea.setText(text);
+ }
+
+ public void mousePressed(MouseEvent e) {
+ }
+ public void mouseReleased(MouseEvent e) {
+ }
+ public void mouseEntered(MouseEvent e) {
+ }
+ public void mouseExited(MouseEvent e) {
+ }
+
+ /**
+ * create the bottom action button panel
+ */
+ private JPanel createUDButtonPanel() {
+ //up, down buttons required
+ //actionlister to this object
+ mAdd = CMSAdminUtil.makeJButton(mResource, PREFIX, "ADD", null, this);
+ mDelete = CMSAdminUtil.makeJButton(mResource, PREFIX, "DELETE",
+ null, this);
+ mEdit = CMSAdminUtil.makeJButton(mResource, PREFIX, "EDIT", null, this);
+ JButton[] buttons = {mAdd, mDelete, mEdit};
+ JButtonFactory.resize(buttons);
+ return CMSAdminUtil.makeJButtonVPanel(buttons);
+ }
+
+ //create botton action panel
+ private JPanel makeActionPane() {
+ mOK = CMSAdminUtil.makeJButton(mResource, PREFIX, "OK", null, this);
+ mCancel = CMSAdminUtil.makeJButton(mResource, PREFIX, "CANCEL", null, this);
+ mHelp = CMSAdminUtil.makeJButton(mResource, PREFIX, "HELP", null, this);
+ //JButton[] buttons = { mOK, mCancel, mHelp};
+ JButton[] buttons = { mOK, mCancel};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonPanel( buttons, true);
+ }
+
+ private JPanel makeHelpPanel() {
+ JPanel helpPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ helpPanel.setBorder(CMSAdminUtil.makeEtchedBorder());
+ helpPanel.setLayout(gb);
+
+ mHelpArea = new JTextArea();
+ mHelpArea.setRows(20);
+ mHelpArea.setLineWrap(true);
+ mHelpArea.setWrapStyleWord(true);
+ mHelpArea.setBackground(helpPanel.getBackground());
+ mHelpArea.setEditable(false);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.fill=gbc.BOTH;
+ gbc.insets = CMSAdminUtil.DEFAULT_EMPTY_INSETS;
+/*
+ gbc.insets = new Insets(0,
+ CMSAdminUtil.DIFFERENT_COMPONENT_SPACE,
+ 0,CMSAdminUtil.DIFFERENT_COMPONENT_SPACE);
+*/
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ // gbc.gridx = 1;
+ // gbc.gridy = 1;
+ gb.setConstraints(mHelpArea, gbc);
+ helpPanel.add(mHelpArea);
+ mHelpArea.setText(mResource.getString(PREFIX+"_INTRO_HELP"));
+ return helpPanel;
+ }
+
+ private JPanel makeContentPanel() {
+ JPanel mainPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mainPanel.setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label1 = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "RESOURCEOBJECT", null);
+ gbc.anchor = gbc.WEST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.DIFFERENT_COMPONENT_SPACE,
+ 0, CMSAdminUtil.COMPONENT_SPACE);
+ gb.setConstraints(label1, gbc);
+ mainPanel.add(label1);
+ label1.setName("resourceID");
+ label1.addMouseListener(this);
+
+ CMSAdminUtil.resetGBC(gbc);
+ if (mIsNew) {
+ mResourceText = new JTextField(30);
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gb.setConstraints(mResourceText, gbc);
+ mainPanel.add(mResourceText);
+ } else {
+ JLabel label2 = new JLabel(mResourceName);
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gb.setConstraints(label2, gbc);
+ mainPanel.add(label2);
+ }
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel rightsLbl = CMSAdminUtil.makeJLabel(
+ mResource, PREFIX, "RIGHTS", null);
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.DIFFERENT_COMPONENT_SPACE,
+ 0, CMSAdminUtil.COMPONENT_SPACE);
+ gb.setConstraints(rightsLbl, gbc);
+ mainPanel.add(rightsLbl);
+ rightsLbl.setName("rights");
+ rightsLbl.addMouseListener(this);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mRightsText = new JTextField(30);
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gb.setConstraints(mRightsText, gbc);
+ mainPanel.add(mRightsText);
+
+ JLabel aciLbl = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "ACI", null);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.DIFFERENT_COMPONENT_SPACE,
+ 0,CMSAdminUtil.DIFFERENT_COMPONENT_SPACE);
+ gb.setConstraints(aciLbl, gbc);
+ mainPanel.add(aciLbl);
+ aciLbl.setName("aci");
+ aciLbl.addMouseListener(this);
+
+ JPanel listPanel = makeListPanel();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.fill=gbc.BOTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ //gbc.gridheight = gbc.REMAINDER;
+ gbc.insets = new Insets(0,
+ CMSAdminUtil.DIFFERENT_COMPONENT_SPACE,
+ 0,CMSAdminUtil.DIFFERENT_COMPONENT_SPACE);
+ gb.setConstraints(listPanel, gbc);
+ mainPanel.add(listPanel);
+
+ JLabel descLbl = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "DESC", null);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.DIFFERENT_COMPONENT_SPACE,
+ 0,CMSAdminUtil.DIFFERENT_COMPONENT_SPACE);
+ gb.setConstraints(descLbl, gbc);
+ mainPanel.add(descLbl);
+ descLbl.setName("description");
+ descLbl.addMouseListener(this);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mDescArea = new JTextArea();
+ mDescArea.setRows(20);
+ mDescArea.setLineWrap(true);
+ mDescArea.setWrapStyleWord(true);
+ if (mDesc != null)
+ mDescArea.setText(mDesc);
+ JScrollPane scrollPane = createScrollPane(mDescArea);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.fill=gbc.BOTH;
+ gbc.insets = new Insets(0,
+ CMSAdminUtil.DIFFERENT_COMPONENT_SPACE,
+ 0,CMSAdminUtil.DIFFERENT_COMPONENT_SPACE);
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ // gbc.gridx = 1;
+ // gbc.gridy = 1;
+ gb.setConstraints(scrollPane, gbc);
+ mainPanel.add(scrollPane);
+
+/*
+ mActiveColor = mDescArea.getBackground();
+
+ if (mIsNew)
+ enableTextField(mResourceText, true, mActiveColor);
+ else
+ enableTextField(mResourceText, false, getBackground());
+*/
+ return mainPanel;
+ }
+
+ private void enableTextField(JTextField textFld, boolean enabled,
+ Color color) {
+ textFld.setEnabled(enabled);
+ textFld.setEditable(enabled);
+ textFld.setBackground(color);
+ CMSAdminUtil.repaintComp(textFld);
+ }
+
+ private JScrollPane createScrollPane(JComponent component) {
+
+ JScrollPane scrollPane = new JScrollPane(component,
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
+ scrollPane.setBackground(getBackground());
+ scrollPane.setAlignmentX(LEFT_ALIGNMENT);
+ scrollPane.setAlignmentY(TOP_ALIGNMENT);
+ scrollPane.setBorder(BorderFactory.createLoweredBevelBorder());
+ return scrollPane;
+ }
+
+ private JPanel makeListPanel() {
+ JPanel listPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ listPanel.setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mList = CMSAdminUtil.makeJList(mDataModel,9);
+ mScrollPane = new JScrollPane(mList,
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
+ mScrollPane.setBorder(BorderFactory.createLoweredBevelBorder());
+ mList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION );
+ mList.addMouseListener(this);
+ mScrollPane.setBackground(Color.white);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ //gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.fill = gbc.BOTH;
+ gbc.insets = CMSAdminUtil.DEFAULT_EMPTY_INSETS;
+ gb.setConstraints(mScrollPane, gbc);
+ listPanel.add(mScrollPane);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JPanel VBtnPanel = createUDButtonPanel();
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 0.0;
+ gbc.weighty = 1.0;
+ gbc.insets = CMSAdminUtil.DEFAULT_EMPTY_INSETS;
+ gb.setConstraints(VBtnPanel, gbc);
+ listPanel.add(VBtnPanel);
+
+ return listPanel;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/ACLImplDataModel.java b/base/console/src/com/netscape/admin/certsrv/config/ACLImplDataModel.java
new file mode 100644
index 000000000..79033030d
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/ACLImplDataModel.java
@@ -0,0 +1,47 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * ACL data model - represents the evaluator table information
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ */
+public class ACLImplDataModel extends CMSTableModel {
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ public static final String COL1 = "EVALNAME";
+ public static final String COL2 = "CLASSNAME";
+
+ private static String[] mColumns = {COL1, COL2};
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public ACLImplDataModel() {
+ super();
+ init(mColumns);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/ACLImplTab.java b/base/console/src/com/netscape/admin/certsrv/config/ACLImplTab.java
new file mode 100644
index 000000000..4693224b1
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/ACLImplTab.java
@@ -0,0 +1,227 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.ug.*;
+import javax.swing.*;
+import java.awt.*;
+import java.util.*;
+import java.awt.event.*;
+
+/**
+ * ACL Implementation Tab
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ */
+public class ACLImplTab extends CMSBaseUGTab {
+ private static String PANEL_NAME = "ACLIMPL";
+ private CMSBaseResourceModel mModel;
+ private AdminConnection mConnection;
+ private JTable mTable;
+ private JScrollPane mScrollPane;
+ protected ACLImplDataModel mDataModel;
+ protected EvaluatorRegisterDialog mEditor=null;
+ protected JButton mRefresh, mAdd, mDelete, mHelp;
+ private static final String HELPINDEX =
+ "configuration-authorization";
+
+ public ACLImplTab(CMSUGTabPanel parent) {
+ super(PANEL_NAME, parent.getResourceModel());
+ mModel = parent.getResourceModel();
+ mDataModel = new ACLImplDataModel();
+ mConnection = mModel.getServerInfo().getAdmin();
+ mHelpToken = HELPINDEX;
+ }
+
+ protected JPanel createListPanel() {
+ JPanel mainPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mainPanel.setLayout(gb);
+
+ //center table
+ mTable = new JTable(mDataModel);
+ mScrollPane = JTable.createScrollPaneForTable(mTable);
+ mScrollPane.setHorizontalScrollBarPolicy(
+ mScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mScrollPane.setVerticalScrollBarPolicy(
+ mScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ mTable.setAutoscrolls(true);
+ mTable.sizeColumnsToFit(true);
+ mTable.getSelectionModel().setSelectionMode(
+ ListSelectionModel.SINGLE_SELECTION);
+ mTable.getSelectionModel().addListSelectionListener(this);
+ mScrollPane.setBackground(Color.white);
+ mTable.addMouseListener(this);
+ setLabelCellRenderer(mTable,0);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = 1;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.fill = gbc.BOTH;
+ gbc.insets = EMPTY_INSETS;
+ gb.setConstraints(mScrollPane, gbc);
+ mainPanel.add(mScrollPane);
+
+ JPanel buttonPanel = createButtonPanel();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 0.0;
+ gbc.weighty = 1.0;
+ gbc.insets = EMPTY_INSETS;
+ gb.setConstraints(buttonPanel, gbc);
+ mainPanel.add(buttonPanel);
+
+ refresh();
+
+ return mainPanel;
+ }
+
+ /**
+ * create the user action button panel
+ */
+ protected JPanel createButtonPanel() {
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mAdd = makeJButton("ADD");
+ mDelete = makeJButton("DELETE");
+ JButton[] buttons = {mAdd, mDelete};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonVPanel( buttons );
+ }
+
+ protected JPanel createActionPanel() {
+ mRefresh = makeJButton("REFRESH");
+ mHelp = makeJButton("HELP");
+ //JButton[] buttons = { mRefresh, mHelp };
+ JButton[] buttons = { mRefresh };
+ return makeJButtonPanel(buttons, true);
+ }
+
+ public void refresh() {
+ mModel.progressStart();
+ mDataModel.removeAllRows();
+ update();
+ mTable.invalidate();
+ mTable.validate();
+ mScrollPane.invalidate();
+ mScrollPane.validate();
+ mScrollPane.repaint(1);
+ mModel.progressStop();
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mRefresh)) {
+ refresh();
+ } else if (e.getSource().equals(mAdd)) {
+ if (mEditor==null)
+ mEditor = new EvaluatorRegisterDialog(mModel.getFrame(),
+ mConnection);
+ mEditor.showDialog(DestDef.DEST_ACL_ADMIN, ScopeDef.SC_ACL_IMPLS);
+ refresh();
+ } else if (e.getSource().equals(mDelete)) {
+ Debug.println("Delete");
+ if(mTable.getSelectedRow()< 0)
+ return;
+ int i = showConfirmDialog("DELETE");
+ if (i == JOptionPane.YES_OPTION) {
+ delete();
+ Debug.println("Deleted");
+ }
+ } else if (e.getSource().equals(mHelp)) {
+ helpCallback();
+ }
+ }
+
+ public void mouseClicked(MouseEvent e) {
+ }
+
+ //Set the first column's cellrender as label cell
+ protected void setLabelCellRenderer(JTable table, int index) {
+ table.getColumnModel().getColumn(index).setCellRenderer(
+ new LabelCellRenderer(new JLabel()));
+ }
+
+ private void delete() {
+ //get entry name
+ int row = mTable.getSelectedRow();
+
+ //send comment to server for the removal of user
+ try {
+ mConnection.delete(DestDef.DEST_ACL_ADMIN,
+ ScopeDef.SC_ACL_IMPLS,
+ ((JLabel)(mDataModel.getValueAt(row, 0))).getText());
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ return;
+ }
+
+ //send comment to server and refetch the content
+ refresh();
+ }
+
+ private void update() {
+ //send request and parse data
+ NameValuePairs response;
+ try {
+ response = mConnection.search(DestDef.DEST_ACL_ADMIN,
+ ScopeDef.SC_ACL_IMPLS,
+ new NameValuePairs());
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ return;
+ }
+
+ Debug.println(response.toString());
+
+ //parse the data
+ int i=0;
+ String[] vals = new String[response.size()];
+
+ for (String entry : response.keySet()) {
+ vals[i++] = entry.trim();
+ }
+
+ CMSAdminUtil.bubbleSort(vals);
+
+ for (i=0; i<vals.length; i++) {
+ String name = vals[i];
+ Vector v = new Vector();
+ v.addElement(new JLabel(name,
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_ACLPLUGIN),
+ JLabel.LEFT));
+ v.addElement(response.get(name));
+ mDataModel.addRow(v);
+ }
+
+ if (mDataModel.getRowCount() >0)
+ mTable.setRowSelectionInterval(0,0);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/ACLPanel.java b/base/console/src/com/netscape/admin/certsrv/config/ACLPanel.java
new file mode 100644
index 000000000..2593e0c0b
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/ACLPanel.java
@@ -0,0 +1,231 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.ug.*;
+import javax.swing.*;
+import java.awt.*;
+import java.util.*;
+import java.awt.event.*;
+
+/**
+ * ACL Management Tab
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ */
+public class ACLPanel extends CMSBaseUGTab {
+ private static String PANEL_NAME = "ACLMGMT";
+ private CMSBaseResourceModel mModel;
+ private AdminConnection mAdmin;
+ private JButton mRefresh;
+ private JButton mHelp;
+ private JButton mEdit, mAdd;
+ private JTable mTable;
+ private ACLDataModel mDataModel;
+ private JScrollPane mScrollPane;
+ private ACLEditDialog mEditor;
+ private static final String HELPINDEX =
+ "configuration-authorization";
+
+ public ACLPanel(CMSUGTabPanel parent) {
+ super(PANEL_NAME, parent.getResourceModel());
+ mModel = parent.getResourceModel();
+ mAdmin = mModel.getServerInfo().getAdmin();
+ mDataModel = new ACLDataModel();
+ mHelpToken = HELPINDEX;
+ }
+
+ protected JPanel createListPanel() {
+ JPanel mainPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mainPanel.setLayout(gb);
+
+ //center table
+ mTable = new JTable(mDataModel);
+ mScrollPane = JTable.createScrollPaneForTable(mTable);
+ mScrollPane.setHorizontalScrollBarPolicy(
+ mScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mScrollPane.setVerticalScrollBarPolicy(
+ mScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ mTable.setAutoscrolls(true);
+ mTable.sizeColumnsToFit(true);
+ mTable.getSelectionModel().setSelectionMode(
+ ListSelectionModel.SINGLE_SELECTION);
+ mTable.getSelectionModel().addListSelectionListener(this);
+ mScrollPane.setBackground(Color.white);
+ mTable.addMouseListener(this);
+ setLabelCellRenderer(mTable,0);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = 1;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.fill = gbc.BOTH;
+ gbc.insets = EMPTY_INSETS;
+ gb.setConstraints(mScrollPane, gbc);
+ mainPanel.add(mScrollPane);
+
+ JPanel buttonPanel = createButtonPanel();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 0.0;
+ gbc.weighty = 1.0;
+ gbc.insets = EMPTY_INSETS;
+ gb.setConstraints(buttonPanel, gbc);
+ mainPanel.add(buttonPanel);
+
+ refresh();
+
+ return mainPanel;
+ }
+
+ /**
+ * create the user action button panel
+ */
+ protected JPanel createButtonPanel() {
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mAdd = makeJButton("ADD");
+ mEdit = makeJButton("EDIT");
+ JButton[] buttons = {mAdd,mEdit};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonVPanel( buttons );
+ }
+
+ private JScrollPane createScrollPane(JList listbox) {
+
+ JScrollPane scrollPane = new JScrollPane(listbox,
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ scrollPane.setBackground(getBackground());
+ scrollPane.setAlignmentX(LEFT_ALIGNMENT);
+ scrollPane.setAlignmentY(TOP_ALIGNMENT);
+ scrollPane.setBorder(BorderFactory.createLoweredBevelBorder());
+ return scrollPane;
+ }
+
+ protected JPanel createActionPanel() {
+ mRefresh = makeJButton("REFRESH");
+ mHelp = makeJButton("HELP");
+ //JButton[] buttons = { mRefresh, mHelp };
+ JButton[] buttons = { mRefresh };
+ return makeJButtonPanel(buttons, true);
+ }
+
+ public void refresh() {
+ mModel.progressStart();
+ mDataModel.removeAllRows();
+ update();
+ mTable.invalidate();
+ mTable.validate();
+ mScrollPane.invalidate();
+ mScrollPane.validate();
+ mScrollPane.repaint(1);
+ mModel.progressStop();
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mEdit)) {
+ int row = -1;
+ if ((row = mTable.getSelectedRow()) < 0)
+ return;
+ String name = ((JLabel)(mDataModel.getValueAt(row, 0))).getText();
+ String desc = (String)(mDataModel.getValueAt(row, 1));
+ NameValuePairs response;
+ try {
+ response = mAdmin.read(DestDef.DEST_ACL_ADMIN,
+ ScopeDef.SC_ACL, name, new NameValuePairs());
+ } catch (EAdminException ee) {
+ //display error dialog
+ showErrorDialog(ee.getMessage());
+ return;
+ }
+
+ Debug.println(response.toString());
+ mEditor = new ACLEditDialog(mAdmin, mModel.getFrame(), name, desc);
+ mEditor.showDialog(response);
+ refresh();
+ } else if (e.getSource().equals(mAdd)) {
+ mEditor = new ACLEditDialog(mAdmin, mModel.getFrame());
+ mEditor.showDialog();
+ refresh();
+ } else if (e.getSource().equals(mRefresh)) {
+ refresh();
+ } else if (e.getSource().equals(mHelp)) {
+ helpCallback();
+ }
+ }
+
+ public void mouseClicked(MouseEvent e) {
+ }
+
+ private void update() {
+ //send request and parse data
+ NameValuePairs response;
+ try {
+ response = mAdmin.search(DestDef.DEST_ACL_ADMIN,
+ ScopeDef.SC_ACL,
+ new NameValuePairs());
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ return;
+ }
+
+ Debug.println(response.toString());
+
+ //parse the data
+ int i=0;
+ String[] vals = new String[response.size()];
+
+ for (String entry : response.keySet()) {
+ vals[i++] = entry.trim();
+ }
+
+ CMSAdminUtil.bubbleSort(vals);
+
+ for (i=0; i<vals.length; i++) {
+ String name = vals[i];
+ Vector v = new Vector();
+ v.addElement(new JLabel(name,
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_ACL),
+ JLabel.LEFT));
+ v.addElement(response.get(name));
+ mDataModel.addRow(v);
+ }
+
+ if (mDataModel.getRowCount() >0)
+ mTable.setRowSelectionInterval(0,0);
+ }
+
+ //Set the first column's cellrender as label cell
+ protected void setLabelCellRenderer(JTable table, int index) {
+ table.getColumnModel().getColumn(index).setCellRenderer(
+ new LabelCellRenderer(new JLabel()));
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/AutoRecoveryModel.java b/base/console/src/com/netscape/admin/certsrv/config/AutoRecoveryModel.java
new file mode 100644
index 000000000..90b617cbd
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/AutoRecoveryModel.java
@@ -0,0 +1,57 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Auto recovery data model - represents the instance
+ * table information
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ */
+public class AutoRecoveryModel extends CMSTableModel
+{
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ public static final String COL1 = "NUMBER";
+ public static final String COL2 = "UID";
+ public static final String COL3 = "PASSWORD";
+
+ private static String[] mColumns = {COL1, COL2, COL3};
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public AutoRecoveryModel() {
+ super();
+ init(mColumns);
+ }
+
+ public boolean isCellEditable(int row, int col) {
+ if(col >= 1)
+ return true;
+ return false;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CACertsTab.java b/base/console/src/com/netscape/admin/certsrv/config/CACertsTab.java
new file mode 100644
index 000000000..18590747a
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CACertsTab.java
@@ -0,0 +1,392 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.ug.*;
+import javax.swing.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.management.client.console.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.keycert.*;
+
+/**
+ * CA certs Tab
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class CACertsTab extends CMSBaseUGTab {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PANEL_NAME = "CACERTS";
+ private CMSBaseResourceModel mModel;
+ private AdminConnection mConnection;
+ private String mDestination;
+ private ConsoleInfo mConsoleInfo;
+
+ protected JScrollPane mScrollPane;
+ protected JTable mTable; //table
+ protected ListCertsModel mDataModel; //table model
+ protected CertViewDialog mEditor=null; //keep single copy
+
+ protected JButton mRefresh, mAdd, mDelete, mView, mEdit, mHelp;
+ private final static String HELPINDEX = "configuration-log-plugin-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CACertsTab(CMSBaseResourceModel model, String destination) {
+ super(PANEL_NAME, model);
+ mConnection = model.getServerInfo().getAdmin();
+ mModel = model;
+ mConsoleInfo = mModel.getConsoleInfo();
+ mDataModel = new ListCertsModel();
+ mDestination = destination;
+ mHelpToken = HELPINDEX;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mRefresh)) {
+ refresh();
+ }
+ if (e.getSource().equals(mHelp)) {
+ helpCallback();
+ }
+ if (e.getSource().equals(mAdd)) {
+
+ CertSetupWizardInfo info = new CertSetupWizardInfo(mConnection, mConsoleInfo);
+
+ // if it is "0", then it means it is root cert mode.
+ // if it is "1", then it means it is user cert mode.
+ info.setMode("0");
+ CertSetupWizard wizard = new CertSetupWizard(
+ mModel, info);
+ refresh();
+ return;
+ }
+
+ int row = mTable.getSelectedRow();
+ if(row < 0)
+ return;
+
+ if (e.getSource().equals(mDelete)) {
+ Debug.println("Delete");
+ if(mTable.getSelectedRow()< 0)
+ return;
+ int i = showConfirmDialog("DELETE");
+ if (i == JOptionPane.YES_OPTION) {
+ delete();
+ Debug.println("Deleted");
+ }
+ }
+ if (e.getSource().equals(mView)) {
+ Debug.println("View");
+ String nickname = (String)(mTable.getValueAt(row, 3)) + ":" +
+ (String)(mTable.getValueAt(row, 0));
+ String serialno = (String)(mTable.getValueAt(row, 1));
+ String issuername = (String)(mTable.getValueAt(row, 2));
+
+ try {
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_NICK_NAME, nickname);
+ nvps.put(Constants.PR_SERIAL_NUMBER, serialno);
+ nvps.put(Constants.PR_ISSUER_NAME, issuername);
+ NameValuePairs results = mConnection.process(
+ DestDef.DEST_SERVER_ADMIN, ScopeDef.SC_CERT_PRETTY_PRINT,
+ Constants.RS_ID_CONFIG, nvps);
+ if (nvps.size() <= 0)
+ return;
+ String name = results.keySet().iterator().next(); // first element
+ String print = results.get(name);
+ CertViewDialog certdialog = new CertViewDialog(mModel.getFrame());
+ certdialog.showDialog(nickname, print);
+ } catch (EAdminException ex) {
+ CMSAdminUtil.showErrorDialog(mModel.getFrame(), mResource, ex.toString(),
+ CMSAdminUtil.ERROR_MESSAGE);
+ }
+ }
+ if (e.getSource().equals(mEdit)) {
+ Debug.println("Edit");
+ String nickname = (String)(mTable.getValueAt(row, 3)) + ":" +
+ (String)(mTable.getValueAt(row, 0));
+ String serialno = (String)(mTable.getValueAt(row, 1));
+ String issuername = (String)(mTable.getValueAt(row, 2));
+
+ try {
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_NICK_NAME, nickname);
+ nvps.put(Constants.PR_SERIAL_NUMBER, serialno);
+ nvps.put(Constants.PR_ISSUER_NAME, issuername);
+ NameValuePairs results = mConnection.process(
+ DestDef.DEST_SERVER_ADMIN, ScopeDef.SC_ROOTCERT_TRUSTBIT,
+ Constants.RS_ID_CONFIG, nvps);
+ if (nvps.size() <= 0)
+ return;
+ String name = results.keySet().iterator().next(); // first element
+ String trust = results.get(name);
+ int i;
+ String[] params = new String[2];
+ if (trust.equals("U")) {
+ params[0] = "untrusted";
+ params[1] = "trust";
+ i = showConfirmDialog("TRUST", params);
+ } else {
+ params[0] = "trusted";
+ params[1] = "untrust";
+ i = showConfirmDialog("TRUST", params);
+ }
+
+ if (i == JOptionPane.YES_OPTION) {
+ nvps.put("trustbit", params[1]);
+ mConnection.modify(DestDef.DEST_SERVER_ADMIN,
+ ScopeDef.SC_ROOTCERT_TRUSTBIT,
+ Constants.RS_ID_CONFIG, nvps);
+ }
+ } catch (EAdminException ex) {
+ CMSAdminUtil.showErrorDialog(mModel.getFrame(), mResource, ex.toString(),
+ CMSAdminUtil.ERROR_MESSAGE);
+ }
+ }
+ }
+
+ //==== MOUSELISTENER ======================
+ public void mouseClicked(MouseEvent e) {
+ setButtons();
+ }
+
+ public void mouseReleased(MouseEvent e) {
+ setButtons();
+ }
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+ public void refresh() {
+
+ mDataModel.removeAllRows();
+ update();
+
+ setButtons();
+ mTable.invalidate();
+ mTable.validate();
+ mTable.repaint(1);
+ }
+
+ /**
+ * create the user action button panel
+ */
+ protected JPanel createButtonPanel() {
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mAdd = makeJButton("ADD");
+ mDelete = makeJButton("DELETE");
+ mView = makeJButton("VIEW");
+ mEdit = makeJButton("EDIT");
+ JButton[] buttons = {mAdd, mDelete, mView, mEdit};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonVPanel( buttons );
+ }
+
+ protected JPanel createActionPanel() {
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mRefresh = makeJButton("REFRESH");
+ mHelp = makeJButton("HELP");
+ //JButton[] buttons = { mRefresh, mHelp };
+ JButton[] buttons = { mRefresh };
+ return makeJButtonPanel(buttons, true);
+ }
+
+ protected JPanel createListPanel() {
+ mListPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mListPanel.setLayout(gb);
+
+ //center table
+ mTable = new JTable(mDataModel);
+ mScrollPane = JTable.createScrollPaneForTable(mTable);
+ //mScrollPane.setBorder(CMSAdminUtil.makeTitledBorder(mResource,PANEL_NAME,"USERS"));
+ mScrollPane.setHorizontalScrollBarPolicy(mScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
+ mScrollPane.setVerticalScrollBarPolicy(mScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ mTable.setAutoscrolls(true);
+ mTable.sizeColumnsToFit(true);
+ mTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ mTable.getSelectionModel().addListSelectionListener(this);
+ mScrollPane.setBackground(Color.white);
+ mTable.addMouseListener(this);
+ setLabelCellRenderer(mTable,0);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = 1;
+ gbc.weightx = 1.0;
+ gbc.insets = EMPTY_INSETS;
+ gb.setConstraints(mScrollPane, gbc);
+ mListPanel.add(mScrollPane);
+
+ JPanel buttonPanel = createButtonPanel();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 0.0;
+ gbc.weighty = 1.0;
+ gbc.insets = EMPTY_INSETS;
+ gb.setConstraints(buttonPanel, gbc);
+ mListPanel.add(buttonPanel);
+
+ refresh();
+
+ return mListPanel;
+ }
+
+ //Set the first column's cellrender as label cell
+ protected void setLabelCellRenderer(JTable table, int index) {
+ table.getColumnModel().getColumn(index).setCellRenderer(new LabelCellRenderer(new JLabel()));
+ }
+
+
+ //set buttons
+ private void setButtons() {
+
+ //enable and diable buttons accordingly
+ //Debug.println("setButtons() - "+mTable.getSelectedRow());
+ //Debug.println("setButtons() - "+mTable.getSelectionModel().isSelectionEmpty());
+ if (mTable.getSelectionModel().isSelectionEmpty()) {
+ mDelete.setEnabled(false);
+ mView.setEnabled(false);
+ return;
+ }
+
+ if(mDataModel.getRowCount()<=0) {
+ mDelete.setEnabled(false);
+ mView.setEnabled(false);
+ return;
+ }
+
+ mDelete.setEnabled(true);
+ mView.setEnabled(true);
+
+ }
+
+ //=============================================
+ // SEND REQUESTS TO THE SERVER SIDE
+ //=============================================
+ private void update() {
+ //send request and parse data
+
+ mModel.progressStart();
+ NameValuePairs response;
+ try {
+ response = mConnection.search(mDestination, ScopeDef.SC_ROOTCERTSLIST,
+ new NameValuePairs());
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ mModel.progressStop();
+ return;
+ }
+
+ Debug.println(response.toString());
+
+ //parse the data
+ mDataModel.removeAllRows();
+ if (response != null) {
+ String[] vals = new String[response.size()];
+ int i=0;
+ for (String entry : response.keySet()) {
+ vals[i++] = entry.trim();
+ }
+
+ int sindex = 0;
+ String snickname = "";
+ CMSAdminUtil.quickSort(vals, 0, response.size()-1);
+ for (i=0; i<vals.length; i++) {
+ Vector v = new Vector();
+ String entry = vals[i];
+ String value = response.get(entry);
+
+ // look for the comma separator
+ int lastindex = entry.lastIndexOf(",");
+ if (lastindex != -1) {
+ String nickname = entry.substring(0, lastindex);
+ int colonindex = nickname.indexOf(":");
+ if (colonindex != -1)
+ v.addElement(nickname.substring(colonindex+1));
+ else
+ v.addElement(nickname);
+ v.addElement(entry.substring(lastindex+1));
+ v.addElement(value);
+ if (colonindex != -1)
+ v.addElement(nickname.substring(0, colonindex));
+ else
+ v.addElement("internal");
+ mDataModel.addRow(v);
+ }
+ }
+ if (vals.length > 0)
+ mTable.setRowSelectionInterval(0,0);
+ }
+
+ mModel.progressStop();
+ }
+
+ private void delete() {
+ mModel.progressStart();
+ int row = mTable.getSelectedRow();
+ String nickname = (String)(mDataModel.getValueAt(row, 3))+":"+
+ (String)(mDataModel.getValueAt(row, 0));
+ String id = nickname+":SERIAL#<"+mDataModel.getValueAt(row, 1)+">"
+ +mDataModel.getValueAt(row, 2);
+
+ //send comment to server for the removal of user
+ try {
+ mConnection.delete(mDestination, ScopeDef.SC_ROOTCERTSLIST, id);
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ mModel.progressStop();
+ return;
+ }
+ mModel.progressStop();
+ //send comment to server and refetch the content
+ refresh();
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSAccessLogPanel.java b/base/console/src/com/netscape/admin/certsrv/config/CMSAccessLogPanel.java
new file mode 100644
index 000000000..8f1fc1f20
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSAccessLogPanel.java
@@ -0,0 +1,210 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.*;
+
+import java.awt.event.*;
+
+/**
+ * Access Log Setting Tab to be displayed at the right hand side
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ */
+public class CMSAccessLogPanel extends CMSBaseLogPanel {
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static String PANEL_NAME = "ACCESSLOG";
+ private CMSTabPanel mParent;
+ private static final String HELPINDEX = "configuration-logs-system-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSAccessLogPanel(CMSTabPanel parent, boolean isNT) {
+ super(PANEL_NAME, parent);
+ mParent = parent;
+ mHelpToken = HELPINDEX;
+ mIsNT = isNT;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * Actual Instantiation of the UI components
+ */
+ public void init() {
+ Debug.println("AccessLogPanel: init()");
+ super.init();
+ refresh();
+ }
+
+ public void refresh() {
+ mModel.progressStart();
+ NameValuePairs nvp = new NameValuePairs();
+ nvp.put(Constants.PR_LOG_ENABLED, "");
+ nvp.put(Constants.PR_LOG_LEVEL, "");
+ nvp.put(Constants.PR_LOG_BUFFERSIZE, "");
+ //nvp.add(Constants.PR_LOG_EXPIRED_TIME, "");
+ //nvp.add(Constants.PR_LOG_FILENAME, "");
+ //nvp.add(Constants.PR_LOG_FLUSHINTERVAL, "");
+ nvp.put(Constants.PR_LOG_MAXFILESIZE, "");
+ nvp.put(Constants.PR_LOG_ROLLEROVER_INTERVAL, "");
+
+ try {
+ NameValuePairs val = mAdmin.read(DestDef.DEST_LOG_ADMIN,
+ ScopeDef.SC_SYSTEMLOG, Constants.RS_ID_CONFIG, nvp);
+ parseVals(val);
+ if (mIsNT) {
+ nvp.clear();
+ nvp.put(Constants.PR_NT_EVENT_SOURCE, "");
+ nvp.put(Constants.PR_NT_LOG_LEVEL, "");
+ nvp.put(Constants.PR_NT_LOG_ENABLED, "");
+ val = mAdmin.read(DestDef.DEST_LOG_ADMIN,
+ ScopeDef.SC_NTSYSTEMLOG, Constants.RS_ID_CONFIG, nvp);
+ parseNTVals(val);
+ }
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ }
+ setValues();
+ mModel.progressStop();
+ clearDirtyFlag();
+ mParent.setOKCancel();
+ }
+
+ private void parseVals(NameValuePairs nvp) {
+ if (nvp.get(Constants.PR_LOG_ENABLED).equalsIgnoreCase(
+ Constants.TRUE))
+ activateLog.setSelected(true);
+ else
+ activateLog.setSelected(false);
+ mLevel = Integer.parseInt(nvp.get(Constants.PR_LOG_LEVEL));
+ mlogBufSizTextData = nvp.get(Constants.PR_LOG_BUFFERSIZE);
+ mlogMaxSizTextData = nvp.get(Constants.PR_LOG_MAXFILESIZE);
+ int val =
+ Integer.parseInt(nvp.get(Constants.PR_LOG_ROLLEROVER_INTERVAL));
+ mFrequency = getRollOverIndex(val);
+ }
+
+ private void parseNTVals(NameValuePairs nvp) {
+ mNTLevel = Integer.parseInt(nvp.get(Constants.PR_NT_LOG_LEVEL));
+ mSource = nvp.get(Constants.PR_NT_EVENT_SOURCE);
+ if (nvp.get(Constants.PR_NT_LOG_ENABLED).equalsIgnoreCase(
+ Constants.TRUE))
+ mActivateNTLog.setSelected(true);
+ else
+ mActivateNTLog.setSelected(false);
+ }
+
+ /**
+ * Implementation for saving panel information
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean applyCallback() {
+ // check blank fields
+ if ((mlogMaxSizText.getText().trim().equals("")) ||
+ (mlogBufSizText.getText().trim().equals("")) ) {
+ showMessageDialog("BLANKFIELD");
+ return false;
+ }
+
+ String bufSize = mlogBufSizText.getText().trim();
+ String maxSize = mlogMaxSizText.getText().trim();
+
+ try {
+ int val1 = Integer.parseInt(bufSize);
+ int val2 = Integer.parseInt(maxSize);
+ if (val1 <= 0 || val2 <= 0) {
+ showMessageDialog("OUTOFRANGE");
+ return false;
+ }
+ } catch (NumberFormatException e) {
+ showMessageDialog("NUMBERFORMAT");
+ return false;
+ }
+
+ NameValuePairs nvp = new NameValuePairs();
+ mModel.progressStart();
+ if (activateLog.isSelected())
+ nvp.put(Constants.PR_LOG_ENABLED, Constants.TRUE);
+ else
+ nvp.put(Constants.PR_LOG_ENABLED, Constants.FALSE);
+ String str = "" + mLogLevel.getSelectedIndex();
+ nvp.put(Constants.PR_LOG_LEVEL, str);
+ nvp.put(Constants.PR_LOG_BUFFERSIZE, mlogBufSizText.getText().trim());
+ //nvp.add(Constants.PR_LOG_EXPIRED_TIME, "");
+ //nvp.add(Constants.PR_LOG_FILENAME, "");
+ //nvp.add(Constants.PR_LOG_FLUSHINTERVAL, "");
+ nvp.put(Constants.PR_LOG_MAXFILESIZE, mlogMaxSizText.getText().trim());
+
+ str = "" + getRollOverTime(mlogFQC.getSelectedIndex());
+ nvp.put(Constants.PR_LOG_ROLLEROVER_INTERVAL, str);
+
+ try {
+ mAdmin.modify(DestDef.DEST_LOG_ADMIN,
+ ScopeDef.SC_SYSTEMLOG, Constants.RS_ID_CONFIG, nvp);
+ if (mIsNT) {
+ nvp.clear();
+ nvp.put(Constants.PR_NT_LOG_LEVEL,
+ "" + mNTLogLevel.getSelectedIndex());
+ nvp.put(Constants.PR_NT_EVENT_SOURCE,
+ mEventSourceText.getText().trim());
+ if (mActivateNTLog.isSelected())
+ nvp.put(Constants.PR_NT_LOG_ENABLED, Constants.TRUE);
+ else
+ nvp.put(Constants.PR_NT_LOG_ENABLED, Constants.FALSE);
+ mAdmin.modify(DestDef.DEST_LOG_ADMIN,
+ ScopeDef.SC_NTSYSTEMLOG, Constants.RS_ID_CONFIG, nvp);
+ }
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ return false;
+ }
+
+ clearDirtyFlag();
+ mModel.progressStop();
+ return true;
+ }
+
+ /**
+ * Implementation for reset values
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean resetCallback() {
+ refresh();
+ return true;
+ }
+
+ /*==========================================================
+ * EVENT HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent e) {
+ super.actionPerformed(e);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSAuditLogPanel.java b/base/console/src/com/netscape/admin/certsrv/config/CMSAuditLogPanel.java
new file mode 100644
index 000000000..067b954e8
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSAuditLogPanel.java
@@ -0,0 +1,210 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.*;
+
+import java.awt.event.*;
+
+/**
+ * Audit Log Setting Tab to be displayed at the right hand side
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ */
+public class CMSAuditLogPanel extends CMSBaseLogPanel {
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static String PANEL_NAME = "AUDITLOG";
+ private CMSTabPanel mParent;
+ private static final String HELPINDEX = "configuration-logs-audit-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSAuditLogPanel(CMSTabPanel parent, boolean isNT) {
+ super(PANEL_NAME, parent);
+ mParent = parent;
+ mHelpToken = HELPINDEX;
+ mIsNT = isNT;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * Actual Instantiation of the UI components
+ */
+ public void init() {
+ Debug.println("AuditLogPanel: init()");
+ super.init();
+ refresh();
+ }
+
+ public void refresh() {
+ mModel.progressStart();
+ NameValuePairs nvp = new NameValuePairs();
+ nvp.put(Constants.PR_LOG_ENABLED, "");
+ nvp.put(Constants.PR_LOG_LEVEL, "");
+ nvp.put(Constants.PR_LOG_BUFFERSIZE, "");
+ //nvp.add(Constants.PR_LOG_EXPIRED_TIME, "");
+ //nvp.add(Constants.PR_LOG_FILENAME, "");
+ //nvp.add(Constants.PR_LOG_FLUSHINTERVAL, "");
+ nvp.put(Constants.PR_LOG_MAXFILESIZE, "");
+ nvp.put(Constants.PR_LOG_ROLLEROVER_INTERVAL, "");
+
+ try {
+ NameValuePairs val = mAdmin.read(DestDef.DEST_LOG_ADMIN,
+ ScopeDef.SC_AUDITLOG, Constants.RS_ID_CONFIG, nvp);
+ parseVals(val);
+ if (mIsNT) {
+ nvp.clear();
+ nvp.put(Constants.PR_NT_EVENT_SOURCE, "");
+ nvp.put(Constants.PR_NT_LOG_LEVEL, "");
+ nvp.put(Constants.PR_NT_LOG_ENABLED, "");
+ val = mAdmin.read(DestDef.DEST_LOG_ADMIN,
+ ScopeDef.SC_NTAUDITLOG, Constants.RS_ID_CONFIG, nvp);
+ parseNTVals(val);
+ }
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ }
+ setValues();
+ mModel.progressStop();
+ clearDirtyFlag();
+ mParent.setOKCancel();
+ }
+
+ private void parseVals(NameValuePairs nvp) {
+ if (nvp.get(Constants.PR_LOG_ENABLED).equalsIgnoreCase(
+ Constants.TRUE))
+ activateLog.setSelected(true);
+ else
+ activateLog.setSelected(false);
+ mLevel = Integer.parseInt(nvp.get(Constants.PR_LOG_LEVEL));
+ mlogBufSizTextData = nvp.get(Constants.PR_LOG_BUFFERSIZE);
+ mlogMaxSizTextData = nvp.get(Constants.PR_LOG_MAXFILESIZE);
+ int val =
+ Integer.parseInt(nvp.get(Constants.PR_LOG_ROLLEROVER_INTERVAL));
+ mFrequency = getRollOverIndex(val);
+ }
+
+ private void parseNTVals(NameValuePairs nvp) {
+ mNTLevel = Integer.parseInt(nvp.get(Constants.PR_NT_LOG_LEVEL));
+ mSource = nvp.get(Constants.PR_NT_EVENT_SOURCE);
+ if (nvp.get(Constants.PR_NT_LOG_ENABLED).equalsIgnoreCase(
+ Constants.TRUE))
+ mActivateNTLog.setSelected(true);
+ else
+ mActivateNTLog.setSelected(false);
+ }
+
+ /**
+ * Implementation for saving panel information
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean applyCallback() {
+ // check blank fields
+ if ((mlogMaxSizText.getText().trim().equals("")) ||
+ (mlogBufSizText.getText().trim().equals("")) ) {
+ showMessageDialog("BLANKFIELD");
+ return false;
+ }
+
+ String bufSize = mlogBufSizText.getText().trim();
+ String maxSize = mlogMaxSizText.getText().trim();
+
+ try {
+ int val1 = Integer.parseInt(bufSize);
+ int val2 = Integer.parseInt(maxSize);
+ if (val1 <= 0 || val2 <= 0) {
+ showMessageDialog("OUTOFRANGE");
+ return false;
+ }
+ } catch (NumberFormatException e) {
+ showMessageDialog("NUMBERFORMAT");
+ return false;
+ }
+
+ NameValuePairs nvp = new NameValuePairs();
+ mModel.progressStart();
+ if (activateLog.isSelected())
+ nvp.put(Constants.PR_LOG_ENABLED, Constants.TRUE);
+ else
+ nvp.put(Constants.PR_LOG_ENABLED, Constants.FALSE);
+ String str = "" + mLogLevel.getSelectedIndex();
+ nvp.put(Constants.PR_LOG_LEVEL, str);
+ nvp.put(Constants.PR_LOG_BUFFERSIZE, mlogBufSizText.getText().trim());
+ //nvp.add(Constants.PR_LOG_EXPIRED_TIME, "");
+ //nvp.add(Constants.PR_LOG_FILENAME, "");
+ //nvp.add(Constants.PR_LOG_FLUSHINTERVAL, "");
+ nvp.put(Constants.PR_LOG_MAXFILESIZE, mlogMaxSizText.getText().trim());
+
+ str = "" + getRollOverTime(mlogFQC.getSelectedIndex());
+ nvp.put(Constants.PR_LOG_ROLLEROVER_INTERVAL, str);
+
+ try {
+ mAdmin.modify(DestDef.DEST_LOG_ADMIN,
+ ScopeDef.SC_AUDITLOG, Constants.RS_ID_CONFIG, nvp);
+ if (mIsNT) {
+ nvp.clear();
+ nvp.put(Constants.PR_NT_LOG_LEVEL,
+ "" + mNTLogLevel.getSelectedIndex());
+ nvp.put(Constants.PR_NT_EVENT_SOURCE,
+ mEventSourceText.getText().trim());
+ if (mActivateNTLog.isSelected())
+ nvp.put(Constants.PR_NT_LOG_ENABLED, Constants.TRUE);
+ else
+ nvp.put(Constants.PR_NT_LOG_ENABLED, Constants.FALSE);
+ mAdmin.modify(DestDef.DEST_LOG_ADMIN,
+ ScopeDef.SC_NTAUDITLOG, Constants.RS_ID_CONFIG, nvp);
+ }
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ return false;
+ }
+
+ mModel.progressStop();
+ clearDirtyFlag();
+ return true;
+ }
+
+ /**
+ * Implementation for reset values
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean resetCallback() {
+ refresh();
+ return true;
+ }
+
+ /*==========================================================
+ * EVENT HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent e) {
+ super.actionPerformed(e);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSAutoRecovery.java b/base/console/src/com/netscape/admin/certsrv/config/CMSAutoRecovery.java
new file mode 100644
index 000000000..ef55470c6
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSAutoRecovery.java
@@ -0,0 +1,267 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.awt.*;
+import java.util.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.table.*;
+import javax.swing.text.*;
+import javax.swing.event.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.*;
+
+/**
+ * Display the auto recovery dialog box.
+ * @author chrisho
+ * @version $Revision$, $Date$
+ */
+public class CMSAutoRecovery extends JDialog implements ActionListener,
+ ListSelectionListener, MouseListener {
+
+ private final static String PREFIX = "AUTORECOVERYDIALOG";
+ private AdminConnection mAdmin;
+ private JFrame mParentFrame;
+ private ResourceBundle mResource;
+ private JButton mOK;
+ private JButton mCancel;
+ private JButton mEnable;
+ private String mDisableLabel;
+ private String mDisableTip;
+ private JTable mTable;
+ private AutoRecoveryModel mDataModel;
+ protected JScrollPane mScrollPane;
+
+ public CMSAutoRecovery(JFrame parent, AdminConnection conn, JButton button) {
+ super(parent, true);
+ mParentFrame = parent;
+ mAdmin = conn;
+ mEnable = button;
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ mDisableLabel = mResource.getString(PREFIX + "_BUTTON_"+"DISABLEAUTO_LABEL");
+ mDisableTip = mResource.getString(PREFIX + "_BUTTON_"+"DISABLEAUTO_TTIP");
+ setSize(360, 216);
+ setTitle(mResource.getString(PREFIX+"_TITLE"));
+ setLocationRelativeTo(parent);
+ getRootPane().setDoubleBuffered(true);
+ setDisplay();
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ if (e.getActionCommand().equals("ok")) {
+
+ Component component = mTable.getEditorComponent();
+ if(component!= null) {
+ int col = mTable.getEditingColumn();
+ int row = mTable.getEditingRow();
+ if ((col>-1)&&(row>-1)) {
+ String str = ((JTextComponent)component).getText();
+ mTable.setValueAt(str, row, col);
+ }
+ }
+
+ String val = getUIDPassword();
+
+ // check empty user id and password
+ if (val.equals("")) {
+ CMSAdminUtil.showMessageDialog(mParentFrame, mResource,
+ PREFIX, "EMPTYFIELD", CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ } else {
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_RECOVERY_AGENT, val);
+ nvps.put(Constants.PR_AUTO_RECOVERY_ON, Constants.TRUE);
+
+ try {
+ mAdmin.modify(DestDef.DEST_KRA_ADMIN,
+ ScopeDef.SC_AUTO_RECOVERY, Constants.RS_ID_CONFIG, nvps);
+ } catch (EAdminException ex) {
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ ex.getMessage(), CMSAdminUtil.ERROR_MESSAGE);
+ }
+ }
+ mEnable.setText(mDisableLabel);
+ mEnable.setToolTipText(mDisableTip);
+ mEnable.repaint();
+ cleanup();
+ this.dispose();
+ } else if (e.getActionCommand().equals("cancel")) {
+ cleanup();
+ this.dispose();
+ }
+
+ }
+
+ //Set the first column's cellrender as label cell
+ protected void setLabelCellRenderer(JTable table, int index) {
+ table.getColumnModel().getColumn(index).setCellRenderer(
+ new DefaultTableCellRenderer());
+ }
+
+ //Set the first column's cellrender as label cell
+ protected void setLabelCellEditor(JTable table, int index) {
+ table.getColumnModel().getColumn(index).setCellRenderer(
+ new PasswordCellRenderer());
+ table.getColumnModel().getColumn(index).setCellEditor(
+ new DefaultCellEditor(new JPasswordField()));
+ }
+
+ private String getUIDPassword() {
+ String result = "";
+ for (int i=0; i<mDataModel.getRowCount(); i++) {
+ for (int j=1; j<mDataModel.getColumnCount(); j++) {
+ String val = (String)mDataModel.getValueAt(i, j);
+ if (val.equals(""))
+ return "";
+ else if (j == (mDataModel.getColumnCount()-1))
+ result = result+val;
+ else
+ result = result+val+"=";
+ }
+ if (i < (mDataModel.getRowCount()-1))
+ result = result+",";
+ }
+ return result;
+ }
+
+ private void cleanup() {
+ mDataModel.removeAllRows();
+ }
+
+ private void setDisplay() {
+ GridBagLayout gbm = new GridBagLayout();
+ getContentPane().setLayout(gbm);
+ GridBagConstraints gbc = new GridBagConstraints();
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel heading = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "HEADING", null);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbm.setConstraints(heading, gbc);
+ getContentPane().add(heading);
+
+ createTable();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.fill = gbc.BOTH;
+ gbm.setConstraints(mScrollPane, gbc);
+ getContentPane().add(mScrollPane);
+
+ JPanel action = makeActionPane();
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.SOUTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbm.setConstraints(action, gbc);
+ getContentPane().add(action);
+
+ this.show();
+ }
+
+ private JPanel makeLabelPane() {
+ JPanel labelPane = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ labelPane.setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel heading = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "HEADING", null);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(heading, gbc);
+ labelPane.add(heading);
+ return labelPane;
+ }
+
+ private JPanel makeActionPane() {
+ mOK = CMSAdminUtil.makeJButton(mResource, PREFIX, "OK", null, this);
+ mOK.setActionCommand("ok");
+ mCancel = CMSAdminUtil.makeJButton(mResource, PREFIX, "CANCEL", null, this);
+ mCancel.setActionCommand("cancel");
+ JButton[] buttons = {mOK, mCancel};
+ JButtonFactory.resize(buttons);
+ return CMSAdminUtil.makeJButtonPanel(buttons);
+ }
+
+ private void createTable() {
+
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_RECOVERY_M, "");
+
+ int numUsers = 0;
+ try {
+ NameValuePairs val = mAdmin.read(DestDef.DEST_KRA_ADMIN,
+ ScopeDef.SC_RECOVERY, Constants.RS_ID_CONFIG, nvps);
+ String str = val.get(Constants.PR_RECOVERY_M);
+ numUsers = Integer.parseInt(str);
+ } catch (EAdminException e) {
+ //showErrorDialog(e.toString());
+ }
+
+ mDataModel = new AutoRecoveryModel();
+ Vector[] data = new Vector[numUsers];
+ for (int i=0; i<data.length; i++) {
+ data[i] = new Vector();
+ Integer num = new Integer(i+1);
+ data[i].addElement(num.toString());
+ data[i].addElement("");
+ data[i].addElement("");
+ mDataModel.addRow(data[i]);
+ }
+
+ mTable = new JTable(mDataModel);
+ mTable.setShowGrid(true);
+ mScrollPane = JTable.createScrollPaneForTable(mTable);
+ mScrollPane.setHorizontalScrollBarPolicy(mScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mScrollPane.setVerticalScrollBarPolicy(mScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ mTable.setAutoscrolls(true);
+ mTable.sizeColumnsToFit(true);
+ mTable.setPreferredScrollableViewportSize(new Dimension(200, 100));
+ //mTable.setMaximumSize(new Dimension(200, 100));
+ mTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
+ mTable.getSelectionModel().addListSelectionListener(this);
+ mScrollPane.setBackground(Color.white);
+ mTable.addMouseListener((MouseListener)this);
+ setLabelCellRenderer(mTable, 1);
+ setLabelCellEditor(mTable, 2);
+ }
+
+ public void mouseClicked(MouseEvent e) {}
+ public void mousePressed(MouseEvent e) {}
+ public void mouseReleased(MouseEvent e) {}
+ public void mouseEntered(MouseEvent e) {}
+ public void mouseExited(MouseEvent e) {}
+ public void valueChanged(ListSelectionEvent e){
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSBaseConfigDialog.java b/base/console/src/com/netscape/admin/certsrv/config/CMSBaseConfigDialog.java
new file mode 100644
index 000000000..87562829b
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSBaseConfigDialog.java
@@ -0,0 +1,1078 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import javax.swing.text.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Plugin Parameter Configuration Dialog
+ *
+ * @author Steve Parkinson
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class CMSBaseConfigDialog extends JDialog
+ implements ActionListener, MouseListener, FocusListener
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ protected JFrame mParentFrame;
+ protected ResourceBundle mResource;
+
+ protected String PREFIX = null;
+
+ protected boolean mIsOK = false;
+ protected NameValuePairs mData=null;
+
+ protected JScrollPane mScrollPane=null;
+ protected JTable mTable=null;
+ protected String mRuleName=null;//instance name
+ protected JPanel mParamPanel=null;
+ protected JPanel mHelpPanel=null;
+ protected JTextArea mHelpLabel=null;
+
+ protected JButton mOK=null, mCancel=null, mHelp=null;
+ protected JTextField mPluginName=null;
+ protected JLabel mImplnameCaption=null,mRulenameCaption=null;
+ protected JLabel mImplName=null, mPluginLabel=null;
+ protected String RAHELPINDEX=null;
+ protected String KRAHELPINDEX=null;
+ protected String CAHELPINDEX=null;
+ protected String mHelpToken=null;
+
+ protected AdminConnection mAdminConnection = null;
+
+ protected String mImplName_token=null;//nvp index for plubinName
+ protected String mImplType=null;//plugin type:policy,auth etc
+ protected String mDest;
+ protected String mInstanceScope=null;
+ protected String mId = null; // used as a ip id for crl exts
+
+ /* true if creating a new instance
+ * false if editing an old one
+ */
+ protected boolean mNewInstance=false; //
+
+ private ExtendedPluginInfoSet mEPIs = null;
+ protected CMSBaseResourceModel mModel = null;
+
+ private String mServletName;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSBaseConfigDialog(JFrame frame,
+ String dest) {
+ super(frame,true);
+ mServletName = dest;
+ }
+
+ protected void init(NameValuePairs nvp,
+ JFrame parent,
+ AdminConnection conn,
+ String dest)
+ {
+ mParentFrame = parent;
+ mDest = dest;
+ mAdminConnection = conn;
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ setSize(360, 415);
+
+ setTitle(mResource.getString(PREFIX+"_TITLE"));
+ setLocationRelativeTo(mParentFrame);
+ getRootPane().setDoubleBuffered(true);
+ setDisplay();
+ }
+
+ protected void init(NameValuePairs nvp,
+ JFrame parent,
+ AdminConnection conn,
+ String dest,
+ String id)
+ {
+ mId = id;
+ init(nvp, parent, conn, dest);
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * the model needs to be set if we need to start/stop the progress
+ * bar.
+ */
+
+ public void setModel(CMSBaseResourceModel model)
+ {
+ mModel = model;
+ }
+
+ public void setInstanceScope(String s)
+ {
+ mInstanceScope = s;
+ }
+
+ /**
+ * retrieve the extended plugin information for this plugin
+ * from the server. The servlet must implement the scope
+ * 'extendedPluginInfo' and the plugin must implement the
+ * IExtendedPluginInfo interface, or else the display
+ * will revert back to simple name-value pairs.
+ */
+
+ ExtendedPluginInfoSet getExtendedPluginInfo(String implname,
+ NameValuePairs oldstyle) {
+
+ NameValuePairs data = new NameValuePairs();
+ String query = mImplType+":"+implname;//implName:pluginName
+ NameValuePairs response=null;
+
+ if (mImplType.equals("policy") &&
+ (mRuleName != null) && !mRuleName.trim().equals("")) {
+ query = query + ":" + mRuleName;
+ }
+
+ /* make the request to the server */
+ try {
+ response = mAdminConnection.read(mServletName,
+ ScopeDef.SC_EXTENDED_PLUGIN_INFO,
+ query,
+ data);
+ }
+ catch (EAdminException e) {
+ }
+
+ ExtendedPluginInfoSet epis = new ExtendedPluginInfoSet();
+
+ if (response == null) response = new NameValuePairs();
+
+ /* if the servlet or rule wasn't capable of handling the new style
+ * of interface, just return the names from the name/value pairs that
+ * were passed in
+ * otherwise, for each parameter name, fetch the associated
+ * parameter type from the extendedPluginInfo that the server
+ * returned
+ */
+ for (String name : oldstyle.keySet()) {
+ String value = response.get(name);
+ if (value != null) {
+ epis.add(name, value,false);
+ }
+ else {
+ epis.add(name, "",true);
+ }
+ }
+
+
+ String ht = response.get("HELP_TOKEN");
+ if (ht != null) epis.setHelpToken(ht);
+
+ String hs = response.get("HELP_TEXT");
+ if (hs != null) epis.setHelpSummary(hs);
+
+ return epis;
+ }
+
+
+
+ /**
+ * show the list of configuration parameters
+ */
+ public void showDialog(NameValuePairs data, String name) {
+ mIsOK = false;
+
+ mData = data;
+
+ Debug.println("in CMSBaseConfigDialog.showDialog()");
+
+ JPanel p = mParamPanel;
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ p.setLayout(gb);
+
+ mRuleName = data.get(mImplName_token);
+ mEPIs = getExtendedPluginInfo(mRuleName,data);
+
+ for (String entry : data.keySet()) {
+ entry = entry.trim();
+ Debug.println("in CMSBaseConfigDialog.showDialog() entry=" + entry);
+ if (!entry.equals(mImplName_token)) {
+ String labelname = entry;
+
+ /* comp is the component which represents the value
+ * of the parameter. It can be a checkbox, choice, or
+ * text field
+ */
+
+ JComponent comp = null;
+ String stringvalue = data.get(entry);
+ ExtendedPluginInfo epi = mEPIs.get(entry);
+ if (epi == null) {
+ Debug.println("no ExtendedPluginInfo for "+entry);
+ }
+
+ if (epi.getType() == ExtendedPluginInfo.TYPE_PASSWORD) {
+ labelname = "password";
+ }
+
+ if (epi.isRequired()) {
+ labelname = "* "+labelname;
+ }
+
+ /* this label is the name of the parameter. We need
+ * to add a mouselistener so that we can update the
+ * help text if someone clicks on the label
+ */
+ JLabel l = new JLabel(labelname);
+ l.addMouseListener(this);
+
+ CMSAdminUtil.resetGBC(gbc);
+
+ gbc.gridwidth = 1;
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.2;
+ gbc.gridwidth = 1;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(
+ CMSAdminUtil.COMPONENT_SPACE, // top
+ 0, // left
+ 0, // bottom
+ 5); // right
+ p.add(l,gbc);
+
+
+ /* if there was no text extendedplugininfo for this parameter
+ * just make it a text box
+ */
+ if (epi == null) {
+ comp = new JTextField(stringvalue);
+ }
+ else {
+ epi.setValue(stringvalue);
+ comp = epi.makeComponent(this);
+ }
+
+ /* this lets us get an event when this component
+ * is clicked on, so we can update the help text
+ */
+ comp.addFocusListener(this);
+
+ gbc.weightx = 0.7;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.gridwidth = gbc.RELATIVE;
+ gbc.anchor = gbc.WEST;
+ gbc.insets = new Insets(
+ CMSAdminUtil.COMPONENT_SPACE, //top
+ 0, //left
+ 0, //bottom
+ 0); // right
+ p.add(comp ,gbc);
+
+ /* add a dummy component to the end of each row to
+ * keep it from hiting the edge of the panel
+ */
+ JLabel j = new JLabel("");
+ gbc.weightx = 0.1;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.anchor = gbc.WEST;
+ gbc.insets = new Insets(
+ CMSAdminUtil.COMPONENT_SPACE, //top
+ 0, //left
+ 0, //bottom
+ CMSAdminUtil.COMPONENT_SPACE); // right
+ p.add(j,gbc);
+
+ }
+ }
+
+ mImplName.setText(mRuleName);
+
+ if ((name==null)||name.equals("")) {
+ mNewInstance = true;
+ /* we're dealing with a new instance - so the rule name is
+ * a text box - it's editable
+ */
+ mPluginName.setVisible(true);
+ mPluginName.setText(getDefaultInstanceName(mRuleName));
+ mPluginLabel.setVisible(false);
+ } else {
+ mNewInstance = false;
+ /* we're editing an old instance - so the rule name is just
+ * a label - you can't edit it
+ */
+ mPluginName.setVisible(false);
+ mPluginLabel.setVisible(true);
+ mPluginLabel.setText(name);
+ }
+
+ mHelpLabel.setText(mEPIs.getHelpSummary());
+ mHelpLabel.repaint();
+
+ mImplName.addMouseListener(this);
+ mPluginName.addMouseListener(this);
+ mPluginLabel.addMouseListener(this);
+
+ this.show();
+ }
+
+ public String getDefaultInstanceName(String implName)
+ {
+ Debug.println("in CMSBaseConfigDialog::getDefaultInstanceName("+implName+") - returning ''");
+ return "";
+ }
+
+ public boolean isOK() {
+ return mIsOK;
+ }
+
+
+ public String getRuleName() {
+ return mRuleName;
+ }
+
+ /*==========================================================
+ * EVENT HANDLER METHODS
+ *==========================================================*/
+
+ /**
+ * From focuslistener interface. This lets us know when a component
+ * has received focus, so we can update the help text.
+ */
+ public void focusGained(FocusEvent f) {
+ Component comp = f.getComponent();
+ mPluginName.addFocusListener(this);
+ mPluginLabel.addMouseListener(this);
+ String text = "";
+
+ if (comp instanceof ExtendedPluginInfoComponent) {
+ ExtendedPluginInfoComponent epic = (ExtendedPluginInfoComponent)comp;
+ ExtendedPluginInfo epi = epic.getExtendedPluginInfo();
+ text = epi.getHelpText()+" ";
+ }
+ else if (doHelpSummary(comp)) {
+ text = mEPIs.getHelpSummary();
+ }
+ else {
+ }
+
+ mHelpLabel.setText(text);
+ mHelpLabel.repaint();
+
+ }
+
+ /** need to supply this method for focuslistener, but we
+ * really don't care about it
+ */
+ public void focusLost(FocusEvent f) {
+ }
+
+
+ /*
+ * mouselistener events - for JLabel
+ */
+
+ /**
+ * This lets us know when someone clicked a label, so we can
+ * update the help text
+ */
+ public void mouseClicked(MouseEvent e) {
+ Component c = e.getComponent();
+ String helpText = "";
+ if (c instanceof JLabel) {
+ String paramName = ((JLabel)c).getText();
+ ExtendedPluginInfo epi = mEPIs.get(paramName);
+
+ if (epi != null) helpText = epi.getHelpText();
+ else if (doHelpSummary(c)) {
+ helpText = mEPIs.getHelpSummary();
+ }
+ }
+ mHelpLabel.setText(helpText);
+ mHelpLabel.repaint();
+ }
+
+ public void mouseEntered(MouseEvent e) {
+ }
+ public void mouseExited(MouseEvent e) {
+ }
+ public void mousePressed(MouseEvent e) {
+ }
+ public void mouseReleased(MouseEvent e) {
+ }
+
+
+ public boolean doHelpSummary(Component c) {
+
+ if (c.equals(mPluginName) ||
+ c.equals(mPluginLabel) ||
+ c.equals(mRulenameCaption) ||
+ c.equals(mImplnameCaption) ||
+ c.equals(mImplName) ) {
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ //=== ACTIONLISTENER =====================
+
+ /**
+ * this gets called when a someone made some kind of event happen.
+ * We really only check for the OK, Cancel, or Help buttons here
+ */
+ public void actionPerformed(ActionEvent evt) {
+
+ if (evt.getSource().equals(mOK)) {
+
+ /* if this is a new instance of a rule, (as opposed to editing an old one) */
+ if (mNewInstance) {
+ mRuleName = mPluginName.getText();
+ /* make sure they set the name of the rule, otherwise, show an error message */
+ if (mRuleName.trim().equals("")) {
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ mResource.getString("INSTANCECONFIGDIALOG_DIALOG_NOINSTANCENAME_MESSAGE"),
+ CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ }
+ else {
+ mRuleName = mPluginLabel.getText();
+ }
+
+ Debug.println(4,"User pressed okay on instance config dialog");
+ Enumeration e = mEPIs.keys();
+ NameValuePairs nvp = new NameValuePairs();
+ while (e.hasMoreElements()) {
+ String paramName = (String)e.nextElement();
+ ExtendedPluginInfo epi = mEPIs.get(paramName);
+ String value = epi.getComponentStateAsString();
+ if (epi.getType() == ExtendedPluginInfo.TYPE_PASSWORD) {
+ String password = value;
+ value = "Rule "+mRuleName;
+ if (password != null && password.length() >0) {
+ nvp.put("PASSWORD_CACHE_ADD", value + ";" + password);
+ }
+ }
+
+ nvp.put(paramName, value);
+ }
+ nvp.put(PolicyRuleDataModel.RULE_NAME, mRuleName);
+ nvp.put(mImplName_token, mImplName.getText());
+
+ mData = nvp;
+ try {
+ if (mModel != null) { mModel.progressStart(); }
+ if (mNewInstance == true) {
+ mAdminConnection.add(mDest, mInstanceScope, mRuleName, nvp);
+ }
+ else {
+ if (mId != null && mId.length() > 0) {
+ nvp.put(Constants.PR_ID, mId);
+ }
+ mAdminConnection.modify(mDest, mInstanceScope, mRuleName, nvp);
+ }
+ mIsOK = true;
+ if (mModel != null) { mModel.progressStop(); }
+ this.dispose();
+ }
+ catch (EAdminException ex) {
+ mModel.progressStop();
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ ex.toString(),CMSAdminUtil.ERROR_MESSAGE);
+ }
+ }
+
+ if (evt.getSource().equals(mCancel)) {
+ this.dispose();
+ }
+ if (evt.getSource().equals(mHelp)) {
+ String ht = mEPIs.getHelpToken();
+ if (ht == null || ht.equals("")) {
+ CMSAdminUtil.help(mHelpToken);
+ }
+ else {
+ CMSAdminUtil.help(ht);
+ }
+ }
+ }
+
+
+ public NameValuePairs getData() {
+ return mData;
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+ private void setDisplay() {
+ getContentPane().setLayout(new BorderLayout());
+ JPanel center = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ center.setLayout(gb);
+
+
+ /* Content panel. This is where we put the name/value pairs,
+ * and the help text */
+ JPanel content = makeContentPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(content, gbc);
+ center.add(content);
+
+
+ /* Action panel. This is where we put the OK, Cancel, Help buttons */
+ JPanel action = makeActionPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints(action, gbc);
+ center.add(action);
+
+ getContentPane().add("Center",center);
+ }
+
+ //create botton action panel
+ private JPanel makeActionPane() {
+
+ mOK = CMSAdminUtil.makeJButton(mResource, PREFIX, "OK", null, this);
+ mCancel = CMSAdminUtil.makeJButton(mResource, PREFIX, "CANCEL", null, this);
+ mHelp = CMSAdminUtil.makeJButton(mResource, PREFIX, "HELP", null, this);
+
+ //JButton[] buttons = { mOK, mCancel, mHelp};
+ JButton[] buttons = { mOK, mCancel};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonPanel( buttons, true);
+ }
+
+ protected void setDestination(String dest) {
+ mDest = dest;
+ }
+
+ protected JPanel makeContentPane() {
+ JPanel mListPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mListPanel.setLayout(gb);
+
+ /* mPluginName and mPluginLabel occupy the same space in the UI, but
+ * only one of them is visible at a time. showDialog() determines which
+ * is visible. If this is a new component, mPluginName is visible, and is a
+ * a text field, so the user can enter the name of the new instance.
+ * Otherwise, it's just a label, showing the existing name.
+ */
+ // 'Policy Rule ID' here
+ CMSAdminUtil.resetGBC(gbc);
+ mRulenameCaption = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "RULENAME", null);
+ mRulenameCaption.addMouseListener(this);
+ mPluginLabel = new JLabel();
+ mPluginLabel.setVisible(false);
+ mPluginName = new JTextField();
+
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ mListPanel.add(mRulenameCaption, gbc);
+
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,
+ 0,CMSAdminUtil.COMPONENT_SPACE);
+ mListPanel.add( mPluginName, gbc );
+ mListPanel.add( mPluginLabel, gbc );
+
+ // 'Policy Plugin ID' here
+ CMSAdminUtil.resetGBC(gbc);
+ mImplnameCaption = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "IMPLNAME", null);
+ mImplnameCaption.addMouseListener(this);
+
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ mListPanel.add( mImplnameCaption, gbc );
+
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ mImplName = new JLabel();
+ mListPanel.add( mImplName, gbc );
+
+ /* Panel for list of plugin's parameters */
+ mParamPanel = new JPanel();
+
+ mScrollPane = new JScrollPane(mParamPanel);
+ mScrollPane.setBorder(CMSAdminUtil.makeEtchedBorder());
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.fill = gbc.BOTH;
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(mScrollPane, gbc);
+ mListPanel.add(mScrollPane);
+
+ /* Panel in which to put plugin's help text */
+ mHelpPanel = new JPanel();
+ mHelpPanel.setBorder(CMSAdminUtil.makeEtchedBorder());
+ mHelpLabel = new JTextArea(3,0);
+ mHelpLabel.setLineWrap(true);
+ mHelpLabel.setWrapStyleWord(true);
+ mHelpLabel.setBackground(mHelpPanel.getBackground());
+ mHelpLabel.setEditable(false);
+ GridBagLayout gb2 = new GridBagLayout();
+ GridBagConstraints gbc2 = new GridBagConstraints();
+
+ CMSAdminUtil.resetGBC(gbc2);
+ gbc2.fill = gbc.BOTH;
+ gbc2.anchor = gbc.WEST;
+ gbc2.gridwidth = gbc.REMAINDER;
+ gbc2.weightx = 1.0;
+ gbc2.weighty = 1.0;
+ gb2.setConstraints(mHelpLabel, gbc2);
+ mHelpPanel.setLayout(gb2);
+ mHelpPanel.add(mHelpLabel);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.SOUTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gb.setConstraints(mHelpPanel, gbc);
+ mListPanel.add(mHelpPanel);
+
+ return mListPanel;
+ }
+
+}
+
+
+class ExtendedPluginInfoSet extends Hashtable {
+
+ /**
+ * Add a value for this config parameter.
+ * the format of 'syntax' is specified in
+ * @see com.netscape.certsrv.base.IExtendedPluginInfo
+ */
+ public void add(String param, String syntax, boolean oldstyle) {
+
+ try {
+ String type;
+ ExtendedPluginInfo epi;
+ boolean required=false;
+
+ if (!oldstyle) {
+ String rest, helptext;
+ int semicolon = syntax.indexOf(';');
+
+ type = syntax.substring(0,semicolon);
+ rest = syntax.substring(semicolon+1);
+
+ for (int i=0;i<1;i++) {
+ int length = type.length();
+ if (type.endsWith(",required")) {
+ type=type.substring(0,length-0);
+ required=true;
+ }
+ }
+ helptext = rest; // ADDED to fix bug #383969
+/*
+ semicolon = rest.indexOf(';');
+ if (semicolon == -1) { // no more semicolons
+ helptext = rest;
+ }
+ else {
+ helptext = rest.substring(0,semicolon);
+ rest = rest.substring(semicolon+1);
+ }
+*/
+ epi = new ExtendedPluginInfo(type,helptext);
+ epi.setRequired(required);
+ }
+ else {
+ epi = new ExtendedPluginInfo("string","");
+ }
+
+ put(param,epi);
+ } catch (Exception e) {
+ Debug.println("Badly formatted ExtendedpluginInfo for string: '"+
+ syntax+"'");
+ }
+ }
+
+ private String mHelpSummary = "";
+ private String mHelpToken = "";
+
+ public String getHelpSummary() {
+ return mHelpSummary;
+ }
+
+ public void setHelpSummary(String summary) {
+ mHelpSummary = summary;
+ }
+
+ public String getHelpToken() {
+ return mHelpToken;
+ }
+
+ public void setHelpToken(String token) {
+ mHelpToken = token;
+ }
+
+ public ExtendedPluginInfo get(String param) {
+ return (ExtendedPluginInfo)super.get(param);
+ }
+
+}
+
+
+
+interface ExtendedPluginInfoComponent
+{
+ public abstract ExtendedPluginInfo getExtendedPluginInfo();
+
+ public abstract String getValueAsString();
+}
+
+
+class ExtendedPluginInfoCheckBox extends JCheckBox
+implements ExtendedPluginInfoComponent
+{
+ private ExtendedPluginInfo mEpi;
+
+ public ExtendedPluginInfoCheckBox(ExtendedPluginInfo epi, boolean b)
+ {
+ super("",b);
+ mEpi = epi;
+ }
+
+ public ExtendedPluginInfo getExtendedPluginInfo() {
+ return mEpi;
+ }
+
+ public String getValueAsString() {
+ if (isSelected()) {
+ return "true";
+ }
+ else {
+ return "false";
+ }
+ }
+
+}
+
+class ExtendedPluginInfoComboBox extends JComboBox
+implements ExtendedPluginInfoComponent
+{
+ private ExtendedPluginInfo mEpi;
+
+ public ExtendedPluginInfoComboBox(ExtendedPluginInfo epi, Vector v)
+ {
+ super(v);
+ mEpi = epi;
+ }
+
+ public ExtendedPluginInfo getExtendedPluginInfo() {
+ return mEpi;
+ }
+
+ public String getValueAsString() {
+ return (String)getSelectedItem();
+ }
+}
+
+class ExtendedPluginInfoTextField extends JTextField
+implements ExtendedPluginInfoComponent
+{
+ private ExtendedPluginInfo mEpi;
+
+ public ExtendedPluginInfoTextField(ExtendedPluginInfo epi, String s)
+ {
+ super(s);
+ mEpi = epi;
+ }
+
+ public ExtendedPluginInfo getExtendedPluginInfo() {
+ return mEpi;
+ }
+
+ public String getValueAsString() {
+ return getText();
+ }
+}
+
+class ExtendedPluginInfoPasswordField extends JPasswordField
+implements ExtendedPluginInfoComponent
+{
+ private ExtendedPluginInfo mEpi;
+
+ public ExtendedPluginInfoPasswordField(ExtendedPluginInfo epi, String s)
+ {
+ super(s);
+ mEpi = epi;
+ }
+
+ public ExtendedPluginInfo getExtendedPluginInfo() {
+ return mEpi;
+ }
+
+ public String getValueAsString() {
+ return getText();
+ }
+}
+
+class ExtendedPluginInfoNumberField extends JTextField
+implements ExtendedPluginInfoComponent
+{
+ private ExtendedPluginInfo mEpi;
+
+ public ExtendedPluginInfoNumberField(ExtendedPluginInfo epi, String s)
+ {
+ super(s);
+ mEpi = epi;
+ }
+
+ public ExtendedPluginInfo getExtendedPluginInfo() {
+ return mEpi;
+ }
+
+ public String getValueAsString() {
+ return getText();
+ }
+
+ protected Document createDefaultModel() {
+ return new NumberDocument();
+ }
+
+ static class NumberDocument extends PlainDocument {
+
+ public void insertString(int offs, String str, AttributeSet a)
+ throws BadLocationException {
+
+ if (str == null) {
+ return;
+ }
+
+ char[] chars = str.toCharArray();
+ int j=0;
+
+ for (int i = 0; i < chars.length; i++) {
+ if ( (chars[i]<'0' || chars[i]>'9')
+ && (chars[i] != '.')
+ && (chars[i] != '-') ) {
+ }
+ else {
+ chars[j++] = chars[i];
+ }
+ }
+ char newchars[] = new char[j];
+ if (j != 0) {
+ System.arraycopy(chars,0,newchars,0,j);
+ }
+ super.insertString(offs, new String(newchars), a);
+ }
+ }
+}
+
+
+
+/**
+ * This class records information about the type of a parameter
+ * and what possible value it can take
+ */
+
+class ExtendedPluginInfo {
+
+ public static final int TYPE_STRING = 0;
+ public static final int TYPE_BOOLEAN = 1;
+ public static final int TYPE_NUMBER = 2;
+ public static final int TYPE_CHOICE = 3;
+ public static final int TYPE_PASSWORD = 4;
+
+ private int mType;
+ private boolean mRequired;
+
+ private String mValue = null;
+
+ private Vector mChoices = null;
+
+ private String mHelpText = null;
+
+
+ ExtendedPluginInfo(String type, String helptext)
+ {
+ mHelpText = helptext;
+
+ if (type.equals("string")) {
+ mType = TYPE_STRING;
+ }
+ else if (type.equals("boolean")) {
+ mType = TYPE_BOOLEAN;
+ }
+ else if (type.equals("number")) {
+ mType = TYPE_NUMBER;
+ }
+ else if (type.equals("integer")) {
+ mType = TYPE_NUMBER;
+ }
+ else if (type.equals("password")) {
+ mType = TYPE_PASSWORD;
+ }
+ else if (type.startsWith("choice")) {
+ mType = TYPE_CHOICE;
+ String choices = type.substring(
+ type.indexOf('(')+1,
+ type.indexOf(')')
+ );
+ StringTokenizer tokenizer = new StringTokenizer(choices,",",false);
+ mChoices = new Vector();
+ String prefix = null;
+ while (tokenizer.hasMoreElements()) {
+ String c = (String)tokenizer.nextElement();
+ int i = c.indexOf("\\");
+ if ( i != -1 ) {
+ if (prefix == null)
+ prefix = c.substring(0,i);
+ else
+ prefix = prefix + "," + c.substring(0,i);
+ } else {
+ if (prefix != null) {
+ c = prefix + "," + c;
+ prefix = null;
+ }
+ mChoices.addElement(c);
+ }
+ }
+ }
+ else {
+ mType = TYPE_STRING; // unknown type - default to string type
+ }
+ }
+
+ public Vector getChoices() {
+ return mChoices;
+ }
+
+ public String getHelpText() {
+ return mHelpText;
+ }
+
+ public String getValue() {
+ return mValue;
+ }
+
+ public void setValue(String val) {
+ mValue = val;
+ }
+
+ public int getType() {
+ return mType;
+ }
+
+ public void setRequired(boolean b) {
+ mRequired = b;
+ }
+
+ public boolean isRequired() {
+ return mRequired;
+ }
+
+ private JComponent component = null;
+
+ public JComponent getComponent() {
+ return component;
+ }
+
+ public String getComponentStateAsString() {
+ if (component == null)
+ return null;
+ return ((ExtendedPluginInfoComponent)component).getValueAsString();
+ }
+
+ public JComponent makeComponent(ActionListener al)
+ {
+ switch (getType()) {
+ case ExtendedPluginInfo.TYPE_BOOLEAN:
+ boolean b;
+ if (getValue().equals("true")) { b=true; }
+ else { b = false; }
+ component = new ExtendedPluginInfoCheckBox(this,b);
+ ((ExtendedPluginInfoCheckBox)component).addActionListener(al);
+ break;
+
+ case ExtendedPluginInfo.TYPE_STRING:
+ component = new ExtendedPluginInfoTextField(this,getValue());
+ ((ExtendedPluginInfoTextField)component).addActionListener(al);
+ break;
+
+ case ExtendedPluginInfo.TYPE_NUMBER:
+ component = new ExtendedPluginInfoNumberField(this,getValue());
+ ((ExtendedPluginInfoNumberField)component).addActionListener(al);
+ break;
+
+ case ExtendedPluginInfo.TYPE_PASSWORD:
+ component = new ExtendedPluginInfoPasswordField(this,"");
+ ((ExtendedPluginInfoPasswordField)component).addActionListener(al);
+ break;
+
+ case ExtendedPluginInfo.TYPE_CHOICE:
+ JComboBox cb = new ExtendedPluginInfoComboBox(this,getChoices());
+ cb.setSelectedItem(getValue());
+ ((ExtendedPluginInfoComboBox)cb).addActionListener(al);
+ component = cb;
+ break;
+
+ default:
+ return null;
+ }
+ return component;
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSBaseConfigPanel.java b/base/console/src/com/netscape/admin/certsrv/config/CMSBaseConfigPanel.java
new file mode 100644
index 000000000..89dce60c7
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSBaseConfigPanel.java
@@ -0,0 +1,180 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import javax.swing.border.*;
+import javax.swing.text.*;
+import com.netscape.management.client.util.*;
+import com.netscape.management.nmclf.*;
+import java.util.*;
+import java.awt.*;
+import java.awt.event.*;
+
+/**
+ * Netscape Certificate Server 4.0 Default Base Panel
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public abstract class CMSBaseConfigPanel extends CMSBasePanel {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+
+ private String mTitle; // panel title actually shows
+ protected boolean mDirty = false; // panel dirty flag
+ protected boolean mInit = false; // true if this panel is initialized
+ protected JPanel mCenterPanel; // display panel
+ protected String mHelpToken;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSBaseConfigPanel(String panelName) {
+ super(panelName);
+ //mPanelName = panelName;
+ setLayout(new BorderLayout());
+ mCenterPanel = new JPanel();
+ try {
+ String title = mResource.getString(mPanelName+"_TITLE");
+ mTitle = title;
+ } catch (MissingResourceException e) {
+ mTitle = "Missing Title";
+ }
+ }
+
+ public CMSBaseConfigPanel() {
+ super("");
+ mTitle = "Missing Title";
+ }
+
+ /*==========================================================
+ * abstract methods
+ *==========================================================*/
+
+ //Actual Instanciation of the panels
+ public abstract void init();
+
+ //Implementation for saving panel information
+ public abstract boolean applyCallback();
+
+ //Implementation for reset values
+ public abstract boolean resetCallback();
+
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ //Implementation for calling help
+ public void helpCallback() {
+ CMSAdminUtil.help(mHelpToken);
+ }
+
+ /**
+ * Returns the title of the tab
+ * @return string representation of the title
+ */
+ public String getTitle() {
+ return mTitle;
+ }
+
+ /**
+ * set the title of the tab
+ */
+ public void setTitle(String title) {
+ mTitle = title;
+ }
+
+ /**
+ * see if the contents of the panel have been changed but not applied
+ * @return true if dirty; otherwise,false.
+ */
+ public boolean isDirty() {
+ return mDirty;
+ }
+
+ /**
+ * Called by the Tab parent to initialize the panel
+ */
+ public void initialize() {
+ if (!mInit) {
+ //Debug.println("CMSBasePanel: initialize()"+mPanelName);
+ mCenterPanel.setBorder(new EmptyBorder(DEFAULT_CENTER_INSETS));
+ init();
+ mInit = true;
+ }
+ }
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent e) {
+ if (mInit)
+ this.setDirtyFlag();
+ }
+
+ //== DocumentListener ==
+ public void insertUpdate(DocumentEvent e) {
+ if (mInit)
+ this.setDirtyFlag();
+ }
+ public void removeUpdate(DocumentEvent e){
+ if (mInit)
+ this.setDirtyFlag();
+ }
+ public void changedUpdate(DocumentEvent e){
+ if (mInit)
+ this.setDirtyFlag();
+ }
+
+ //== ItemListener ==
+ public void itemStateChanged(ItemEvent e){
+ if (mInit)
+ this.setDirtyFlag();
+ }
+
+ //== ListSelectionListener ==
+ public void valueChanged(ListSelectionEvent e){
+ if (mInit)
+ this.setDirtyFlag();
+ }
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+
+ //=== Dirty Flag =========================
+
+ //set dirty flag
+ protected void setDirtyFlag() {
+ mDirty = true;
+ }
+
+ //clear dirty flag
+ protected void clearDirtyFlag() {
+ mDirty = false;
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSBaseLDAPPanel.java b/base/console/src/com/netscape/admin/certsrv/config/CMSBaseLDAPPanel.java
new file mode 100644
index 000000000..dbba4a763
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSBaseLDAPPanel.java
@@ -0,0 +1,692 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import java.awt.*;
+import java.util.*;
+import java.awt.event.*;
+
+/**
+ * LDAP server setting tab
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ */
+public abstract class CMSBaseLDAPPanel extends CMSBaseTab implements ItemListener {
+ private static final String SERVER_CERT_NICKNAME = "Server-Cert";
+ private JTextField mHostNameText;
+ private JTextField mPortText;
+ //private JTextField mBaseDNText;
+ private JTextField mBindAsText;
+ private JPasswordField mPasswordText;
+ private JCheckBox mSecurePort;
+ private JCheckBox mEnable;
+ private JCheckBox mEnablePublishing;
+ private JCheckBox mEnableQueue;
+ private Color mActiveColor;
+ private JLabel mHostLabel, mPortLabel, mBindAsLabel, mVersionLabel;
+ protected JLabel mPasswordLabel;
+ protected AdminConnection mAdmin;
+ protected CMSBaseResourceModel mModel;
+ private String mServletName;
+ private CMSTabPanel mParent;
+ private boolean mPublishing = true;
+ private boolean mLDAPPublishing = true;
+ private boolean mPublishingQueue = true;
+ private String mPublishingQueuePriorityLevel = "0";
+ private String mMaxNumberOfPublishingThreads = "3";
+ private String mPublishingQueuePageSize = "40";
+ private String mPublishingQueueStatus = "200";
+ private JLabel mAuthLabel, mCertLabel;
+ private JComboBox mAuthBox, mCertBox;
+ private String mPanelName;
+ private JComboBox mVersionBox;
+ private final static String[] AUTHTYPE = {Constants.PR_BASIC_AUTH,
+ Constants.PR_SSL_AUTH};
+
+ private static final String DELIMITER = ",";
+
+ public CMSBaseLDAPPanel(String panelName, CMSTabPanel parent) {
+ this(panelName, parent, true);
+ mPanelName = panelName;
+ }
+
+ public CMSBaseLDAPPanel(String panelName, CMSTabPanel parent, boolean flag) {
+ super(panelName, parent);
+ mServletName = getServletName(panelName);
+ mModel = parent.getResourceModel();
+ mParent = parent;
+ mPublishing = flag;
+ mPublishingQueue = flag;
+ mLDAPPublishing = flag;
+ }
+
+ public void init() {
+ mAdmin = mModel.getServerInfo().getAdmin();
+ JPanel serverInfo = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mCenterPanel.setLayout(gb);
+
+ mEnablePublishing = makeJCheckBox("ENABLEPUBLISHING");
+ mEnablePublishing.setSelected(true);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(DIFFERENT_COMPONENT_SPACE,
+ DIFFERENT_COMPONENT_SPACE,
+ 0,
+ DIFFERENT_COMPONENT_SPACE);
+ gb.setConstraints(mEnablePublishing, gbc);
+ mEnablePublishing.addItemListener(this);
+ mCenterPanel.add(mEnablePublishing);
+
+ //add the enable queue
+ mEnableQueue = makeJCheckBox("ENABLEQUEUE");
+ mEnableQueue.setSelected(true);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(DIFFERENT_COMPONENT_SPACE,
+ DIFFERENT_COMPONENT_SPACE,
+ 0,
+ DIFFERENT_COMPONENT_SPACE);
+ gb.setConstraints(mEnableQueue, gbc);
+ mEnableQueue.addItemListener(this);
+ mCenterPanel.add(mEnableQueue);
+
+ //add the enable checkbox
+ mEnable = makeJCheckBox("ENABLE");
+ mEnable.setSelected(true);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(DIFFERENT_COMPONENT_SPACE,
+ DIFFERENT_COMPONENT_SPACE,
+ 0,
+ DIFFERENT_COMPONENT_SPACE);
+ gb.setConstraints(mEnable, gbc);
+ mEnable.addItemListener(this);
+ if (mLDAPPublishing)
+ mCenterPanel.add(mEnable);
+
+ //add the destination panel
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(serverInfo, gbc);
+ mCenterPanel.add(serverInfo);
+
+ GridBagLayout gb1 = new GridBagLayout();
+ serverInfo.setLayout(gb1);
+ if (mLDAPPublishing)
+ serverInfo.setBorder(makeTitledBorder("DESTINATION"));
+
+ // add host name label and text field
+ CMSAdminUtil.resetGBC(gbc);
+ mHostLabel = makeJLabel("HOST");
+ mHostNameText = makeJTextField(30);
+ mActiveColor = mHostNameText.getBackground();
+ CMSAdminUtil.addEntryField(serverInfo, mHostLabel, mHostNameText, gbc);
+
+ // add port number label
+ CMSAdminUtil.resetGBC(gbc);
+ mPortLabel = makeJLabel("PORT");
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0,0);
+ gb1.setConstraints(mPortLabel, gbc);
+ serverInfo.add(mPortLabel);
+
+ // add port number text field
+ CMSAdminUtil.resetGBC(gbc);
+ mPortText = makeJTextField(10);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 0.0;
+ gb1.setConstraints(mPortText, gbc);
+ serverInfo.add(mPortText);
+
+ // add check box
+ CMSAdminUtil.resetGBC(gbc);
+ mSecurePort = makeJCheckBox("SECUREPORT");
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE - COMPONENT_SPACE,0,COMPONENT_SPACE);
+ gb1.setConstraints(mSecurePort, gbc);
+ serverInfo.add(mSecurePort);
+
+ /* add base DN label and text field
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel baseDNLabel = makeJLabel("BASEDN");
+ mBaseDNText = makeJTextField(30);
+ CMSAdminUtil.addEntryField(serverInfo, baseDNLabel, mBaseDNText, gbc);
+ */
+
+ // add bind as label and text field
+ CMSAdminUtil.resetGBC(gbc);
+ mBindAsLabel = makeJLabel("BINDAS");
+ mBindAsText = makeJTextField(30);
+ CMSAdminUtil.addEntryField(serverInfo, mBindAsLabel, mBindAsText, gbc);
+
+ // add password label and text field
+ CMSAdminUtil.resetGBC(gbc);
+ mPasswordLabel = makeJLabel("PWD");
+ mPasswordText = makeJPasswordField(20);
+ CMSAdminUtil.addEntryField(serverInfo, mPasswordLabel, mPasswordText, gbc);
+
+ // add LDAP version
+ CMSAdminUtil.resetGBC(gbc);
+ mVersionLabel = makeJLabel("VERSION");
+ mVersionBox = makeJComboBox("VERSION");
+ JLabel dummy = new JLabel(" ");
+ CMSAdminUtil.addEntryField(serverInfo, mVersionLabel, mVersionBox,
+ dummy, gbc);
+
+ // add cert nickname
+ CMSAdminUtil.resetGBC(gbc);
+ mCertLabel = makeJLabel("CERTLIST");
+ mCertBox = makeJComboBox("CERTLIST");
+ JLabel dummy3 = new JLabel(" ");
+ CMSAdminUtil.addEntryField(serverInfo, mCertLabel, mCertBox, dummy3, gbc);
+
+ // add combo box for authentication type
+ CMSAdminUtil.resetGBC(gbc);
+ mAuthLabel = makeJLabel("AUTHTYPE");
+ mAuthBox = makeJComboBox("AUTHTYPE");
+ mAuthBox.addItemListener(this);
+ JLabel dummy4 = new JLabel(" ");
+ CMSAdminUtil.addEntryField(serverInfo, mAuthLabel, mAuthBox, dummy4, gbc);
+ }
+
+ public void refresh() {
+ mModel.progressStart();
+ NameValuePairs nvps = new NameValuePairs();
+ if (mPublishing)
+ nvps.put(Constants.PR_PUBLISHING_ENABLE, "");
+ if (mLDAPPublishing)
+ nvps.put(Constants.PR_ENABLE, "");
+ nvps.put(Constants.PR_HOST_NAME, "");
+ nvps.put(Constants.PR_LDAP_PORT, "");
+ nvps.put(Constants.PR_SECURE_PORT_ENABLED, "");
+ //nvps.add(Constants.PR_BASE_DN, "");
+ nvps.put(Constants.PR_BIND_DN, "");
+ nvps.put(Constants.PR_LDAP_VERSION, "");
+ nvps.put(Constants.PR_AUTH_TYPE, "");
+ nvps.put(Constants.PR_CERT_NAMES, "");
+ nvps.put(Constants.PR_LDAP_CLIENT_CERT, "");
+
+ nvps.put(Constants.PR_PUBLISHING_QUEUE_ENABLE, "");
+ nvps.put(Constants.PR_PUBLISHING_QUEUE_THREADS, "");
+ nvps.put(Constants.PR_PUBLISHING_QUEUE_PAGE_SIZE, "");
+ nvps.put(Constants.PR_PUBLISHING_QUEUE_PRIORITY, "");
+ nvps.put(Constants.PR_PUBLISHING_QUEUE_STATUS, "");
+
+ try {
+ NameValuePairs val = mAdmin.read(mServletName,
+ ScopeDef.SC_LDAP, Constants.RS_ID_CONFIG, nvps);
+
+ populate(val);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ }
+ mModel.progressStop();
+ clearDirtyFlag();
+ mParent.setOKCancel();
+ }
+
+ protected String getServletName(String panelName) {
+ if (panelName.equals("LDAPSETTING"))
+ return DestDef.DEST_SERVER_ADMIN;
+ else if (panelName.equals("CALDAPSETTING"))
+ return DestDef.DEST_CA_PUBLISHER_ADMIN;
+ return DestDef.DEST_RA_PUBLISHER_ADMIN;
+ }
+
+ protected void populate(NameValuePairs nvps) {
+ String clientCert = "";
+ int serverCertIndex = -1;
+
+ String version = "";
+ for (String name : nvps.keySet()) {
+ String value = nvps.get(name);
+ if (name.equals(Constants.PR_HOST_NAME)) {
+ mHostNameText.setText(value);
+ } else if (name.equals(Constants.PR_LDAP_PORT)) {
+ mPortText.setText(value);
+ } else if (name.equals(Constants.PR_SECURE_PORT_ENABLED)) {
+ if (value.equals(Constants.TRUE))
+ mSecurePort.setSelected(true);
+ else
+ mSecurePort.setSelected(false);
+ } else if (name.equals(Constants.PR_BIND_DN)) {
+ mBindAsText.setText(value);
+ } else if (name.equals(Constants.PR_PUBLISHING_ENABLE)) {
+ if (value.equals(Constants.TRUE))
+ mEnablePublishing.setSelected(true);
+ else
+ mEnablePublishing.setSelected(false);
+ } else if (name.equals(Constants.PR_PUBLISHING_QUEUE_ENABLE)) {
+ if (value.equals(Constants.TRUE)) {
+ mEnableQueue.setSelected(true);
+ mPublishingQueue = true;
+ } else {
+ mEnableQueue.setSelected(false);
+ mPublishingQueue = false;
+ }
+ } else if (name.equals(Constants.PR_PUBLISHING_QUEUE_THREADS)) {
+ mMaxNumberOfPublishingThreads = value;
+ } else if (name.equals(Constants.PR_PUBLISHING_QUEUE_PAGE_SIZE)) {
+ mPublishingQueuePageSize = value;
+ } else if (name.equals(Constants.PR_PUBLISHING_QUEUE_PRIORITY)) {
+ mPublishingQueuePriorityLevel = value;
+ } else if (name.equals(Constants.PR_PUBLISHING_QUEUE_STATUS)) {
+ mPublishingQueueStatus = value;
+ } else if (name.equals(Constants.PR_ENABLE)) {
+ if (value.equals(Constants.TRUE))
+ mEnable.setSelected(true);
+ else
+ mEnable.setSelected(false);
+ } else if (name.equals(Constants.PR_AUTH_TYPE)) {
+ int index = getIndex(value, AUTHTYPE);
+ if (index >= 0)
+ mAuthBox.setSelectedIndex(index);
+ } else if (name.equals(Constants.PR_CERT_NAMES)) {
+ mCertBox.removeAllItems();
+ String certNames = value;
+ StringTokenizer tokenizer = new StringTokenizer(certNames,
+ DELIMITER);
+ for (int index=0; tokenizer.hasMoreTokens(); index++) {
+ String str = (String)tokenizer.nextToken();
+ if (str.startsWith(SERVER_CERT_NICKNAME))
+ serverCertIndex = index;
+ mCertBox.addItem(str);
+ }
+ } else if (name.equals(Constants.PR_LDAP_CLIENT_CERT)) {
+ clientCert = value;
+ } else if (name.equals(Constants.PR_LDAP_VERSION)) {
+ version = value;
+ }
+ }
+
+ if (version.equals(""))
+ mVersionBox.setSelectedIndex(1);
+ else
+ mVersionBox.setSelectedItem(version);
+
+ if (clientCert.equals("")) {
+ if (serverCertIndex == -1)
+ mCertBox.setSelectedIndex(0);
+ else
+ mCertBox.setSelectedIndex(serverCertIndex);
+ } else
+ mCertBox.setSelectedItem(clientCert.trim());
+
+ if (mEnablePublishing.isSelected())
+ {
+ enableFieldsAndLDAP(true, mActiveColor);
+ }
+ else
+ {
+ enableFieldsAndLDAP(false, getBackground());
+ }
+
+ if (mEnable.isSelected())
+ enableFields(true, mActiveColor);
+ else
+ enableFields(false, getBackground());
+
+ mPasswordText.setText("");
+ }
+
+ private int getIndex(String val, String[] array) {
+ for (int i=0; i<array.length; i++) {
+ if (val.equals(array[i]))
+ return i;
+ }
+ return -1;
+ }
+
+ private void enableFieldsAndLDAP(boolean enable, Color color) {
+ mEnable.setEnabled(enable);
+ mEnableQueue.setEnabled(enable);
+ if (!enable) {
+ mEnable.setSelected(false);
+ mEnableQueue.setSelected(false);
+ mPublishingQueue = false;
+ }
+ enableFields(enable, color);
+ }
+
+ private void enableFields(boolean enable, Color color) {
+ mHostNameText.setEnabled(enable);
+ mHostNameText.setEditable(enable);
+ mHostNameText.setBackground(color);
+ mPortText.setEnabled(enable);
+ mPortText.setEditable(enable);
+ mPortText.setBackground(color);
+ mPasswordText.setEnabled(enable);
+ mPasswordText.setEditable(enable);
+ mPasswordText.setBackground(color);
+ mSecurePort.setEnabled(enable);
+ mHostLabel.setEnabled(enable);
+ mPortLabel.setEnabled(enable);
+ mAuthBox.setEnabled(enable);
+ mAuthLabel.setEnabled(enable);
+ mVersionLabel.setEnabled(enable);
+ mVersionBox.setEnabled(enable);
+ mPasswordLabel.setEnabled(enable);
+ enableAuthFields(enable, color);
+ }
+
+ private void enableAuthFields(boolean enable, Color color) {
+ if (enable) {
+ if (mAuthBox.getSelectedIndex() == 0) {
+ mCertLabel.setEnabled(!enable);
+ mCertBox.setEnabled(!enable);
+ mBindAsText.setEnabled(enable);
+ mBindAsText.setEditable(enable);
+ mBindAsText.setBackground(color);
+ mBindAsLabel.setEnabled(enable);
+ mPasswordText.setEnabled(enable);
+ mPasswordText.setEditable(enable);
+ mPasswordText.setBackground(color);
+ mPasswordLabel.setEnabled(enable);
+ } else {
+ mCertLabel.setEnabled(enable);
+ mCertBox.setEnabled(enable);
+ mBindAsText.setEnabled(!enable);
+ mBindAsText.setEditable(!enable);
+ mBindAsText.setBackground(getBackground());
+ mBindAsLabel.setEnabled(!enable);
+ mPasswordText.setEnabled(!enable);
+ mPasswordText.setEditable(!enable);
+ mPasswordText.setBackground(getBackground());
+ mPasswordLabel.setEnabled(!enable);
+ }
+ } else {
+ mCertLabel.setEnabled(enable);
+ mCertBox.setEnabled(enable);
+ mBindAsText.setEnabled(enable);
+ mBindAsText.setEditable(enable);
+ mBindAsText.setBackground(color);
+ mBindAsLabel.setEnabled(enable);
+ mPasswordText.setEnabled(enable);
+ mPasswordText.setEditable(enable);
+ mPasswordText.setBackground(color);
+ mPasswordLabel.setEnabled(enable);
+ }
+ repaintComp(mHostLabel);
+ repaintComp(mPortLabel);
+ repaintComp(mSecurePort);
+ repaintComp(mBindAsLabel);
+ repaintComp(mCertLabel);
+ repaintComp(mAuthLabel);
+ repaintComp(mVersionLabel);
+ repaintComp(mPasswordText);
+ repaintComp(mPasswordLabel);
+ }
+
+ private void repaintComp(JComponent component) {
+ component.invalidate();
+ component.validate();
+ component.repaint(1);
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ super.actionPerformed(e);
+ if (mEnablePublishing.isSelected()) {
+ mEnable.setEnabled(true);
+ mEnableQueue.setEnabled(true);
+ enableFieldsAndLDAP(true, mActiveColor);
+ } else {
+ mEnable.setEnabled(false);
+ mEnableQueue.setEnabled(false);
+ enableFieldsAndLDAP(false, getBackground());
+ }
+ if (mLDAPPublishing) {
+ if (mEnable.isSelected()) {
+ enableFields(true, mActiveColor);
+ } else {
+ enableFields(false, getBackground());
+ }
+ }
+ }
+
+ public void itemStateChanged(ItemEvent e) {
+ super.itemStateChanged(e);
+ if (e.getSource().equals(mAuthBox)) {
+ int index = mAuthBox.getSelectedIndex();
+ if (index == 1) {
+ mSecurePort.setSelected(true);
+ }
+ enableFields(true, mActiveColor);
+ } else if (e.getSource().equals(mEnable)) {
+ if (mEnable.isSelected()) {
+ mEnableQueue.setSelected(true);
+ }
+ enableFields(true, mActiveColor);
+ }
+ }
+
+ /**
+ * Implementation for saving panel information
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean applyCallback() {
+ // check blank fields
+ NameValuePairs nvps = new NameValuePairs();
+
+ if (mPublishing) {
+ if (mEnablePublishing.isSelected())
+ nvps.put(Constants.PR_PUBLISHING_ENABLE, Constants.TRUE);
+ else
+ nvps.put(Constants.PR_PUBLISHING_ENABLE, Constants.FALSE);
+ }
+
+ if (mLDAPPublishing) {
+ if (mEnable.isSelected())
+ nvps.put(Constants.PR_ENABLE, Constants.TRUE);
+ else
+ nvps.put(Constants.PR_ENABLE, Constants.FALSE);
+ }
+
+ if (mEnableQueue.isSelected())
+ nvps.put(Constants.PR_PUBLISHING_QUEUE_ENABLE, Constants.TRUE);
+ else
+ nvps.put(Constants.PR_PUBLISHING_QUEUE_ENABLE, Constants.FALSE);
+ nvps.put(Constants.PR_PUBLISHING_QUEUE_THREADS, mMaxNumberOfPublishingThreads);
+ nvps.put(Constants.PR_PUBLISHING_QUEUE_PAGE_SIZE, mPublishingQueuePageSize);
+ nvps.put(Constants.PR_PUBLISHING_QUEUE_PRIORITY, mPublishingQueuePriorityLevel);
+ nvps.put(Constants.PR_PUBLISHING_QUEUE_STATUS, mPublishingQueueStatus);
+
+ if (mEnable.isSelected()) {
+ String host = mHostNameText.getText().trim();
+ String port = mPortText.getText().trim();
+ String bindAs = mBindAsText.getText().trim();
+ String passwd = null;
+
+ if (host.equals("") || port.equals("")) {
+ showMessageDialog("BLANKFIELD");
+ return false;
+ }
+
+ try {
+ int num = Integer.parseInt(port);
+ } catch (NumberFormatException e) {
+ showMessageDialog("NUMBERFORMAT");
+ return false;
+ }
+ nvps.put(Constants.PR_HOST_NAME, host);
+ nvps.put(Constants.PR_LDAP_PORT, port);
+
+ if (mSecurePort.isSelected())
+ nvps.put(Constants.PR_SECURE_PORT_ENABLED, Constants.TRUE);
+ else
+ nvps.put(Constants.PR_SECURE_PORT_ENABLED, Constants.FALSE);
+
+ if (mAuthBox.getSelectedIndex() == 0) {
+ if (mPanelName.equals("CALDAPSETTING")) {
+ nvps.put(Constants.PR_BINDPWD_PROMPT, "CA LDAP Publishing");
+ } else {
+ nvps.put(Constants.PR_BINDPWD_PROMPT, "RA LDAP Publishing");
+ }
+ nvps.put(Constants.PR_BIND_DN, bindAs);
+ passwd = mPasswordText.getText();
+
+ if (passwd.equals("")) {
+ showMessageDialog("EMPTYPASSWD");
+ return false;
+ }
+
+ nvps.put(Constants.PR_DIRECTORY_MANAGER_PWD, passwd);
+ } else {
+ nvps.put(Constants.PR_LDAP_CLIENT_CERT,
+ (String) (mCertBox.getSelectedItem()));
+ }
+
+ int index = mAuthBox.getSelectedIndex();
+ if (index == 1) {
+ if (!mSecurePort.isSelected()) {
+ showMessageDialog("SSLERROR");
+ return false;
+ }
+ }
+ nvps.put(Constants.PR_AUTH_TYPE, AUTHTYPE[index]);
+ nvps.put(Constants.PR_LDAP_VERSION,
+ (String) mVersionBox.getSelectedItem());
+
+ // test the connection before save
+ /*
+ LDAPConnection conn = null;
+ if (mAuthBox.getSelectedIndex() == 1) {
+ try {
+ conn = new LDAPConnection(new LdapJssSSLSocketFactory(
+ (String)(mCertBox.getSelectedItem())));
+ showMessageDialog("SSLOK");
+ } catch (LDAPException e ) {
+ showMessageDialog("SSLERROR");
+ }
+ try {
+ conn.connect((String)mVersionBox.getSelectedItem(),
+ host, port, null, null);
+ } catch (LDAPException e ) {
+ showMessageDialog("SSLERROR");
+ }
+ } else {
+ try {
+ if (mSecurePort.isSelected()) {
+ conn = new LDAPConnection(new
+ LdapJssSSLSocketFactory());
+ } else {
+ conn = new LDAPConnection();
+ }
+ showMessageDialog("SSLOK");
+ } catch (LDAPException e ) {
+ showMessageDialog("SSLERROR");
+ }
+ try {
+ conn.connect(host, port);
+ showMessageDialog("SSLOK");
+ } catch (LDAPException e ) {
+ showMessageDialog("SSLERROR");
+ }
+ try {
+ conn.authenticate((String)mVersionBox.getSelectedItem(),
+ bindAs, passwd);
+ showMessageDialog("SSLOK");
+ } catch (LDAPException e ) {
+ showMessageDialog("SSLERROR");
+ }
+ }
+ */
+
+ }
+
+ mModel.progressStart();
+ try {
+ NameValuePairs nvps1 = mAdmin.process(mServletName, ScopeDef.SC_LDAP,
+ Constants.RS_ID_CONFIG, nvps, false);
+ // show test report
+ String report = "";
+ for (String value : nvps1.values()) {
+ report = report + value + "\n";
+ }
+ if (report.indexOf("Fail") == -1) {
+ JOptionPane.showMessageDialog(
+ UtilConsoleGlobals.getActivatedFrame(),
+ CMSAdminUtil.wrapText(report,80),
+ "Configuration Successful",
+ JOptionPane.INFORMATION_MESSAGE,
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_INFO_ICON));
+ clearDirtyFlag();
+ } else {
+ int i = JOptionPane.showConfirmDialog(
+ UtilConsoleGlobals.getActivatedFrame(),
+ CMSAdminUtil.wrapText(report,80),
+ "Configuration Error", JOptionPane.YES_NO_OPTION,
+ JOptionPane.ERROR_MESSAGE,
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_ERROR_ICON));
+ if (i == JOptionPane.YES_OPTION) {
+ mAdmin.modify(mServletName, ScopeDef.SC_LDAP,
+ Constants.RS_ID_CONFIG, nvps, false);
+ clearDirtyFlag();
+ } else {
+ nvps.put(Constants.PR_ENABLE, "false");
+ mAdmin.modify(mServletName, ScopeDef.SC_LDAP,
+ Constants.RS_ID_CONFIG, nvps, false);
+ }
+ }
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ return false;
+ }
+
+ mModel.progressStop();
+ //clearDirtyFlag();
+ return true;
+ }
+
+ /**
+ * Implementation for reset values
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean resetCallback() {
+ refresh();
+ return true;
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSBaseLogPanel.java b/base/console/src/com/netscape/admin/certsrv/config/CMSBaseLogPanel.java
new file mode 100644
index 000000000..c0437cbc4
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSBaseLogPanel.java
@@ -0,0 +1,366 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.management.client.util.*;
+import com.netscape.admin.certsrv.connection.*;
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+
+/**
+ * Base Log Panel
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ */
+public abstract class CMSBaseLogPanel extends CMSBaseTab {
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ protected JCheckBox activateLog;
+
+ protected JComboBox mlogFQC, mLogLevel, mNTLogLevel;
+ protected JTextField mlogMaxSizText, mlogBufSizText, mEventSourceText;
+ protected Color mActiveColor;
+
+ protected Object mselectedItem;
+ protected String mlogMaxSizTextData, mlogBufSizTextData;
+ protected CMSBaseResourceModel mModel;
+ protected AdminConnection mAdmin;
+ protected int mLevel, mNTLevel;
+ protected int mFrequency;
+ protected String mSource;
+
+ protected JLabel mMaxLabel, mNTLogLevelLbl;
+ protected JLabel mBufferLabel, mEventSourceLbl;
+ protected JCheckBox mActivateNTLog;
+ protected boolean mIsNT;
+
+ protected final static int YEAR = 31536000;
+ protected final static int MONTH = 2592000;
+ protected final static int WEEK = 604800;
+ protected final static int DAY = 86400;
+ protected final static int HOUR = 3600;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSBaseLogPanel(String panelName, CMSTabPanel parent) {
+ super(panelName, parent);
+ mModel = parent.getResourceModel();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * Actual Instantiation of the UI components
+ */
+ public void init() {
+ mAdmin = mModel.getServerInfo().getAdmin();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ CMSAdminUtil.resetGBC(gbc);
+ mCenterPanel.setLayout(gb);
+
+ //=== Activate Radio Button ===
+ activateLog = makeJCheckBox("ACTIVATE");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0, COMPONENT_SPACE);
+ gb.setConstraints(activateLog, gbc);
+ mCenterPanel.add(activateLog);
+
+ // use a lined border later...titled for now
+ JPanel logInfo = new JPanel();
+ GridBagLayout gb1 = new GridBagLayout();
+ logInfo.setLayout(gb1);
+ logInfo.setBorder(makeTitledBorder("LOGATTRIBUTE"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ if (!mIsNT)
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(logInfo, gbc);
+ mCenterPanel.add(logInfo);
+
+ // Log Rotation Frequency
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel logFQC = makeJLabel("LOGFQC");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 0.0;
+ gbc.weighty = 0.0;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0, COMPONENT_SPACE);
+ logInfo.add(logFQC, gbc);
+
+ mlogFQC = makeJComboBox("LOGFQC");
+ gbc.anchor = gbc.WEST;
+ logInfo.add(mlogFQC, gbc);
+
+ JLabel dummyFQC = new JLabel();
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ logInfo.add(dummyFQC, gbc);
+
+ // Log File Maximum Size
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel logMaxSiz = makeJLabel("LOGMAXSIZ");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.weightx = 0.0;
+ gbc.weighty = 0.0;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0, COMPONENT_SPACE);
+ logInfo.add(logMaxSiz, gbc);
+
+ mlogMaxSizText = makeJTextField(10);
+ gbc.anchor = gbc.WEST;
+ gbc.weightx = 0.007;
+ gbc.fill = gbc.HORIZONTAL;
+ logInfo.add(mlogMaxSizText, gbc);
+ mActiveColor = mlogMaxSizText.getBackground();
+
+ mMaxLabel = makeJLabel("SIZEUNIT");
+ gbc.weightx = 0.0;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0, 0, COMPONENT_SPACE);
+ logInfo.add(mMaxLabel, gbc);
+
+ JLabel dummy = new JLabel(" ");
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.fill = gbc.HORIZONTAL;
+ logInfo.add(dummy, gbc);
+
+ // Log File Buffer Size
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel logBufSiz = makeJLabel("LOGBUFSIZ");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.weightx = 0.0;
+ gbc.weighty = 0.0;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0, COMPONENT_SPACE);
+ logInfo.add(logBufSiz, gbc);
+
+ mlogBufSizText = makeJTextField(10);
+ gbc.anchor = gbc.WEST;
+ gbc.weightx = 0.007;
+ gbc.fill = gbc.HORIZONTAL;
+ logInfo.add(mlogBufSizText, gbc);
+
+ mBufferLabel = makeJLabel("SIZEUNIT");
+ gbc.insets = new Insets(COMPONENT_SPACE, 0, 0, COMPONENT_SPACE);
+ gbc.weightx = 0.0;
+ gbc.fill = gbc.NONE;
+ logInfo.add(mBufferLabel, gbc);
+
+ JLabel dummy1 = new JLabel(" ");
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.fill = gbc.HORIZONTAL;
+ logInfo.add(dummy1, gbc);
+
+ // Log Level
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel logLevel = makeJLabel("LOGLEVEL");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.weightx = 0.0;
+ gbc.weighty = 0.0;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0, COMPONENT_SPACE);
+ logInfo.add(logLevel, gbc);
+
+ mLogLevel = makeJComboBox("LOGLEVEL");
+ gbc.anchor = gbc.WEST;
+ logInfo.add(mLogLevel, gbc);
+
+ JLabel dummy2 = new JLabel(" ");
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.fill = gbc.HORIZONTAL;
+ logInfo.add(dummy2, gbc);
+
+ if (mIsNT)
+ addNTEventLog();
+ }
+
+ private void addNTEventLog() {
+ GridBagConstraints gbc = new GridBagConstraints();
+ CMSAdminUtil.resetGBC(gbc);
+ mActivateNTLog = makeJCheckBox("ACTIVATENTLOG");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, 0, COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ mCenterPanel.add(mActivateNTLog, gbc);
+
+ JPanel NTLogInfo = new JPanel();
+ GridBagLayout gb1 = new GridBagLayout();
+ NTLogInfo.setLayout(gb1);
+ NTLogInfo.setBorder(makeTitledBorder("NTLOGATTRIBUTE"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ mCenterPanel.add(NTLogInfo, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mEventSourceLbl = makeJLabel("EVENTSOURCE");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.weightx = 0.0;
+ gbc.weighty = 0.0;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0, COMPONENT_SPACE);
+ NTLogInfo.add(mEventSourceLbl, gbc);
+
+ mEventSourceText = makeJTextField(10);
+ gbc.anchor = gbc.WEST;
+ gbc.weightx = 0.007;
+ gbc.fill = gbc.HORIZONTAL;
+ NTLogInfo.add(mEventSourceText, gbc);
+
+ JLabel dummy1 = new JLabel(" ");
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.fill = gbc.HORIZONTAL;
+ NTLogInfo.add(dummy1, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mNTLogLevelLbl = makeJLabel("LOGLEVEL");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.weightx = 0.0;
+ gbc.weighty = 0.0;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0, COMPONENT_SPACE);
+ NTLogInfo.add(mNTLogLevelLbl, gbc);
+
+ mNTLogLevel = makeJComboBox("LOGLEVEL");
+ gbc.anchor = gbc.WEST;
+ NTLogInfo.add(mNTLogLevel, gbc);
+
+ JLabel dummy2 = new JLabel(" ");
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.fill = gbc.HORIZONTAL;
+ NTLogInfo.add(dummy2, gbc);
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+
+ //enable/disable section
+ protected void setSection(boolean flag) {
+ mlogFQC.setEnabled(flag);
+ mLogLevel.setEnabled(flag);
+ mlogMaxSizText.setEditable(flag);
+ mlogBufSizText.setEditable(flag);
+ if (flag) {
+ mlogFQC.setBackground(mActiveColor);
+ mLogLevel.setBackground(mActiveColor);
+ mlogMaxSizText.setBackground(mActiveColor);
+ mlogBufSizText.setBackground(mActiveColor);
+ } else {
+ mLogLevel.setBackground(getBackground());
+ mlogFQC.setBackground(getBackground());
+ mlogMaxSizText.setBackground(getBackground());
+ mlogBufSizText.setBackground(getBackground());
+ }
+ mlogFQC.repaint();
+ mlogMaxSizText.repaint();
+ mlogBufSizText.repaint();
+ }
+
+ protected void setNTSection(boolean flag, Color color) {
+ mNTLogLevel.setEnabled(flag);
+ mEventSourceText.setEnabled(flag);
+ mEventSourceText.setEditable(flag);
+ mEventSourceText.setBackground(color);
+ CMSAdminUtil.repaintComp(mNTLogLevel);
+ CMSAdminUtil.repaintComp(mEventSourceText);
+ }
+
+ //update component data
+ protected void setValues() {
+ if (activateLog.isSelected()) {
+ setSection(true);
+ } else {
+ setSection(false);
+ }
+ mlogFQC.setSelectedIndex(mFrequency);
+ mlogMaxSizText.setText(mlogMaxSizTextData);
+ mlogBufSizText.setText(mlogBufSizTextData);
+ mLogLevel.setSelectedIndex(mLevel);
+
+ if (mIsNT) {
+ if (mActivateNTLog.isSelected()) {
+ setNTSection(true, mActiveColor);
+ } else {
+ setNTSection(false, getBackground());
+ }
+ mEventSourceText.setText(mSource);
+ mNTLogLevel.setSelectedIndex(mNTLevel);
+ }
+ }
+
+ protected int getRollOverTime(int index) {
+ if (index == 0)
+ return HOUR;
+ else if (index == 1)
+ return DAY;
+ else if (index == 2)
+ return WEEK;
+ else if (index == 3)
+ return MONTH;
+ return YEAR;
+ }
+
+ protected int getRollOverIndex(int val) {
+ if (val >= YEAR)
+ return 4;
+ else if (val >= MONTH)
+ return 3;
+ else if (val >= WEEK)
+ return 2;
+ else if (val >= DAY)
+ return 1;
+ return 0;
+ }
+
+ /*==========================================================
+ * EVENT HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent e) {
+ super.actionPerformed(e);
+ if (e.getSource().equals(activateLog) ||
+ e.getSource().equals(mActivateNTLog)) {
+ setValues();
+ }
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSBaseTab.java b/base/console/src/com/netscape/admin/certsrv/config/CMSBaseTab.java
new file mode 100644
index 000000000..c3c707f68
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSBaseTab.java
@@ -0,0 +1,95 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import javax.swing.border.*;
+import javax.swing.text.*;
+import java.util.*;
+import java.awt.*;
+import java.awt.event.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Netscape Certificate Server 4.0 Deafult Base TAB
+ * This class is the base class for all the TAB panels.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public abstract class CMSBaseTab extends CMSBaseConfigPanel
+ implements IRefreshTab {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ protected CMSTabPanel mParent;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSBaseTab(String panelName, CMSTabPanel parent) {
+ super(panelName);
+ mParent = parent;
+ add("Center", mCenterPanel);
+ }
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+
+ //set dirty flag
+ protected void setDirtyFlag() {
+ super.setDirtyFlag();
+ mParent.setDirtyTab(this);
+ }
+
+ //clear dirty flag
+ protected void clearDirtyFlag() {
+ super.clearDirtyFlag();
+ mParent.clearDirtyTab(this);
+ }
+
+ //=== OVERWRITE DIALOG MESSAGE =====================
+
+ protected void showMessageDialog(String keyword, int messageType ) {
+ CMSAdminUtil.showMessageDialog(mParent.mModel.getFrame(), mResource, mPanelName, keyword, messageType);
+ }
+
+ protected void showMessageDialog(String keyword) {
+ showMessageDialog(keyword, ERROR_MESSAGE);
+ }
+
+ protected int showConfirmDialog(String keyword, int messageType ) {
+ return CMSAdminUtil.showConfirmDialog(mParent.mModel.getFrame(), mResource, mPanelName, keyword, messageType);
+ }
+
+ protected int showConfirmDialog(String keyword) {
+ return showConfirmDialog(keyword, WARNING_MESSAGE);
+ }
+
+ protected void showErrorDialog(String message) {
+ CMSAdminUtil.showErrorDialog(mParent.mModel.getFrame(), mResource, message, ERROR_MESSAGE);
+ }
+
+ public void refresh() {
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSBlankPanel.java b/base/console/src/com/netscape/admin/certsrv/config/CMSBlankPanel.java
new file mode 100644
index 000000000..b3f357564
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSBlankPanel.java
@@ -0,0 +1,82 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.management.client.*;
+import com.netscape.admin.certsrv.*;
+
+/**
+ * Blank Panel to be displayed at the right hand side
+ * we should place some ads here... =-)
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class CMSBlankPanel extends CMSBaseTab {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static String PANEL_NAME = "CMSBLANKPANEL";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSBlankPanel(ResourceModel model) {
+ super(PANEL_NAME, null);
+ }
+
+ public CMSBlankPanel(ResourceModel model, CMSTabPanel parent, String name) {
+ super(PANEL_NAME, parent);
+ setTitle(name);
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * Actual Instanciation of the UI components
+ */
+ public void init() {
+ }
+
+ /**
+ * Implementation for saving panel information
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean applyCallback() {
+ return true;
+ }
+
+ /**
+ * Implementation for reset values
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean resetCallback() {
+ return true;
+ }
+
+ /**
+ * Implementation for calling help
+ */
+ public void helpCallback() {
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSCACertSettingPanel.java b/base/console/src/com/netscape/admin/certsrv/config/CMSCACertSettingPanel.java
new file mode 100644
index 000000000..76aa59511
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSCACertSettingPanel.java
@@ -0,0 +1,171 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.*;
+
+import java.awt.event.*;
+
+/**
+ * CA Certificate Setting
+ *
+ * @author Christine Ho
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public class CMSCACertSettingPanel extends CMSCertSettingPanel {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static String PANEL_NAME = "CACERTSETTING";
+ private PanelMapperConfigDialog mDialog = null;
+ private CMSTabPanel mParent;
+ private static final String HELPINDEX =
+ "configuration-ca-ldappublish-cacert-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSCACertSettingPanel(CMSTabPanel parent) {
+ super(PANEL_NAME, parent);
+ mParent = parent;
+ mHelpToken = HELPINDEX;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * Actual UI construction
+ */
+ public void init() {
+ super.init();
+
+ //XXX B1 - disable the publisher configuration
+ mPublisher.setEnabled(false);
+ //XXX B1 - disable the publisher configuration
+
+ refresh();
+ }
+
+ public void refresh() {
+ _model.progressStart();
+ NameValuePairs nvp = new NameValuePairs();
+ nvp.put(Constants.PR_MAPPER, "");
+ nvp.put(Constants.PR_PUBLISHER, "");
+
+ try {
+ NameValuePairs val = _admin.read(DestDef.DEST_CA_ADMIN,
+ ScopeDef.SC_CACERT, Constants.RS_ID_CONFIG, nvp);
+
+ populate(val);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ _model.progressStop();
+ }
+ _model.progressStop();
+ clearDirtyFlag();
+ mParent.setOKCancel();
+ }
+
+
+ /**
+ * Implementation for saving panel information
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean applyCallback() {
+ clearDirtyFlag();
+ return true;
+ }
+
+ /**
+ * Implementation for reset values
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean resetCallback() {
+ refresh();
+ return true;
+ }
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mMapper)) {
+ Debug.println("Edit Mapper Config");
+ mDialog = new PanelMapperConfigDialog(_model.getFrame(), _admin);
+ mDialog.showDialog(_mapper.getText(),
+ DestDef.DEST_CA_ADMIN, ScopeDef.SC_CACERT);
+ if (!mDialog.isOK())
+ return;
+ refresh();
+ } else if (e.getSource().equals(mPublisher)) {
+ //Debug.println("Edit Publisher Config");
+ }
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+
+ /* get config parameters associated with each mapper
+ private NameValueParis getConfig() throws EAdminException {
+
+ NameValuePairs response = _admin.read(DestDef.DEST_CA_ADMIN,
+ ScopeDef.SC_CAMAPPER, _mapper.getText()],
+ new NameValuePairs());
+ return response;
+ }
+ */
+
+ /*send configuration to server
+ private void sendConfig(NameValuePairs response) {
+
+ response.add(Constants.PR_MAPPER, MAPPER[_mapper.getSelectedIndex()]);
+ _model.progressStart();
+ try {
+ _admin.modify(DestDef.DEST_CA_ADMIN,
+ ScopeDef.SC_CACERT, Constants.RS_ID_CONFIG, response);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ _model.progressStop();
+ return false;
+ }
+ _model.progressStop();
+
+ }
+ */
+
+ private void populate(NameValuePairs nvps) {
+ for (String name : nvps.keySet()) {
+ String value = nvps.get(name);
+ if (name.equals(Constants.PR_MAPPER)) {
+ _mapper.setText(value);
+ } else if (name.equals(Constants.PR_PUBLISHER)) {
+ _publisher.setText(value);
+ }
+ }
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSCAConnectorPanel.java b/base/console/src/com/netscape/admin/certsrv/config/CMSCAConnectorPanel.java
new file mode 100644
index 000000000..1af02a881
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSCAConnectorPanel.java
@@ -0,0 +1,237 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.*;
+
+/**
+ * CA Connector Panel
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ */
+public class CMSCAConnectorPanel extends CMSBaseTab
+ implements MouseListener
+{
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+
+ private final static String PANEL_NAME = "CACONNECTOR";
+ private final static String HELPINDEX = "configuration-ca-connector-help";
+
+ private AdminConnection mAdmin;
+ private CMSBaseResourceModel mModel;
+ private CMSTabPanel mParent;
+ private JList mList;
+ private DefaultListModel mDataModel;
+ private JScrollPane mScrollPane;
+ private JButton mEdit;
+ protected boolean mInit = false;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSCAConnectorPanel(CMSBaseResourceModel model, CMSTabPanel parent) {
+ super(PANEL_NAME, parent);
+ mModel = model;
+ mParent = parent;
+ mDataModel = new DefaultListModel();
+ mHelpToken = HELPINDEX;
+
+ // hardcoded just for beta 1
+ mDataModel.addElement("Data Recovery Manager Connector");
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * initialize the UI components
+ */
+ public void init() {
+// setLayout(new BorderLayout());
+
+ // JPanel mainPanel = new JPanel();
+ JPanel mainPanel = mCenterPanel;
+
+
+ Debug.println("ConnectorPanel: init()");
+ mAdmin = mModel.getServerInfo().getAdmin();
+
+ GridBagLayout gb1 = new GridBagLayout();
+ mainPanel.setLayout(gb1);
+
+ GridBagConstraints gbc = new GridBagConstraints();
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel listLabel = makeJLabel("CONNLIST");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(DIFFERENT_COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,
+ 0,DIFFERENT_COMPONENT_SPACE);
+ gb1.setConstraints(listLabel, gbc);
+ mainPanel.add(listLabel);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mList = makeJList(mDataModel, 3);
+ mScrollPane = new JScrollPane(mList,
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mList.addMouseListener(this);
+ mScrollPane.setBackground(Color.white);
+ mScrollPane.setBorder(BorderFactory.createLoweredBevelBorder());
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 0.5;
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,
+ 0,DIFFERENT_COMPONENT_SPACE);
+ gb1.setConstraints(mScrollPane, gbc);
+ mainPanel.add(mScrollPane);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mEdit = makeJButton("EDIT");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ gbc.weightx = 0.5;
+ gbc.insets = new Insets(COMPONENT_SPACE,0,
+ 0,DIFFERENT_COMPONENT_SPACE);
+ gb1.setConstraints(mEdit, gbc);
+ mainPanel.add(mEdit);
+
+ // add("Center",mainPanel);
+ refresh();
+ }
+
+ /**
+ * refresh the panel data
+ */
+ public void refresh() {
+ repaint(1);
+ }
+
+ /*==========================================================
+ * Event Handler
+ *==========================================================*/
+
+ //======= ActionLister ============================
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mEdit)) {
+ JFrame frame = mModel.getFrame();
+ String name = (String)mList.getSelectedValue();
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_ID, "");
+ nvps.put(Constants.PR_HOST, "");
+ nvps.put(Constants.PR_PORT, "");
+ // Inserted by beomsuk
+ nvps.put(Constants.PR_TIMEOUT, "");
+ // Insert end
+ nvps.put(Constants.PR_URI, "");
+ nvps.put(Constants.PR_LOCAL, "");
+ nvps.put(Constants.PR_ENABLE, "");
+
+ try {
+ NameValuePairs values = mAdmin.read(DestDef.DEST_CA_ADMIN,
+ ScopeDef.SC_CONNECTOR, name, nvps);
+ NameValuePairs subsystems = mAdmin.search(DestDef.DEST_SERVER_ADMIN,
+ ScopeDef.SC_SUBSYSTEM, new NameValuePairs());
+
+ boolean colocated = false;
+ if (name.equals("Data Recovery Manager Connector")) {
+ String val = values.get("id");
+ if (val != null && val.equals("kra"))
+ colocated = true;
+ }
+
+ ConnectorEditor editor = new ConnectorEditor(mAdmin,
+ mModel.getFrame(), name, DestDef.DEST_CA_ADMIN,
+ mModel.getServerInfo().getServerId(), colocated);
+ editor.showDialog(values);
+ } catch (EAdminException ex) {
+ showErrorDialog(ex.toString());
+ }
+/*
+ NameValuePairs values = new NameValuePairs();
+ ConnectorEditor editor = new ConnectorEditor(mAdmin,
+ mModel.getFrame(), name);
+ editor.showDialog(values);
+*/
+ }
+ }
+
+ //=== MOUSELISTENER ========================
+ public void mouseClicked(MouseEvent e) {
+ if (e.getSource() == mList) {
+ if (mList.getSelectedIndex() < 0)
+ mEdit.setEnabled(false);
+ else
+ mEdit.setEnabled(true);
+ }
+ }
+
+ public void mousePressed(MouseEvent e) {}
+ public void mouseReleased(MouseEvent e) {}
+ public void mouseEntered(MouseEvent e) {}
+ public void mouseExited(MouseEvent e) {}
+
+ //======== CMSBaseConfigPanel ==============
+ public boolean applyCallback() {
+ return true;
+ }
+
+ /**
+ * Implementation for reset values
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean resetCallback() {
+ refresh();
+ return true;
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+
+ //update the UI component using the data retrieved
+ private void populate(NameValuePairs nvps) {
+/*
+ Enumeration names = nvps.getNames();
+ mDataModel.removeAllElements();
+ while (names.hasMoreElements())
+ mDataModel.addElement(names.nextElement());
+
+ if (mDataModel.size() > 0) {
+ mList.setSelectedIndex(0);
+ mEdit.setEnabled(true);
+ } else
+ mEdit.setEnabled(false);
+*/
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSCAGeneralPanel.java b/base/console/src/com/netscape/admin/certsrv/config/CMSCAGeneralPanel.java
new file mode 100644
index 000000000..6f809316a
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSCAGeneralPanel.java
@@ -0,0 +1,424 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import java.math.*;
+
+/**
+ * RA General Setting
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ */
+public class CMSCAGeneralPanel extends CMSBaseTab implements ItemListener {
+
+ private static String PANEL_NAME = "CAGENERAL";
+ private static CMSBaseResourceModel mModel;
+ protected AdminConnection mAdmin;
+ private JCheckBox mRAEnable;
+ private JCheckBox mEEEnable;
+ private JCheckBox mOCSPEnable;
+ private CMSTabPanel mParent;
+ private JComboBox mGroups;
+ private JComboBox mAlgorithms;
+ private JTextField mSerialNumber;
+ private JTextField mMaxSerialNumber;
+ private JCheckBox mValidity;
+ private Vector mGroupData;
+ private static final String HELPINDEX =
+ "configuration-ca-general-help";
+
+ public CMSCAGeneralPanel(CMSTabPanel parent) {
+ super(PANEL_NAME, parent);
+ mModel = parent.getResourceModel();
+ mParent = parent;
+ mHelpToken = HELPINDEX;
+ }
+
+ public void init() {
+ Debug.println("CMSCAGeneral: init()");
+ mAdmin = mModel.getServerInfo().getAdmin();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ CMSAdminUtil.resetGBC(gbc);
+ mCenterPanel.setLayout(gb);
+
+ JPanel adminPanel = new JPanel();
+ GridBagLayout gb1 = new GridBagLayout();
+ adminPanel.setLayout(gb1);
+ adminPanel.setBorder(makeTitledBorder("INTERACTION"));
+
+ JPanel signingPanel = new JPanel();
+ GridBagLayout gb2 = new GridBagLayout();
+ signingPanel.setLayout(gb2);
+ signingPanel.setBorder(makeTitledBorder("SIGNING"));
+
+ JPanel serialPanel = new JPanel();
+ GridBagLayout gb3 = new GridBagLayout();
+ serialPanel.setLayout(gb3);
+ serialPanel.setBorder(makeTitledBorder("SERIAL"));
+
+ JPanel validityPanel = new JPanel();
+ GridBagLayout gb4 = new GridBagLayout();
+ validityPanel.setLayout(gb4);
+ validityPanel.setBorder(makeTitledBorder("VALIDITY"));
+
+ CMSAdminUtil.resetGBC(gbc);
+ mCenterPanel.setLayout(gb);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ //gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ //gbc.weighty = 1.0;
+ gb.setConstraints(adminPanel, gbc);
+ // mCenterPanel.add(adminPanel);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints(validityPanel, gbc);
+ mCenterPanel.add(validityPanel);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints(serialPanel, gbc);
+ mCenterPanel.add(serialPanel);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(signingPanel, gbc);
+ mCenterPanel.add(signingPanel);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mEEEnable = makeJCheckBox("EE");
+ gbc.anchor = gbc.NORTHWEST;
+ // gbc.gridwidth = gbc.REMAINDER;
+ // gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb1.setConstraints(mEEEnable, gbc);
+ adminPanel.add(mEEEnable);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mOCSPEnable = makeJCheckBox("OCSP");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb1.setConstraints(mOCSPEnable, gbc);
+ adminPanel.add(mOCSPEnable);
+
+ // add validity block
+ CMSAdminUtil.resetGBC(gbc);
+ mValidity = makeJCheckBox("VALIDITY");
+ gbc.anchor = gbc.CENTER;
+ //gbc.gridwidth = gbc.REMAINDER;
+ //gbc.gridheight = gbc.REMAINDER;
+ //gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb4.setConstraints(mValidity, gbc);
+ validityPanel.add(mValidity);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel dummy4 = new JLabel(" ");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb4.setConstraints(dummy4, gbc);
+ validityPanel.add(dummy4);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel signingLabel = makeJLabel("ALGORITHM");
+ gbc.anchor = gbc.CENTER;
+ gb2.setConstraints(signingLabel, gbc);
+ gbc.weighty = 1.0;
+ signingPanel.add(signingLabel);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mAlgorithms = new JComboBox();
+ mAlgorithms.addItemListener(this);
+ //mAlgorithms = makeJComboBox("ALGORITHM");
+ gbc.anchor = gbc.NORTHWEST;
+ //gbc.gridwidth = gbc.REMAINDER;
+ //gbc.gridheight = gbc.REMAINDER;
+ //gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb2.setConstraints(mAlgorithms, gbc);
+ signingPanel.add(mAlgorithms);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel dummy1 = new JLabel(" ");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb2.setConstraints(dummy1, gbc);
+ signingPanel.add(dummy1);
+
+ // add serial number block
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel serialLabel = makeJLabel("SERIAL");
+ gbc.anchor = gbc.CENTER;
+ gb3.setConstraints(serialLabel, gbc);
+ gbc.weighty = 1.0;
+ //gbc.insets = new Insets(COMPONENT_SPACE,0,COMPONENT_SPACE,0);
+ serialPanel.add(serialLabel);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mSerialNumber = makeJTextField(17);
+ mSerialNumber.setEnabled(false);
+ gbc.anchor = gbc.NORTHWEST;
+ //gbc.gridwidth = gbc.REMAINDER;
+ //gbc.gridheight = gbc.REMAINDER;
+ //gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb3.setConstraints(mSerialNumber, gbc);
+ serialPanel.add(mSerialNumber);
+
+ // add end serial number block
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel maxSerialLabel = makeJLabel("MAXSERIAL");
+ gbc.anchor = gbc.EAST;
+ //gbc.insets = new Insets(COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,0,0);
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.gridx = 0;
+ gb3.setConstraints(maxSerialLabel, gbc);
+ //gbc.weighty = 1.0;
+ serialPanel.add(maxSerialLabel);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mMaxSerialNumber = makeJTextField(17);
+ mMaxSerialNumber.setEnabled(false);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridy = 1;
+ //gbc.gridwidth = gbc.REMAINDER;
+ //gbc.gridheight = gbc.REMAINDER;
+ //gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb3.setConstraints(mMaxSerialNumber, gbc);
+ serialPanel.add(mMaxSerialNumber);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel dummy2 = new JLabel(" ");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb3.setConstraints(dummy2, gbc);
+ serialPanel.add(dummy2);
+
+ refresh();
+ }
+
+ public void refresh() {
+ mModel.progressStart();
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_EE_ENABLED, "");
+ //nvps.add(Constants.PR_RA_ENABLED, "");
+ nvps.put(Constants.PR_DEFAULT_ALGORITHM, "");
+ nvps.put(Constants.PR_ALL_ALGORITHMS, "");
+ nvps.put(Constants.PR_SERIAL, "");
+ nvps.put(Constants.PR_MAXSERIAL, "");
+ nvps.put(Constants.PR_VALIDITY, "");
+
+ try {
+ NameValuePairs val = mAdmin.read(DestDef.DEST_CA_ADMIN,
+ ScopeDef.SC_GENERAL, Constants.RS_ID_CONFIG, nvps);
+
+ populate(val);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ }
+ mModel.progressStop();
+ clearDirtyFlag();
+ }
+
+ protected void populate(NameValuePairs nvps) {
+ String defaultAlgorithm = "";
+ for (String name : nvps.keySet()) {
+ String value = nvps.get(name);
+ if (name.equals(Constants.PR_EE_ENABLED)) {
+ mEEEnable.setSelected(getBoolean(value));
+ } else if (name.equals(Constants.PR_OCSP_ENABLED)) {
+ mOCSPEnable.setSelected(getBoolean(value));
+/*
+ } else if (name.equals(Constants.PR_RA_ENABLED)) {
+ mRAEnable.setSelected(getBoolean(nvp.getValue()));
+*/
+ } else if (name.equals(Constants.PR_VALIDITY)) {
+ mValidity.setSelected(getBoolean(value));
+ } else if (name.equals(Constants.PR_DEFAULT_ALGORITHM)) {
+ defaultAlgorithm = value;
+ } else if (name.equals(Constants.PR_ALL_ALGORITHMS)) {
+ initAlgorithmBox(value);
+ } else if (name.equals(Constants.PR_SERIAL)) {
+ String serial = value;
+ if (!serial.equals(""))
+ mSerialNumber.setText(serial);
+ else
+ mSerialNumber.setText("All serial numbers are used");
+ } else if (name.equals(Constants.PR_MAXSERIAL)) {
+ String serial = value;
+ if (!serial.equals(""))
+ mMaxSerialNumber.setText(serial);
+ }
+ }
+
+ mAlgorithms.setSelectedItem(defaultAlgorithm);
+ }
+
+ private void initAlgorithmBox(String val) {
+ if (mAlgorithms.getItemCount() >= 0) {
+ mAlgorithms.removeAllItems();
+ }
+ StringTokenizer tokenizer = new StringTokenizer(val, ":");
+ while (tokenizer.hasMoreTokens()) {
+ mAlgorithms.addItem(tokenizer.nextToken());
+ }
+ }
+
+ private boolean getBoolean(String str) {
+ if (str.equals(Constants.TRUE))
+ return true;
+ return false;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ super.actionPerformed(e);
+ }
+
+ private String hexToDecimal(String hex)
+ {
+ //String newHex = hex.substring(2);
+ BigInteger bi = new BigInteger(hex, 16);
+ return bi.toString();
+ }
+
+ /**
+ * Implementation for saving panel information
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean applyCallback() {
+ NameValuePairs nvps = new NameValuePairs();
+
+ if (mEEEnable.isSelected())
+ nvps.put(Constants.PR_EE_ENABLED, Constants.TRUE);
+ else
+ nvps.put(Constants.PR_EE_ENABLED, Constants.FALSE);
+
+ if (mOCSPEnable.isSelected())
+ nvps.put(Constants.PR_OCSP_ENABLED, Constants.TRUE);
+ else
+ nvps.put(Constants.PR_OCSP_ENABLED, Constants.FALSE);
+
+/*
+ if (mRAEnable.isSelected())
+ nvps.add(Constants.PR_RA_ENABLED, Constants.TRUE);
+ else
+ nvps.add(Constants.PR_RA_ENABLED, Constants.FALSE);
+*/
+
+ if (mValidity.isSelected())
+ nvps.put(Constants.PR_VALIDITY, Constants.TRUE);
+ else
+ nvps.put(Constants.PR_VALIDITY, Constants.FALSE);
+
+ nvps.put(Constants.PR_DEFAULT_ALGORITHM,
+ (String) mAlgorithms.getSelectedItem());
+
+ String serial = (String)mSerialNumber.getText().trim();
+ try {
+ //if (serial.startsWith("0x")) {
+ serial = hexToDecimal(serial);
+ //}
+ BigInteger num = new BigInteger(serial);
+ if (num.compareTo(new BigInteger("0")) < 0) {
+ showMessageDialog("OUTOFRANGE");
+ return false;
+ }
+ } catch (NumberFormatException e) {
+ showMessageDialog("NUMBERFORMAT");
+ return false;
+ }
+// nvps.add(Constants.PR_SERIAL, serial);
+
+ String maxserial =
+ (String)mMaxSerialNumber.getText().trim();
+ if (maxserial != null && !maxserial.equals("")) {
+ try {
+ //if (serial.startsWith("0x")) {
+ String maxserialdec = hexToDecimal(maxserial);
+ //}
+ BigInteger num = new BigInteger(maxserialdec);
+ if (num.compareTo(new BigInteger("0")) < 0) {
+ showMessageDialog("OUTOFRANGE");
+ return false;
+ }
+ } catch (NumberFormatException e) {
+ showMessageDialog("NUMBERFORMAT");
+ return false;
+ }
+// nvps.add(Constants.PR_MAXSERIAL, maxserial);
+ }
+
+ mModel.progressStart();
+ try {
+ mAdmin.modify(DestDef.DEST_CA_ADMIN,
+ ScopeDef.SC_GENERAL, Constants.RS_ID_CONFIG, nvps);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ return false;
+ }
+ mModel.progressStop();
+ clearDirtyFlag();
+ mParent.setOKCancel();
+ return true;
+ }
+
+ /**
+ * Implementation for reset values
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean resetCallback() {
+ refresh();
+ return true;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSCALDAPPanel.java b/base/console/src/com/netscape/admin/certsrv/config/CMSCALDAPPanel.java
new file mode 100644
index 000000000..735818834
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSCALDAPPanel.java
@@ -0,0 +1,44 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.management.client.util.*;
+
+/**
+ * LDAP server setting tab
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ */
+public class CMSCALDAPPanel extends CMSBaseLDAPPanel {
+
+ private static String PANEL_NAME = "CALDAPSETTING";
+ private static final String HELPINDEX =
+ "configuration-ca-ldappublish-destination-help";
+
+ public CMSCALDAPPanel(CMSTabPanel parent) {
+ super(PANEL_NAME, parent);
+ mHelpToken = HELPINDEX;
+ }
+
+ public void init() {
+ super.init();
+ refresh();
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSCRLCachePanel.java b/base/console/src/com/netscape/admin/certsrv/config/CMSCRLCachePanel.java
new file mode 100644
index 000000000..51da9c58c
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSCRLCachePanel.java
@@ -0,0 +1,371 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.*;
+
+/**
+ * Panel Setting CRL Cache
+ *
+ * @author Andrew Wnuk
+ * @version $Revision$, $Date$
+ */
+public class CMSCRLCachePanel extends CMSBaseTab {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static String PANEL_NAME = "CRLCACHE";
+
+ private JCheckBox mEnableCache;
+
+ private JLabel mCacheFreqLabel;
+ private JTextField mCacheFreq;
+ private JLabel mCacheFreqMinLabel;
+
+ private JLabel mEnableCacheRecoveryLabel;
+ private JCheckBox mEnableCacheRecovery;
+
+ private JLabel mEnableCacheTestingLabel;
+ private JCheckBox mEnableCacheTesting;
+
+ private Color mActiveColor;
+ private AdminConnection _admin;
+ private CMSBaseResourceModel _model;
+ private CMSTabPanel mParent;
+ private String mId = null;
+ private static final String HELPINDEX =
+ "configuration-ca-ldappublish-crl-help";
+ private CMSCRLFormatPanel mCRLFormatPanel = null;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSCRLCachePanel(CMSTabPanel parent) {
+ super(PANEL_NAME, parent);
+ _model = parent.getResourceModel();
+ mParent = parent;
+ mHelpToken = HELPINDEX;
+ }
+
+ public CMSCRLCachePanel(CMSTabPanel parent, String id) {
+ super(PANEL_NAME, parent);
+ _model = parent.getResourceModel();
+ mParent = parent;
+ mHelpToken = HELPINDEX;
+ mId = id;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public void init() {
+ Debug.println("CRLCachePanel: init()");
+ _admin = _model.getServerInfo().getAdmin();
+
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mCenterPanel.setLayout(gb);
+
+
+ //cache panel
+ JPanel cachePanel = new JPanel();
+ cachePanel.setBorder(makeTitledBorder("CACHE"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(cachePanel, gbc);
+ mCenterPanel.add(cachePanel);
+
+ GridBagLayout gb3 = new GridBagLayout();
+ cachePanel.setLayout(gb3);
+
+
+ // enable cache
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel enableCacheLabel = makeJLabel("CACHE");
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.gridx = 0;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.insets = new Insets(COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,0,0);
+ cachePanel.add(enableCacheLabel, gbc);
+
+ mEnableCache = makeJCheckBox();
+ gbc.anchor = gbc.WEST;
+ gbc.gridx++;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0,COMPONENT_SPACE);
+ cachePanel.add(mEnableCache, gbc);
+
+
+ // how often to save cache
+ CMSAdminUtil.resetGBC(gbc);
+ mCacheFreqLabel = makeJLabel("INTERVAL");
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.gridx = 0;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.insets = new Insets(COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,0,0);
+ cachePanel.add(mCacheFreqLabel, gbc);
+
+ mCacheFreq = makeJTextField(5);
+ gbc.anchor = gbc.WEST;
+ gbc.gridx++;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0,0);
+ cachePanel.add(mCacheFreq, gbc);
+ mActiveColor = mCacheFreq.getBackground();
+
+ mCacheFreqMinLabel = makeJLabel("MINUTES");
+ gbc.anchor = gbc.WEST;
+ gbc.gridx++;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0,COMPONENT_SPACE);
+ cachePanel.add(mCacheFreqMinLabel, gbc);
+
+
+ // enable cache recovery
+ CMSAdminUtil.resetGBC(gbc);
+ mEnableCacheRecoveryLabel = makeJLabel("RECOVERY");
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.gridx = 0;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.insets = new Insets(COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,0,0);
+ cachePanel.add(mEnableCacheRecoveryLabel, gbc );
+
+ mEnableCacheRecovery = makeJCheckBox();
+ gbc.anchor = gbc.WEST;
+ gbc.gridx++;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0,COMPONENT_SPACE);
+ cachePanel.add(mEnableCacheRecovery, gbc);
+
+ // enable cache testing
+ CMSAdminUtil.resetGBC(gbc);
+ mEnableCacheTestingLabel = makeJLabel("TEST");
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.gridx = 0;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.insets = new Insets(COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,0,0);
+ cachePanel.add(mEnableCacheTestingLabel, gbc );
+
+ mEnableCacheTesting = makeJCheckBox();
+ gbc.anchor = gbc.WEST;
+ gbc.gridx++;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0,COMPONENT_SPACE);
+ cachePanel.add(mEnableCacheTesting, gbc);
+
+ int nTabs = mParent.mTabbedPane.getTabCount();
+ for (int i = 0; i < nTabs; i++) {
+ Object p = mParent.mTabbedPane.getComponentAt(i);
+ if (p instanceof CMSCRLFormatPanel) {
+ mCRLFormatPanel = (CMSCRLFormatPanel)p;
+ }
+ }
+
+ refresh();
+ }
+
+ public void refresh() {
+ _model.progressStart();
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_ENABLE_CACHE, "");
+ nvps.put(Constants.PR_CACHE_FREQ, "");
+ nvps.put(Constants.PR_CACHE_RECOVERY, "");
+ nvps.put(Constants.PR_CACHE_TESTING, "");
+
+ try {
+ NameValuePairs val = null;
+ if (mId != null && mId.length() > 0) {
+ val = _admin.read(DestDef.DEST_CA_ADMIN, ScopeDef.SC_CRL,
+ mId, nvps);
+ } else {
+ val = _admin.read(DestDef.DEST_CA_ADMIN, ScopeDef.SC_CRL,
+ Constants.RS_ID_CONFIG, nvps);
+ }
+
+ populate(val);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ _model.progressStop();
+ }
+ _model.progressStop();
+ clearDirtyFlag();
+ mParent.setOKCancel();
+ enableFields();
+ }
+
+ public void populate(NameValuePairs nvps) {
+ String signingAlg = "";
+ for (String name : nvps.keySet()) {
+ String value = nvps.get(name).trim();
+ if (name.equals(Constants.PR_ENABLE_CACHE)) {
+ mEnableCache.setSelected(getBoolean(value, true));
+ } else if (name.equals(Constants.PR_CACHE_FREQ)) {
+ mCacheFreq.setText(value);
+ } else if (name.equals(Constants.PR_CACHE_RECOVERY)) {
+ mEnableCacheRecovery.setSelected(getBoolean(value));
+ } else if (name.equals(Constants.PR_CACHE_TESTING)) {
+ mEnableCacheTesting.setSelected(getBoolean(value));
+ }
+ }
+ }
+
+ public boolean getBoolean(String val) {
+ if (val.equals(Constants.TRUE))
+ return true;
+ return false;
+ }
+
+ public boolean getBoolean(String val, boolean defaultValue) {
+ if (val.equals(Constants.TRUE))
+ return true;
+ else if (val.equals(Constants.FALSE))
+ return false;
+ else
+ return defaultValue;
+ }
+
+ /**
+ * Implementation for saving panel information
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean applyCallback() {
+ String cacheFreq = "";
+ int iCacheFreq = 0;
+
+ NameValuePairs nvps = new NameValuePairs();
+
+
+ if (mEnableCache.isSelected())
+ nvps.put(Constants.PR_ENABLE_CACHE, Constants.TRUE);
+ else
+ nvps.put(Constants.PR_ENABLE_CACHE, Constants.FALSE);
+
+ cacheFreq = mCacheFreq.getText().trim();
+ if (cacheFreq.equals("")) {
+ showMessageDialog("BLANKFIELD");
+ return false;
+ }
+ try {
+ iCacheFreq = Integer.parseInt(cacheFreq);
+ } catch (NumberFormatException e) {
+ showMessageDialog("NUMBERFORMAT");
+ return false;
+ }
+ if (iCacheFreq < 0) {
+ showMessageDialog("NUMBERFORMAT");
+ return false;
+ }
+ nvps.put(Constants.PR_CACHE_FREQ, cacheFreq);
+
+
+ if (mEnableCacheRecovery.isSelected())
+ nvps.put(Constants.PR_CACHE_RECOVERY, Constants.TRUE);
+ else
+ nvps.put(Constants.PR_CACHE_RECOVERY, Constants.FALSE);
+
+ if (mEnableCacheTesting.isSelected())
+ nvps.put(Constants.PR_CACHE_TESTING, Constants.TRUE);
+ else
+ nvps.put(Constants.PR_CACHE_TESTING, Constants.FALSE);
+
+ _model.progressStart();
+
+ try {
+ if (mId != null && mId.length() > 0) {
+ _admin.modify(DestDef.DEST_CA_ADMIN, ScopeDef.SC_CRL,
+ mId, nvps);
+ } else {
+ _admin.modify(DestDef.DEST_CA_ADMIN, ScopeDef.SC_CRL,
+ Constants.RS_ID_CONFIG, nvps);
+ }
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ _model.progressStop();
+ return false;
+ }
+
+ _model.progressStop();
+ clearDirtyFlag();
+ return true;
+ }
+
+ /**
+ * Implementation for reset values
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean resetCallback() {
+ refresh();
+ return true;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mEnableCache)) {
+ enableFields();
+ }
+ super.actionPerformed(e);
+ }
+
+ private void enableFields() {
+ boolean enable = mEnableCache.isSelected();
+ Color color = (enable)? mActiveColor: getBackground();
+ mCRLFormatPanel.setCacheEnabled(enable);
+
+ mCacheFreqLabel.setEnabled(enable);
+ CMSAdminUtil.repaintComp(mCacheFreqLabel);
+
+ CMSAdminUtil.enableJTextField(mCacheFreq, enable, color);
+
+ mCacheFreqMinLabel.setEnabled(enable);
+ CMSAdminUtil.repaintComp(mCacheFreqMinLabel);
+
+ mEnableCacheRecoveryLabel.setEnabled(enable);
+ CMSAdminUtil.repaintComp(mEnableCacheRecoveryLabel);
+
+ mEnableCacheRecovery.setEnabled(enable);
+ CMSAdminUtil.repaintComp(mEnableCacheRecovery);
+
+ mEnableCacheTestingLabel.setEnabled(enable);
+ CMSAdminUtil.repaintComp(mEnableCacheTestingLabel);
+
+ mEnableCacheTesting.setEnabled(enable);
+ CMSAdminUtil.repaintComp(mEnableCacheTesting);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSCRLFormatPanel.java b/base/console/src/com/netscape/admin/certsrv/config/CMSCRLFormatPanel.java
new file mode 100644
index 000000000..3257b90a0
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSCRLFormatPanel.java
@@ -0,0 +1,448 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.*;
+import java.util.StringTokenizer;
+
+/**
+ * Panel Setting CRL Format
+ *
+ * @author Andrew Wnuk
+ * @version $Revision$, $Date$
+ */
+public class CMSCRLFormatPanel extends CMSBaseTab {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static String PANEL_NAME = "CRLFORMAT";
+ private JCheckBox mEnableExtensions;
+ private JCheckBox mEnableExpired;
+ private JCheckBox mEnableOneExtraTime;
+ private JCheckBox mCACertsOnly;
+ private JCheckBox mProfileCertsOnly;
+ private JTextField mProfiles;
+ private AdminConnection _admin;
+ private CMSBaseResourceModel _model;
+ private JComboBox mAlgorithms;
+ private Color mActiveColor;
+ private CMSTabPanel mParent;
+ private String mId = null;
+ private static final String HELPINDEX =
+ "configuration-ca-ldappublish-crl-help";
+ private boolean mCacheEnabled;
+ private boolean mInitialized = false;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSCRLFormatPanel(CMSTabPanel parent) {
+ super(PANEL_NAME, parent);
+ _model = parent.getResourceModel();
+ mParent = parent;
+ mHelpToken = HELPINDEX;
+ }
+
+ public CMSCRLFormatPanel(CMSTabPanel parent, String id) {
+ super(PANEL_NAME, parent);
+ _model = parent.getResourceModel();
+ mParent = parent;
+ mHelpToken = HELPINDEX;
+ mId = id;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public void init() {
+ Debug.println("CRLFormatPanel: init()");
+ _admin = _model.getServerInfo().getAdmin();
+
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mCenterPanel.setLayout(gb);
+
+
+ //format panel
+ JPanel formatPanel = new JPanel();
+ formatPanel.setBorder(makeTitledBorder("FORMAT"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gb.setConstraints(formatPanel, gbc);
+ mCenterPanel.add(formatPanel);
+
+ GridBagLayout gb1 = new GridBagLayout();
+ formatPanel.setLayout(gb1);
+
+
+ // algorithm selection
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel digestLabel = makeJLabel("MESSAGEDIGEST");
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.gridx = 0;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.insets = new Insets(COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,0,0);
+ formatPanel.add(digestLabel, gbc );
+
+ mAlgorithms = makeJComboBox();
+ mAlgorithms.addItemListener(this);
+ gbc.anchor = gbc.WEST;
+ gbc.gridx++;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0,COMPONENT_SPACE);
+ formatPanel.add(mAlgorithms, gbc);
+
+
+ // allow extensions
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel allowExtensionsLabel = makeJLabel("EXT");
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.gridx = 0;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.insets = new Insets(COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,0,0);
+ formatPanel.add(allowExtensionsLabel, gbc );
+
+ mEnableExtensions = makeJCheckBox();
+ gbc.anchor = gbc.WEST;
+ gbc.gridx++;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0,COMPONENT_SPACE);
+ formatPanel.add(mEnableExtensions, gbc);
+
+
+ //contents panel
+ JPanel contentsPanel = new JPanel();
+ contentsPanel.setBorder(makeTitledBorder("CONTENTS"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(contentsPanel, gbc);
+ mCenterPanel.add(contentsPanel);
+
+ GridBagLayout gb2 = new GridBagLayout();
+ contentsPanel.setLayout(gb2);
+
+
+ // include expired certs
+ CMSAdminUtil.resetGBC(gbc);
+ mEnableExpired = makeJCheckBox("EXPIRED");
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridx = 0;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,0,0);
+ contentsPanel.add(mEnableExpired, gbc);
+
+
+ // include expired certs one extra time
+ CMSAdminUtil.resetGBC(gbc);
+ mEnableOneExtraTime = makeJCheckBox("ONEEXTRATIME");
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridx = 0;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,0,0);
+ contentsPanel.add(mEnableOneExtraTime, gbc);
+
+
+ // CA certs only
+ CMSAdminUtil.resetGBC(gbc);
+ mCACertsOnly = makeJCheckBox("CACERTSONLY");
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridx = 0;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,0,0);
+ contentsPanel.add(mCACertsOnly, gbc);
+
+
+ // profile certs only
+ CMSAdminUtil.resetGBC(gbc);
+ mProfileCertsOnly = makeJCheckBox("PROFILECERTSONLY");
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridx = 0;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.insets = new Insets(COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,0,0);
+ contentsPanel.add(mProfileCertsOnly, gbc);
+
+ mProfiles = makeJTextField(20);
+ gbc.anchor = gbc.WEST;
+ gbc.gridx++;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,0,0,COMPONENT_SPACE);
+ contentsPanel.add(mProfiles, gbc);
+ mActiveColor = mProfiles.getBackground();
+
+
+ refresh();
+ mInitialized = true;
+ }
+
+ public void refresh() {
+ _model.progressStart();
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_EXTENSIONS, "");
+ nvps.put(Constants.PR_SIGNING_ALGORITHM, "");
+ nvps.put(Constants.PR_INCLUDE_EXPIREDCERTS, "");
+ nvps.put(Constants.PR_INCLUDE_EXPIREDCERTS_ONEEXTRATIME, "");
+ nvps.put(Constants.PR_CA_CERTS_ONLY, "");
+ nvps.put(Constants.PR_PROFILE_CERTS_ONLY, "");
+ nvps.put(Constants.PR_PROFILE_LIST, "");
+ nvps.put(Constants.PR_ENABLE_CACHE, "");
+
+ try {
+ NameValuePairs val = null;
+ if (mId != null && mId.length() > 0) {
+ val = _admin.read(DestDef.DEST_CA_ADMIN, ScopeDef.SC_CRL,
+ mId, nvps);
+ } else {
+ val = _admin.read(DestDef.DEST_CA_ADMIN, ScopeDef.SC_CRL,
+ Constants.RS_ID_CONFIG, nvps);
+ }
+
+ populate(val);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ _model.progressStop();
+ }
+ _model.progressStop();
+ clearDirtyFlag();
+ mParent.setOKCancel();
+
+ if (mProfileCertsOnly.isSelected()) {
+ CMSAdminUtil.enableJTextField(mProfiles, true, mActiveColor);
+ } else {
+ CMSAdminUtil.enableJTextField(mProfiles, false, getBackground());
+ }
+ mEnableOneExtraTime.setEnabled(mCacheEnabled && (!mEnableExpired.isSelected()));
+ CMSAdminUtil.repaintComp(mEnableOneExtraTime);
+ }
+
+ public void populate(NameValuePairs nvps) {
+ String signingAlg = "";
+ for (String name : nvps.keySet()) {
+ String value = nvps.get(name).trim();
+ if (name.equals(Constants.PR_EXTENSIONS)) {
+ mEnableExtensions.setSelected(getBoolean(value));
+ } else if (name.equals(Constants.PR_SIGNING_ALGORITHM)) {
+ signingAlg = value;
+ } else if (name.equals(Constants.PR_ALL_ALGORITHMS)) {
+ initAlgorithmBox(value);
+ } else if (name.equals(Constants.PR_INCLUDE_EXPIREDCERTS)) {
+ mEnableExpired.setSelected(getBoolean(value));
+ } else if (name.equals(Constants.PR_INCLUDE_EXPIREDCERTS_ONEEXTRATIME)) {
+ mEnableOneExtraTime.setSelected(getBoolean(value));
+ } else if (name.equals(Constants.PR_CA_CERTS_ONLY)) {
+ mCACertsOnly.setSelected(getBoolean(value));
+ } else if (name.equals(Constants.PR_PROFILE_CERTS_ONLY)) {
+ mProfileCertsOnly.setSelected(getBoolean(value));
+ } else if (name.equals(Constants.PR_PROFILE_LIST)) {
+ mProfiles.setText(value);
+ } else if (name.equals(Constants.PR_ENABLE_CACHE)) {
+ mCacheEnabled = (value.equals(Constants.TRUE))? true: false;
+ }
+ }
+
+ mAlgorithms.setSelectedItem(signingAlg);
+ }
+
+ private void initAlgorithmBox(String val) {
+ if (mAlgorithms.getItemCount() >= 0) {
+ mAlgorithms.removeAllItems();
+ }
+ StringTokenizer tokenizer = new StringTokenizer(val, ":");
+ while (tokenizer.hasMoreTokens()) {
+ mAlgorithms.addItem(tokenizer.nextToken());
+ }
+ }
+
+ public boolean getBoolean(String val) {
+ if (val.equals(Constants.TRUE))
+ return true;
+ return false;
+ }
+
+ private String trimList(String list) {
+ String trimmed = "";
+
+ StringTokenizer elements = new StringTokenizer(list, ",", true);
+ int n = 0;
+ while (elements.hasMoreTokens()) {
+ String element = elements.nextToken().trim();
+ if (element == null || element.length() == 0) return null;
+ if (element.equals(",") && n % 2 == 0) return null;
+ trimmed += element;
+ n++;
+ }
+ if (n % 2 == 0) return null;
+
+ return trimmed;
+ }
+
+ /**
+ * Implementation for saving panel information
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean applyCallback() {
+ NameValuePairs nvps = new NameValuePairs();
+
+ if (mEnableExtensions.isSelected())
+ nvps.put(Constants.PR_EXTENSIONS, Constants.TRUE);
+ else
+ nvps.put(Constants.PR_EXTENSIONS, Constants.FALSE);
+
+ if (mEnableExpired.isSelected())
+ nvps.put(Constants.PR_INCLUDE_EXPIREDCERTS, Constants.TRUE);
+ else
+ nvps.put(Constants.PR_INCLUDE_EXPIREDCERTS, Constants.FALSE);
+
+ if (mEnableOneExtraTime.isSelected())
+ nvps.put(Constants.PR_INCLUDE_EXPIREDCERTS_ONEEXTRATIME, Constants.TRUE);
+ else
+ nvps.put(Constants.PR_INCLUDE_EXPIREDCERTS_ONEEXTRATIME, Constants.FALSE);
+
+ if (mCACertsOnly.isSelected())
+ nvps.put(Constants.PR_CA_CERTS_ONLY, Constants.TRUE);
+ else
+ nvps.put(Constants.PR_CA_CERTS_ONLY, Constants.FALSE);
+
+ if (mProfileCertsOnly.isSelected())
+ nvps.put(Constants.PR_PROFILE_CERTS_ONLY, Constants.TRUE);
+ else
+ nvps.put(Constants.PR_PROFILE_CERTS_ONLY, Constants.FALSE);
+
+ String profileList = null;
+ if (mProfileCertsOnly.isSelected()) {
+ if (mProfiles.getText().trim().equals("")) {
+ showMessageDialog("BLANKPROFILELIST");
+ return false;
+ }
+ profileList = trimList(mProfiles.getText());
+ if (profileList == null) {
+ showMessageDialog("PROFILELISTFORMAT");
+ return false;
+ }
+ }
+ if (profileList != null)
+ nvps.put(Constants.PR_PROFILE_LIST, profileList);
+ else
+ nvps.put(Constants.PR_PROFILE_LIST, mProfiles.getText().trim());
+
+
+ int index = mAlgorithms.getSelectedIndex();
+
+ nvps.put(Constants.PR_SIGNING_ALGORITHM,
+ (String) mAlgorithms.getSelectedItem());
+
+ _model.progressStart();
+
+ try {
+ if (mId != null && mId.length() > 0) {
+ _admin.modify(DestDef.DEST_CA_ADMIN, ScopeDef.SC_CRL,
+ mId, nvps);
+ } else {
+ _admin.modify(DestDef.DEST_CA_ADMIN, ScopeDef.SC_CRL,
+ Constants.RS_ID_CONFIG, nvps);
+ }
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ _model.progressStop();
+ return false;
+ }
+
+ _model.progressStop();
+ clearDirtyFlag();
+ return true;
+ }
+
+ /**
+ * Implementation for reset values
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean resetCallback() {
+ refresh();
+ return true;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mProfileCertsOnly)) {
+ if (mProfileCertsOnly.isSelected()) {
+ CMSAdminUtil.enableJTextField(mProfiles, true, mActiveColor);
+ } else {
+ CMSAdminUtil.enableJTextField(mProfiles, false, getBackground());
+ }
+ } else if (e.getSource().equals(mEnableExpired)) {
+ mEnableOneExtraTime.setEnabled(mCacheEnabled && (!mEnableExpired.isSelected()));
+ CMSAdminUtil.repaintComp(mEnableOneExtraTime);
+ }
+
+ super.actionPerformed(e);
+ }
+
+ public void setCacheEnabled (boolean cacheEnabled) {
+ if (mCacheEnabled != cacheEnabled) {
+ mCacheEnabled = cacheEnabled;
+ if (mInitialized) {
+ mEnableOneExtraTime.setEnabled(mCacheEnabled && (!mEnableExpired.isSelected()));
+ CMSAdminUtil.repaintComp(mEnableOneExtraTime);
+ }
+ }
+ }
+
+ /**
+ * Override the initialize method only for this panel.
+ * We need to refresh in case the CRLDistributionPointExtension
+ * has modified the caCertsOnly property for us.
+ **/
+ public void initialize() {
+ Debug.println("CMSCRLFormatPanel: intialize()");
+ if (!mInit) {
+ init();
+ mInit = true;
+ } else {
+ if(!isDirty()) {
+ refresh();
+ }
+ }
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSCRLIPPanel.java b/base/console/src/com/netscape/admin/certsrv/config/CMSCRLIPPanel.java
new file mode 100644
index 000000000..553211eb8
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSCRLIPPanel.java
@@ -0,0 +1,327 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.ug.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+
+/**
+ * CRL IP Panel
+ *
+ * @version $Revision$, $Date$
+ */
+public class CMSCRLIPPanel extends CMSBaseTab
+ implements MouseListener
+{
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+
+ private final static String PANEL_NAME = "CRLIPS";
+ private final static String HELPINDEX = "configuration-revocation";
+
+ private AdminConnection mAdmin;
+ private CMSBaseResourceModel mModel;
+ private CMSTabPanel mParent;
+ private JList mList;
+ private DefaultListModel mDataModel;
+ private JScrollPane mScrollPane;
+ private JButton mAdd;
+ private JButton mEdit;
+ private JButton mDelete;
+ private Vector mNames;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSCRLIPPanel(CMSBaseResourceModel model, CMSTabPanel parent) {
+ super(PANEL_NAME, parent);
+ mModel = model;
+ mParent = parent;
+ mDataModel = new DefaultListModel();
+ mHelpToken = HELPINDEX;
+ mNames = new Vector();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * initialize the UI components
+ */
+ public void init() {
+ JPanel mainPanel = mCenterPanel;
+
+ Debug.println("CRLIPPanel: init()");
+ mAdmin = mModel.getServerInfo().getAdmin();
+
+ GridBagLayout gb1 = new GridBagLayout();
+ mainPanel.setLayout(gb1);
+
+ GridBagConstraints gbc = new GridBagConstraints();
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel listLabel = makeJLabel("CRLIPLIST");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(DIFFERENT_COMPONENT_SPACE,
+ DIFFERENT_COMPONENT_SPACE,
+ 0,DIFFERENT_COMPONENT_SPACE);
+ gb1.setConstraints(listLabel, gbc);
+ mainPanel.add(listLabel);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mList = makeJList(mDataModel, 7);
+ mScrollPane = new JScrollPane(mList,
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mList.addMouseListener(this);
+ mScrollPane.setBackground(Color.white);
+ mScrollPane.setBorder(BorderFactory.createLoweredBevelBorder());
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 0.5;
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,
+ DIFFERENT_COMPONENT_SPACE,
+ 0,DIFFERENT_COMPONENT_SPACE);
+ gb1.setConstraints(mScrollPane, gbc);
+ mainPanel.add(mScrollPane);
+
+ JPanel buttonPanel = createUserButtonPanel();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 0.0;
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,0,
+ 0,DIFFERENT_COMPONENT_SPACE);
+ gb1.setConstraints(buttonPanel, gbc);
+ mainPanel.add(buttonPanel);
+
+ refresh();
+ }
+
+
+ /**
+ * create the user action button panel
+ */
+ protected JPanel createUserButtonPanel() {
+ //add, edit, delete, help buttons required
+ //actionlister to this object
+ mAdd = makeJButton("ADD");
+ mEdit = makeJButton("EDIT");
+ mDelete = makeJButton("DELETE");
+ JButton[] buttons = {mAdd, mEdit, mDelete};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonVPanel( buttons );
+ }
+
+ /**
+ * refresh the panel data
+ */
+ public void refresh() {
+ try {
+ NameValuePairs nvps = mAdmin.search(DestDef.DEST_CA_ADMIN,
+ ScopeDef.SC_CRLIPS,
+ new NameValuePairs());
+ populate(nvps);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ }
+
+ repaint(1);
+ }
+
+
+ /*==========================================================
+ * Event Handler
+ *==========================================================*/
+
+ //======= ActionLister ============================
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mEdit)) {
+ JFrame frame = mModel.getFrame();
+ String name = ((JLabel)mList.getSelectedValue()).getText();
+ //(String)mList.getSelectedValue();
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_ENABLED, "");
+ nvps.put(Constants.PR_ID, "");
+ nvps.put(Constants.PR_DESCRIPTION, "");
+ nvps.put(Constants.PR_CLASS, "");
+ try {
+ NameValuePairs values = mAdmin.read(DestDef.DEST_CA_ADMIN,
+ ScopeDef.SC_CRLIPS,
+ name, nvps);
+
+ CRLIPEditor editor = new CRLIPEditor(mAdmin, mModel.getFrame(),
+ name, DestDef.DEST_CA_ADMIN,
+ mModel.getServerInfo().getServerId(),
+ mNames);
+ editor.showDialog(values);
+ } catch (EAdminException ex) {
+ showErrorDialog(ex.toString());
+ }
+ refresh();
+ } else if (e.getSource().equals(mAdd)) {
+ CRLIPEditor editor = new CRLIPEditor(mAdmin, mModel.getFrame(),
+ null, DestDef.DEST_CA_ADMIN,
+ mModel.getServerInfo().getServerId(),
+ mNames);
+ editor.showDialog(new NameValuePairs());
+ String name = editor.getCRLName();
+ CMSResourceObject node = (CMSResourceObject)(mParent.getResourceObject());
+ CMSResourceObject crlsNode = node;
+ node = new CMSResourceObject();
+ node.setName(name);
+ CMSTabPanel crlIPTabPane = new CMSTabPanel(mModel, node);
+ crlIPTabPane.addTab(new CMSCRLSettingPanel(crlIPTabPane, name));
+ crlIPTabPane.addTab(new CMSCRLCachePanel(crlIPTabPane, name));
+ crlIPTabPane.addTab(new CMSCRLFormatPanel(crlIPTabPane, name));
+ node.setCustomPanel(crlIPTabPane);
+ node.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULEOBJECT));
+ node.setAllowsChildren(true);
+ crlsNode.insert(node, crlsNode.getChildCount());
+
+ CMSResourceObject crlNode = node;
+
+ node = new CMSResourceObject("CRLEXTENSIONS");
+ CMSUGTabPanel crlExtTabPane1 = new CMSUGTabPanel(mModel, node);
+ crlExtTabPane1.addTab(new CRLExtensionsInstanceTab(mModel, DestDef.DEST_CA_ADMIN, name));
+ node.setCustomPanel(crlExtTabPane1);
+ node.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULEOBJECT));
+ node.setAllowsChildren(false);
+ crlNode.add(node);
+ mModel.fireTreeStructureChanged((ResourceObject)crlsNode);
+
+ refresh();
+ } else if (e.getSource().equals(mDelete)) {
+ int index = mList.getSelectedIndex();
+ if (index >= 0) {
+ String name = ((JLabel)mList.getSelectedValue()).getText();
+ //(String)mList.getSelectedValue();
+
+ int i = showConfirmDialog("DELETE");
+ if (i == JOptionPane.YES_OPTION) {
+ try {
+ mAdmin.delete(DestDef.DEST_CA_ADMIN,
+ ScopeDef.SC_CRLIPS, name);
+ } catch (EAdminException ex) {
+ showErrorDialog(ex.toString());
+ }
+ if (mNames.contains(name))
+ mNames.remove(name);
+ mDataModel.removeElementAt(index);
+ if (mDataModel.size() > 0)
+ mList.setSelectedIndex(0);
+ }
+ CMSResourceObject node =
+ (CMSResourceObject)(mParent.getResourceObject());
+ Enumeration allchildren = node.children();
+ while (allchildren.hasMoreElements()) {
+ CMSResourceObject child = (CMSResourceObject)(allchildren.nextElement());
+ String name1 = child.getName();
+ if (name1.equals(name)) {
+ node.remove(child);
+ mModel.fireTreeStructureChanged((ResourceObject)node);
+ return;
+ }
+ }
+ }
+ }
+ }
+
+ //=== MOUSELISTENER ========================
+ public void mouseClicked(MouseEvent e) {
+ if (e.getSource() == mList) {
+ if (mList.getSelectedIndex() < 0)
+ mEdit.setEnabled(false);
+ else
+ mEdit.setEnabled(true);
+ }
+ }
+
+ public void mousePressed(MouseEvent e) {}
+ public void mouseReleased(MouseEvent e) {}
+ public void mouseEntered(MouseEvent e) {}
+ public void mouseExited(MouseEvent e) {}
+
+ //======== CMSBaseConfigPanel ==============
+ public boolean applyCallback() {
+ return true;
+ }
+
+ /**
+ * Implementation for reset values
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean resetCallback() {
+ refresh();
+ return true;
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+
+ //update the UI component using the data retrieved
+ private void populate(NameValuePairs nvps) {
+
+ mDataModel.removeAllElements();
+ mNames.removeAllElements();
+ for (String name : nvps.keySet()) {
+ if (name.indexOf('.') == -1) {
+ mNames.addElement(name);
+
+ String enable = nvps.get(name + "." + Constants.PR_ENABLED);
+ if (enable != null && enable.equalsIgnoreCase(Constants.TRUE)) {
+ mDataModel.addElement(new JLabel(name,
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE),
+ JLabel.LEFT));
+ } else {
+ mDataModel.addElement(new JLabel(name,
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE_DISABLE),
+ JLabel.LEFT));
+ }
+ /*
+ mDataModel.addElement(name);
+ */
+ }
+ }
+
+ if (mDataModel.size() > 0) {
+ mList.setSelectedIndex(0);
+ mEdit.setEnabled(true);
+ mDelete.setEnabled(true);
+ } else {
+ mEdit.setEnabled(false);
+ mDelete.setEnabled(false);
+ }
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSCRLSettingPanel.java b/base/console/src/com/netscape/admin/certsrv/config/CMSCRLSettingPanel.java
new file mode 100644
index 000000000..d420686e3
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSCRLSettingPanel.java
@@ -0,0 +1,698 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.*;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+/**
+ * CRL Publishing Setting Panel
+ *
+ * @author Andrew Wnuk
+ * @author Christine Ho
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public class CMSCRLSettingPanel extends CMSBaseTab {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static String PANEL_NAME = "CRLSETTING";
+
+ private JCheckBox mEnableCRL;
+ private JLabel mCRLGenLabel;
+ private JTextField mCRLGen;
+ private JLabel mDeltaGenLabel;
+
+ private JLabel mExtendNextUpdateLabel;
+ private JCheckBox mExtendNextUpdate;
+
+ private JCheckBox mAlways;
+ private JCheckBox mDaily;
+ private JTextField mDailyAt;
+ private JCheckBox mEnableFreq;
+ private JTextField mFrequency;
+ private JLabel mMinLabel;
+ private JLabel mGracePeriodLabel;
+ private JTextField mGracePeriod;
+ private JLabel mGracePeriodMinLabel;
+
+ private Color mActiveColor;
+ private AdminConnection _admin;
+ private CMSBaseResourceModel _model;
+ private CMSTabPanel mParent;
+ private String mId = null;
+ private static final String HELPINDEX =
+ "configuration-ca-ldappublish-crl-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSCRLSettingPanel(CMSTabPanel parent) {
+ super(PANEL_NAME, parent);
+ _model = parent.getResourceModel();
+ mParent = parent;
+ mHelpToken = HELPINDEX;
+ }
+
+ public CMSCRLSettingPanel(CMSTabPanel parent, String id) {
+ super(PANEL_NAME, parent);
+ _model = parent.getResourceModel();
+ mParent = parent;
+ mHelpToken = HELPINDEX;
+ mId = id;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public void init() {
+ Debug.println("CRLSettingPanel: init()");
+ _admin = _model.getServerInfo().getAdmin();
+
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mCenterPanel.setLayout(gb);
+
+
+ //schema panel
+ JPanel schemaPanel = new JPanel();
+ schemaPanel.setBorder(makeTitledBorder("SCHEMA"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gb.setConstraints(schemaPanel, gbc);
+ mCenterPanel.add(schemaPanel);
+
+ GridBagLayout gb4 = new GridBagLayout();
+ schemaPanel.setLayout(gb4);
+
+
+ // enable CRL generation
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel enableCRLLabel = makeJLabel("CRL");
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.gridx = 0;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.insets = new Insets(COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,0,0);
+ schemaPanel.add(enableCRLLabel, gbc );
+
+ mEnableCRL = makeJCheckBox();
+ gbc.anchor = gbc.WEST;
+ gbc.gridx++;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0,COMPONENT_SPACE);
+ schemaPanel.add(mEnableCRL, gbc);
+
+
+ // generate full CRL every X deltas
+ CMSAdminUtil.resetGBC(gbc);
+ mCRLGenLabel = makeJLabel("GENERATION");
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.gridx = 0;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.insets = new Insets(COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,0,0);
+ schemaPanel.add(mCRLGenLabel, gbc );
+
+ mCRLGen = makeJTextField(5);
+ gbc.anchor = gbc.WEST;
+ gbc.gridx++;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0,0);
+ schemaPanel.add(mCRLGen, gbc);
+ mActiveColor = mCRLGen.getBackground();
+
+ mDeltaGenLabel = makeJLabel("DELTAS");
+ gbc.anchor = gbc.WEST;
+ gbc.gridx++;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0,COMPONENT_SPACE);
+ schemaPanel.add(mDeltaGenLabel, gbc);
+
+
+ // Extend next update time
+ CMSAdminUtil.resetGBC(gbc);
+ mExtendNextUpdateLabel = makeJLabel("NEXTTIME");
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.gridx = 0;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.insets = new Insets(COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,0,0);
+ schemaPanel.add(mExtendNextUpdateLabel, gbc );
+
+ mExtendNextUpdate = makeJCheckBox();
+ gbc.anchor = gbc.WEST;
+ gbc.gridx++;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0,COMPONENT_SPACE);
+ schemaPanel.add(mExtendNextUpdate, gbc);
+
+
+ //frequency panel
+ JPanel freqPanel = new JPanel();
+ freqPanel.setBorder(makeTitledBorder("FREQ"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(freqPanel, gbc);
+ mCenterPanel.add(freqPanel);
+
+ //add components
+ GridBagLayout gb2 = new GridBagLayout();
+ freqPanel.setLayout(gb2);
+
+
+ // update every time
+ CMSAdminUtil.resetGBC(gbc);
+ mAlways = makeJCheckBox("ALWAYS");
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridx = 0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,0,COMPONENT_SPACE);
+ freqPanel.add(mAlways, gbc);
+
+
+ // update at specified time
+ CMSAdminUtil.resetGBC(gbc);
+ mDaily = makeJCheckBox("DAILY");
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridx = 0;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.insets = new Insets(COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,0,0);
+ freqPanel.add(mDaily, gbc);
+
+ mDailyAt = makeJTextField(30);
+ gbc.anchor = gbc.WEST;
+ gbc.gridx++;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0,COMPONENT_SPACE);
+ freqPanel.add(mDailyAt, gbc);
+
+
+ // update by time interval
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridx = 0;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ mEnableFreq = makeJCheckBox("FREQ");
+ gbc.insets = new Insets(COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,0,0);
+ freqPanel.add(mEnableFreq, gbc);
+
+ mFrequency = makeJTextField(5);
+ gbc.anchor = gbc.WEST;
+ gbc.gridx++;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0,0);
+ freqPanel.add(mFrequency, gbc);
+
+ mMinLabel = makeJLabel("MINUTES");
+ gbc.anchor = gbc.WEST;
+ gbc.gridx++;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0,COMPONENT_SPACE);
+ freqPanel.add(mMinLabel, gbc);
+
+
+ // next update grace period
+ CMSAdminUtil.resetGBC(gbc);
+ mGracePeriodLabel = makeJLabel("GRACEPERIOD");
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridx = 0;
+ // gbc.gridx = 2;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.insets = new Insets(COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,0,0);
+ freqPanel.add(mGracePeriodLabel, gbc);
+
+ mGracePeriod = makeJTextField(5);
+ gbc.anchor = gbc.WEST;
+ gbc.gridx++;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0,0);
+ freqPanel.add(mGracePeriod, gbc);
+
+ mGracePeriodMinLabel = makeJLabel("MINUTES");
+ gbc.anchor = gbc.WEST;
+ gbc.gridx++;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0,COMPONENT_SPACE);
+ freqPanel.add(mGracePeriodMinLabel, gbc);
+
+
+ refresh();
+ }
+
+ public void refresh() {
+ _model.progressStart();
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_ENABLE_CRL, "");
+ nvps.put(Constants.PR_UPDATE_SCHEMA, "");
+ nvps.put(Constants.PR_EXTENDED_NEXT_UPDATE, "");
+ nvps.put(Constants.PR_UPDATE_ALWAYS, "");
+ nvps.put(Constants.PR_ENABLE_DAILY, "");
+ nvps.put(Constants.PR_DAILY_UPDATES, "");
+ nvps.put(Constants.PR_ENABLE_FREQ, "");
+ nvps.put(Constants.PR_UPDATE_FREQ, "");
+ nvps.put(Constants.PR_GRACE_PERIOD, "");
+
+ try {
+ NameValuePairs val = null;
+ if (mId != null && mId.length() > 0) {
+ val = _admin.read(DestDef.DEST_CA_ADMIN, ScopeDef.SC_CRL,
+ mId, nvps);
+ } else {
+ val = _admin.read(DestDef.DEST_CA_ADMIN, ScopeDef.SC_CRL,
+ Constants.RS_ID_CONFIG, nvps);
+ }
+
+ populate(val);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ _model.progressStop();
+ }
+ _model.progressStop();
+ clearDirtyFlag();
+ mParent.setOKCancel();
+
+ enableFields();
+ }
+
+ public void populate(NameValuePairs nvps) {
+ for (String name : nvps.keySet()) {
+ String value = nvps.get(name).trim();
+ if (name.equals(Constants.PR_ENABLE_CRL)) {
+ mEnableCRL.setSelected(getBoolean(value));
+ } else if (name.equals(Constants.PR_UPDATE_SCHEMA)) {
+ mCRLGen.setText(value);
+ } else if (name.equals(Constants.PR_EXTENDED_NEXT_UPDATE)) {
+ mExtendNextUpdate.setSelected(getBoolean(value));
+ } else if (name.equals(Constants.PR_UPDATE_ALWAYS)) {
+ mAlways.setSelected(getBoolean(value));
+ } else if (name.equals(Constants.PR_ENABLE_DAILY)) {
+ mDaily.setSelected(getBoolean(value));
+ } else if (name.equals(Constants.PR_DAILY_UPDATES)) {
+ mDailyAt.setText(value);
+ } else if (name.equals(Constants.PR_ENABLE_FREQ)) {
+ mEnableFreq.setSelected(getBoolean(value));
+ } else if (name.equals(Constants.PR_UPDATE_FREQ)) {
+ mFrequency.setText(value);
+ } else if (name.equals(Constants.PR_GRACE_PERIOD)) {
+ mGracePeriod.setText(value);
+ }
+ }
+ }
+
+ public boolean getBoolean(String val) {
+ if (val.equals(Constants.TRUE))
+ return true;
+ return false;
+ }
+
+ public boolean getBoolean(String val, boolean defaultValue) {
+ if (val.equals(Constants.TRUE))
+ return true;
+ else if (val.equals(Constants.FALSE))
+ return false;
+ else
+ return defaultValue;
+ }
+
+ private int checkTime(String time) {
+ String digits = "0123456789";
+ int len = time.length();
+ if (len < 3 || len > 5) return -1;
+ int s = time.indexOf(':');
+ if (s < 0 || s > 2 || (len - s) != 3) return -1;
+
+ int h = 0;
+ for (int i = 0; i < s; i++) {
+ h *= 10;
+ int k = digits.indexOf(time.charAt(i));
+ if (k < 0) return -1;
+ h += k;
+ }
+ if (h > 23) return -1;
+
+ int m = 0;
+ for (int i = s+1; i < len; i++) {
+ m *= 10;
+ int k = digits.indexOf(time.charAt(i));
+ if (k < 0) return -1;
+ m += k;
+ }
+ if (m > 59) return -1;
+
+ return ((h * 60) + m);
+ }
+
+ private String trimList(String list) {
+ String trimmed = "";
+
+ StringTokenizer days = new StringTokenizer(list, ";", true);
+ while (days.hasMoreTokens()) {
+ String dayList = days.nextToken().trim();
+ if (dayList == null || dayList.length() == 0) continue;
+ if (dayList.equals(";")) {
+ trimmed += dayList;
+ continue;
+ }
+ StringTokenizer elements = new StringTokenizer(dayList, ",", true);
+ int n = 0;
+ while (elements.hasMoreTokens()) {
+ String element = elements.nextToken().trim();
+ if (element == null || element.length() == 0) return null;
+ if (element.equals(",") && n % 2 == 0) return null;
+ trimmed += element;
+ n++;
+ }
+ if (n % 2 == 0) return null;
+ }
+ return trimmed;
+ }
+
+ private Vector checkTimeList(String list) {
+ if (list == null || list.length() == 0) return null;
+ if (list.charAt(0) == ',' || list.charAt(list.length()-1) == ',') return null;
+
+ Vector listedTimes = new Vector();
+
+ StringTokenizer days = new StringTokenizer(list, ";");
+ while (days.hasMoreTokens()) {
+ String dayList = days.nextToken().trim();
+ if (dayList == null || dayList.length() == 0) continue;
+ int t0 = -1;
+ StringTokenizer times = new StringTokenizer(dayList, ",");
+ while (times.hasMoreTokens()) {
+ String time = times.nextToken();
+ if (time.charAt(0) == '*') time = time.substring(1);
+ int t = checkTime(time);
+ if (t < 0) {
+ return null;
+ } else {
+ if (t > t0) {
+ listedTimes.addElement(new Integer(t));
+ t0 = t;
+ } else {
+ return null;
+ }
+ }
+ }
+ }
+ return listedTimes;
+ }
+
+
+ /**
+ * Implementation for saving panel information
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean applyCallback() {
+ String timeList = trimList(mDailyAt.getText());
+
+ if (mEnableCRL.isSelected()) {
+ if (!mAlways.isSelected() && !mDaily.isSelected() &&
+ !mEnableFreq.isSelected()) {
+ showMessageDialog("UPDATES");
+ return false;
+ }
+
+ if (mCRLGen.getText().trim().equals("")) {
+ showMessageDialog("BLANKSCHEMA");
+ return false;
+ }
+ try {
+ int num = Integer.parseInt(mCRLGen.getText().trim());
+ if (num < 1) {
+ showMessageDialog("SCHEMANUMBER");
+ return false;
+ }
+ } catch (NumberFormatException e) {
+ showMessageDialog("SCHEMANUMBER");
+ return false;
+ }
+
+ Vector daily = null;
+ if (mDaily.isSelected()) {
+ if (mDailyAt.getText().trim().equals("")) {
+ showMessageDialog("BLANKDAILY");
+ return false;
+ }
+ daily = checkTimeList(timeList);
+ if (daily == null) {
+ showMessageDialog("DAILYFORMAT");
+ return false;
+ }
+ }
+
+ if (mEnableFreq.isSelected()) {
+ if (mFrequency.getText().trim().equals("")) {
+ showMessageDialog("BLANKFREQ");
+ return false;
+ }
+ int freq = 0;
+ try {
+ freq = Integer.parseInt(mFrequency.getText().trim());
+ if (freq < 1) {
+ showMessageDialog("FREQNUMBER");
+ return false;
+ }
+ } catch (NumberFormatException e) {
+ showMessageDialog("FREQNUMBER");
+ return false;
+ }
+ if (mDaily.isSelected() && daily != null && daily.size() > 1) {
+ showMessageDialog("DAILYFORMAT");
+ return false;
+ }
+ if (mDaily.isSelected() && daily != null && daily.size() == 1 &&
+ (freq >= 1440 ||
+ freq + ((Integer)(daily.elementAt(0))).intValue() >= 1440)) {
+ showMessageDialog("INTERVALTOBIG");
+ return false;
+ }
+ }
+
+ if (mGracePeriod.getText().trim().equals("")) {
+ showMessageDialog("BLANKGRACE");
+ return false;
+ }
+ try {
+ int grace = Integer.parseInt(mGracePeriod.getText().trim());
+ if (grace < 0) {
+ showMessageDialog("GRACENUMBER");
+ return false;
+ }
+ } catch (NumberFormatException e) {
+ showMessageDialog("GRACENUMBER");
+ return false;
+ }
+ }
+
+ NameValuePairs nvps = new NameValuePairs();
+
+ if (mEnableCRL.isSelected())
+ nvps.put(Constants.PR_ENABLE_CRL, Constants.TRUE);
+ else
+ nvps.put(Constants.PR_ENABLE_CRL, Constants.FALSE);
+
+ nvps.put(Constants.PR_UPDATE_SCHEMA, mCRLGen.getText().trim());
+
+ if (mExtendNextUpdate.isSelected())
+ nvps.put(Constants.PR_EXTENDED_NEXT_UPDATE, Constants.TRUE);
+ else
+ nvps.put(Constants.PR_EXTENDED_NEXT_UPDATE, Constants.FALSE);
+
+ if (mAlways.isSelected())
+ nvps.put(Constants.PR_UPDATE_ALWAYS, Constants.TRUE);
+ else
+ nvps.put(Constants.PR_UPDATE_ALWAYS, Constants.FALSE);
+
+ if (mDaily.isSelected())
+ nvps.put(Constants.PR_ENABLE_DAILY, Constants.TRUE);
+ else
+ nvps.put(Constants.PR_ENABLE_DAILY, Constants.FALSE);
+
+ if (timeList != null)
+ nvps.put(Constants.PR_DAILY_UPDATES, timeList);
+ else
+ nvps.put(Constants.PR_DAILY_UPDATES, mDailyAt.getText().trim());
+
+
+ if (mEnableFreq.isSelected())
+ nvps.put(Constants.PR_ENABLE_FREQ, Constants.TRUE);
+ else
+ nvps.put(Constants.PR_ENABLE_FREQ, Constants.FALSE);
+
+ nvps.put(Constants.PR_UPDATE_FREQ, mFrequency.getText().trim());
+
+ nvps.put(Constants.PR_GRACE_PERIOD, mGracePeriod.getText().trim());
+
+
+ _model.progressStart();
+
+ try {
+ if (mId != null && mId.length() > 0) {
+ _admin.modify(DestDef.DEST_CA_ADMIN, ScopeDef.SC_CRL,
+ mId, nvps);
+ } else {
+ _admin.modify(DestDef.DEST_CA_ADMIN, ScopeDef.SC_CRL,
+ Constants.RS_ID_CONFIG, nvps);
+ }
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ _model.progressStop();
+ return false;
+ }
+
+ _model.progressStop();
+ clearDirtyFlag();
+ return true;
+ }
+
+ /**
+ * Implementation for reset values
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean resetCallback() {
+ Debug.println("CRLSettingPanel: resetCallback()");
+ refresh();
+ return true;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ Debug.println("CRLSettingPanel: actionPerformed()");
+ if (e.getSource().equals(mEnableCRL)) {
+ enableFields();
+ }
+
+ if (e.getSource().equals(mDaily)) {
+ if (mDaily.isSelected()) {
+ CMSAdminUtil.enableJTextField(mDailyAt, true, mActiveColor);
+ CMSAdminUtil.enableJTextField(mGracePeriod, true, mActiveColor);
+ mGracePeriodLabel.setEnabled(true);
+ CMSAdminUtil.repaintComp(mGracePeriodLabel);
+ mGracePeriodMinLabel.setEnabled(true);
+ CMSAdminUtil.repaintComp(mGracePeriodMinLabel);
+ } else {
+ CMSAdminUtil.enableJTextField(mDailyAt, false, getBackground());
+ if (!mEnableFreq.isSelected()) {
+ CMSAdminUtil.enableJTextField(mGracePeriod, false, getBackground());
+ mGracePeriodLabel.setEnabled(false);
+ CMSAdminUtil.repaintComp(mGracePeriodLabel);
+ mGracePeriodMinLabel.setEnabled(false);
+ CMSAdminUtil.repaintComp(mGracePeriodMinLabel);
+ }
+ }
+ }
+ if (e.getSource().equals(mEnableFreq)) {
+ if (mEnableFreq.isSelected()) {
+ CMSAdminUtil.enableJTextField(mFrequency, true, mActiveColor);
+ mMinLabel.setEnabled(true);
+ CMSAdminUtil.repaintComp(mMinLabel);
+ CMSAdminUtil.enableJTextField(mGracePeriod, true, mActiveColor);
+ mGracePeriodLabel.setEnabled(true);
+ CMSAdminUtil.repaintComp(mGracePeriodLabel);
+ mGracePeriodMinLabel.setEnabled(true);
+ CMSAdminUtil.repaintComp(mGracePeriodMinLabel);
+ } else {
+ CMSAdminUtil.enableJTextField(mFrequency, false, getBackground());
+ mMinLabel.setEnabled(false);
+ CMSAdminUtil.repaintComp(mMinLabel);
+ if (!mDaily.isSelected()) {
+ CMSAdminUtil.enableJTextField(mGracePeriod, false, getBackground());
+ mGracePeriodLabel.setEnabled(false);
+ CMSAdminUtil.repaintComp(mGracePeriodLabel);
+ mGracePeriodMinLabel.setEnabled(false);
+ CMSAdminUtil.repaintComp(mGracePeriodMinLabel);
+ }
+ }
+ }
+
+ super.actionPerformed(e);
+ }
+
+ private void enableFields() {
+ boolean enable = mEnableCRL.isSelected();
+ Color color = (enable)? mActiveColor: getBackground();
+
+ CMSAdminUtil.enableJTextField(mCRLGen, enable, color);
+ mCRLGenLabel.setEnabled(enable);
+ CMSAdminUtil.repaintComp(mCRLGenLabel);
+ mDeltaGenLabel.setEnabled(enable);
+ CMSAdminUtil.repaintComp(mDeltaGenLabel);
+
+ mExtendNextUpdateLabel.setEnabled(enable);
+ CMSAdminUtil.repaintComp(mExtendNextUpdateLabel);
+ mExtendNextUpdate.setEnabled(enable);
+ CMSAdminUtil.repaintComp(mExtendNextUpdate);
+
+ mAlways.setEnabled(enable);
+ CMSAdminUtil.repaintComp(mAlways);
+
+ mDaily.setEnabled(enable);
+ CMSAdminUtil.repaintComp(mDaily);
+
+ boolean enable1 = enable && mDaily.isSelected();
+ Color color1 = (enable1)? mActiveColor: getBackground();
+ CMSAdminUtil.enableJTextField(mDailyAt, enable1, color1);
+
+ mEnableFreq.setEnabled(enable);
+ CMSAdminUtil.repaintComp(mEnableFreq);
+
+ boolean enable2 = enable && mEnableFreq.isSelected();
+ Color color2 = (enable2)? mActiveColor: getBackground();
+ CMSAdminUtil.enableJTextField(mFrequency, enable2, color2);
+ mMinLabel.setEnabled(enable2);
+ CMSAdminUtil.repaintComp(mMinLabel);
+
+ boolean enable3 = enable1 || enable2;
+ Color color3 = (enable3)? mActiveColor: getBackground();
+ CMSAdminUtil.enableJTextField(mGracePeriod, enable3, color3);
+ mGracePeriodLabel.setEnabled(enable3);
+ CMSAdminUtil.repaintComp(mGracePeriodLabel);
+ mGracePeriodMinLabel.setEnabled(enable3);
+ CMSAdminUtil.repaintComp(mGracePeriodMinLabel);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSCertSettingPanel.java b/base/console/src/com/netscape/admin/certsrv/config/CMSCertSettingPanel.java
new file mode 100644
index 000000000..975ba97da
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSCertSettingPanel.java
@@ -0,0 +1,150 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.management.client.util.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.*;
+
+/**
+ * CA Certificate Setting
+ *
+ * @author Christine Ho
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public abstract class CMSCertSettingPanel extends CMSBaseTab {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ protected JLabel _mapper, _publisher;
+ protected CMSBaseResourceModel _model;
+ protected AdminConnection _admin;
+ protected JButton mMapper, mPublisher;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+
+ public CMSCertSettingPanel(String panelName, CMSTabPanel parent) {
+ super(panelName, parent);
+ _model = parent.getResourceModel();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * Actual UI construction
+ */
+ public void init() {
+ _admin = _model.getServerInfo().getAdmin();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ CMSAdminUtil.resetGBC(gbc);
+ mCenterPanel.setLayout(gb);
+
+ JPanel mapPanel = new JPanel();
+ GridBagLayout gb2 = new GridBagLayout();
+ mapPanel.setLayout(gb2);
+ mapPanel.setBorder(makeTitledBorder("MAPPER"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints(mapPanel, gbc);
+ mCenterPanel.add(mapPanel);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel mapperLabel = makeJLabel("MAPPER");
+ _mapper = new JLabel("");
+ mMapper = makeJButton("MAPPER");
+ addEntryField(mapPanel, mapperLabel, _mapper, mMapper , gbc);
+
+ JPanel certSetting = new JPanel();
+ GridBagLayout gb1 = new GridBagLayout();
+ certSetting.setLayout(gb1);
+ certSetting.setBorder(makeTitledBorder("PUBLISHER"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(certSetting, gbc);
+ mCenterPanel.add(certSetting);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel publisherLabel = makeJLabel("PUBLISHER");
+ _publisher = new JLabel("");
+ mPublisher = makeJButton("PUBLISHER");
+ addEntryField(certSetting, publisherLabel, _publisher, mPublisher, gbc);
+ }
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+
+ protected int getIndex(String value, String[] source) {
+ for (int i=0; i<source.length; i++) {
+ if (value.equals(source[i]))
+ return i;
+ }
+ return -1;
+ }
+
+ /**
+ * Add 3 components in the same row to a panel, assumed to be using
+ * GridBagLayout. Customized for the LDAP certificate mappings/publishing
+ * UI.
+ */
+ protected void addEntryField(JPanel panel, JComponent field1,
+ JComponent field2, JComponent field3, GridBagConstraints gbc) {
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.gridx = 0;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,0,0);
+ panel.add( field1, gbc );
+
+ gbc.gridx++;
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = 1;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0,0);
+ panel.add(field2, gbc);
+
+ gbc.gridx++;
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ 0,DIFFERENT_COMPONENT_SPACE);
+ panel.add( field3, gbc );
+ }
+
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSCipherPreferenceDialog.java b/base/console/src/com/netscape/admin/certsrv/config/CMSCipherPreferenceDialog.java
new file mode 100644
index 000000000..69e208be5
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSCipherPreferenceDialog.java
@@ -0,0 +1,201 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.security.CipherPreferenceDialog;
+import com.netscape.management.client.util.*;
+import javax.swing.*;
+import java.awt.*;
+
+/**
+ * Allows user to select the SSL cipher preferences.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class CMSCipherPreferenceDialog extends AbstractDialog {
+
+ CMSSSL2CipherPreference ssl2CipherPref = null;
+ CMSSSL3CipherPreference ssl3CipherPref = null;
+
+ public final static int SSL2 = 1;
+ public final static int SSL3 = 2;
+ private JPanel cipherPreferencePane;
+ boolean modified = true;
+ private static final ResourceSet mHelpResource =
+ new ResourceSet("com.netscape.admin.certsrv.certsrv-help");
+ Help help;
+
+ public CMSCipherPreferenceDialog(JFrame parent, boolean isDomestic) {
+ this(parent, isDomestic, false);
+ }
+
+ public CMSCipherPreferenceDialog(JFrame parent, boolean isDomestic,
+ boolean hasFortezza) {
+ this(parent, isDomestic, hasFortezza, SSL2|SSL3);
+ }
+
+ public CMSCipherPreferenceDialog(JFrame parent, boolean isDomestic,
+ boolean hasFortezza, int SSLVersion) {
+
+ super(parent, "", true, OK | CANCEL | HELP);
+ cipherPreferencePane = new JPanel();
+ cipherPreferencePane.setLayout(new BoxLayout(cipherPreferencePane, BoxLayout.Y_AXIS));
+ if ((SSL2 & SSLVersion) == SSL2) {
+ ssl2CipherPref = new CMSSSL2CipherPreference(isDomestic);
+ cipherPreferencePane.add(ssl2CipherPref);
+ }
+
+ if ((SSL3 & SSLVersion) == SSL3) {
+ ssl3CipherPref = new CMSSSL3CipherPreference(isDomestic, hasFortezza);
+ cipherPreferencePane.add(ssl3CipherPref);
+ }
+
+ cipherPreferencePane.add(Box.createRigidArea(new Dimension(0,4)));
+ getContentPane().add(cipherPreferencePane);
+ pack();
+ }
+
+ public void removeSSLVersion(int sslVersion) {
+ switch (sslVersion) {
+ case SSL2:
+ cipherPreferencePane.remove(ssl2CipherPref);
+ break;
+ case SSL3:
+ cipherPreferencePane.remove(ssl3CipherPref);
+ break;
+ }
+ pack();
+ }
+
+ public boolean isCipherEnabled(String cipher) {
+ return (((ssl2CipherPref == null)?false:ssl2CipherPref.isCipherEnabled(cipher))||
+ ((ssl3CipherPref == null)?false:ssl3CipherPref.isCipherEnabled(cipher)));
+ }
+
+ public void setCipherEnabled(String cipher, boolean enable) {
+ if (ssl2CipherPref != null) {
+ ssl2CipherPref.setCipherEnabled(cipher, enable);
+ }
+ if (ssl3CipherPref != null) {
+ ssl3CipherPref.setCipherEnabled(cipher, enable);
+ }
+ }
+
+ public String[] getSSLPreference(int sslVersion) {
+ String[] cipher = null;
+ switch(sslVersion) {
+ case SSL2:
+ cipher = ssl2CipherPref.getCipherList();
+ break;
+ case SSL3:
+ cipher = ssl3CipherPref.getCipherList();
+ break;
+ default:
+ break;
+ }
+
+ return cipher;
+ }
+
+ public boolean isSSLEnabled(int sslVersion) {
+ boolean enable = false;
+ switch (sslVersion) {
+ case SSL2:
+ enable = ssl2CipherPref.isEnabled();
+ break;
+
+ case SSL3:
+ enable = ssl3CipherPref.isEnabled();
+ break;
+
+ default:
+ break;
+ }
+
+ return enable;
+ }
+
+ public void setSSLEnabled(int sslVersion, boolean enable) {
+ switch (sslVersion) {
+ case SSL2:
+ ssl2CipherPref.setEnabled(enable);
+ break;
+
+ case SSL3:
+ ssl3CipherPref.setEnabled(enable);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ public boolean isModified() {
+ return modified;
+ }
+
+ public void reset() {
+ if (ssl2CipherPref != null)
+ ssl2CipherPref.reset();
+
+ if (ssl3CipherPref != null)
+ ssl3CipherPref.reset();
+ }
+
+ public void setSaved() {
+ if (ssl2CipherPref != null) {
+ ssl2CipherPref.setSaved();
+ }
+
+ if (ssl3CipherPref != null) {
+ ssl3CipherPref.setSaved();
+ }
+ }
+
+ public void setSaved(boolean saved) {
+ if (saved) {
+ if (ssl2CipherPref != null) {
+ ssl2CipherPref.setSaved();
+ }
+ if (ssl3CipherPref != null) {
+ ssl3CipherPref.setSaved();
+ }
+ }
+ }
+
+ protected void cancelInvoked() {
+ reset();
+ modified = false;
+ super.cancelInvoked();
+ }
+
+ protected void okInvoked() {
+ modified = (((ssl2CipherPref==null)?false:ssl2CipherPref.isModified()) ||
+ ((ssl3CipherPref==null)?false:ssl3CipherPref.isModified()));
+ setSaved();
+ super.okInvoked();
+ }
+
+ protected void helpInvoked() {
+ new Help(mHelpResource).help("configuration-overview");
+// help.help("SSL", "Preference");
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSCipherPreferencePane.java b/base/console/src/com/netscape/admin/certsrv/config/CMSCipherPreferencePane.java
new file mode 100644
index 000000000..88faf2a71
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSCipherPreferencePane.java
@@ -0,0 +1,112 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.security.*;
+import java.awt.event.*;
+import java.awt.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import javax.swing.plaf.*;
+import com.netscape.management.nmclf.*;
+import com.netscape.admin.certsrv.*;
+
+/**
+ * Constructs a Cipher preference pane.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class CMSCipherPreferencePane extends AbstractCipherPreference implements ICipherConstants {
+ private JCheckBox on;
+ private JPanel top = new JPanel();
+ boolean _ismodified;
+ boolean oldValue;
+
+ public CMSCipherPreferencePane(IAbstractCipherSet cipherSet) {
+ this(cipherSet, true);
+ }
+
+ public CMSCipherPreferencePane(IAbstractCipherSet cipherSet, boolean enabled) {
+ oldValue = enabled;
+ on = new JCheckBox(cipherSet.getTitle(), enabled);
+ on.setActionCommand("ENABLED");
+ on.addActionListener(new actionListener());
+ top.setLayout(new BoxLayout(top, BoxLayout.Y_AXIS));
+ top.add(on);
+ setBorder(new CompoundBorder(new ToggleBorder(top, SwingConstants.TOP),
+ new EmptyBorder(0, SuiConstants.COMPONENT_SPACE, SuiConstants.COMPONENT_SPACE, 0)));
+ add(top);
+ initialize(cipherSet);
+ add(Box.createHorizontalGlue());
+ }
+
+ class actionListener implements ActionListener{
+ public void actionPerformed(ActionEvent e) {
+ if (e.getActionCommand().equals("ENABLED")) {
+ _ismodified = true;
+ setEnableAll(on.isSelected());
+ }
+ }
+ }
+
+ public void setEnabled(boolean enable) {
+ on.setSelected(enable);
+ super.setEnableAll(enable);
+ }
+
+ public boolean isEnabled() {
+ return on.isSelected();
+ }
+
+
+ class ToggleBorder extends EtchedBorder {
+ private JComponent _switchPanel;
+ private int _switchAlign;
+
+ public ToggleBorder(JComponent sp, int align) {
+ _switchPanel = sp;
+ _switchAlign = align;
+ }
+
+ public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
+ Color save = g.getColor();
+ int top = y + (_switchPanel.getHeight() >> 1);
+ int new_height = height - top;
+ BorderUIResource.getEtchedBorderUIResource().paintBorder(c, g, x, top, width, new_height);
+ }
+ }
+
+ public boolean isModified() {
+ return (_ismodified | super.isModified());
+ }
+
+ public void reset() {
+ setEnabled(oldValue);
+ _ismodified = false;
+ super.reset();
+ }
+
+ public void setSaved() {
+ oldValue = isEnabled();
+ _ismodified = false;
+ super.setSaved();
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSEAGeneralPanel.java b/base/console/src/com/netscape/admin/certsrv/config/CMSEAGeneralPanel.java
new file mode 100644
index 000000000..2d35133df
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSEAGeneralPanel.java
@@ -0,0 +1,169 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.*;
+
+/**
+ * KRA General Setting
+ *
+ * @author Ade Lee
+ * @version $Revision: 1211 $, $Date: 2010-08-18 13:15:37 -0400 (Wed, 18 Aug 2010) $
+ */
+public class CMSEAGeneralPanel extends CMSBaseTab implements ItemListener {
+
+ private static String PANEL_NAME = "EAGENERAL";
+ private static CMSBaseResourceModel mModel;
+ protected AdminConnection mAdmin;
+ private JTextField mNumberOfAgentsText;
+ private CMSTabPanel mParent;
+ private static final String EAHELPINDEX =
+ "configuration-ea-general-help";
+
+ public CMSEAGeneralPanel(CMSTabPanel parent) {
+ super(PANEL_NAME, parent);
+ mModel = parent.getResourceModel();
+ mParent = parent;
+ mHelpToken = EAHELPINDEX;
+ }
+
+ public void init() {
+ Debug.println("CMSEAGeneral: init()");
+ mAdmin = mModel.getServerInfo().getAdmin();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ CMSAdminUtil.resetGBC(gbc);
+ mCenterPanel.setLayout(gb);
+
+ JPanel agentsPanel = new JPanel();
+ GridBagLayout gb2 = new GridBagLayout();
+ agentsPanel.setLayout(gb2);
+ agentsPanel.setBorder(makeTitledBorder("AGENTS"));
+
+ CMSAdminUtil.resetGBC(gbc);
+ mCenterPanel.setLayout(gb);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(agentsPanel, gbc);
+ mCenterPanel.add(agentsPanel);
+
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel numberLabel = makeJLabel("NUMBER");
+ mNumberOfAgentsText = makeJTextField(30);
+ CMSAdminUtil.addEntryField(agentsPanel, numberLabel, mNumberOfAgentsText, gbc);
+
+ refresh();
+ }
+
+ public void refresh() {
+ mModel.progressStart();
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_NO_OF_REQUIRED_RECOVERY_AGENTS, "1");
+
+ try {
+ NameValuePairs val = mAdmin.read(DestDef.DEST_KRA_ADMIN,
+ ScopeDef.SC_GENERAL, Constants.RS_ID_CONFIG, nvps);
+
+ populate(val);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ }
+ mModel.progressStop();
+ clearDirtyFlag();
+ }
+
+ protected void populate(NameValuePairs nvps) {
+ for (String name : nvps.keySet()) {
+ String value = nvps.get(name);
+ if (name.equals(Constants.PR_NO_OF_REQUIRED_RECOVERY_AGENTS)) {
+ mNumberOfAgentsText.setText(value);
+ }
+ }
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ super.actionPerformed(e);
+ }
+
+ /**
+ * Implementation for saving panel information
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean applyCallback() {
+ String numberOfAgents = mNumberOfAgentsText.getText().trim();
+
+ if (numberOfAgents.equals("")) {
+ showMessageDialog("BLANKFIELD");
+ return false;
+ }
+
+ try {
+ int num = Integer.parseInt(numberOfAgents);
+ if (num < 1) {
+ showMessageDialog("NUMBERRANGE");
+ return false;
+ }
+ } catch (NumberFormatException e) {
+ showMessageDialog("NUMBERFORMAT");
+ return false;
+ }
+
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_NO_OF_REQUIRED_RECOVERY_AGENTS,
+ numberOfAgents);
+
+ mModel.progressStart();
+ try {
+ mAdmin.modify(DestDef.DEST_KRA_ADMIN,
+ ScopeDef.SC_GENERAL, Constants.RS_ID_CONFIG, nvps);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ return false;
+ }
+ mModel.progressStop();
+ clearDirtyFlag();
+ mParent.setOKCancel();
+ return true;
+ }
+
+ /**
+ * Implementation for reset values
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean resetCallback() {
+ refresh();
+ return true;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSEncryptionPanel.java b/base/console/src/com/netscape/admin/certsrv/config/CMSEncryptionPanel.java
new file mode 100644
index 000000000..913974eaf
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSEncryptionPanel.java
@@ -0,0 +1,835 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.management.client.console.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.certsrv.common.*;
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import java.awt.event.*;
+import javax.swing.border.*;
+import com.netscape.management.client.util.*;
+import com.netscape.admin.certsrv.keycert.*;
+import com.netscape.admin.certsrv.managecert.*;
+
+/**
+ * Encryption panel used for setup server encryption options.
+ * This is a wrapper class that emulates the CMSBaseTab API
+ * calls.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class CMSEncryptionPanel extends CMSBaseTab {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static String PANEL_NAME = "ENCRYPTION";
+ private ConsoleInfo mConsoleInfo;
+ private CMSServerInfo mServerInfo;
+ private AdminConnection mConnection;
+ private JPanel mEncryptPane;
+ private JComboBox mSelection, mTokenList, mCertList;
+ private Hashtable mCertMapping; //maps the function list items to tags
+ private String mSelectedItem, mSelectedToken, mSelectedCert;
+ private JButton mWizard, mCipherPref, mSetup;
+ private Hashtable mTokenCertList; //container for tokens and certs (Vector)
+ private boolean mIsDomestic = false;
+ private boolean mHasFortezza = false;
+ private Vector mCipherPrefStore;
+ private CMSCipherPreferenceDialog mCipherDialog;
+ private boolean updateFlag = false;
+ private boolean mSelectionIgnore = false;
+ private boolean mWarningOn = false;
+ private static final String HELPINDEX =
+ "configuration-system-encryption-help";
+
+ /**=========================================================
+ * constructors
+ * @param parent the parent panel
+ * @see com.netscape.admin.certsrv.config.CMSTabPanel
+ *==========================================================*/
+ public CMSEncryptionPanel(CMSTabPanel parent) {
+ super(PANEL_NAME, parent);
+ mConsoleInfo = parent.getResourceModel().getConsoleInfo();
+ mServerInfo = parent.getResourceModel().getServerInfo();
+ mConnection = mServerInfo.getAdmin();
+ mCertMapping = new Hashtable();
+ mTokenCertList = new Hashtable();
+ mCipherPrefStore = new Vector();
+ mHelpToken = HELPINDEX;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * Actual Instanciation of the UI components
+ */
+ public void init() {
+ Debug.println("EncryptionPanel: init()");
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ CMSAdminUtil.resetGBC(gbc);
+ mCenterPanel.setLayout(gb);
+
+ //certificate settings
+ JPanel top = new JPanel();
+ GridBagLayout gb2 = new GridBagLayout();
+ top.setLayout(gb2);
+ top.setBorder( new CompoundBorder(
+ BorderFactory.createTitledBorder(
+ mResource.getString("ENCRYPTION_BORDER_CERT_LABEL")),
+ new EmptyBorder(-3,
+ 0,
+ DIFFERENT_COMPONENT_SPACE - 3,
+ 0)));
+
+ //add selection combobox
+ JLabel label1 = makeJLabel("SELECT");
+ mSelection = new JComboBox();
+ updateCertSelection(); //dynamically generate this list
+ addTopEntryField(top, label1, mSelection, gbc);
+ if (mSelection.getItemCount()>0) {
+ mSelection.setSelectedIndex(0);
+ mSelectedItem = (String) mSelection.getSelectedItem();
+ } else {
+ //disable if nothing there
+ mSelection.setEnabled(false);
+ }
+ mSelection.addItemListener(this);
+
+ //add encryption panel
+ mEncryptPane = createCertEntry();
+ //mEncryptPane = new InnerEncryptionPane(mConsoleInfo);
+ //mEncryptPane.addEncryptionPaneListener(this);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ //gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ //gbc.weighty = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,
+ COMPONENT_SPACE,0,COMPONENT_SPACE);
+ gb2.setConstraints(mEncryptPane, gbc);
+ top.add(mEncryptPane);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints(top, gbc);
+ mCenterPanel.add(top);
+
+ mWizard = makeJButton("WIZARD");
+ mCipherPref = makeJButton("CIPHERPREF");
+ mSetup = makeJButton("SETUP");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ //addButtonEntryField(mCenterPanel, mSetup, mWizard, mCipherPref, gbc);
+ addButtonEntryField(mCenterPanel, mSetup, mWizard, gbc);
+ //addButtonEntryField(mCenterPanel, mCipherPref, gbc);
+
+ /* retrieve data from server and
+ * feed data into mEncryptionPane for display ...
+ */
+ refresh();
+ }
+
+ /**
+ * Implementation for saving panel information
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean applyCallback() {
+ if (mWarningOn) {
+ String errorMsg =
+ mResource.getString(mPanelName+"_LABEL_WARNING_LABEL");
+ JOptionPane.showMessageDialog(new JFrame(), errorMsg, "Warning",
+ JOptionPane.WARNING_MESSAGE,
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_WARN_ICON));
+ mWarningOn = false;
+ return false;
+ }
+
+ //save current changes if modified
+ saveChanges((String) mSelection.getSelectedItem());
+
+ //construct NVP parameters
+ NameValuePairs nvp = new NameValuePairs();
+ for (Enumeration e = mCertMapping.keys() ; e.hasMoreElements() ;) {
+ CipherEntryData data =
+ (CipherEntryData)mCertMapping.get(e.nextElement());
+ nvp.put(data.getTagName(), data.getTokenName() + "," + data.getCertName());
+ }
+
+ if (updateCertMap(nvp)) {
+ mWarningOn = false;
+ clearDirtyFlag();
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Implementation for reset values
+ * @return true if reset successful; otherwise, false.
+ */
+ public boolean resetCallback() {
+ refresh();
+ mWarningOn = false;
+ return true;
+ }
+
+ /**
+ * retrieve data from server and
+ * feed data into mEncryptPane for display ...
+ * refresh the panel and update data
+ */
+ public void refresh() {
+
+ //call server to get the encryption settings
+ NameValuePairs response;
+ try {
+ response = updateSecurityInformation();
+ } catch(EAdminException e) {
+ //display error dialog
+ CMSAdminUtil.showErrorDialog(mParent.getResourceModel().getFrame(), mResource,
+ e.getMessage(), CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+
+ //setup the data and UI
+ updateFlag = true;
+ cleanup();
+ setupDataContainer(response);
+ setupComboSelection();
+ updateFlag = false;
+
+ clearDirtyFlag();
+ }
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent e) {
+/*
+ if (e.getSource().equals(mSetup)) {
+ Debug.println("Configure cert");
+ InstallWizardInfo info = new InstallWizardInfo();
+ InstallWizard wizard = new InstallWizard(
+ mParent.getResourceModel().getFrame(), info);
+ return;
+ }
+*/
+ if (e.getSource().equals(mSetup)) {
+ ManageCertDialog manageDialog =
+ new ManageCertDialog(mParent.getResourceModel().getFrame());
+ manageDialog.showDialog(mParent.getResourceModel().getServerInfo().getAdmin());
+ }
+ if (e.getSource().equals(mWizard)) {
+ Debug.println("Wizard");
+
+ //XXX launch OUR OWN wizard
+ CertSetupWizardInfo info = new
+ CertSetupWizardInfo(mConnection, mConsoleInfo);
+ CertSetupWizard wizard = new CertSetupWizard(mParent.getResourceModel(), info);
+ // mParent.getResourceModel().getFrame(), info);
+ //KeyCertWizard wizard = new KeyCertWizard(mConnection);
+
+ //XXX we should update the settings to reflect the changes
+
+
+ return;
+ }
+ if (e.getSource().equals(mCipherPref)) {
+ Debug.println("Wizard");
+
+ if (mCipherDialog == null) {
+ mCipherDialog = new CMSCipherPreferenceDialog(mParent.mModel.getFrame(),
+ mIsDomestic,
+ mHasFortezza,
+ CMSCipherPreferenceDialog.SSL2|CMSCipherPreferenceDialog.SSL3);
+
+ }
+
+ refresh();
+ setupCipherDialog(mCipherDialog);
+
+ mCipherDialog.show();
+
+ if (!mCipherDialog.isModified())
+ return;
+
+ //Save the cipher settings
+ StringBuffer buf = new StringBuffer();
+
+ if (mCipherDialog.isSSLEnabled(mCipherDialog.SSL2)) {
+ String[] v2 = mCipherDialog.getSSLPreference(mCipherDialog.SSL2);
+ for (int i=0; i< v2.length; i++) {
+ if (mCipherDialog.isCipherEnabled(v2[i])) {
+ if (buf.length()>0)
+ buf.append(",");
+ buf.append(v2[i]);
+ }
+ }
+ }
+
+ if (mCipherDialog.isSSLEnabled(mCipherDialog.SSL3)) {
+ String[] v3 = mCipherDialog.getSSLPreference(mCipherDialog.SSL3);
+ for (int i=0; i< v3.length; i++) {
+ if (mCipherDialog.isCipherEnabled(v3[i])) {
+ if (buf.length()>0)
+ buf.append(",");
+ buf.append(v3[i]);
+ }
+ }
+ }
+
+ updateCipherPref(buf.toString());
+
+ //save the new settings
+ mCipherDialog.setSaved(true);
+
+ return;
+ }
+ }
+
+ //== ItemListener ==
+ public void itemStateChanged(ItemEvent e){
+
+ if (e.getSource().equals(mSelection)) {
+ if (e.getStateChange() == e.SELECTED) {
+ if (!mSelectionIgnore) {
+ updateFlag = true;
+ saveChanges(mSelectedItem);
+ mSelectedItem = (String) mSelection.getSelectedItem();
+ setupComboSelection();
+ updateFlag = false;
+ }
+ }
+ } else if (e.getSource().equals(mTokenList)) {
+ if ( (!updateFlag) && (e.getStateChange() == e.SELECTED) ){
+ Debug.println("Token Selected");
+ setDirtyFlag();
+ updateFlag = true;
+ setupCertCombo();
+ updateFlag = false;
+ }
+ } else if (e.getSource().equals(mCertList)) {
+ if ( (!updateFlag) && (e.getStateChange() == e.SELECTED) ){
+ Debug.println("Cert Selected");
+ saveChanges(mSelectedItem);
+ setupComboSelection();
+ setDirtyFlag();
+ }
+ }
+ mWarningOn = true;
+ }
+
+ /*==========================================================
+ * Private Methods
+ *==========================================================*/
+
+ //save the mappings if changes made
+ private void saveChanges(String entry) {
+ if ( (!mSelectedToken.equals((String)mTokenList.getSelectedItem())) ||
+ (!mSelectedCert.equals((String)mCertList.getSelectedItem())) ) {
+
+ CipherEntryData data = (CipherEntryData) mCertMapping.get(entry);
+ data.setData((String)mTokenList.getSelectedItem(),
+ (String)mCertList.getSelectedItem());
+ }
+ }
+
+ //cleanup the
+ private void cleanup() {
+ mTokenCertList.clear();
+ mCipherPrefStore.removeAllElements();
+ mTokenList.removeAllItems();
+ mCertList.removeAllItems();
+ }
+
+ //setup the cipher dialog
+ private void setupCipherDialog(CMSCipherPreferenceDialog dialog) {
+ Debug.println("setupCipherDialog");
+ dialog.setSSLEnabled(dialog.SSL3,true);
+
+ //set selected/unselected ciphers
+ String[] v2 = dialog.getSSLPreference(dialog.SSL2);
+
+ if (v2.length <= 0)
+ dialog.setSSLEnabled(dialog.SSL2,false);
+ else
+ dialog.setSSLEnabled(dialog.SSL2,true);
+
+ for (int i=0; i< v2.length; i++) {
+ if (mCipherPrefStore.contains(v2[i])) {
+ //Debug.println("setEnable: "+v2[i]);
+ dialog.setCipherEnabled(v2[i], true);
+ } else {
+ //Debug.println("setDisable: "+v2[i]);
+ dialog.setCipherEnabled(v2[i], false);
+ }
+ }
+ String[] v3 = dialog.getSSLPreference(dialog.SSL3);
+ if (v3.length <= 0)
+ dialog.setSSLEnabled(dialog.SSL3,false);
+ else
+ dialog.setSSLEnabled(dialog.SSL3,true);
+
+ for (int i=0; i< v3.length; i++) {
+ if (mCipherPrefStore.contains(v3[i])) {
+ //Debug.println("setEnable: "+v3[i]);
+ dialog.setCipherEnabled(v3[i], true);
+ } else {
+ //Debug.println("setDisable: "+v3[i]);
+ dialog.setCipherEnabled(v3[i], false);
+ }
+ }
+
+ mCipherDialog.setSaved(true);
+ }
+
+ //initialize the data containers
+ private void setupDataContainer(NameValuePairs response) {
+
+ //setup security version flag
+ String version = response.get(Constants.PR_CIPHER_VERSION);
+ if ( (version != null) && (version.equals(
+ Constants.PR_CIPHER_VERSION_DOMESTIC)) ) {
+ mIsDomestic = true;
+ }
+
+ //setup fortezza flag
+ String fortezza = response.get(Constants.PR_CIPHER_FORTEZZA);
+ if ( (fortezza != null) && (fortezza.equalsIgnoreCase("TRUE")) ){
+ mHasFortezza = true;
+ }
+
+ //setup cipher preference settings
+ String cipherpref = response.get(Constants.PR_CIPHER_PREF);
+ //Debug.println("cipher preference: "+cipherpref);
+ if ( (cipherpref != null) && (!cipherpref.trim().equals("")) ) {
+ StringTokenizer tokenizer = new StringTokenizer(cipherpref, ",");
+ while (tokenizer.hasMoreTokens()) {
+ String pref = tokenizer.nextToken().trim();
+ //Debug.println("Add cipher: "+pref);
+ mCipherPrefStore.addElement(pref);
+ }
+ } else {
+ Debug.println("ERROR: CMSEncryptionPanel: setupDataContainer()- no cert pref list");
+ }
+
+ //setup the cipher entry data - loop through table and retrieve
+ //the current mappings
+ mSelectionIgnore = true;
+ for (Enumeration e = mCertMapping.keys() ; e.hasMoreElements() ;) {
+ String name = (String) e.nextElement();
+ CipherEntryData data = (CipherEntryData)mCertMapping.get(name);
+ String value = response.get(data.getTagName());
+ if ( (value != null) && (!value.trim().equals("")) ) {
+ StringTokenizer tokenizer = new StringTokenizer(value, ",");
+ try {
+ String token = tokenizer.nextToken().trim();
+ String cert = tokenizer.nextToken().trim();
+ data.setData(token, cert);
+ } catch(Exception ex) {
+ Debug.println("ERROR: CMSEncryptionPanel: setupDataContainer()- no token/cert not complete");
+ }
+ } else {
+ Debug.println("ERROR: CMSEncryptionPanel: setupDataContainer()- no token/cert for:"+data.getTagName());
+ mCertMapping.remove(name);
+ mSelection.removeItem(name);
+ Debug.println("RECOVER: CMSEncryptionPanel: setupDataContainer()- "+name+" removed from selection");
+ }
+ }
+ mSelectionIgnore = false;
+
+ //setup the token-cert list data table
+ String tokenlist = response.get(Constants.PR_TOKEN_LIST);
+ if ( (tokenlist != null) && (!tokenlist.trim().equals("")) ) {
+ StringTokenizer tokenizer = new StringTokenizer(tokenlist, ",");
+ while (tokenizer.hasMoreTokens()) {
+ String token = tokenizer.nextToken().trim();
+ Debug.println("Token: "+token);
+
+ //get the certificate associated with this token
+ String certList = response.get(Constants.PR_TOKEN_PREFIX + token);
+ Vector certVector = new Vector();
+ if ( (certList != null) && (!certList.trim().equals("")) ) {
+ StringTokenizer tokenizer2 = new StringTokenizer(certList, ",");
+ while (tokenizer2.hasMoreTokens()) {
+ certVector.addElement(tokenizer2.nextToken().trim());
+ }
+ } else {
+ Debug.println("WARNING: CMSEncryptionPanel: setupDataContainer()- no certlist for: "+token);
+ }
+
+ //set the token-cert to hashtable
+ mTokenCertList.put(token, certVector);
+ mTokenList.addItem(token);
+ }
+ } else {
+ Debug.println("ERROR: CMSEncryptionPanel: setupDataContainer()- no tokenlist");
+ }
+
+ //setup the initial combobox selection
+ String newToken = (String) mTokenList.getSelectedItem();
+ mSelectedToken = newToken;
+ mCertList.removeAllItems();
+ Vector list = (Vector) mTokenCertList.get(newToken);
+ for (int i=0; i< list.size(); i++)
+ mCertList.addItem(list.elementAt(i));
+ }
+
+ //setup combobox selection
+ private void setupComboSelection() {
+ //get current function selection
+ CipherEntryData data = (CipherEntryData) mCertMapping.get(mSelection.getSelectedItem());
+
+ //select correct token from the token list
+ String oldToken = (String) mTokenList.getSelectedItem();
+ String newToken = data.getTokenName();
+ if (!oldToken.equals(newToken)) {
+ mTokenList.setSelectedItem(newToken);
+ mSelectedToken = newToken;
+ setupCertCombo();
+ }
+ //select correct certiicate from the cert list
+ mCertList.setSelectedItem(data.getCertName());
+ mSelectedCert = data.getCertName();
+ }
+
+ //setup the certlist combo
+ private void setupCertCombo() {
+ String newToken = (String) mTokenList.getSelectedItem();
+ mCertList.removeAllItems();
+ Vector list = (Vector) mTokenCertList.get(newToken);
+ for (int i=0; i< list.size(); i++)
+ mCertList.addItem(list.elementAt(i));
+ }
+
+ //creating the certificate mapping UI components
+ private JPanel createCertEntry() {
+ JPanel panel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ CMSAdminUtil.resetGBC(gbc);
+ panel.setLayout(gb);
+
+ //set border
+ panel.setBorder( new CompoundBorder(
+ BorderFactory.createTitledBorder(mResource.getString("ENCRYPTION_BORDER_MAPTO_LABEL")),
+ new EmptyBorder(-3,
+ 0,
+ CMSAdminUtil.DIFFERENT_COMPONENT_SPACE,
+ 0)));
+
+ //add components
+ mTokenList = new JComboBox();
+ mTokenList.addItemListener(this);
+ mCertList = new JComboBox();
+ mCertList.addItemListener(this);
+ JLabel label1 = makeJLabel("TOKEN");
+ JLabel label2 = makeJLabel("CERTIFICATE");
+ CMSAdminUtil.addEntryField(panel, label1, mTokenList, label2, mCertList, gbc);
+ return panel;
+ }
+
+ /**
+ * The certificates used by each subsystem are stored as cert list
+ * strings in the resource file using the PR_ prefix tags.
+ */
+ private void updateCertSelection() {
+ //get installed subsystem
+ Vector v = mServerInfo.getInstalledSubsystems();
+
+ //add default system certificate list
+ String certs;
+ try {
+ certs = mResource.getString("ENCRYPTION_SERVER_CERTS");
+ } catch (MissingResourceException e) {
+ Debug.println("ERROR: unable retrieving server default cert list");
+ certs = "";
+ }
+ if (!certs.trim().equals("")) {
+ StringTokenizer tokenizer = new StringTokenizer(certs, ",");
+ while (tokenizer.hasMoreTokens()) {
+ String certname = tokenizer.nextToken().trim();
+ loadCertList(certname);
+ }
+ }
+
+ //create additional subsystem certificate list
+ for (int i=0; i< v.size(); i++) {
+ String name = (String)v.elementAt(i);
+ try {
+ String certlist = mResource.getString(PANEL_NAME+"_"+name+"_CERTS");
+ if (!certlist.trim().equals("")) {
+ StringTokenizer tokenizer = new StringTokenizer(certlist, ",");
+ while (tokenizer.hasMoreTokens()) {
+ String certname = tokenizer.nextToken().trim();
+ loadCertList(certname);
+ }
+ }
+ } catch (MissingResourceException e) {
+ Debug.println("ERROR: unable retrieving subsystem certificate list: "+name);
+ }
+ }
+ }
+
+ //register the certificate and mapping entry
+ private void loadCertList(String certTag) {
+ //add to selection list
+ String name;
+ try {
+ name = mResource.getString("ENCRYPTION_COMBOBOX_SELECT_VALUE_"+certTag);
+ } catch (MissingResourceException e) {
+ Debug.println("ERROR: cert resource not found: "+certTag);
+ return;
+ }
+ mSelection.addItem(name);
+ mCertMapping.put(name, new CipherEntryData(certTag));
+ }
+
+ private static void addTopEntryField(JPanel panel, JComponent label,
+ JComponent field, GridBagConstraints gbc) {
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.gridx = 0;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,0,0);
+ panel.add( label, gbc );
+
+ gbc.gridx++;
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ 0,DIFFERENT_COMPONENT_SPACE);
+ panel.add( field, gbc );
+ }
+
+ private static void addButtonEntryField(JPanel panel,
+ JComponent field, GridBagConstraints gbc) {
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.gridx = 0;
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0,0);
+ //gbc.insets = new Insets(DIFFERENT_COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,0,0);
+ panel.add(new JLabel(""));
+
+ gbc.gridx++;
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ //gbc.insets = new Insets(DIFFERENT_COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,
+ // 0,DIFFERENT_COMPONENT_SPACE);
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ 0,COMPONENT_SPACE);
+ panel.add( field, gbc );
+ }
+
+ private static void addButtonEntryField(JPanel panel, JComponent label,
+ JComponent field, GridBagConstraints gbc) {
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.gridx = 0;
+ gbc.anchor = gbc.NORTHEAST;
+ //gbc.insets = new Insets(DIFFERENT_COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,0,0);
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0,0);
+ panel.add(new JLabel(""));
+
+ gbc.gridx++;
+ gbc.weightx = 1.0;
+ panel.add( label, gbc );
+
+ gbc.gridx++;
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ //gbc.insets = new Insets(DIFFERENT_COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,
+ //0,DIFFERENT_COMPONENT_SPACE);
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ 0,COMPONENT_SPACE);
+ panel.add( field, gbc );
+ }
+
+ private static void addButtonEntryField(JPanel panel, JComponent label,
+ JComponent field, JComponent field1, GridBagConstraints gbc) {
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.gridx = 0;
+ gbc.anchor = gbc.NORTHEAST;
+ //gbc.insets = new Insets(DIFFERENT_COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,0,0);
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0,0);
+ panel.add(new JLabel(""));
+
+ gbc.gridx++;
+ gbc.weightx = 1.0;
+ panel.add( label, gbc );
+
+ gbc.gridx++;
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ //gbc.gridwidth = gbc.REMAINDER;
+ //gbc.insets = new Insets(DIFFERENT_COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,
+ // 0,DIFFERENT_COMPONENT_SPACE);
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ 0,COMPONENT_SPACE);
+ panel.add( field, gbc );
+
+ gbc.gridx++;
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ //gbc.insets = new Insets(DIFFERENT_COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,
+ // 0,DIFFERENT_COMPONENT_SPACE);
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ 0,COMPONENT_SPACE);
+ panel.add( field1, gbc );
+ }
+
+ /*==========================================================
+ * SEND STUFF TO SERVER
+ *==========================================================*/
+
+ //retrieve security information from the server side
+ private NameValuePairs updateSecurityInformation()
+ throws EAdminException
+ {
+ Debug.println("Get Security Information");
+ NameValuePairs nvp = new NameValuePairs();
+ nvp.put(Constants.PR_CIPHER_PREF, "");
+ nvp.put(Constants.PR_CIPHER_VERSION, "");
+ nvp.put(Constants.PR_CIPHER_FORTEZZA, "");
+ nvp.put(Constants.PR_TOKEN_LIST, "");
+
+ //create installed certificate list data request
+ for (Enumeration e = mCertMapping.elements(); e.hasMoreElements() ;) {
+ CipherEntryData data = (CipherEntryData)e.nextElement();
+ nvp.put(data.getTagName(), "");
+ }
+
+ NameValuePairs response;
+
+ response = mConnection.read(DestDef.DEST_SERVER_ADMIN,
+ ScopeDef.SC_ENCRYPTION,
+ Constants.RS_ID_CONFIG,
+ nvp);
+
+ Debug.println("Received: "+response.toString());
+
+ return response;
+ }
+
+ //modify cipher preference
+ private void updateCipherPref(String list) {
+ Debug.println("Set Cipher Preference: "+list);
+
+ NameValuePairs nvp = new NameValuePairs();
+ nvp.put(Constants.PR_CIPHER_PREF, list);
+
+ //send to server
+ try {
+ mConnection.modify(DestDef.DEST_SERVER_ADMIN,
+ ScopeDef.SC_ENCRYPTION,
+ Constants.RS_ID_CONFIG,
+ nvp);
+ } catch(EAdminException e) {
+ //display error dialog
+ CMSAdminUtil.showErrorDialog(mParent.getResourceModel().getFrame(), mResource,
+ e.getMessage(), CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ }
+
+ //modify certificate mapping
+ private boolean updateCertMap(NameValuePairs config) {
+ Debug.println("Set Certificate Mapping: "+config.toString());
+
+ //send to server
+ try {
+ mConnection.modify(DestDef.DEST_SERVER_ADMIN,
+ ScopeDef.SC_ENCRYPTION,
+ Constants.RS_ID_CONFIG,
+ config);
+ } catch(EAdminException e) {
+ //display error dialog
+ CMSAdminUtil.showErrorDialog(mParent.getResourceModel().getFrame(), mResource,
+ e.getMessage(), CMSAdminUtil.ERROR_MESSAGE);
+ return false;
+ }
+
+ return true;
+ }
+
+}
+
+//internal data structure
+class CipherEntryData {
+
+ String mTag;
+ String mToken;
+ String mCert;
+
+ public CipherEntryData(String tag) {
+ mTag = tag;
+ }
+
+ public void setData(String token, String cert) {
+ mToken = token;
+ mCert = cert;
+ }
+
+ public String getCertName() {
+ return mCert;
+ }
+
+ public String getTokenName() {
+ return mToken;
+ }
+
+ public String getTagName() {
+ return mTag;
+ }
+
+ public String toString() {
+ return mTag+"-"+mToken+":"+mCert;
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSErrorLogPanel.java b/base/console/src/com/netscape/admin/certsrv/config/CMSErrorLogPanel.java
new file mode 100644
index 000000000..23b4ececa
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSErrorLogPanel.java
@@ -0,0 +1,180 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.*;
+
+import java.awt.event.*;
+
+/**
+ * Error Log Setting Tab to be displayed at the right hand side
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ */
+public class CMSErrorLogPanel extends CMSBaseLogPanel {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static String PANEL_NAME = "ERRORLOG";
+ private CMSTabPanel mParent;
+ private static final String HELPINDEX = "configuration-logs-error-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSErrorLogPanel(CMSTabPanel parent, boolean isNT) {
+ super(PANEL_NAME, parent);
+ mParent = parent;
+ mHelpToken = HELPINDEX;
+ mIsNT = isNT;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * Actual Instantiation of the UI components
+ */
+ public void init() {
+ Debug.println("ErrorLogPanel: init()");
+ super.init();
+ refresh();
+ }
+
+ public void refresh() {
+ mModel.progressStart();
+ NameValuePairs nvp = new NameValuePairs();
+ nvp.put(Constants.PR_LOG_ENABLED, "");
+ nvp.put(Constants.PR_LOG_LEVEL, "");
+ nvp.put(Constants.PR_LOG_BUFFERSIZE, "");
+ //nvp.add(Constants.PR_LOG_EXPIRED_TIME, "");
+ //nvp.add(Constants.PR_LOG_FILENAME, "");
+ //nvp.add(Constants.PR_LOG_FLUSHINTERVAL, "");
+ nvp.put(Constants.PR_LOG_MAXFILESIZE, "");
+ nvp.put(Constants.PR_LOG_ROLLEROVER_INTERVAL, "");
+
+ try {
+ NameValuePairs val = mAdmin.read(DestDef.DEST_LOG_ADMIN,
+ ScopeDef.SC_ERRORLOG, Constants.RS_ID_CONFIG, nvp);
+
+ parseVals(val);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ }
+ setValues();
+ mModel.progressStop();
+ clearDirtyFlag();
+ mParent.setOKCancel();
+ }
+
+ private void parseVals(NameValuePairs nvp) {
+ if (nvp.get(Constants.PR_LOG_ENABLED).equalsIgnoreCase(
+ Constants.TRUE))
+ activateLog.setSelected(true);
+ else
+ activateLog.setSelected(false);
+ mLevel = Integer.parseInt(nvp.get(Constants.PR_LOG_LEVEL));
+ mlogBufSizTextData = nvp.get(Constants.PR_LOG_BUFFERSIZE);
+ mlogMaxSizTextData = nvp.get(Constants.PR_LOG_MAXFILESIZE);
+ int val =
+ Integer.parseInt(nvp.get(Constants.PR_LOG_ROLLEROVER_INTERVAL));
+ mFrequency = getRollOverIndex(val);
+ }
+
+ /**
+ * Implementation for saving panel information
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean applyCallback() {
+ // check blank fields
+ if ((mlogMaxSizText.getText().trim().equals("")) ||
+ (mlogBufSizText.getText().trim().equals("")) ) {
+ showMessageDialog("BLANKFIELD");
+ return false;
+ }
+
+ String bufSize = mlogBufSizText.getText().trim();
+ String maxSize = mlogMaxSizText.getText().trim();
+
+ try {
+ int val1 = Integer.parseInt(bufSize);
+ int val2 = Integer.parseInt(maxSize);
+ if (val1 <= 0 || val2 <= 0) {
+ showMessageDialog("OUTOFRANGE");
+ return false;
+ }
+ } catch (NumberFormatException e) {
+ showMessageDialog("NUMBERFORMAT");
+ return false;
+ }
+
+ NameValuePairs nvp = new NameValuePairs();
+
+ if (activateLog.isSelected())
+ nvp.put(Constants.PR_LOG_ENABLED, Constants.TRUE);
+ else
+ nvp.put(Constants.PR_LOG_ENABLED, Constants.FALSE);
+ String str = "" + mLogLevel.getSelectedIndex();
+ nvp.put(Constants.PR_LOG_LEVEL, str);
+ nvp.put(Constants.PR_LOG_BUFFERSIZE, mlogBufSizText.getText().trim());
+ //nvp.add(Constants.PR_LOG_EXPIRED_TIME, "");
+ //nvp.add(Constants.PR_LOG_FILENAME, "");
+ //nvp.add(Constants.PR_LOG_FLUSHINTERVAL, "");
+ nvp.put(Constants.PR_LOG_MAXFILESIZE, mlogMaxSizText.getText().trim());
+
+ str = "" + getRollOverTime(mlogFQC.getSelectedIndex());
+ nvp.put(Constants.PR_LOG_ROLLEROVER_INTERVAL, str);
+
+ mModel.progressStart();
+ try {
+ mAdmin.modify(DestDef.DEST_LOG_ADMIN,
+ ScopeDef.SC_ERRORLOG, Constants.RS_ID_CONFIG, nvp);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ return false;
+ }
+ mModel.progressStop();
+ clearDirtyFlag();
+ return true;
+ }
+
+ /**
+ * Implementation for reset values
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean resetCallback() {
+ refresh();
+ return true;
+ }
+
+ /*==========================================================
+ * EVENT HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent e) {
+ super.actionPerformed(e);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSKRAAutoPanel.java b/base/console/src/com/netscape/admin/certsrv/config/CMSKRAAutoPanel.java
new file mode 100644
index 000000000..f408e7297
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSKRAAutoPanel.java
@@ -0,0 +1,220 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.ug.*;
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.*;
+
+/**
+ * KRA recovery management tab
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ */
+public class CMSKRAAutoPanel extends CMSBaseUGTab {
+ private static String PANEL_NAME = "AUTORECOVERYMGMT";
+ private CMSBaseResourceModel mModel;
+ private JButton mEnableAuto;
+ private AdminConnection mAdmin;
+ private String mEnableLabel;
+ private String mEnableTTip;
+ private String mDisableLabel;
+ private String mDisableTTip;
+ private JButton mRefresh, mHelp;
+ private JLabel mStatus;
+ private String mEnableStatus;
+ private String mEnableStatusTTip;
+ private String mDisableStatus;
+ private String mDisableStatusTTip;
+ private static final String HELPINDEX =
+ "configuration-kra-autorecovery-help";
+
+ public CMSKRAAutoPanel(CMSUGTabPanel parent) {
+ super(PANEL_NAME, parent.getResourceModel());
+ mModel = parent.getResourceModel();
+ mAdmin = mModel.getServerInfo().getAdmin();
+ mDisableTTip = mResource.getString(PANEL_NAME + "_BUTTON_"+
+ "DISABLEAUTO_TTIP");
+ mDisableLabel = mResource.getString(PANEL_NAME + "_BUTTON_"+
+ "DISABLEAUTO_LABEL");
+ mEnableTTip = mResource.getString(PANEL_NAME + "_BUTTON_"+
+ "ENABLEAUTO_TTIP");
+ mEnableLabel = mResource.getString(PANEL_NAME + "_BUTTON_"+
+ "ENABLEAUTO_LABEL");
+ mEnableStatus = mResource.getString(PANEL_NAME + "_LABEL_"+
+ "ENABLESTATUS_LABEL");
+ mEnableStatusTTip = mResource.getString(PANEL_NAME + "_LABEL_"+
+ "ENABLESTATUS_TTIP");
+ mDisableStatus = mResource.getString(PANEL_NAME + "_LABEL_"+
+ "DISABLESTATUS_LABEL");
+ mDisableStatusTTip = mResource.getString(PANEL_NAME + "_LABEL_"+
+ "DISABLESTATUS_TTIP");
+ mHelpToken = HELPINDEX;
+ }
+
+ protected JPanel createListPanel() {
+ JPanel mainPanel = new JPanel();
+ GridBagLayout gb3 = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mainPanel.setLayout(gb3);
+
+ JPanel autoPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ autoPanel.setLayout(gb);
+ autoPanel.setBorder(makeTitledBorder("AUTO"));
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.gridwidth = gbc.REMAINDER;
+ gb3.setConstraints(autoPanel, gbc);
+ mainPanel.add(autoPanel);
+
+ // Auto recovery
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel autoLabel = makeJLabel("ENABLEAUTO");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridheight = gbc.REMAINDER;
+ gb.setConstraints(autoLabel, gbc);
+ autoPanel.add(autoLabel);
+
+ // labels
+ CMSAdminUtil.resetGBC(gbc);
+ mStatus = makeJLabel("ENABLESTATUS");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 0.0;
+ gbc.weighty = 0.0;
+ gbc.gridheight = gbc.REMAINDER;
+ gb.setConstraints(mStatus, gbc);
+ autoPanel.add(mStatus);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mEnableAuto = makeJButton("DISABLEAUTO");
+ mEnableAuto.setPreferredSize(new Dimension(78, 23));
+ mEnableAuto.setActionCommand("autoButton");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.weighty = 1.0;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gb.setConstraints(mEnableAuto, gbc);
+ autoPanel.add(mEnableAuto);
+
+ refresh();
+ return mainPanel;
+ }
+
+ protected JPanel createActionPanel() {
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mRefresh = makeJButton("REFRESH");
+ mHelp = makeJButton("HELP");
+ //JButton[] buttons = { mRefresh, mHelp };
+ JButton[] buttons = { mRefresh };
+ return makeJButtonPanel(buttons, true);
+ }
+
+ public void refresh() {
+ mModel.progressStart();
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_AUTO_RECOVERY_ON, "");
+
+ try {
+ NameValuePairs val = mAdmin.read(DestDef.DEST_KRA_ADMIN,
+ ScopeDef.SC_AUTO_RECOVERY, Constants.RS_ID_CONFIG, nvps);
+
+ populate(val);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ }
+ mModel.progressStop();
+ }
+
+ protected void populate(NameValuePairs nvps) {
+ for (String name : nvps.keySet()) {
+ String value = nvps.get(name);
+ if (name.equals(Constants.PR_AUTO_RECOVERY_ON)) {
+ if (value.equals(Constants.TRUE)) {
+ setStatus(true);
+ //mEnableAuto.setText(mDisableLabel);
+ //mEnableAuto.setToolTipText(mDisableTTip);
+ } else {
+ setStatus(false);
+ //mEnableAuto.setText(mEnableLabel);
+ //mEnableAuto.setToolTipText(mEnableTTip);
+ }
+ }
+ }
+ }
+
+ private void setStatus(boolean enabled) {
+ if (enabled) {
+ mEnableAuto.setText(mDisableLabel);
+ mEnableAuto.setToolTipText(mDisableTTip);
+ mStatus.setText(mEnableStatus);
+ mStatus.setToolTipText(mEnableStatusTTip);
+ } else {
+ mEnableAuto.setText(mEnableLabel);
+ mEnableAuto.setToolTipText(mEnableTTip);
+ mStatus.setText(mDisableStatus);
+ mStatus.setToolTipText(mDisableStatusTTip);
+ }
+ }
+
+ public void actionPerformed(ActionEvent e) {
+
+ if (e.getActionCommand().equals("autoButton")) {
+ String text = mEnableAuto.getText();
+ if (text.equals(mEnableLabel)) {
+ JDialog enableDialog = new CMSAutoRecovery(mModel.getFrame(),
+ mAdmin, mEnableAuto);
+ } else {
+ mModel.progressStart();
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_AUTO_RECOVERY_ON, Constants.FALSE);
+ try {
+ mAdmin.modify(DestDef.DEST_KRA_ADMIN,
+ ScopeDef.SC_AUTO_RECOVERY, Constants.RS_ID_CONFIG, nvps);
+ //mEnableAuto.setText(mEnableLabel);
+ //mEnableAuto.setToolTipText(mEnableTTip);
+ } catch (EAdminException ex) {
+ showErrorDialog(ex.toString());
+ }
+ mModel.progressStop();
+ }
+ refresh();
+ } else if (e.getSource().equals(mRefresh)) {
+ refresh();
+ } else if (e.getSource().equals(mHelp)) {
+ helpCallback();
+ }
+ }
+
+ public void mouseClicked(MouseEvent e) {
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSKRAPasswdPanel.java b/base/console/src/com/netscape/admin/certsrv/config/CMSKRAPasswdPanel.java
new file mode 100644
index 000000000..7c70dca7f
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSKRAPasswdPanel.java
@@ -0,0 +1,267 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.AdminConnection;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.ug.*;
+import javax.swing.*;
+import java.awt.*;
+import java.util.*;
+import java.awt.event.*;
+
+/**
+ * KRA password management tab
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ */
+public class CMSKRAPasswdPanel extends CMSBaseUGTab {
+ private static String PANEL_NAME = "KRAPASSWD";
+ private CMSBaseResourceModel mModel;
+ private JButton mPwdBtn;
+ private AdminConnection mAdmin;
+ private JList mAgentList;
+ private DefaultListModel mAgentModel;
+ private Icon mUserIcon;
+ private JButton mRefresh, mHelp;
+ private static final String HELPINDEX =
+ "configuration-kra-agentpwd-help";
+ private CMSUGTabPanel mParent = null;
+
+ public CMSKRAPasswdPanel(CMSUGTabPanel parent) {
+ super(PANEL_NAME, parent.getResourceModel());
+ mModel = parent.getResourceModel();
+ mAdmin = mModel.getServerInfo().getAdmin();
+ mParent = parent;
+ mHelpToken = HELPINDEX;
+ }
+
+ public void refresh() {
+ mModel.progressStart();
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_RECOVERY_AGENT, "");
+
+ try {
+ NameValuePairs val = mAdmin.read(DestDef.DEST_KRA_ADMIN,
+ ScopeDef.SC_RECOVERY, Constants.RS_ID_CONFIG, nvps);
+
+ populate(val);
+ } catch (EAdminException e) {
+ mParent.removeAll();
+ //showErrorDialog(e.toString());
+ mModel.progressStop();
+ }
+ mModel.progressStop();
+ }
+
+ protected void populate(NameValuePairs nvps) {
+ for (String name : nvps.keySet()) {
+ String value = nvps.get(name);
+ if (name.equals(Constants.PR_RECOVERY_AGENT)) {
+ mAgentModel.removeAllElements();
+ updateModel(value);
+ }
+ }
+ }
+
+ private void updateModel(String value) {
+ String[] uids = getUIDs(value);
+ for (int i=0; i<uids.length; i++) {
+ JLabel label = makeJLabel(mUserIcon, uids[i],
+ SwingConstants.LEFT);
+ mAgentModel.add(i, label);
+ }
+
+ if (mAgentModel.size() > 0)
+ mAgentList.setSelectedIndex(0);
+ setSelectedItem();
+ }
+
+ private String[] getUIDs(String uids) {
+ StringTokenizer tokenizer = new StringTokenizer(uids, ",");
+ String[] vals = new String[tokenizer.countTokens()];
+ int i=0;
+ while (tokenizer.hasMoreElements()) {
+ vals[i++] = (String)tokenizer.nextElement();
+ }
+ CMSAdminUtil.bubbleSort(vals);
+ return vals;
+ }
+
+ protected JPanel createActionPanel() {
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mRefresh = makeJButton("REFRESH");
+ mHelp = makeJButton("HELP");
+ //JButton[] buttons = { mRefresh, mHelp };
+ JButton[] buttons = { mRefresh };
+ return makeJButtonPanel(buttons, true);
+ }
+
+ protected JPanel createListPanel() {
+ JPanel mainPanel = new JPanel();
+ GridBagLayout gb3 = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mainPanel.setLayout(gb3);
+
+ JPanel listPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ listPanel.setLayout(gb);
+ listPanel.setBorder(makeTitledBorder("RECOVERYLIST"));
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.gridwidth = gbc.REMAINDER;
+ gb3.setConstraints(listPanel, gbc);
+ mainPanel.add(listPanel);
+
+ // label for table
+ JLabel tablelbl = makeJLabel("RECOVERYLIST");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.gridx = 0;
+ gbc.gridy = 0;
+ //gbc.weightx = 1.0;
+ //gbc.weighty = 1.0;
+ gb.setConstraints(tablelbl, gbc);
+ listPanel.add(tablelbl);
+
+ // agent table
+ mAgentModel = new DefaultListModel();
+ mAgentList = makeJList(mAgentModel, 10);
+ mAgentList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ MouseListener mouseListener = new MouseAdapter() {
+ public void mouseClicked(MouseEvent e) {
+ if (e.getClickCount() == 2)
+ displayPasswordDialog();
+ else
+ setSelectedItem();
+ }
+ };
+
+ mAgentList.addMouseListener(mouseListener);
+ mUserIcon = CMSAdminUtil.getImage(CMSAdminResources.IMAGE_USER);
+ JScrollPane scrollPane = createScrollPane(mAgentList);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.gridx = 0;
+ gbc.gridy = 1;
+ gbc.gridheight = gbc.REMAINDER;
+ gb.setConstraints(scrollPane, gbc);
+ listPanel.add(scrollPane);
+
+ // change password button
+ mPwdBtn = makeJButton("CHANGEPWD");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.gridx = 1;
+ gbc.gridy = 1;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.gridwidth = gbc.REMAINDER;
+ gb.setConstraints(mPwdBtn, gbc);
+ listPanel.add(mPwdBtn);
+
+ refresh();
+
+ return mainPanel;
+ }
+
+ private JScrollPane createScrollPane(JList listbox) {
+
+ JScrollPane scrollPane = new JScrollPane(listbox,
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ scrollPane.setBackground(getBackground());
+ scrollPane.setAlignmentX(LEFT_ALIGNMENT);
+ scrollPane.setAlignmentY(TOP_ALIGNMENT);
+ scrollPane.setBorder(BorderFactory.createLoweredBevelBorder());
+ return scrollPane;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mRefresh)) {
+ refresh();
+ } else if (e.getSource().equals(mHelp)) {
+ helpCallback();
+ } else if (e.getSource().equals(mPwdBtn)) {
+ displayPasswordDialog();
+ }
+ }
+
+ public void displayPasswordDialog() {
+ Object[] values = mAgentList.getSelectedValues();
+ if (values.length == 0) {
+ showMessageDialog("NOSELECTION");
+ } else if (values.length > 1) {
+ showMessageDialog("MULTISELECTIONS");
+ } else {
+ String str = ((JLabel)values[0]).getText();
+
+ // ensure the selected id is valid
+ refresh();
+ int s = mAgentList.getModel().getSize();
+ boolean foundID = false;
+ for (int i = 0; i < s; i++) {
+ JLabel l = (JLabel)mAgentList.getModel().getElementAt(i);
+ if (str.equals(l.getText())) {
+ foundID = true;
+ break;
+ }
+ }
+ if (foundID) {
+ JDialog pwdDialog = new CMSPasswordDialog(mModel.getFrame(),
+ mAdmin, str);
+ } else {
+ showErrorDialog("Invalid ID");
+ }
+ }
+ }
+
+ private void setSelectedItem() {
+ if (mAgentList.getSelectedIndex()< 0) {
+ mPwdBtn.setEnabled(false);
+ return;
+ }
+
+ if (mAgentList.getSelectedIndex() >= 0)
+ mPwdBtn.setEnabled(true);
+ }
+
+ public void mouseClicked(MouseEvent e) {
+/*
+ if (e.getClickCount() == 2)
+ displayPasswordDialog();
+ else
+ setSelectedItem();
+*/
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSKRASchemePanel.java b/base/console/src/com/netscape/admin/certsrv/config/CMSKRASchemePanel.java
new file mode 100644
index 000000000..34950b371
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSKRASchemePanel.java
@@ -0,0 +1,198 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.AdminConnection;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.ug.*;
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.*;
+
+/**
+ * KRA scheme management tab
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ */
+public class CMSKRASchemePanel extends CMSBaseUGTab {
+ private static String PANEL_NAME = "SCHEMEMGMT";
+ private CMSBaseResourceModel mModel;
+ private JButton mSchemeBtn;
+ private AdminConnection mAdmin;
+ private JLabel mAvailAgentLbl;
+ private JLabel mReqAgentLbl;
+ private String mAvailAgentStr;
+ private String mReqAgentStr;
+ private JButton mRefresh, mHelp;
+ private static final String HELPINDEX =
+ "configuration-kra-schememgt-help";
+ private CMSUGTabPanel mParent = null;
+
+ public CMSKRASchemePanel(CMSUGTabPanel parent) {
+ super(PANEL_NAME, parent.getResourceModel());
+ mModel = parent.getResourceModel();
+ mAdmin = mModel.getServerInfo().getAdmin();
+ mAvailAgentStr =
+ mResource.getString(PANEL_NAME + "_LABEL_AVAILAGENT_LABEL");
+ mReqAgentStr =
+ mResource.getString(PANEL_NAME + "_LABEL_REQAGENT_LABEL");
+ mParent = parent;
+ mHelpToken = HELPINDEX;
+ }
+
+/*
+ public void init() {
+ GridBagLayout gbm = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ CMSAdminUtil.resetGBC(gbc);
+ mCenterPanel.setLayout(gbm);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ JPanel agentPanel = createAgentPanel();
+ gbm.setConstraints(agentPanel, gbc);
+ mCenterPanel.add(agentPanel);
+
+ refresh();
+ }
+*/
+
+ public void refresh() {
+ mModel.progressStart();
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_RECOVERY_N, "");
+ nvps.put(Constants.PR_RECOVERY_M, "");
+
+ try {
+ NameValuePairs val = mAdmin.read(DestDef.DEST_KRA_ADMIN,
+ ScopeDef.SC_RECOVERY, Constants.RS_ID_CONFIG, nvps);
+
+ populate(val);
+ } catch (EAdminException e) {
+ mParent.removeAll();
+ //showErrorDialog(e.toString());
+ mModel.progressStop();
+ }
+ mModel.progressStop();
+ }
+
+ protected void populate(NameValuePairs nvps) {
+ for (String name : nvps.keySet()) {
+ String value = nvps.get(name);
+ if (name.equals(Constants.PR_RECOVERY_N)) {
+ mAvailAgentLbl.setText(value);
+ } else if (name.equals(Constants.PR_RECOVERY_M)) {
+ mReqAgentLbl.setText(value);
+ }
+ }
+ }
+
+ protected JPanel createActionPanel() {
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mRefresh = makeJButton("REFRESH");
+ mHelp = makeJButton("HELP");
+ //JButton[] buttons = { mRefresh, mHelp };
+ JButton[] buttons = { mRefresh };
+ return makeJButtonPanel(buttons, true);
+ }
+
+ protected JPanel createListPanel() {
+ JPanel listPanel = new JPanel();
+ GridBagLayout gb3 = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ listPanel.setLayout(gb3);
+
+ JPanel agentPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ agentPanel.setLayout(gb);
+ agentPanel.setBorder(makeTitledBorder("CURRENT"));
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.gridwidth = gbc.REMAINDER;
+ gb3.setConstraints(agentPanel, gbc);
+ listPanel.add(agentPanel);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label2 = makeJLabel("REQAGENT");
+ mReqAgentLbl= new JLabel("");
+ gbc.fill = gbc.NONE;
+ gbc.anchor = gbc.EAST;
+ gbc. insets = new Insets(0,COMPONENT_SPACE,0,0);
+ gb.setConstraints(label2, gbc);
+ agentPanel.add(label2);
+
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc. insets = new Insets(0,COMPONENT_SPACE,
+ 0,COMPONENT_SPACE);
+ gb.setConstraints(mReqAgentLbl, gbc);
+ agentPanel.add(mReqAgentLbl);
+
+ mSchemeBtn = makeJButton("CHANGESCHEME");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gb.setConstraints(mSchemeBtn, gbc);
+ agentPanel.add(mSchemeBtn);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label1 = makeJLabel("AVAILAGENT");
+ mAvailAgentLbl = new JLabel("");
+ gbc.gridheight = gbc.REMAINDER;
+ CMSAdminUtil.addEntryField(agentPanel, label1, mAvailAgentLbl, gbc);
+
+ refresh();
+ return listPanel;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mSchemeBtn)) {
+ try {
+ MNSchemeWizardInfo info = new MNSchemeWizardInfo(mAdmin,
+ Integer.parseInt(mReqAgentLbl.getText()),
+ Integer.parseInt(mAvailAgentLbl.getText()));
+ MNSchemeWizard wizard = new MNSchemeWizard(mModel.getFrame(), info);
+ } catch(NumberFormatException ex) {
+ Debug.println("CMSKRASchemePanel: MN not intereger "+ex.toString());
+ showErrorDialog(mResource.getString("SCHEMEMGMT_DIALOG_MNFORMAT_MESSAGE"));
+ }
+ refresh();
+ } else if (e.getSource().equals(mRefresh)) {
+ refresh();
+ } else if (e.getSource().equals(mHelp)) {
+ helpCallback();
+ }
+ }
+
+ public void mouseClicked(MouseEvent e) {
+ }
+
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSLDAPSettingPanel.java b/base/console/src/com/netscape/admin/certsrv/config/CMSLDAPSettingPanel.java
new file mode 100644
index 000000000..641a6641e
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSLDAPSettingPanel.java
@@ -0,0 +1,362 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.*;
+
+/**
+ * LDAP server setting tab
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ */
+public class CMSLDAPSettingPanel extends CMSBaseTab {
+
+ private static String PANEL_NAME = "LDAPSETTING";
+ private static final String HELPINDEX =
+ "configuration-database-settings-help";
+ private JTextField mHostNameText;
+ private JTextField mPortText;
+ private JTextField mBindAsText;
+ private JTextField mMaxConnsText;
+ private JTextField mMinConnsText;
+ private JPasswordField mPasswordText;
+ private JPasswordField mPasswordAgainText;
+ private JCheckBox mEnable;
+ private Color mActiveColor;
+ protected AdminConnection mAdmin;
+ protected CMSBaseResourceModel mModel;
+ private String mServletName;
+ private CMSTabPanel mParent;
+ private static final int MAX_PORT = 65535;
+ //private JComboBox mVersionBox;
+
+ public CMSLDAPSettingPanel(CMSTabPanel parent) {
+ super(PANEL_NAME, parent);
+ mHelpToken = HELPINDEX;
+ mServletName = getServletName(PANEL_NAME);
+ mModel = parent.getResourceModel();
+ mParent = parent;
+ }
+
+ public void init() {
+ mAdmin = mModel.getServerInfo().getAdmin();
+ JPanel serverInfo = new JPanel();
+ serverInfo.setBorder(makeTitledBorder("SETTING"));
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mCenterPanel.setLayout(gb);
+
+ //add the destination panel
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(serverInfo, gbc);
+ mCenterPanel.add(serverInfo);
+
+ GridBagLayout gb1 = new GridBagLayout();
+ serverInfo.setLayout(gb1);
+
+ // add host name label and text field
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel hostLabel = makeJLabel("HOST");
+ mHostNameText = makeJTextField(30);
+ mActiveColor = mHostNameText.getBackground();
+ CMSAdminUtil.addEntryField(serverInfo, hostLabel, mHostNameText, gbc);
+
+ // add port number label
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel portLabel = makeJLabel("PORT");
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0,0);
+ gb1.setConstraints(portLabel, gbc);
+ serverInfo.add(portLabel);
+
+ // add port number text field
+ CMSAdminUtil.resetGBC(gbc);
+ mPortText = makeJTextField(10);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ //gbc.weightx = 0.0;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gb1.setConstraints(mPortText, gbc);
+ serverInfo.add(mPortText);
+
+ // add check box
+/*
+ CMSAdminUtil.resetGBC(gbc);
+ mSecurePort = makeJCheckBox("SECUREPORT");
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE - COMPONENT_SPACE,0,COMPONENT_SPACE);
+ gb1.setConstraints(mSecurePort, gbc);
+ serverInfo.add(mSecurePort);
+*/
+
+ // add base DN label and text field
+/*
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel baseDNLabel = makeJLabel("BASEDN");
+ mBaseDNText = makeJTextField(30);
+ CMSAdminUtil.addEntryField(serverInfo, baseDNLabel, mBaseDNText, gbc);
+*/
+
+ // add bind as label and text field
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel bindAsLabel = makeJLabel("BINDAS");
+ mBindAsText = makeJTextField(30);
+ CMSAdminUtil.addEntryField(serverInfo, bindAsLabel, mBindAsText, gbc);
+
+ // add password label and text field
+/*
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel passwordLabel = makeJLabel("PWD");
+ mPasswordText = makeJPasswordField(20);
+ CMSAdminUtil.addEntryField(serverInfo, passwordLabel, mPasswordText, gbc);
+*/
+
+ // add password again label and text field
+/*
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel passwordAgainLabel = makeJLabel("PWDAGAIN");
+ mPasswordAgainText = makeJPasswordField(30);
+ CMSAdminUtil.addEntryField(serverInfo, passwordAgainLabel,
+ mPasswordAgainText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel versionLabel = makeJLabel("VERSION");
+ mVersionBox = makeJComboBox("VERSION");
+ JLabel dummy = new JLabel(" ");
+ CMSAdminUtil.addEntryField(serverInfo, versionLabel, mVersionBox,
+ dummy, gbc);
+*/
+
+ // add maxconns label text field
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel maxConnsLabel = makeJLabel("MAXCONNS");
+ mMaxConnsText = makeJTextField(30);
+ CMSAdminUtil.addEntryField(serverInfo, maxConnsLabel, mMaxConnsText, gbc);
+
+ // add maxconns label text field
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel minConnsLabel = makeJLabel("MINCONNS");
+ mMinConnsText = makeJTextField(30);
+ CMSAdminUtil.addEntryField(serverInfo, minConnsLabel, mMinConnsText, gbc);
+
+ refresh();
+ }
+
+ public void refresh() {
+ mModel.progressStart();
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_HOST_NAME, "");
+ nvps.put(Constants.PR_LDAP_PORT, "");
+ //nvps.add(Constants.PR_SECURE_PORT_ENABLED, "");
+ //nvps.add(Constants.PR_BASE_DN, "");
+ nvps.put(Constants.PR_BIND_DN, "");
+ nvps.put(Constants.PR_LDAP_VERSION, "");
+ nvps.put(Constants.PR_LDAP_MAX_CONNS, "");
+ nvps.put(Constants.PR_LDAP_MIN_CONNS, "");
+
+ try {
+ NameValuePairs val = mAdmin.read(mServletName,
+ ScopeDef.SC_LDAP, Constants.RS_ID_CONFIG, nvps);
+
+ populate(val);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ }
+ mModel.progressStop();
+ clearDirtyFlag();
+ mParent.setOKCancel();
+ }
+
+ protected String getServletName(String panelName) {
+ if (panelName.equals("LDAPSETTING"))
+ return DestDef.DEST_SERVER_ADMIN;
+ else if (panelName.equals("CALDAPSETTING"))
+ return DestDef.DEST_CA_ADMIN;
+ return DestDef.DEST_RA_ADMIN;
+ }
+
+ protected void populate(NameValuePairs nvps) {
+ String version = "";
+ for (String name : nvps.keySet()) {
+ String value = nvps.get(name);
+ if (name.equals(Constants.PR_HOST_NAME)) {
+ mHostNameText.setText(value);
+ } else if (name.equals(Constants.PR_LDAP_PORT)) {
+ mPortText.setText(value);
+ } else if (name.equals(Constants.PR_SECURE_PORT_ENABLED)) {
+/*
+ if (nvp.getValue().equals(Constants.TRUE))
+ mSecurePort.setSelected(true);
+ else
+ mSecurePort.setSelected(false);
+*/
+ } else if (name.equals(Constants.PR_BASE_DN)) {
+ //mBaseDNText.setText(nvp.getValue());
+ } else if (name.equals(Constants.PR_BIND_DN)) {
+ mBindAsText.setText(value);
+ } else if (name.equals(Constants.PR_ENABLE)) {
+ if (value.equals(Constants.TRUE))
+ mEnable.setSelected(true);
+ else
+ mEnable.setSelected(false);
+ } else if (name.equals(Constants.PR_LDAP_VERSION)) {
+ version = value;
+ } else if (name.equals(Constants.PR_LDAP_MIN_CONNS)) {
+ mMinConnsText.setText(value);
+ } else if (name.equals(Constants.PR_LDAP_MAX_CONNS)) {
+ mMaxConnsText.setText(value);
+ }
+
+ }
+
+/*
+ if (version.equals(""))
+ mVersionBox.setSelectedIndex(1);
+ else
+ mVersionBox.setSelectedItem(version);
+*/
+ //mPasswordText.setText("");
+ //mPasswordAgainText.setText("");
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ super.actionPerformed(e);
+ }
+
+ /**
+ * Implementation for saving panel information
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean applyCallback() {
+ // check blank fields
+ String host = mHostNameText.getText().trim();
+ String port = mPortText.getText().trim();
+ //String baseDN = mBaseDNText.getText().trim();
+ String bindAs = mBindAsText.getText().trim();
+ String maxConns = mMaxConnsText.getText().trim();
+ String minConns = mMinConnsText.getText().trim();
+
+ //if (host.equals("") || port.equals("") || baseDN.equals("") ||
+ // bindAs.equals("")) {
+ if (host.equals("") || port.equals("") || bindAs.equals("") || maxConns.equals("") || minConns.equals("")) {
+ showMessageDialog("BLANKFIELD");
+ return false;
+ }
+
+ try {
+ int num = Integer.parseInt(port);
+ if (num <= 0 || num > MAX_PORT) {
+ showMessageDialog("PORTRANGE");
+ return false;
+ }
+ } catch (NumberFormatException e) {
+ showMessageDialog("NUMBERFORMAT");
+ return false;
+ }
+
+ try {
+ int max = Integer.parseInt(maxConns);
+ int min = Integer.parseInt(minConns);
+ if ((max < min) || (max <0) || (min <0)) {
+ showMessageDialog("MAXMINRANGE");
+ return false;
+ }
+ } catch (NumberFormatException e) {
+ showMessageDialog("MAXMINNUMBERFORMAT");
+ return false;
+ }
+
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_HOST_NAME, host);
+ nvps.put(Constants.PR_LDAP_PORT, port);
+ //nvps.add(Constants.PR_BASE_DN, baseDN);
+ nvps.put(Constants.PR_BIND_DN, bindAs);
+ nvps.put(Constants.PR_LDAP_MAX_CONNS, maxConns);
+ nvps.put(Constants.PR_LDAP_MIN_CONNS, minConns);
+/*
+ nvps.add(Constants.PR_LDAP_VERSION,
+ (String)mVersionBox.getSelectedItem());
+*/
+
+/*
+ if (mSecurePort.isSelected())
+ nvps.add(Constants.PR_SECURE_PORT_ENABLED, Constants.TRUE);
+ else
+ nvps.add(Constants.PR_SECURE_PORT_ENABLED, Constants.FALSE);
+*/
+
+/*
+ String passwd = mPasswordText.getText();
+ String passwdagain = mPasswordAgainText.getText();
+
+ if (!passwd.equals("") && !passwdagain.equals("")) {
+ if (passwd.equals(passwdagain)) {
+ nvps.add(Constants.PR_BIND_PASSWD, passwd);
+ } else {
+ showMessageDialog("UNMATCHEDPASSWD");
+ return false;
+ }
+ } else if (((!passwd.equals("")) && passwdagain.equals("")) ||
+ ((!passwd.equals("")) && passwdagain.equals(""))) {
+ showMessageDialog("UNMATCHEDPASSWD");
+ return false;
+ }
+*/
+
+ mModel.progressStart();
+ try {
+ mAdmin.modify(mServletName, ScopeDef.SC_LDAP,
+ Constants.RS_ID_CONFIG, nvps, false);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ return false;
+ }
+
+ mModel.progressStop();
+ clearDirtyFlag();
+ return true;
+ }
+
+ /**
+ * Implementation for reset values
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean resetCallback() {
+ refresh();
+ return true;
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSNetworkPanel.java b/base/console/src/com/netscape/admin/certsrv/config/CMSNetworkPanel.java
new file mode 100644
index 000000000..03458d2b1
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSNetworkPanel.java
@@ -0,0 +1,465 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.*;
+import com.netscape.management.client.console.ConsoleInfo;
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.text.*;
+import netscape.ldap.*;
+
+/**
+ * Network Connection Setting Tab to be displayed at the right hand side
+ *
+ * @author Christine Ho
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class CMSNetworkPanel extends CMSBaseTab {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private final static String PANEL_NAME = "NETWORK";
+ private final static String DISABLED = "-1";
+
+ private static final int MAX_PORT = 65535;
+ private static final int MIN_PORT = 1;
+
+ private Color mActiveColor;
+
+ // TextField for port
+ private JTextField mAdminSSLPortText;
+ private JTextField mAgentSSLPortText;
+ private JTextField mGatewayPortText;
+ private JTextField mGatewaySSLPortText;
+
+ // TextField for Backlog
+ private JTextField mAdminSSLBacklogText;
+ private JTextField mAgentSSLBacklogText;
+ private JTextField mGatewayBacklogText;
+ private JTextField mGatewaySSLBacklogText;
+
+ // Label for EE port
+ private JLabel mPortLabel;
+ private JLabel mEnableLabel;
+ private JLabel mBacklogLabel;
+
+ // Label for SSL EE port
+ private JLabel mSSLPortLabel;
+ private JLabel mSSLBacklogLabel;
+
+ private JCheckBox mEnable;
+
+ private CMSBaseResourceModel mModel;
+ protected AdminConnection mAdmin;
+ private boolean mBlankFieldError = false;
+ private boolean mNumberError = false;
+ private CMSTabPanel mParent;
+ private static final String HELPINDEX = "configuration-system-network-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSNetworkPanel(CMSTabPanel parent) {
+ super(PANEL_NAME, parent);
+ mParent = parent;
+ mModel = parent.getResourceModel();
+ mHelpToken = HELPINDEX;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * Actual Instanciation of the UI components
+ */
+ public void init() {
+ Debug.println("NetworkPanel: init()");
+ mAdmin = mModel.getServerInfo().getAdmin();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ CMSAdminUtil.resetGBC(gbc);
+ mCenterPanel.setLayout(gb);
+
+ // admin panel
+ JPanel adminPanel = new JPanel();
+ GridBagLayout gb1 = new GridBagLayout();
+ adminPanel.setLayout(gb1);
+ adminPanel.setBorder(makeTitledBorder("ADMIN"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints(adminPanel, gbc);
+ mCenterPanel.add(adminPanel);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel adminSSLport = makeJLabel("ADMINSSLPORT");
+ mAdminSSLPortText = makeJTextField(10);
+ JLabel adminBacklog = makeJLabel("ADMINBACKLOG");
+ mAdminSSLBacklogText = makeJTextField(10);
+ JLabel dummy1 = new JLabel(" ");
+ CMSAdminUtil.addEntryField(adminPanel, adminSSLport,
+ mAdminSSLPortText, adminBacklog, mAdminSSLBacklogText, dummy1, gbc);
+
+ mActiveColor = mAdminSSLPortText.getBackground();
+
+ // gateway panel
+ JPanel agentPanel = new JPanel();
+ GridBagLayout gb2 = new GridBagLayout();
+ agentPanel.setLayout(gb2);
+ agentPanel.setBorder(makeTitledBorder("AGENT"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints(agentPanel, gbc);
+ mCenterPanel.add(agentPanel);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel agentPort = makeJLabel("AGENTSSLPORT");
+ mAgentSSLPortText = makeJTextField(10);
+ JLabel agentBacklog = makeJLabel("SECUREAGENTBACKLOG");
+ mAgentSSLBacklogText = makeJTextField(10);
+ JLabel dummy = new JLabel(" ");
+ CMSAdminUtil.addEntryField(agentPanel, agentPort, mAgentSSLPortText,
+ agentBacklog, mAgentSSLBacklogText, dummy, gbc);
+
+ JPanel gatewayPanel = new JPanel();
+ GridBagLayout gb3 = new GridBagLayout();
+ gatewayPanel.setLayout(gb3);
+ gatewayPanel.setBorder(makeTitledBorder("EE"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(gatewayPanel, gbc);
+ mCenterPanel.add(gatewayPanel);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mPortLabel = makeJLabel("GATEWAYPORT");
+ mGatewayPortText = makeJTextField(10);
+ mBacklogLabel = makeJLabel("EEBACKLOG");
+ mGatewayBacklogText = makeJTextField(10);
+ mEnableLabel = makeJLabel("ENABLED");
+ mEnable = makeJCheckBox();
+ CMSAdminUtil.addEntryField(gatewayPanel, mPortLabel, mGatewayPortText,
+ mBacklogLabel, mGatewayBacklogText, mEnableLabel, mEnable, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mSSLPortLabel = makeJLabel("GATEWAYSSLPORT");
+ mGatewaySSLPortText = makeJTextField(10);
+ mSSLBacklogLabel = makeJLabel("SECUREEEBACKLOG");
+ mGatewaySSLBacklogText = makeJTextField(10);
+ JLabel dummy2 = new JLabel(" ");
+ CMSAdminUtil.addEntryField(gatewayPanel, mSSLPortLabel,
+ mGatewaySSLPortText, mSSLBacklogLabel, mGatewaySSLBacklogText,
+ dummy2, gbc);
+
+ refresh();
+ }
+
+ /**
+ * Implementation for saving panel information
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean applyCallback() {
+ String adminSSLPortStr = mAdminSSLPortText.getText().trim();
+ String gatewayPortStr = mGatewayPortText.getText().trim();
+ String gatewaySSLPortStr = mGatewaySSLPortText.getText().trim();
+ String agentSSLPortStr = mAgentSSLPortText.getText().trim();
+ String adminSSLBacklogStr = mAdminSSLBacklogText.getText().trim();
+ String gatewayBacklogStr = mGatewayBacklogText.getText().trim();
+ String gatewaySSLBacklogStr = mGatewaySSLBacklogText.getText().trim();
+ String agentSSLBacklogStr = mAgentSSLBacklogText.getText().trim();
+ //String docroot = mDocRootText.getText().trim();
+
+ //check blank fields
+ if (adminSSLPortStr.equals("") ||
+ (gatewayPortStr.equals("") && mGatewayPortText.isEnabled()) ||
+ (gatewaySSLPortStr.equals("") && mGatewaySSLPortText.isEnabled()) ||
+ agentSSLPortStr.equals("") ||
+ adminSSLBacklogStr.equals("") ||
+ (gatewayBacklogStr.equals("") && mGatewayBacklogText.isEnabled()) ||
+ (gatewaySSLBacklogStr.equals("") && mGatewaySSLBacklogText.isEnabled()) ||
+ agentSSLBacklogStr.equals("") ) {
+ showMessageDialog("BLANKFIELD");
+ return false;
+ }
+
+ //check format and range number
+ int adminSSLPort;
+ int gatewayPort;
+ int gatewaySSLPort;
+ int agentSSLPort;
+ int adminSSLBacklog;
+ int gatewayBacklog;
+ int gatewaySSLBacklog;
+ int agentSSLBacklog;
+
+ try {
+ adminSSLPort = Integer.parseInt(adminSSLPortStr);
+ gatewayPort = Integer.parseInt(gatewayPortStr);
+ gatewaySSLPort = Integer.parseInt(gatewaySSLPortStr);
+ agentSSLPort = Integer.parseInt(agentSSLPortStr);
+ adminSSLBacklog = Integer.parseInt(adminSSLBacklogStr);
+ gatewayBacklog = Integer.parseInt(gatewayBacklogStr);
+ gatewaySSLBacklog = Integer.parseInt(gatewaySSLBacklogStr);
+ agentSSLBacklog = Integer.parseInt(agentSSLBacklogStr);
+ } catch (NumberFormatException e) {
+ showMessageDialog("NUMBERFORMAT");
+ return false;
+ }
+
+ if (adminSSLBacklog <= 0 || gatewayBacklog <= 0 ||
+ gatewaySSLBacklog <= 0 || agentSSLBacklog <= 0) {
+ showMessageDialog("NEGATIVE");
+ return false;
+ }
+ if ((adminSSLPort < MIN_PORT) || (adminSSLPort > MAX_PORT) ||
+ (gatewayPort < MIN_PORT) || (gatewayPort > MAX_PORT) ||
+ (agentSSLPort < MIN_PORT) || (agentSSLPort > MAX_PORT) ||
+ (gatewaySSLPort < MIN_PORT) || (gatewaySSLPort > MAX_PORT)) {
+ showMessageDialog("PORTRANGE");
+ return false;
+ } else {
+ mModel.progressStart();
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_ADMIN_S_PORT, adminSSLPortStr);
+ nvps.put(Constants.PR_GATEWAY_PORT, gatewayPortStr);
+ nvps.put(Constants.PR_AGENT_S_PORT, agentSSLPortStr);
+
+ if (mGatewaySSLPortText.isEnabled()) {
+ nvps.put(Constants.PR_GATEWAY_S_PORT, gatewaySSLPortStr);
+ }
+
+ if (mGatewaySSLBacklogText.isEnabled()) {
+ nvps.put(Constants.PR_GATEWAY_S_BACKLOG, gatewaySSLBacklogStr);
+ }
+
+ if (mEnable.isSelected()) {
+ nvps.put(Constants.PR_GATEWAY_PORT_ENABLED, Constants.TRUE);
+ nvps.put(Constants.PR_ADMIN_S_BACKLOG, adminSSLBacklogStr);
+ nvps.put(Constants.PR_GATEWAY_BACKLOG, gatewayBacklogStr);
+ nvps.put(Constants.PR_AGENT_S_BACKLOG, agentSSLBacklogStr);
+ } else
+ nvps.put(Constants.PR_GATEWAY_PORT_ENABLED, Constants.FALSE);
+
+ try {
+ mAdmin.modify(DestDef.DEST_SERVER_ADMIN, ScopeDef.SC_NETWORK,
+ Constants.RS_ID_CONFIG, nvps);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ return false;
+ }
+
+ ConsoleInfo consoleInfo = mModel.getConsoleInfo();
+ LDAPConnection conn = consoleInfo.getLDAPConnection();
+ try {
+ LDAPAttribute attr = new LDAPAttribute("nsserverport", adminSSLPortStr);
+ LDAPModification singleChange = new LDAPModification(LDAPModification.REPLACE,
+ attr);
+ conn.modify(consoleInfo.getCurrentDN(), singleChange);
+ } catch (Exception eee) {
+ }
+ mModel.progressStop();
+ }
+
+ clearDirtyFlag();
+ return true;
+ }
+
+ /**
+ * Implementation for reset values
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean resetCallback() {
+ refresh();
+ //clearDirtyFlag();
+ return true;
+ }
+
+ /**
+ * refresh the panel and update data
+ */
+ public void refresh() {
+ mModel.progressStart();
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_ADMIN_S_PORT, "");
+ nvps.put(Constants.PR_AGENT_S_PORT, "");
+ nvps.put(Constants.PR_GATEWAY_S_PORT, "");
+ nvps.put(Constants.PR_GATEWAY_PORT, "");
+ nvps.put(Constants.PR_GATEWAY_PORT_ENABLED, "");
+
+ try {
+ NameValuePairs val = mAdmin.read(DestDef.DEST_SERVER_ADMIN,
+ ScopeDef.SC_NETWORK, Constants.RS_ID_CONFIG, nvps);
+
+ populate(val);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ }
+ mModel.progressStop();
+ clearDirtyFlag();
+ mParent.setOKCancel();
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ super.actionPerformed(e);
+ if (e.getSource().equals(mEnable)) {
+ if (mEnable.isSelected()) {
+ enableFields(true, mActiveColor);
+ } else {
+ enableFields(false, getBackground());
+ }
+ }
+ }
+
+ private void populate(NameValuePairs nvps) {
+ for (String name : nvps.keySet()) {
+ String str = nvps.get(name);
+
+ if (name.equals(Constants.PR_GATEWAY_PORT_ENABLED)) {
+ mEnable.setSelected(getBoolean(str));
+ } else {
+ if (!validate(str))
+ continue;
+
+ if (name.equals(Constants.PR_AGENT_S_PORT)) {
+ mAgentSSLPortText.setText(str);
+ } else if (name.equals(Constants.PR_ADMIN_S_PORT)) {
+ mAdminSSLPortText.setText(str);
+ } else if (name.equals(Constants.PR_GATEWAY_S_PORT)) {
+ if (str.equals(DISABLED)) {
+ mGatewaySSLPortText.setText("");
+ enableFields(mSSLPortLabel, mGatewaySSLPortText, false,
+ getBackground());
+ } else {
+ mGatewaySSLPortText.setText(str);
+ enableFields(mSSLPortLabel, mGatewaySSLPortText, true,
+ mActiveColor);
+ }
+ } else if (name.equals(Constants.PR_GATEWAY_PORT)) {
+ if (str.equals(DISABLED)) {
+ mGatewayPortText.setText("");
+ enableFields(mEnable, false);
+ } else {
+ mGatewayPortText.setText(str);
+ enableFields(mEnable, true);
+ }
+ } else if (name.equals(Constants.PR_ADMIN_S_BACKLOG)) {
+ mAdminSSLBacklogText.setText(str);
+ } else if (name.equals(Constants.PR_AGENT_S_BACKLOG)) {
+ mAgentSSLBacklogText.setText(str);
+ } else if (name.equals(Constants.PR_GATEWAY_S_BACKLOG)) {
+ if (str.equals(DISABLED)) {
+ enableFields(mSSLBacklogLabel, mGatewaySSLBacklogText,
+ false, getBackground());
+ mGatewaySSLBacklogText.setText("");
+ } else {
+ enableFields(mSSLBacklogLabel, mGatewaySSLBacklogText,
+ true, mActiveColor);
+ mGatewaySSLBacklogText.setText(str);
+ }
+ } else if (name.equals(Constants.PR_GATEWAY_BACKLOG)) {
+ if (str.equals(DISABLED)) {
+ enableFields(mEnable, false);
+ mGatewayBacklogText.setText("");
+ } else {
+ enableFields(mEnable, true);
+ mGatewayBacklogText.setText(str);
+ }
+ }
+ }
+ }
+
+ if (mEnable.isSelected())
+ enableFields(true, mActiveColor);
+ else
+ enableFields(false, getBackground());
+ }
+
+ private boolean getBoolean(String val) {
+ if (val.equals(Constants.TRUE))
+ return true;
+ return false;
+ }
+
+ private void enableFields(boolean enabled, Color color) {
+ mGatewayPortText.setEnabled(enabled);
+ mGatewayPortText.setEditable(enabled);
+ mGatewayPortText.setBackground(color);
+ mGatewayBacklogText.setEnabled(enabled);
+ mGatewayBacklogText.setEditable(enabled);
+ mGatewayBacklogText.setBackground(color);
+ mPortLabel.setEnabled(enabled);
+ mBacklogLabel.setEnabled(enabled);
+
+ invalidate();
+ validate();
+ repaint(1);
+ }
+
+ private void enableFields(JLabel label, JTextComponent text,
+ boolean enabled, Color color) {
+ label.setEnabled(enabled);
+ text.setEnabled(enabled);
+ text.setEditable(enabled);
+ text.setBackground(color);
+ CMSAdminUtil.repaintComp(label);
+ CMSAdminUtil.repaintComp(text);
+ }
+
+ private void enableFields(JCheckBox comp, boolean enabled) {
+ comp.setEnabled(enabled);
+ CMSAdminUtil.repaintComp(comp);
+ }
+
+ private boolean validate(String str) {
+ if (str.equals("")) {
+ if (!mBlankFieldError) {
+ showMessageDialog("BLANKFIELD");
+ mBlankFieldError = true;
+ }
+ return false;
+ }
+
+ try {
+ int sslPort = Integer.parseInt(str);
+ } catch (NumberFormatException e) {
+ if (!mNumberError) {
+ showMessageDialog("NUMBERFORMAT");
+ mNumberError = true;
+ }
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSOCSPGeneralPanel.java b/base/console/src/com/netscape/admin/certsrv/config/CMSOCSPGeneralPanel.java
new file mode 100644
index 000000000..37dfbef44
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSOCSPGeneralPanel.java
@@ -0,0 +1,219 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import java.math.*;
+
+/**
+ * OCSP General Setting
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ */
+public class CMSOCSPGeneralPanel extends CMSBaseTab implements ItemListener {
+
+ private static String PANEL_NAME = "OCSPGENERAL";
+ private static CMSBaseResourceModel mModel;
+ protected AdminConnection mAdmin;
+ private JCheckBox mRAEnable;
+ private JCheckBox mEEEnable;
+ private CMSTabPanel mParent;
+ private JComboBox mGroups;
+ private JComboBox mAlgorithms;
+ private JTextField mSerialNumber;
+ private JTextField mMaxSerialNumber;
+ private JCheckBox mValidity;
+ private Vector mGroupData;
+ private static final String OCSPHELPINDEX =
+ "configuration-ocsp-general-help";
+
+ public CMSOCSPGeneralPanel(CMSTabPanel parent) {
+ super(PANEL_NAME, parent);
+ mModel = parent.getResourceModel();
+ mParent = parent;
+ mHelpToken = OCSPHELPINDEX;
+ }
+
+ public void init() {
+ Debug.println("CMSCAGeneral: init()");
+ mAdmin = mModel.getServerInfo().getAdmin();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ CMSAdminUtil.resetGBC(gbc);
+ mCenterPanel.setLayout(gb);
+
+ JPanel signingPanel = new JPanel();
+ GridBagLayout gb2 = new GridBagLayout();
+ signingPanel.setLayout(gb2);
+ signingPanel.setBorder(makeTitledBorder("SIGNING"));
+
+ CMSAdminUtil.resetGBC(gbc);
+ mCenterPanel.setLayout(gb);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ //gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ //gbc.weighty = 1.0;
+// gb.setConstraints(adminPanel, gbc);
+// mCenterPanel.add(adminPanel);
+
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(signingPanel, gbc);
+ mCenterPanel.add(signingPanel);
+
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel signingLabel = makeJLabel("ALGORITHM");
+ gbc.anchor = gbc.CENTER;
+ gb2.setConstraints(signingLabel, gbc);
+ gbc.weighty = 1.0;
+ signingPanel.add(signingLabel);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mAlgorithms = new JComboBox();
+ mAlgorithms.addItemListener(this);
+ //mAlgorithms = makeJComboBox("ALGORITHM");
+ gbc.anchor = gbc.NORTHWEST;
+ //gbc.gridwidth = gbc.REMAINDER;
+ //gbc.gridheight = gbc.REMAINDER;
+ //gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb2.setConstraints(mAlgorithms, gbc);
+ signingPanel.add(mAlgorithms);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel dummy1 = new JLabel(" ");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb2.setConstraints(dummy1, gbc);
+ signingPanel.add(dummy1);
+
+ refresh();
+ }
+
+ public void refresh() {
+ mModel.progressStart();
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_DEFAULT_ALGORITHM, "");
+ nvps.put(Constants.PR_ALL_ALGORITHMS, "");
+
+ try {
+ NameValuePairs val = mAdmin.read(DestDef.DEST_OCSP_ADMIN,
+ ScopeDef.SC_GENERAL, Constants.RS_ID_CONFIG, nvps);
+
+ populate(val);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ }
+ mModel.progressStop();
+ clearDirtyFlag();
+ }
+
+ protected void populate(NameValuePairs nvps) {
+ String defaultAlgorithm = "";
+ for (String name : nvps.keySet()) {
+ String value = nvps.get(name);
+ if (name.equals(Constants.PR_DEFAULT_ALGORITHM)) {
+ defaultAlgorithm = value;
+ } else if (name.equals(Constants.PR_ALL_ALGORITHMS)) {
+ initAlgorithmBox(value);
+ }
+ }
+
+ mAlgorithms.setSelectedItem(defaultAlgorithm);
+ }
+
+ private void initAlgorithmBox(String val) {
+ if (mAlgorithms.getItemCount() >= 0) {
+ mAlgorithms.removeAllItems();
+ }
+ StringTokenizer tokenizer = new StringTokenizer(val, ":");
+ while (tokenizer.hasMoreTokens()) {
+ mAlgorithms.addItem(tokenizer.nextToken());
+ }
+ }
+
+ private boolean getBoolean(String str) {
+ if (str.equals(Constants.TRUE))
+ return true;
+ return false;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ super.actionPerformed(e);
+ }
+
+ private String hexToDecimal(String hex)
+ {
+ //String newHex = hex.substring(2);
+ BigInteger bi = new BigInteger(hex, 16);
+ return bi.toString();
+ }
+
+ /**
+ * Implementation for saving panel information
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean applyCallback() {
+ NameValuePairs nvps = new NameValuePairs();
+
+ nvps.put(Constants.PR_DEFAULT_ALGORITHM,
+ (String) mAlgorithms.getSelectedItem());
+
+ mModel.progressStart();
+ try {
+ mAdmin.modify(DestDef.DEST_OCSP_ADMIN,
+ ScopeDef.SC_GENERAL, Constants.RS_ID_CONFIG, nvps);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ return false;
+ }
+ mModel.progressStop();
+ clearDirtyFlag();
+ mParent.setOKCancel();
+ return true;
+ }
+
+ /**
+ * Implementation for reset values
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean resetCallback() {
+ refresh();
+ return true;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSPasswordDialog.java b/base/console/src/com/netscape/admin/certsrv/config/CMSPasswordDialog.java
new file mode 100644
index 000000000..47cb6c865
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSPasswordDialog.java
@@ -0,0 +1,310 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.awt.*;
+import java.util.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.event.*;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.connection.*;
+
+/**
+ * Display this dialog to get a password.
+ *
+ * @author chrisho
+ * @author jpanchen
+ * @version $Revision$, $Date$
+ * @date 07/21/98
+ */
+
+public class CMSPasswordDialog extends JDialog
+ implements ActionListener, DocumentListener, MouseListener
+{
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final int WIDTH = 300;
+ private static final int HEIGHT = 216;
+
+ private JLabel mUsernameField; // username textfield
+ private JPasswordField mPasswordField; // password field
+ private JPasswordField mPasswordFieldAgain; // password field
+ private JPasswordField mOldPasswordField; // old password
+ private boolean mCanceled = true; // exit state of the dialog
+ private String mUsername; // username
+ private String mPassword; // password
+ private static final String PREFIX = "PASSWDDIALOG";
+ private JFrame mParentFrame;
+ private ResourceBundle mResource;
+ private AdminConnection mAdmin;
+ private JButton mOK, mCancel, mHelp;
+
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+
+ /**
+ * @param parent parent frame
+ */
+ public CMSPasswordDialog(JFrame parent, AdminConnection conn, String uid) {
+ super(parent, true);
+ mParentFrame = parent;
+ mAdmin = conn;
+ mResource =
+ ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ setTitle(mResource.getString(PREFIX+"_TITLE"));
+ setLocationRelativeTo(parent);
+
+ JPanel center = new JPanel();
+ getContentPane().setLayout(new BorderLayout());
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ center.setLayout(gb);
+
+ JPanel contentPanel = new JPanel();
+ GridBagLayout gb1 = new GridBagLayout();
+ contentPanel.setLayout(gb1);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(contentPanel, gbc);
+ center.add(contentPanel);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel lUsername =
+ new JLabel(mResource.getString(PREFIX+"_LABEL_USERID_LABEL"));
+ lUsername.setToolTipText(
+ mResource.getString(PREFIX+"_LABEL_USERID_TTIP"));
+
+ mUsernameField = new JLabel(uid);
+
+
+ CMSAdminUtil.addEntryField(contentPanel, lUsername, mUsernameField,
+ gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel lOldPassword=
+ new JLabel(mResource.getString(PREFIX+"_LABEL_OLDPASSWORD_LABEL"));
+ lOldPassword.setToolTipText(
+ mResource.getString(PREFIX+"_LABEL_OLDPASSWORD_TTIP"));
+ mOldPasswordField = new JPasswordField();
+ mOldPasswordField.getDocument().addDocumentListener(this);
+ mOldPasswordField.addMouseListener(this);
+ CMSAdminUtil.addEntryField(contentPanel, lOldPassword,
+ mOldPasswordField, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel lPassword=
+ new JLabel(mResource.getString(PREFIX+"_LABEL_PASSWORD_LABEL"));
+ lPassword.setToolTipText(
+ mResource.getString(PREFIX+"_LABEL_PASSWORD_TTIP"));
+ mPasswordField = new JPasswordField();
+ mPasswordField.getDocument().addDocumentListener(this);
+ mPasswordField.addMouseListener(this);
+ CMSAdminUtil.addEntryField(contentPanel, lPassword, mPasswordField,
+ gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel lPasswordAgain=
+ new JLabel(mResource.getString(PREFIX+"_LABEL_PASSWORD_AGAIN_LABEL"));
+ lPassword.setToolTipText(
+ mResource.getString(PREFIX+"_LABEL_PASSWORD_AGAIN_TTIP"));
+ mPasswordFieldAgain = new JPasswordField();
+ mPasswordFieldAgain.getDocument().addDocumentListener(this);
+ mPasswordFieldAgain.addMouseListener(this);
+ CMSAdminUtil.addEntryField(contentPanel, lPasswordAgain,
+ mPasswordFieldAgain, gbc);
+
+ JPanel actionPanel = makeActionPane();
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints(actionPanel, gbc);
+ center.add(actionPanel);
+
+ getContentPane().add("Center",center);
+
+ mCanceled=false;
+ mUsername="";
+ mPassword="";
+
+ setSize( WIDTH, HEIGHT );
+ this.show();
+
+ /* Cancel if the window is closed */
+ addWindowListener(
+ new WindowAdapter() {
+ public void windowClosing(WindowEvent e) {
+ dispose();
+ mCanceled = true;
+ }
+ }
+ );
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * return the exit status of the dialog
+ *
+ * @return true if the user hits the cancel button.
+ */
+ public boolean isCancel() {
+ return mCanceled;
+ }
+
+ /**
+ * Returns the username typed in by the user, on OK.
+ *
+ * @return The selected username, if the user hits the OK button.
+ */
+ public String getUsername() {
+ return mUsername;
+ }
+
+ /**
+ * Return the password typed in by the user, on OK.
+ *
+ * @return The selected password, if the user hits the OK button.
+ */
+ public String getPassword() {
+ return mPassword;
+ }
+
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ public void actionPerformed(ActionEvent evt) {
+ if (evt.getSource().equals(mOK)) {
+ String userid = mUsernameField.getText().trim();
+ String oldpassword = mOldPasswordField.getText().trim();
+ String newpassword = mPasswordField.getText().trim();
+ String passwordAgain = mPasswordFieldAgain.getText().trim();
+
+ /* PROACTIVE VERIFICATION
+ if (oldpassword.equals("") || newpassword.equals("") ||
+ passwordAgain.equals("")) {
+ CMSAdminUtil.showMessageDialog(mParentFrame, mResource,
+ PREFIX, "EMPTYFIELD", CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ */
+ if (!newpassword.equals(passwordAgain)) {
+ CMSAdminUtil.showMessageDialog(mParentFrame, mResource,
+ PREFIX, "CONFIRMED", CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+
+
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_OLD_AGENT_PWD, oldpassword);
+ nvps.put(Constants.PR_AGENT_PWD, newpassword);
+
+ try {
+ mAdmin.modify(DestDef.DEST_KRA_ADMIN,
+ ScopeDef.SC_AGENT_PWD, userid, nvps);
+ } catch (EAdminException ex) {
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ ex.getMessage(), CMSAdminUtil.ERROR_MESSAGE);
+ if (!ex.getMessage().equals("Server Error"))
+ return;
+ }
+
+ mCanceled = false;
+ this.dispose();
+ return;
+ }
+ if (evt.getSource().equals(mCancel)) {
+ //setVisible(false);
+ mCanceled = true;
+ this.dispose();
+ return;
+ }
+ }
+
+
+ //== DocumentListener ==
+ public void insertUpdate(DocumentEvent e) {
+ setButtons();
+ }
+
+ public void removeUpdate(DocumentEvent e){
+ setButtons();
+ }
+
+ public void changedUpdate(DocumentEvent e){
+ setButtons();
+ }
+
+ //==== MOUSELISTENER ======================
+ public void mouseClicked(MouseEvent e) {
+ setButtons();
+ }
+
+ public void mousePressed(MouseEvent e) {}
+ public void mouseReleased(MouseEvent e) {}
+ public void mouseEntered(MouseEvent e) {}
+ public void mouseExited(MouseEvent e) {
+ setButtons();
+ }
+
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+
+ private JPanel makeActionPane() {
+ mOK = CMSAdminUtil.makeJButton(mResource, PREFIX, "OK", null,
+ this);
+ mOK.setEnabled(false);
+ mCancel = CMSAdminUtil.makeJButton(mResource, PREFIX, "CANCEL",
+ null, this);
+ JButton[] buttons = { mOK, mCancel};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonPanel(buttons);
+ }
+
+ //set buttons
+ private void setButtons() {
+ if ( (mPasswordField.getText().trim().equals("")) ||
+ (mPasswordFieldAgain.getText().trim().equals("")) ||
+ (mOldPasswordField.getText().trim().equals("")) ) {
+ mOK.setEnabled(false);
+ } else {
+ mOK.setEnabled(true);
+ }
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSPluginInstanceTab.java b/base/console/src/com/netscape/admin/certsrv/config/CMSPluginInstanceTab.java
new file mode 100644
index 000000000..d4fb62340
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSPluginInstanceTab.java
@@ -0,0 +1,442 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.ug.*;
+import javax.swing.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Plugin Instances Management Tab
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public abstract class CMSPluginInstanceTab extends CMSBaseUGTab {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ protected static String PANEL_NAME = null;
+ protected static String RULE_NAME = null;
+ protected static String RULE_STAT = null;
+ protected static String RULE_IMPL = null;
+ protected static String RULE_TYPE = null;
+
+
+ protected AdminConnection mConnection;
+
+ protected JScrollPane mScrollPane;
+ protected JTable mTable; //table
+ protected CMSRuleDataModel mDataModel; //table model
+ protected String mDestination; //dest flag
+ protected String mScope;
+ protected String mId = null; // used as a ip id for crl exts
+
+ protected JButton mRefresh, mEdit, mAdd, mDelete, mOrder, mHelp;
+ protected static String RAHELPINDEX = null;
+ protected static String CAHELPINDEX = null;
+ protected static String KRAHELPINDEX = null;
+ protected static String OCSPHELPINDEX = null;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSPluginInstanceTab(CMSBaseResourceModel model, String dest,
+ String panelName) {
+ super(panelName, model);
+ Debug.println("CMSPluginInstanceTab::CMSPluginInstanceTab(<model>,"+dest+","+panelName+")");
+ mConnection = model.getServerInfo().getAdmin();
+ mDestination = dest;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /*==========================================================
+ * EVENT HANDLER METHODS
+ *==========================================================*/
+
+ public CMSBaseConfigDialog makeEditConfigDialog(
+ NameValuePairs nvp,
+ JFrame parent,
+ AdminConnection conn,
+ String dest
+ )
+ {
+ // make it possible to use a different dialog for
+ // edit operation
+ return makeNewConfigDialog(nvp, parent, conn, dest);
+ }
+
+ public abstract CMSBaseConfigDialog makeNewConfigDialog(
+ NameValuePairs nvp,
+ JFrame parent,
+ AdminConnection conn,
+ String dest
+ );
+
+ public abstract PluginSelectionDialog getPluginSelectionDialog(
+ JFrame parent,
+ AdminConnection conn,
+ String dest,
+ CMSPluginInstanceTab pluginType
+ );
+
+ /**
+ * Can override this to handle more events if needed
+ */
+ public void moreActionPerformed(ActionEvent e)
+ {
+ return;
+ }
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mRefresh)) {
+ Debug.println("Refresh");
+ refresh();
+ }
+ if (e.getSource().equals(mEdit)) {
+ if(mTable.getSelectedRow()< 0)
+ return;
+ NameValuePairs data = (NameValuePairs)
+ mDataModel.getObjectValueAt(mTable.getSelectedRow());
+
+ NameValuePairs response;
+ mModel.progressStart();
+ try{
+ response = getConfig();
+ } catch (EAdminException ex1) {
+ showErrorDialog(ex1.getMessage());
+ mModel.progressStop();
+ return;
+ }
+ mModel.progressStop();
+ Debug.println(response.toString());
+
+ CMSBaseConfigDialog dialog = makeEditConfigDialog(
+ response,
+ mModel.getFrame(),
+ mModel.getServerInfo().getAdmin(),
+ mDestination);
+
+ dialog.setModel(mModel);
+ dialog.setInstanceScope(mScope);
+ dialog.showDialog(response, data.get(RULE_NAME));
+
+ if(!dialog.isOK()) return;
+
+ refresh();
+ }
+
+ if (e.getSource().equals(mAdd)) {
+ Debug.println("Add");
+ PluginSelectionDialog dialog =
+ getPluginSelectionDialog(
+ mModel.getFrame(),
+ mConnection,
+ mDestination,
+ this
+ );
+
+ dialog.setModel(mModel);
+ dialog.showDialog();
+ refresh();
+ }
+
+ if (e.getSource().equals(mDelete)) {
+ Debug.println("Delete");
+ if(mTable.getSelectedRow()< 0)
+ return;
+ int i = showConfirmDialog("DELETE");
+ if (i == JOptionPane.YES_OPTION) {
+ delete();
+ Debug.println("Deleted");
+ }
+ }
+ if (e.getSource().equals(mHelp)) {
+ helpCallback();
+ }
+ moreActionPerformed(e);
+ }
+
+ //==== MOUSELISTENER ======================
+ public void mouseClicked(MouseEvent e) {
+ setButtons();
+ }
+
+ public void mouseReleased(MouseEvent e) {
+ setButtons();
+ }
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+ public void refresh() {
+
+ mDataModel.removeAllRows();
+ update();
+
+ setButtons();
+ }
+
+ /**
+ * create the user action button panel
+ */
+ protected JPanel createUserButtonPanel() {
+ Debug.println("CMSPluginInstanceTab::createUserButtonPanel()");
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mEdit = makeJButton("EDIT");
+ mAdd = makeJButton("ADD");
+ mDelete = makeJButton("DELETE");
+ JButton[] buttons = {mAdd, mDelete, mEdit};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonVPanel( buttons );
+ }
+
+ protected JPanel createActionPanel() {
+ Debug.println("CMSPluginInstanceTab::createActionPanel()");
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mRefresh = makeJButton("REFRESH");
+ mHelp = makeJButton("HELP");
+ //JButton[] buttons = { mRefresh, mHelp };
+ JButton[] buttons = { mRefresh };
+ return makeJButtonPanel( buttons , true);
+ }
+
+ protected JPanel createListPanel() {
+ Debug.println("CMSPluginInstanceTab::createListPanel()");
+ try {
+ mListPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mListPanel.setLayout(gb);
+
+ //center table
+ mTable = new JTable(mDataModel);
+ mScrollPane = JTable.createScrollPaneForTable(mTable);
+ mScrollPane.setHorizontalScrollBarPolicy(mScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mScrollPane.setVerticalScrollBarPolicy(mScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ mTable.setAutoscrolls(true);
+ mTable.sizeColumnsToFit(true);
+ mTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ mTable.getSelectionModel().addListSelectionListener(this);
+ mScrollPane.setBackground(Color.white);
+ mTable.addMouseListener(this);
+ setLabelCellRenderer(mTable,0);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = 1;
+ gbc.weightx = 1.0;
+ gbc.insets = EMPTY_INSETS;
+ gb.setConstraints(mScrollPane, gbc);
+ mListPanel.add(mScrollPane);
+
+ JPanel buttonPanel = createUserButtonPanel();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 0.0;
+ gbc.weighty = 1.0;
+ gbc.insets = EMPTY_INSETS;
+ gb.setConstraints(buttonPanel, gbc);
+ mListPanel.add(buttonPanel);
+
+ refresh();
+
+ Debug.println("returning from CMSPluginInstanceTab::createListPanel()");
+
+ } catch (Exception e3) {
+ Debug.println("e3: caught exception:");
+ if (Debug.isEnabled())
+ e3.printStackTrace();
+ }
+ return mListPanel;
+ }
+
+ //Set the first column's cellrender as label cell
+ protected void setLabelCellRenderer(JTable table, int index) {
+ Debug.println("Table.getColumnModel = "+table.getColumnModel());
+ table.getColumnModel().getColumn(index).setCellRenderer(new LabelCellRenderer(new JLabel()));
+ }
+
+ //Set the first column's cellrender as label cell
+ protected void setLabelCellEditor(JTable table, int index) {
+ table.getColumnModel().getColumn(index).setCellRenderer(new PasswordCellRenderer());
+ table.getColumnModel().getColumn(index).setCellEditor(new DefaultCellEditor(new JPasswordField()));
+ }
+
+
+ //set buttons
+ protected void setButtons() {
+
+ //enable and diable buttons accordingly
+ //Debug.println("setButtons() - "+mTable.getSelectedRow());
+
+ if (mTable.getSelectionModel().isSelectionEmpty()) {
+ mDelete.setEnabled(false);
+ mEdit.setEnabled(false);
+ return;
+ }
+
+ if(mDataModel.getRowCount()<=0) {
+ mDelete.setEnabled(false);
+ mEdit.setEnabled(false);
+ return;
+ }
+
+ mDelete.setEnabled(true);
+ mEdit.setEnabled(true);
+ }
+
+ //=============================================
+ // SEND REQUESTS TO THE SERVER SIDE
+ //=============================================
+ private void update() {
+ //send request and parse data
+
+ NameValuePairs response;
+ NameValuePairs request = new NameValuePairs();
+ if (mId != null && mId.length() > 0) {
+ request.put(Constants.PR_ID, mId);
+ }
+
+ try {
+ Debug.println("CMSPluginInstanceTab:update() ---- 1 --- ");
+ Debug.println("mConnection = "+mConnection);
+ response = mConnection.search(mDestination,
+ mScope,
+ request);
+ } catch (EAdminException e) {
+ //display error dialog
+ if (Debug.isEnabled())
+ e.printStackTrace();
+ showErrorDialog(e.getMessage());
+ mModel.progressStop();
+ return;
+ }
+
+ Debug.println(response.toString());
+
+ /* format of each data element:
+ plugin;visibility;enabled
+ where plugin is the name of the plugin impl
+ visibility is one of {visible,invisible}
+ enabled is one of {enabled,disabled}
+ */
+
+ for (String entry : response.keySet()) {
+ String plugin="";
+ String visibility=null;
+ String enabled=null;
+
+ entry = entry.trim();
+ String value = response.get(entry);
+
+ StringTokenizer st = new StringTokenizer(value,";");
+
+ if (st.hasMoreElements()) {
+ plugin = st.nextToken();
+Debug.println("xxxxxxx plugin " + plugin);
+ if (st.hasMoreElements()) {
+ visibility = st.nextToken();
+ if (st.hasMoreElements()) {
+ enabled = st.nextToken();
+ }
+ }
+ }
+
+ if (visibility != null && visibility.equals("visible")) {
+
+ NameValuePairs data = new NameValuePairs();
+ data.put(RULE_NAME, entry);
+ data.put(RULE_IMPL, plugin);
+ if (enabled != null) {
+ data.put(RULE_STAT, enabled);
+ }
+ mDataModel.processData(data);
+ }
+ }
+
+ if (mDataModel.getRowCount() >0)
+ mTable.setRowSelectionInterval(0,0);
+
+ mTable.invalidate();
+ mTable.validate();
+ mTable.repaint(1);
+ mModel.progressStop();
+ }
+
+ private void delete() {
+
+ mModel.progressStart();
+ //get entry name
+ NameValuePairs data = (NameValuePairs)
+ mDataModel.getObjectValueAt(mTable.getSelectedRow());
+
+ //send comment to server for the removal of user
+ try {
+ mConnection.delete(mDestination,
+ mScope,
+ data.get(RULE_NAME));
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ mModel.progressStop();
+ return;
+ }
+
+ mModel.progressStop();
+ //send comment to server and refetch the content
+ refresh();
+
+ }
+
+ //this returns the onfiguration
+ private NameValuePairs getConfig() throws EAdminException {
+ NameValuePairs data = (NameValuePairs)
+ mDataModel.getObjectValueAt(mTable.getSelectedRow());
+ NameValuePairs request = new NameValuePairs();
+ if (mId != null && mId.length() > 0) {
+ request.put(mId, "");
+ }
+
+ NameValuePairs response = mConnection.read(mDestination,
+ mScope,
+ data.get(RULE_NAME),
+ request);
+ return response;
+ }
+
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSRACLMPanel.java b/base/console/src/com/netscape/admin/certsrv/config/CMSRACLMPanel.java
new file mode 100644
index 000000000..734425b41
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSRACLMPanel.java
@@ -0,0 +1,313 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.*;
+
+/**
+ * RA CLM Setting
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ */
+public class CMSRACLMPanel extends CMSBaseTab {
+
+ private static String PANEL_NAME = "RACLM";
+ private static CMSBaseResourceModel mModel;
+ protected AdminConnection mAdmin;
+ private JCheckBox mRenewEnable;
+ private JTextField mValidText;
+ private JTextField mEmailText;
+ private JCheckBox mNotifyEnable;
+ private JTextField mNotifiedText;
+ private JTextField mIntervalText;
+ private Color mActiveColor;
+ private CMSTabPanel mParent;
+ private static final String HELPINDEX =
+ "configuration-ra-clm-help";
+
+ public CMSRACLMPanel(CMSTabPanel parent) {
+ super(PANEL_NAME, parent);
+ mModel = parent.getResourceModel();
+ mParent = parent;
+ mHelpToken = HELPINDEX;
+ }
+
+ public void init() {
+ Debug.println("CMSRACLMPanel: init()");
+ mAdmin = mModel.getServerInfo().getAdmin();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ CMSAdminUtil.resetGBC(gbc);
+ mCenterPanel.setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mRenewEnable = makeJCheckBox("RENEWENABLED");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gb.setConstraints(mRenewEnable, gbc);
+ mCenterPanel.add(mRenewEnable);
+
+ JPanel adminPanel = new JPanel();
+ GridBagLayout gb1 = new GridBagLayout();
+ adminPanel.setLayout(gb1);
+ adminPanel.setBorder(makeTitledBorder("CLMRENEWAL"));
+
+ CMSAdminUtil.resetGBC(gbc);
+ mCenterPanel.setLayout(gb);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(adminPanel, gbc);
+ mCenterPanel.add(adminPanel);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel validLbl = makeJLabel("VALID");
+ mValidText = makeJTextField(4);
+ mActiveColor = mValidText.getBackground();
+ JLabel day1Lbl = makeJLabel("DAYS");
+ CMSAdminUtil.addEntryField(adminPanel, validLbl, mValidText,
+ day1Lbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ //JLabel dummy2 = new JLabel("");
+ mNotifyEnable = makeJCheckBox("NOTIFIED");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gb1.setConstraints(mNotifyEnable, gbc);
+ adminPanel.add(mNotifyEnable);
+
+ //CMSAdminUtil.addEntryField(adminPanel, dummy2, mNotifyEnable, gbc);
+
+ JPanel subPanel = new JPanel();
+ GridBagLayout gb2 = new GridBagLayout();
+ subPanel.setLayout(gb2);
+ subPanel.setBorder(makeTitledBorder("CLMRENEWALNOTIFY"));
+
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb1.setConstraints(subPanel, gbc);
+ adminPanel.add(subPanel);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel emailLbl = makeJLabel("EMAIL");
+ mEmailText = makeJTextField(30);
+ CMSAdminUtil.addEntryField(subPanel, emailLbl, mEmailText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel numNotifyLbl = makeJLabel("NUMNOTIFIED");
+ mNotifiedText = makeJTextField(4);
+ CMSAdminUtil.addEntryField(subPanel, numNotifyLbl, mNotifiedText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel intervalLbl = makeJLabel("INTERVAL");
+ mIntervalText = makeJTextField(4);
+ JLabel day2Lbl = makeJLabel("DAYS");
+ CMSAdminUtil.addEntryField(subPanel, intervalLbl, mIntervalText,
+ day2Lbl, gbc);
+
+ refresh();
+ }
+
+ public void refresh() {
+ mModel.progressStart();
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_RENEWAL_ENABLED, "");
+ nvps.put(Constants.PR_RENEWAL_VALIDITY, "");
+ nvps.put(Constants.PR_RENEWAL_EMAIL, "");
+ nvps.put(Constants.PR_RENEWAL_EXPIREDNOTIFIEDENABLED, "");
+ nvps.put(Constants.PR_RENEWAL_NUMNOTIFICATION, "");
+ nvps.put(Constants.PR_RENEWAL_INTERVAL, "");
+
+ try {
+ NameValuePairs val = mAdmin.read(DestDef.DEST_RA_ADMIN,
+ ScopeDef.SC_CLM, Constants.RS_ID_CONFIG, nvps);
+
+ populate(val);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ }
+ mModel.progressStop();
+ clearDirtyFlag();
+ mParent.setOKCancel();
+ }
+
+ protected void populate(NameValuePairs nvps) {
+ boolean renewalEnabled = false;
+ boolean notificationEnabled = false;
+ for (String name : nvps.keySet()) {
+ String value = nvps.get(name);
+ if (name.equals(Constants.PR_RENEWAL_ENABLED)) {
+ renewalEnabled = getBoolean(value);
+ mRenewEnable.setSelected(renewalEnabled);
+ } else if (name.equals(Constants.PR_RENEWAL_EXPIREDNOTIFIEDENABLED)) {
+ notificationEnabled = getBoolean(value);
+ mNotifyEnable.setSelected(notificationEnabled);
+ } else if (name.equals(Constants.PR_RENEWAL_VALIDITY)) {
+ mValidText.setText(value);
+ } else if (name.equals(Constants.PR_RENEWAL_EMAIL)) {
+ mEmailText.setText(value);
+ } else if (name.equals(Constants.PR_RENEWAL_NUMNOTIFICATION)) {
+ mNotifiedText.setText(value);
+ } else if (name.equals(Constants.PR_RENEWAL_INTERVAL)) {
+ mIntervalText.setText(value);
+ }
+ }
+
+ if (renewalEnabled) {
+ enableRenewal(renewalEnabled, mActiveColor);
+ if (notificationEnabled)
+ enableNotification(notificationEnabled, mActiveColor);
+ else
+ enableNotification(notificationEnabled, getBackground());
+ } else {
+ enableRenewal(renewalEnabled, getBackground());
+ enableNotification(renewalEnabled, getBackground());
+ }
+ }
+
+ private boolean getBoolean(String str) {
+ if (str.equals(Constants.TRUE))
+ return true;
+ return false;
+ }
+
+ private void enableRenewal(boolean renewalEnabled, boolean notificationEnabled) {
+
+ if (renewalEnabled) {
+ enableRenewal(renewalEnabled, mActiveColor);
+ if (notificationEnabled)
+ enableNotification(notificationEnabled, mActiveColor);
+ else
+ enableNotification(notificationEnabled, getBackground());
+ } else {
+ enableRenewal(renewalEnabled, getBackground());
+ enableNotification(renewalEnabled, getBackground());
+ }
+ }
+
+ private void enableRenewal(boolean enable, Color color) {
+ mValidText.setEnabled(enable);
+ mValidText.setEditable(enable);
+ mValidText.setBackground(color);
+ mNotifyEnable.setEnabled(enable);
+ mNotifyEnable.setBackground(color);
+ //enableNotification(enable, color);
+ }
+
+ private void enableNotification(boolean enable, Color color) {
+ mEmailText.setEnabled(enable);
+ mEmailText.setEditable(enable);
+ mEmailText.setBackground(color);
+ mNotifiedText.setEnabled(enable);
+ mNotifiedText.setEditable(enable);
+ mNotifiedText.setBackground(color);
+ mIntervalText.setEnabled(enable);
+ mIntervalText.setEditable(enable);
+ mIntervalText.setBackground(color);
+ invalidate();
+ validate();
+ repaint(1);
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ super.actionPerformed(e);
+ if (e.getSource().equals(mRenewEnable) ||
+ e.getSource().equals(mNotifyEnable)) {
+ enableRenewal(mRenewEnable.isSelected(),
+ mNotifyEnable.isSelected());
+ }
+ }
+
+ /**
+ * Implementation for saving panel information
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean applyCallback() {
+ NameValuePairs nvps = new NameValuePairs();
+ if (mRenewEnable.isSelected()) {
+ nvps.put(Constants.PR_RENEWAL_ENABLED, Constants.TRUE);
+ String validStr = mValidText.getText();
+ try {
+ int num = Integer.parseInt(validStr);
+ } catch (NumberFormatException e) {
+ showMessageDialog("NUMBERFORMAT");
+ return false;
+ }
+ nvps.put(Constants.PR_RENEWAL_VALIDITY, validStr);
+
+ if (mNotifyEnable.isSelected()) {
+ nvps.put(Constants.PR_RENEWAL_EXPIREDNOTIFIEDENABLED,
+ Constants.TRUE);
+ nvps.put(Constants.PR_RENEWAL_EMAIL, mEmailText.getText());
+ String numStr = mNotifiedText.getText();
+ String intervalStr = mIntervalText.getText();
+
+ try {
+ int num1 = Integer.parseInt(numStr);
+ int num2 = Integer.parseInt(intervalStr);
+ } catch (NumberFormatException ex) {
+ showMessageDialog("NUMBERFORMAT");
+ return false;
+ }
+
+ nvps.put(Constants.PR_RENEWAL_NUMNOTIFICATION, numStr);
+ nvps.put(Constants.PR_RENEWAL_INTERVAL, intervalStr);
+ } else {
+ nvps.put(Constants.PR_RENEWAL_EXPIREDNOTIFIEDENABLED,
+ Constants.FALSE);
+ }
+ } else {
+ nvps.put(Constants.PR_RENEWAL_ENABLED, Constants.FALSE);
+ }
+
+ mModel.progressStart();
+ try {
+ mAdmin.modify(DestDef.DEST_RA_ADMIN,
+ ScopeDef.SC_CLM, Constants.RS_ID_CONFIG, nvps);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ return false;
+ }
+ mModel.progressStop();
+ clearDirtyFlag();
+ return true;
+ }
+
+ /**
+ * Implementation for reset values
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean resetCallback() {
+ refresh();
+ return true;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSRAConnectorPanel.java b/base/console/src/com/netscape/admin/certsrv/config/CMSRAConnectorPanel.java
new file mode 100644
index 000000000..7733a43d7
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSRAConnectorPanel.java
@@ -0,0 +1,251 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.*;
+
+/**
+ * RA Connector Panel
+ *
+ * @author Christine Ho
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public class CMSRAConnectorPanel extends CMSBaseTab
+ implements MouseListener
+{
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+
+ private final static String PANEL_NAME = "CONNECTOR";
+ private final static String HELPINDEX = "configuration-ra-connector-help";
+
+ private AdminConnection mAdmin;
+ private CMSBaseResourceModel mModel;
+ private CMSTabPanel mParent;
+ private JList mList;
+ private DefaultListModel mDataModel;
+ private JScrollPane mScrollPane;
+ private JButton mEdit;
+ protected boolean mInit = false;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSRAConnectorPanel(CMSBaseResourceModel model, CMSTabPanel parent) {
+ super(PANEL_NAME, parent);
+ mModel = model;
+ mParent = parent;
+ mDataModel = new DefaultListModel();
+ mHelpToken = HELPINDEX;
+
+ // hardcoded just for beta 1
+ mDataModel.addElement("Certificate Manager Connector");
+ mDataModel.addElement("Data Recovery Manager Connector");
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * initialize the UI components
+ */
+ public void init() {
+// setLayout(new BorderLayout());
+
+ // JPanel mainPanel = new JPanel();
+ JPanel mainPanel = mCenterPanel;
+
+
+ Debug.println("ConnectorPanel: init()");
+ mAdmin = mModel.getServerInfo().getAdmin();
+
+ GridBagLayout gb1 = new GridBagLayout();
+ mainPanel.setLayout(gb1);
+
+ GridBagConstraints gbc = new GridBagConstraints();
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel listLabel = makeJLabel("CONNLIST");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(DIFFERENT_COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,
+ 0,DIFFERENT_COMPONENT_SPACE);
+ gb1.setConstraints(listLabel, gbc);
+ mainPanel.add(listLabel);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mList = makeJList(mDataModel, 3);
+ mScrollPane = new JScrollPane(mList,
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mList.addMouseListener(this);
+ mScrollPane.setBackground(Color.white);
+ mScrollPane.setBorder(BorderFactory.createLoweredBevelBorder());
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 0.5;
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,
+ 0,DIFFERENT_COMPONENT_SPACE);
+ gb1.setConstraints(mScrollPane, gbc);
+ mainPanel.add(mScrollPane);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mEdit = makeJButton("EDIT");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ gbc.weightx = 0.5;
+ gbc.insets = new Insets(COMPONENT_SPACE,0,
+ 0,DIFFERENT_COMPONENT_SPACE);
+ gb1.setConstraints(mEdit, gbc);
+ mainPanel.add(mEdit);
+
+ // add("Center",mainPanel);
+ refresh();
+ }
+
+ /**
+ * refresh the panel data
+ */
+ public void refresh() {
+/*
+ NameValuePairs response;
+ mModel.progressStart();
+ try {
+ response = mAdmin.search(DestDef.DEST_RA_ADMIN,
+ ScopeDef.SC_CONNECTOR, new NameValuePairs());
+
+ Debug.println(response.toString());
+ populate(response);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ }
+ mModel.progressStop();
+*/
+ }
+
+ /*==========================================================
+ * Event Handler
+ *==========================================================*/
+
+ //======= ActionLister ============================
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mEdit)) {
+ JFrame frame = mModel.getFrame();
+ String name = (String)mList.getSelectedValue();
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_ID, "");
+ nvps.put(Constants.PR_HOST, "");
+ nvps.put(Constants.PR_PORT, "");
+ // Inserted by beomsuk
+ nvps.put(Constants.PR_TIMEOUT, "");
+ // Insert end
+ nvps.put(Constants.PR_URI, "");
+ nvps.put(Constants.PR_LOCAL, "");
+ nvps.put(Constants.PR_ENABLE, "");
+
+ try {
+ NameValuePairs values = mAdmin.read(DestDef.DEST_RA_ADMIN,
+ ScopeDef.SC_CONNECTOR, name, nvps);
+
+ NameValuePairs subsystems = mAdmin.search(DestDef.DEST_SERVER_ADMIN,
+ ScopeDef.SC_SUBSYSTEM, new NameValuePairs());
+
+ boolean colocated = false;
+ if (name.equals("Data Recovery Manager Connector")) {
+ String val = values.get("id");
+ if (val != null && val.equals("kra"))
+ colocated = true;
+ }
+ ConnectorEditor editor = new ConnectorEditor(mAdmin,
+ mModel.getFrame(), name, DestDef.DEST_RA_ADMIN,
+ mModel.getServerInfo().getServerId(), colocated);
+ editor.showDialog(values);
+ } catch (EAdminException ex) {
+ showErrorDialog(ex.toString());
+ }
+/*
+ NameValuePairs values = new NameValuePairs();
+ ConnectorEditor editor = new ConnectorEditor(mAdmin,
+ mModel.getFrame(), name);
+ editor.showDialog(values);
+*/
+ }
+ }
+
+ //=== MOUSELISTENER ========================
+ public void mouseClicked(MouseEvent e) {
+ if (e.getSource() == mList) {
+ if (mList.getSelectedIndex() < 0)
+ mEdit.setEnabled(false);
+ else
+ mEdit.setEnabled(true);
+ }
+ }
+
+ public void mousePressed(MouseEvent e) {}
+ public void mouseReleased(MouseEvent e) {}
+ public void mouseEntered(MouseEvent e) {}
+ public void mouseExited(MouseEvent e) {}
+
+ //======== CMSBaseConfigPanel ==============
+ public boolean applyCallback() {
+ return true;
+ }
+
+ /**
+ * Implementation for reset values
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean resetCallback() {
+ refresh();
+ return true;
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+
+ //update the UI component using the data retrieved
+ private void populate(NameValuePairs nvps) {
+/*
+ Enumeration names = nvps.getNames();
+ mDataModel.removeAllElements();
+ while (names.hasMoreElements())
+ mDataModel.addElement(names.nextElement());
+
+ if (mDataModel.size() > 0) {
+ mList.setSelectedIndex(0);
+ mEdit.setEnabled(true);
+ } else
+ mEdit.setEnabled(false);
+*/
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSRAGeneralPanel.java b/base/console/src/com/netscape/admin/certsrv/config/CMSRAGeneralPanel.java
new file mode 100644
index 000000000..6605385b0
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSRAGeneralPanel.java
@@ -0,0 +1,185 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.*;
+
+/**
+ * RA General Setting
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ */
+public class CMSRAGeneralPanel extends CMSBaseTab {
+
+ private static String PANEL_NAME = "RAGENERAL";
+ private static CMSBaseResourceModel mModel;
+ protected AdminConnection mAdmin;
+ private JCheckBox mRAEnable;
+ private JCheckBox mEEEnable;
+ private CMSTabPanel mParent;
+ private static final String HELPINDEX =
+ "configuration-ra-general-help";
+
+ public CMSRAGeneralPanel(CMSTabPanel parent) {
+ super(PANEL_NAME, parent);
+ mModel = parent.getResourceModel();
+ mParent = parent;
+ mHelpToken = HELPINDEX;
+ }
+
+ public void init() {
+ Debug.println("CMSRAGeneral: init()");
+ mAdmin = mModel.getServerInfo().getAdmin();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ CMSAdminUtil.resetGBC(gbc);
+ mCenterPanel.setLayout(gb);
+
+ JPanel adminPanel = new JPanel();
+ GridBagLayout gb1 = new GridBagLayout();
+ adminPanel.setLayout(gb1);
+ adminPanel.setBorder(makeTitledBorder("PARAMETERS"));
+
+ CMSAdminUtil.resetGBC(gbc);
+ mCenterPanel.setLayout(gb);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(adminPanel, gbc);
+ mCenterPanel.add(adminPanel);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mEEEnable = makeJCheckBox("EE");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb1.setConstraints(mEEEnable, gbc);
+ adminPanel.add(mEEEnable);
+
+/*
+ CMSAdminUtil.resetGBC(gbc);
+ mRAEnable = makeJCheckBox("RA");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb1.setConstraints(mRAEnable, gbc);
+ adminPanel.add(mRAEnable);
+*/
+
+ refresh();
+ }
+
+ public void refresh() {
+ mModel.progressStart();
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_EE_ENABLED, "");
+ //nvps.add(Constants.PR_RA_ENABLED, "");
+
+ try {
+ NameValuePairs val = mAdmin.read(DestDef.DEST_RA_ADMIN,
+ ScopeDef.SC_GENERAL, Constants.RS_ID_CONFIG, nvps);
+
+ populate(val);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ }
+ mModel.progressStop();
+ clearDirtyFlag();
+ }
+
+ protected void populate(NameValuePairs nvps) {
+ Debug.println("RA General Received: "+nvps.toString());
+ for (String name : nvps.keySet()) {
+ String value = nvps.get(name);
+ if (name.equals(Constants.PR_EE_ENABLED)) {
+ mEEEnable.setSelected(getBoolean(value));
+/*
+ } else if (name.equals(Constants.PR_RA_ENABLED)) {
+ mRAEnable.setSelected(getBoolean(value));
+*/
+ }
+ }
+ }
+
+ private boolean getBoolean(String str) {
+ if (str.equals(Constants.TRUE))
+ return true;
+ return false;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ super.actionPerformed(e);
+ }
+
+ /**
+ * Implementation for saving panel information
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean applyCallback() {
+ NameValuePairs nvps = new NameValuePairs();
+
+ if (mEEEnable.isSelected())
+ nvps.put(Constants.PR_EE_ENABLED, Constants.TRUE);
+ else
+ nvps.put(Constants.PR_EE_ENABLED, Constants.FALSE);
+
+/*
+ if (mRAEnable.isSelected())
+ nvps.add(Constants.PR_RA_ENABLED, Constants.TRUE);
+ else
+ nvps.add(Constants.PR_RA_ENABLED, Constants.FALSE);
+*/
+
+ mModel.progressStart();
+ try {
+ mAdmin.modify(DestDef.DEST_RA_ADMIN,
+ ScopeDef.SC_GENERAL, Constants.RS_ID_CONFIG, nvps);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ return false;
+ }
+ mModel.progressStop();
+ clearDirtyFlag();
+ mParent.setOKCancel();
+ return true;
+ }
+
+ /**
+ * Implementation for reset values
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean resetCallback() {
+ refresh();
+ return true;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSRALDAPPanel.java b/base/console/src/com/netscape/admin/certsrv/config/CMSRALDAPPanel.java
new file mode 100644
index 000000000..3fbe6a72a
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSRALDAPPanel.java
@@ -0,0 +1,44 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.management.client.util.*;
+
+/**
+ * LDAP server setting tab
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ */
+public class CMSRALDAPPanel extends CMSBaseLDAPPanel {
+
+ private static String PANEL_NAME = "RALDAPSETTING";
+ private static final String HELPINDEX =
+ "configuration-ra-ldappublish-destination-help";
+
+ public CMSRALDAPPanel(CMSTabPanel parent) {
+ super(PANEL_NAME, parent);
+ mHelpToken = HELPINDEX;
+ }
+
+ public void init() {
+ super.init();
+ refresh();
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSRuleDataModel.java b/base/console/src/com/netscape/admin/certsrv/config/CMSRuleDataModel.java
new file mode 100644
index 000000000..2c12183c7
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSRuleDataModel.java
@@ -0,0 +1,82 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.certsrv.common.*;
+
+
+/**
+ * instance Data model - represents the instance
+ * table information
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public abstract class CMSRuleDataModel extends CMSContentTableModel
+ implements IDataProcessor
+{
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ public static final String RULE_NAME = "RULENAME";
+ public static final String RULE_STAT = "STATUS";
+ public static final String RULE_IMPL = "IMPL";
+ public static final String RULE_TYPE = "TYPE";
+
+ protected static String[] mColumns = null;
+ protected Vector mRules;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSRuleDataModel() {
+ super();
+ mColumns = getColumns();
+ init(mColumns);
+ mRules = new Vector();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ protected abstract String[] getColumns();
+
+ /**
+ * clean up the table including the datat objects
+ */
+ public void removeAllRows() {
+ super.removeAllRows();
+ mRules.removeAllElements();
+ }
+
+
+ public Vector getRules() {
+ return (Vector) mRules.clone();
+ }
+
+ public boolean isCellEditable(int row, int col) {
+ return false;
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSSMTPPanel.java b/base/console/src/com/netscape/admin/certsrv/config/CMSSMTPPanel.java
new file mode 100644
index 000000000..0275e3cb0
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSSMTPPanel.java
@@ -0,0 +1,170 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.*;
+
+/**
+ * SMTP setting tab
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ */
+public class CMSSMTPPanel extends CMSBaseTab {
+ private static String PANEL_NAME = "SMTPSETTING";
+ private JTextField mServerText;
+ private JTextField mPortText;
+ private Color mActiveColor;
+ private AdminConnection mAdmin;
+ private CMSBaseResourceModel mModel;
+ private CMSTabPanel mParent;
+ private static final String HELPINDEX =
+ "configuration-system-smtp-help";
+
+ public CMSSMTPPanel(CMSTabPanel parent) {
+ super(PANEL_NAME, parent);
+ mModel = parent.getResourceModel();
+ mParent = parent;
+ mHelpToken = HELPINDEX;
+ }
+
+ public void init() {
+ Debug.println("SMTPPanel: init()");
+ mAdmin = mModel.getServerInfo().getAdmin();
+ JPanel smtpInfo = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ CMSAdminUtil.resetGBC(gbc);
+ mCenterPanel.setLayout(gb);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(smtpInfo, gbc);
+ mCenterPanel.add(smtpInfo);
+
+ GridBagLayout gb1 = new GridBagLayout();
+ smtpInfo.setLayout(gb1);
+
+ // add server name label and text field
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel serverLabel = makeJLabel("SERVER");
+ mServerText = makeJTextField(30);
+ mActiveColor = mServerText.getBackground();
+ CMSAdminUtil.addEntryField(smtpInfo, serverLabel, mServerText, gbc);
+
+ // add port number label and text field
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel portLabel = makeJLabel("PORT");
+ mPortText = makeJTextField(30);
+ CMSAdminUtil.addEntryField(smtpInfo, portLabel, mPortText, gbc);
+
+ refresh();
+ }
+
+ public void refresh() {
+ mModel.progressStart();
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_SERVER_NAME, "");
+ nvps.put(Constants.PR_PORT, "");
+ try {
+ NameValuePairs val = mAdmin.read(DestDef.DEST_SERVER_ADMIN,
+ ScopeDef.SC_SMTP, Constants.RS_ID_CONFIG, nvps);
+
+ populate(val);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ }
+ mModel.progressStop();
+ clearDirtyFlag();
+ mParent.setOKCancel();
+ }
+
+ private void populate(NameValuePairs nvps) {
+ for (String name : nvps.keySet()) {
+ String value = nvps.get(name);
+ if (name.equals(Constants.PR_SERVER_NAME)) {
+ mServerText.setText(value);
+ } else if (name.equals(Constants.PR_PORT)) {
+ mPortText.setText(value);
+ }
+ }
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ super.actionPerformed(e);
+ }
+
+ /**
+ * Implementation for saving panel information
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean applyCallback() {
+ // check blank field
+ if (mServerText.getText().trim().equals("")) {
+ showMessageDialog("BLANKFIELD");
+ return false;
+ }
+
+ String port = mPortText.getText().trim();
+ try {
+ int num = Integer.parseInt(port);
+ if (num <= 0) {
+ showMessageDialog("OUTOFRANGE");
+ return false;
+ }
+ } catch (NumberFormatException e) {
+ showMessageDialog("NUMBERFORMAT");
+ return false;
+ }
+
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_SERVER_NAME, mServerText.getText().trim());
+ nvps.put(Constants.PR_PORT, port);
+ mModel.progressStart();
+ try {
+ mAdmin.modify(DestDef.DEST_SERVER_ADMIN,
+ ScopeDef.SC_SMTP, Constants.RS_ID_CONFIG, nvps);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ return false;
+ }
+ mModel.progressStop();
+ clearDirtyFlag();
+ return true;
+ }
+
+ /**
+ * Implementation for reset values
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean resetCallback() {
+ refresh();
+ return true;
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSSNMPPanel.java b/base/console/src/com/netscape/admin/certsrv/config/CMSSNMPPanel.java
new file mode 100644
index 000000000..b5b589eb0
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSSNMPPanel.java
@@ -0,0 +1,296 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.*;
+
+/**
+ * SNMP setting tab
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ */
+public class CMSSNMPPanel extends CMSBaseTab {
+ private static String PANEL_NAME = "SNMPSETTING";
+ private Color mActiveColor;
+ private JButton mOnB;
+ private JButton mOffB;
+ private JCheckBox mEnable;
+ private JTextField mHostNameText;
+ private JTextField mPortText;
+ private JTextField mDescText;
+ private JTextField mOrgnText;
+ private JTextField mLocText;
+ private JTextField mContactText;
+ private AdminConnection mAdmin;
+ private CMSBaseResourceModel mModel;
+ private CMSTabPanel mParent;
+ private JLabel mHostLabel;
+ private JLabel mPortLabel;
+ private JLabel mDescLabel;
+ private JLabel mOrgnLabel;
+ private JLabel mLocLabel;
+ private JLabel mContactLabel;
+ private static final String HELPINDEX =
+ "configuration-system-snmp-help";
+
+ public CMSSNMPPanel(CMSTabPanel parent) {
+ super(PANEL_NAME, parent);
+ mModel = parent.getResourceModel();
+ mParent = parent;
+ mHelpToken = HELPINDEX;
+ }
+
+ public void init() {
+ Debug.println("SNMPPanel: init()");
+ mAdmin = mModel.getServerInfo().getAdmin();
+ JPanel snmpInfo = new JPanel();
+ snmpInfo.setBorder(CMSAdminUtil.makeEtchedBorder());
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ CMSAdminUtil.resetGBC(gbc);
+ mCenterPanel.setLayout(gb);
+
+ mEnable = makeJCheckBox("ENABLE");
+ mEnable.setActionCommand("enable");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gb.setConstraints(mEnable, gbc);
+ mCenterPanel.add(mEnable);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(snmpInfo, gbc);
+ mCenterPanel.add(snmpInfo);
+
+ mOnB = makeJButton("ON");
+ mOffB = makeJButton("OFF");
+ JButton[] bArray = {mOnB, mOffB};
+ JPanel buttonPanel = CMSAdminUtil.makeJButtonPanel(bArray);
+
+ GridBagLayout gb1 = new GridBagLayout();
+ snmpInfo.setLayout(gb1);
+
+ // add host name label and text field
+ CMSAdminUtil.resetGBC(gbc);
+ mHostLabel = makeJLabel("HOST");
+ mHostNameText = makeJTextField(30);
+ mActiveColor = mHostNameText.getBackground();
+ CMSAdminUtil.addEntryField(snmpInfo, mHostLabel, mHostNameText, gbc);
+
+ // add port label and text field
+ CMSAdminUtil.resetGBC(gbc);
+ mPortLabel = makeJLabel("PORT");
+ mPortText = makeJTextField(30);
+ CMSAdminUtil.addEntryField(snmpInfo, mPortLabel, mPortText, gbc);
+
+ // add description label and text field
+ CMSAdminUtil.resetGBC(gbc);
+ mDescLabel = makeJLabel("DESC");
+ mDescText = makeJTextField(30);
+ CMSAdminUtil.addEntryField(snmpInfo, mDescLabel, mDescText, gbc);
+
+ // add organization label and text field
+ CMSAdminUtil.resetGBC(gbc);
+ mOrgnLabel = makeJLabel("ORGN");
+ mOrgnText = makeJTextField(30);
+ CMSAdminUtil.addEntryField(snmpInfo, mOrgnLabel, mOrgnText, gbc);
+
+ // add location label and text field
+ CMSAdminUtil.resetGBC(gbc);
+ mLocLabel = makeJLabel("LOC");
+ mLocText = makeJTextField(30);
+ CMSAdminUtil.addEntryField(snmpInfo, mLocLabel, mLocText, gbc);
+
+ // add contact label and text field
+ CMSAdminUtil.resetGBC(gbc);
+ mContactLabel = makeJLabel("CONTACT");
+ mContactText = makeJTextField(30);
+ CMSAdminUtil.addEntryField(snmpInfo, mContactLabel, mContactText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gb1.setConstraints(buttonPanel, gbc);
+ snmpInfo.add(buttonPanel);
+
+ refresh();
+ }
+
+ public void refresh() {
+ mModel.progressStart();
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_SNMP_ENABLED, "");
+ nvps.put(Constants.PR_SNMP_MASTER_HOST, "");
+ nvps.put(Constants.PR_SNMP_MASTER_PORT, "");
+ nvps.put(Constants.PR_SNMP_DESC, "");
+ nvps.put(Constants.PR_SNMP_ORGN, "");
+ nvps.put(Constants.PR_SNMP_LOC, "");
+ nvps.put(Constants.PR_SNMP_CONTACT, "");
+
+ try {
+ NameValuePairs val = mAdmin.read(DestDef.DEST_SERVER_ADMIN,
+ ScopeDef.SC_SNMP, Constants.RS_ID_CONFIG, nvps);
+
+ populate(val);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ }
+ mModel.progressStop();
+ clearDirtyFlag();
+ mParent.setOKCancel();
+ }
+
+ private void populate(NameValuePairs nvps) {
+ for (String name : nvps.keySet()) {
+ String value = nvps.get(name);
+ if (name.equals(Constants.PR_SNMP_ENABLED)) {
+ mEnable.setSelected(getBoolean(value));
+ } else if (name.equals(Constants.PR_SNMP_MASTER_HOST)) {
+ mHostNameText.setText(value);
+ } else if (name.equals(Constants.PR_SNMP_MASTER_PORT)) {
+ mPortText.setText(value);
+ } else if (name.equals(Constants.PR_SNMP_DESC)) {
+ mDescText.setText(value);
+ } else if (name.equals(Constants.PR_SNMP_ORGN)) {
+ mOrgnText.setText(value);
+ } else if (name.equals(Constants.PR_SNMP_LOC)) {
+ mLocText.setText(value);
+ } else if (name.equals(Constants.PR_SNMP_CONTACT)) {
+ mContactText.setText(value);
+ }
+ }
+
+ if (mEnable.isSelected())
+ enableTextField(true, mActiveColor);
+ else
+ enableTextField(false, getBackground());
+ }
+
+ public boolean getBoolean(String value) {
+ if (value.equals(Constants.TRUE))
+ return true;
+ return false;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ super.actionPerformed(e);
+ if (e.getActionCommand().equals("enable")) {
+ if (mEnable.isSelected()) {
+ enableTextField(true, mActiveColor);
+ } else {
+ enableTextField(false, getBackground());
+ }
+ }
+ }
+
+ private void enableTextField(boolean enable, Color color) {
+ mHostNameText.setEnabled(enable);
+ mHostNameText.setEditable(enable);
+ mHostNameText.setBackground(color);
+ mHostLabel.setEnabled(enable);
+ mPortText.setEnabled(enable);
+ mPortText.setEditable(enable);
+ mPortText.setBackground(color);
+ mPortLabel.setEnabled(enable);
+ mDescText.setEnabled(enable);
+ mDescText.setEditable(enable);
+ mDescText.setBackground(color);
+ mDescLabel.setEnabled(enable);
+ mOrgnText.setEnabled(enable);
+ mOrgnText.setEditable(enable);
+ mOrgnText.setBackground(color);
+ mOrgnLabel.setEnabled(enable);
+ mLocText.setEnabled(enable);
+ mLocText.setEditable(enable);
+ mLocText.setBackground(color);
+ mLocLabel.setEnabled(enable);
+ mContactText.setEnabled(enable);
+ mContactText.setEditable(enable);
+ mContactText.setBackground(color);
+ mContactLabel.setEnabled(enable);
+ mOnB.setEnabled(enable);
+ mOffB.setEnabled(enable);
+ invalidate();
+ validate();
+ repaint(1);
+ }
+
+ /**
+ * Implementation for saving panel information
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean applyCallback() {
+ String port = mPortText.getText().trim();
+
+ try {
+ Integer num = new Integer(port);
+ } catch (NumberFormatException e) {
+ showMessageDialog("NUMBERFORMAT");
+ return false;
+ }
+
+ NameValuePairs nvps = new NameValuePairs();
+ if (mEnable.isSelected())
+ nvps.put(Constants.PR_SNMP_ENABLED, Constants.TRUE);
+ else
+ nvps.put(Constants.PR_SNMP_ENABLED, Constants.FALSE);
+
+ nvps.put(Constants.PR_SNMP_MASTER_HOST, mHostNameText.getText().trim());
+ nvps.put(Constants.PR_SNMP_MASTER_PORT, port);
+ nvps.put(Constants.PR_SNMP_DESC, mDescText.getText().trim());
+ nvps.put(Constants.PR_SNMP_ORGN, mOrgnText.getText().trim());
+ nvps.put(Constants.PR_SNMP_LOC, mLocText.getText().trim());
+ nvps.put(Constants.PR_SNMP_CONTACT, mContactText.getText().trim());
+
+ mModel.progressStart();
+ try {
+ mAdmin.modify(DestDef.DEST_SERVER_ADMIN,
+ ScopeDef.SC_SNMP, Constants.RS_ID_CONFIG, nvps);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ return false;
+ }
+ mModel.progressStop();
+ clearDirtyFlag();
+ return true;
+ }
+
+ /**
+ * Implementation for reset values
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean resetCallback() {
+ refresh();
+ return true;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSSSL2CipherPreference.java b/base/console/src/com/netscape/admin/certsrv/config/CMSSSL2CipherPreference.java
new file mode 100644
index 000000000..4e95d25db
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSSSL2CipherPreference.java
@@ -0,0 +1,36 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.security.*;
+/**
+ * Constructs panel containing a SSL2 cipher suites
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+
+public class CMSSSL2CipherPreference extends CMSCipherPreferencePane
+ implements ICipherConstants {
+
+ public CMSSSL2CipherPreference(boolean isDomestic) {
+ super(new CMSSSL2CipherSet(isDomestic), true);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSSSL2CipherSet.java b/base/console/src/com/netscape/admin/certsrv/config/CMSSSL2CipherSet.java
new file mode 100644
index 000000000..fa18107cb
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSSSL2CipherSet.java
@@ -0,0 +1,74 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.security.*;
+import java.util.*;
+
+/**
+ * Constructs a SSL2 cipher suites.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class CMSSSL2CipherSet implements ICipherConstants, IAbstractCipherSet {
+ Vector cipherList = new Vector();
+ String title;
+
+ boolean defaultOn = true;
+
+ /**
+ * Create a SSL2 cipher set
+ * @param isDomestic show all ssl2 ciphers for domestic and export version.
+ */
+ public CMSSSL2CipherSet(boolean isDomestic) {
+ ResourceBundle resource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ cipherList.addElement(
+ new AbstractCipher(resource.getString("SSL2CIPHERPREF_RC440MD5"),
+ RC4EXPORT, defaultOn));
+ cipherList.addElement(
+ new AbstractCipher(resource.getString("SSL2CIPHERPREF_RC240MD5"),
+ RC2EXPORT, defaultOn));
+ cipherList.addElement(
+ new AbstractCipher(resource.getString("SSL2CIPHERPREF_DES56MD5"),
+ DES, defaultOn));
+ if (isDomestic) {
+ cipherList.addElement(
+ new AbstractCipher(resource.getString("SSL2CIPHERPREF_RC4128MD5"),
+ RC4, defaultOn));
+ cipherList.addElement(
+ new AbstractCipher(resource.getString("SSL2CIPHERPREF_RC2128MD5"),
+ RC2, defaultOn));
+ cipherList.addElement(
+ new AbstractCipher(resource.getString("SSL2CIPHERPREF_TRIPLEDES168MD5"),
+ DES3, defaultOn));
+ }
+ title = resource.getString("SSL2CIPHERPREF_TITLE");
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public Vector getCipherList() {
+ return cipherList;
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSSSL3CipherPreference.java b/base/console/src/com/netscape/admin/certsrv/config/CMSSSL3CipherPreference.java
new file mode 100644
index 000000000..63444fc75
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSSSL3CipherPreference.java
@@ -0,0 +1,37 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.security.*;
+
+/**
+ * Constructs panel containing a SSL3 cipher suites
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+
+public class CMSSSL3CipherPreference extends CMSCipherPreferencePane
+ implements ICipherConstants {
+
+ public CMSSSL3CipherPreference(boolean isDomestic, boolean hasFortezza) {
+ super(new CMSSSL3CipherSet(isDomestic, hasFortezza), true);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSSSL3CipherSet.java b/base/console/src/com/netscape/admin/certsrv/config/CMSSSL3CipherSet.java
new file mode 100644
index 000000000..0286f3820
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSSSL3CipherSet.java
@@ -0,0 +1,91 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.security.*;
+import java.util.*;
+import com.netscape.admin.certsrv.*;
+
+/**
+ * Constructs a SSL3 cipher suites.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class CMSSSL3CipherSet implements ICipherConstants, IAbstractCipherSet {
+ Vector cipherList = new Vector();
+ String title;
+
+ boolean defaultOn = true;
+
+ /**
+ * Create a SSL3 cipher set
+ * @param isDomestic show all ssl2 ciphers for domestic and export version.
+ */
+ public CMSSSL3CipherSet(boolean isDomestic, boolean hasFortezza) {
+ ResourceBundle resource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ cipherList.addElement(
+ new AbstractCipher(resource.getString("SSL3CIPHERPREF_RC440MD5"),
+ RSA_RC4_40_MD5, defaultOn));
+ cipherList.addElement(
+ new AbstractCipher(resource.getString("SSL3CIPHERPREF_RC240MD5"),
+ RSA_RC2_40_MD5, defaultOn));
+ cipherList.addElement(
+ new AbstractCipher(resource.getString("SSL3CIPHERPREF_DES56SHA"),
+ RSA_DES_SHA, defaultOn));
+ cipherList.addElement(
+ new AbstractCipher(resource.getString("SSL3CIPHERPREF_FIPSDES56SHA"),
+ RSA_FIPS_DES_SHA, defaultOn));
+ if (isDomestic) {
+ cipherList.addElement(
+ new AbstractCipher(resource.getString("SSL3CIPHERPREF_RC4128MD5"),
+ RSA_RC4_128_MD5, defaultOn));
+ cipherList.addElement(
+ new AbstractCipher(resource.getString("SSL3CIPHERPREF_TRIPLEDES168SHA"),
+ RSA_3DES_SHA, defaultOn));
+ cipherList.addElement(
+ new AbstractCipher(resource.getString("SSL3CIPHERPREF_TRIPLEDES168SHA"),
+ RSA_FIPS_3DES_SHA, defaultOn));
+ if (hasFortezza) {
+ cipherList.addElement(
+ new AbstractCipher(resource.getString("SSL3CIPHERPREF_FORT80SHA"),
+ FORTEZZA, !defaultOn));
+ cipherList.addElement(
+ new AbstractCipher(resource.getString("SSL3CIPHERPREF_RC4128FORTSHA"),
+ FORTEZZA_RC4_128_SHA, !defaultOn));
+ cipherList.addElement(
+ new AbstractCipher(resource.getString("SSL3CIPHERPREF_NOENCRYPTIONFORSHA"),
+ FORTEZZA_NULL, !defaultOn));
+ }
+ }
+ cipherList.addElement(
+ new AbstractCipher(resource.getString("SSL3CIPHERPREF_NOENCRYPTION"),
+ RSA_NULL_MD5, !defaultOn));
+ title = resource.getString("SSL3CIPHERPREF_TITLE");
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public Vector getCipherList() {
+ return cipherList;
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSSelfTestsPanel.java b/base/console/src/com/netscape/admin/certsrv/config/CMSSelfTestsPanel.java
new file mode 100644
index 000000000..ab957a69c
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSSelfTestsPanel.java
@@ -0,0 +1,219 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.*;
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.border.*;
+
+/**
+ * Self Tests setting tab
+ *
+ * @author Matt Harmsen
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ */
+public class CMSSelfTestsPanel extends CMSBaseTab
+{
+ private static final String PROP_TITLE = "On-Demand Self Tests Results";
+ private static String PANEL_NAME = "SELFTESTS";
+ private AdminConnection mAdmin;
+ private JButton mOnDemand;
+ private CMSBaseResourceModel mModel;
+ private CMSTabPanel mParent;
+ private static final String HELPINDEX =
+ "configuration-overview";
+ private ViewSelfTestsDialog mViewer = null;
+
+
+ public CMSSelfTestsPanel( CMSTabPanel parent )
+ {
+ super( PANEL_NAME, parent );
+ mModel = parent.getResourceModel();
+ mParent = parent;
+ mHelpToken = HELPINDEX;
+ }
+
+
+ public void init()
+ {
+ Debug.println( "SelfTestsPanel: init()" );
+ mAdmin = mModel.getServerInfo().getAdmin();
+ JPanel selftestsInfo = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ CMSAdminUtil.resetGBC( gbc );
+ mCenterPanel.setLayout( gb );
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints( selftestsInfo, gbc );
+ mCenterPanel.add( selftestsInfo );
+
+ GridBagLayout gb1 = new GridBagLayout();
+ selftestsInfo.setLayout( gb1 );
+
+ // self tests border
+ selftestsInfo.setBorder( new CompoundBorder(
+ BorderFactory.createTitledBorder(
+ mResource.getString(
+ "SELFTESTS_BORDER_LABEL" ) ),
+ new EmptyBorder( -3,
+ 0,
+ DIFFERENT_COMPONENT_SPACE - 3,
+ 0 ) ) );
+
+ // add on-demand self tests label
+ CMSAdminUtil.resetGBC( gbc );
+ JLabel onDemandLabel = makeJLabel( "ONDEMAND" );
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.gridx = 0;
+ gbc.anchor = gbc.WEST;
+ gbc.insets = new Insets( COMPONENT_SPACE,
+ DIFFERENT_COMPONENT_SPACE,
+ 0,
+ 0 );
+ selftestsInfo.add( onDemandLabel, gbc );
+
+
+ // add run button for on-demand self tests
+ mOnDemand = makeJButton( "RUN" );
+ JButton[] buttons = { mOnDemand };
+ JButtonFactory.resize( buttons );
+ CMSAdminUtil.makeJButtonVPanel( buttons );
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = gbc.RELATIVE;
+ gbc.gridx = gbc.RELATIVE;
+ gbc.anchor = gbc.WEST;
+ gbc.insets = new Insets( COMPONENT_SPACE,
+ DIFFERENT_COMPONENT_SPACE,
+ 0,
+ DIFFERENT_COMPONENT_SPACE );
+ selftestsInfo.add( mOnDemand, gbc );
+
+ // add space after the run button
+ JLabel dummy = new JLabel(" ");
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridx = gbc.RELATIVE;
+ gbc.anchor = gbc.WEST;
+ gbc.insets = new Insets( COMPONENT_SPACE,
+ 0,
+ COMPONENT_SPACE,
+ 0 );
+ selftestsInfo.add( dummy, gbc );
+
+ refresh();
+ }
+
+
+ public void refresh()
+ {
+ clearDirtyFlag();
+ }
+
+
+ public void actionPerformed( ActionEvent evt )
+ {
+ super.actionPerformed( evt );
+
+ NameValuePairs nvps = new NameValuePairs();
+ NameValuePairs nvps1;
+
+ nvps.put(Constants.PR_RUN_SELFTESTS_ON_DEMAND, Constants.TRUE);
+
+ if( evt.getSource().equals( mOnDemand ) ) {
+ Debug.println( "Run self tests on-demand . . ." );
+
+ mModel.progressStart();
+ try {
+ nvps1 = mAdmin.process( DestDef.DEST_SERVER_ADMIN,
+ ScopeDef.SC_SELFTESTS,
+ Constants.RS_ID_CONFIG,
+ nvps );
+ // show server response
+ String responseClass = "";
+ String response = "";
+ boolean first = true;
+ for (String name : nvps1.keySet()) {
+ String value = nvps1.get(name);
+ if (first) {
+ first = false;
+ responseClass = value;
+ } else {
+ response = response + value + "\n";
+ }
+ }
+
+ Debug.println( ". . . class \""
+ + responseClass
+ + "\" responded with "
+ + "on-demand self tests results." );
+
+ if( mViewer == null ) {
+ mViewer = new ViewSelfTestsDialog( mModel.getFrame(),
+ PROP_TITLE );
+ }
+
+ mViewer.showDialog( response );
+ } catch( EAdminException e ) {
+ showErrorDialog( e.toString() );
+ mModel.progressStop();
+ return;
+ }
+ mModel.progressStop();
+ }
+
+ clearDirtyFlag();
+ return;
+ }
+
+
+ /**
+ * Implementation for saving panel information
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean applyCallback()
+ {
+ clearDirtyFlag();
+ return true;
+ }
+
+
+ /**
+ * Implementation for reset values
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean resetCallback()
+ {
+ refresh();
+ return true;
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSTabPanel.java b/base/console/src/com/netscape/admin/certsrv/config/CMSTabPanel.java
new file mode 100644
index 000000000..63899892f
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSTabPanel.java
@@ -0,0 +1,350 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.tree.*;
+import java.awt.event.*;
+import java.awt.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Base Class for Tabbed right hand pane
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public class CMSTabPanel extends CMSBaseConfigPanel
+ implements IResourceSelectionListener, ChangeListener, IRefreshTabPanel
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static String PANEL_NAME = "CMSTABPANEL";
+
+ protected JTabbedPane mTabbedPane; //tabbed panel
+ protected JButton mbOK, mbReset, mbHelp; //buttons
+ CMSBaseResourceModel mModel; //resource model
+ private ResourceObject mParent; //tree node parent
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSTabPanel(CMSBaseResourceModel model, ResourceObject parent) {
+ this(model, parent, true);
+ }
+
+ public CMSTabPanel(CMSBaseResourceModel model, ResourceObject parent, boolean showButton) {
+ super(PANEL_NAME);
+ mModel = model;
+ mParent = parent;
+
+ setLayout(new BorderLayout());
+ //mTabbedPane = new JTabbedPane();
+
+ // Look and Feel
+ mTabbedPane = new NSTabbedPane();
+ add("Center", mTabbedPane);
+
+ if (showButton)
+ add("South", createButtonPanel());
+ mbOK.setEnabled(false);
+ mbReset.setEnabled(false);
+
+ mModel.addIResourceSelectionListener(this);
+ //mTabbedPane.addChangeListener(this);
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public void init() {}
+
+ /**
+ * Retrieve Resource Model
+ */
+ public CMSBaseResourceModel getResourceModel() {
+ return mModel;
+ }
+
+ public ResourceObject getResourceObject() {
+ return mParent;
+ }
+
+ /**
+ * Set the Tab associated with this component dirty
+ */
+ public void setDirtyTab(CMSBaseTab component) {
+ int index = mTabbedPane.indexOfComponent(component);
+ if (index == -1) {
+ Debug.println("CMSTabPanel: setDirtyTab() - component not part of this panel");
+ return;
+ }
+ if ((mTabbedPane != null) && (mTabbedPane.getIconAt(index)== null) ) {
+ mTabbedPane.setIconAt(index,
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_DIRTY_TAB));
+ mTabbedPane.repaint();
+ }
+ mbOK.setEnabled(true);
+ mbReset.setEnabled(true);
+ }
+
+ /**
+ * Clear the Tab associated with this component
+ */
+ public void clearDirtyTab(CMSBaseTab component) {
+ int index = mTabbedPane.indexOfComponent(component);
+ if (index == -1) {
+ Debug.println("CMSTabPanel: clearDirtyTab() - component not part of this panel");
+ return;
+ }
+ if ((mTabbedPane != null) && (mTabbedPane.getIconAt(index)!= null) ) {
+ mTabbedPane.setIconAt(index, null);
+ mTabbedPane.repaint();
+ }
+ setOKCancel();
+ }
+
+ //=== Callback methods ====
+ public boolean applyCallback(){
+ int currentTab = mTabbedPane.getSelectedIndex();
+ int nTabs = mTabbedPane.getTabCount();
+ boolean failed = false;
+
+ //we will go through each tab and apply
+ for (int i= 0; i < nTabs; ++i) {
+ CMSBaseTab p = (CMSBaseTab)mTabbedPane.getComponentAt(i);
+ if (p.isDirty()) {
+ mTabbedPane.setSelectedIndex(i);
+ if (!p.applyCallback()) {
+ failed = true;
+ }
+ }
+ }
+
+ //one or more panel falied
+ if (failed) {
+ //get first dirty tab
+ for (int i= 0; i < nTabs; ++i) {
+ CMSBaseTab p = (CMSBaseTab)mTabbedPane.getComponentAt(i);
+ if (p.isDirty()) {
+ mTabbedPane.setSelectedIndex(i);
+ break;
+ }
+ }
+ return false;
+ }
+
+ //everything ok
+ if (currentTab >=0 )
+ mTabbedPane.setSelectedIndex(currentTab);
+ mbOK.setEnabled(false);
+ mbReset.setEnabled(false);
+ mbHelp.requestFocusInWindow();
+ return true;
+ }
+
+ public boolean resetCallback() {
+ int nTabs = mTabbedPane.getTabCount();
+ for (int i= 0; i < nTabs; ++i) {
+ CMSBaseTab p = (CMSBaseTab)mTabbedPane.getComponentAt(i);
+ if (p.isDirty()) {
+ p.resetCallback();
+ }
+ }
+ mbOK.setEnabled(false);
+ mbReset.setEnabled(false);
+ return true;
+ }
+
+ public void setOKCancel() {
+ int nTabs = mTabbedPane.getTabCount();
+ for (int i= 0; i < nTabs; ++i) {
+ CMSBaseTab p = (CMSBaseTab)mTabbedPane.getComponentAt(i);
+ if (p.isDirty()) {
+ return;
+ }
+ }
+ mbOK.setEnabled(false);
+ mbReset.setEnabled(false);
+ }
+
+ public void helpCallback() {
+ CMSBaseTab p = (CMSBaseTab)mTabbedPane.getSelectedComponent();
+ if (p != null)
+ p.helpCallback();
+ Debug.println("CMSTabPanel: helpCallback()");
+ }
+
+ public CMSBasePanel getSelectedTab() {
+ return (CMSBasePanel)mTabbedPane.getSelectedComponent();
+ }
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+ //== ACTIONLISTENER =====
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mbOK)) {
+ applyCallback();
+ }
+ if (e.getSource().equals(mbReset)) {
+ resetCallback();
+ }
+ if (e.getSource().equals(mbHelp)) {
+ helpCallback();
+ }
+ }
+
+ //== IResourceListener ===
+ public void select(IResourceObject parent, Object viewInstance) {
+ //System.out.println("CMSTabPanel: select() "+ parent);
+ if (parent == mParent) {
+ try {
+ mTabbedPane.addChangeListener(this);
+ mTabbedPane.setSelectedIndex(0);
+ CMSBaseConfigPanel selectedPanel = (CMSBaseConfigPanel) mTabbedPane.getComponentAt(0);
+ if ( selectedPanel != null )
+ selectedPanel.initialize();
+ mTabbedPane.invalidate();
+ mTabbedPane.validate();
+ } catch (ArrayIndexOutOfBoundsException e) {
+ //NO TAB SO IGNORE
+ }
+ }
+ }
+
+ public boolean unselect(IResourceObject parent, Object viewInstance) {
+ //System.out.println("CMSTabPanel: unselect() "+ parent);
+
+ // XXX NOT SAVED MODEL IS MOVED TO HIGHER LEVEL
+
+ //check if any tab is dirty
+ boolean dirty = false;
+ int nTabs = mTabbedPane.getTabCount();
+ for (int i= 0; i < nTabs; ++i) {
+ CMSBaseTab p = (CMSBaseTab)mTabbedPane.getComponentAt(i);
+ if (p.isDirty()) {
+ dirty = true;
+ }
+ }
+ if (!dirty)
+ return true;
+
+ //return to previous node
+ TreePath thisPath = new TreePath(((ResourceObject)parent).getPath());
+ TreePath selectedPath =
+ ((CMSResourcePage)viewInstance).getTree().getSelectionPath();
+ if (!thisPath.equals(selectedPath))
+ ((CMSResourcePage)viewInstance).getTree().setSelectionPath(thisPath);
+
+ //popup dialog for user to set changes
+ int result = showConfirmDialog("NOTSAVED");
+ switch (result) {
+ case JOptionPane.YES_OPTION:
+ if (applyCallback()) {
+ ((CMSResourcePage)viewInstance).getTree().setSelectionPath(selectedPath);
+ return true;
+ }
+ break;
+ case JOptionPane.NO_OPTION:
+ resetCallback();
+ ((CMSResourcePage)viewInstance).getTree().setSelectionPath(selectedPath);
+ return true;
+ default:
+ break;
+ }
+
+ //can not be unselected
+ return false;
+ }
+
+ //== ChangeListener ==
+ public void stateChanged(ChangeEvent e) {
+ //Debug.println("CMSTabPanel: stateChanged()");
+ CMSBaseConfigPanel selectedPanel = (CMSBaseConfigPanel)mTabbedPane.getSelectedComponent();
+ if ( selectedPanel != null )
+ selectedPanel.initialize();
+ mTabbedPane.invalidate();
+ mTabbedPane.validate();
+ mTabbedPane.repaint(1);
+ }
+
+ /**
+ * Add Panels to the Tab Panel. ChangeListener is
+ * added automatically.
+ *
+ * @param p CMS Panel to be added
+ */
+ public void addTab(CMSBaseTab p) {
+ mTabbedPane.addTab(p.getTitle(), p);
+ }
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+
+ /**
+ * create button panel using the factory method
+ */
+ protected JPanel createButtonPanel() {
+ mbOK = makeJButton("APPLY");
+ mbReset = makeJButton("RESET");
+ mbHelp = makeJButton("HELP");
+
+ //JButton[] buttons = { mbOK, mbReset, mbHelp };
+ JButton[] buttons = { mbOK, mbReset };
+ return makeJButtonPanel(buttons, true, true);
+ }
+
+ class NSTabbedPane extends JTabbedPane {
+/*
+ public String getUIClassID() {
+ return "SecondaryTabbedPaneUI";
+ }
+*/
+ }
+
+ //=== OVERWRITE DIALOG MESSAGE =====================
+
+ protected void showMessageDialog(String keyword, int messageType ) {
+ CMSAdminUtil.showMessageDialog(mModel.getFrame(), mResource, mPanelName, keyword, messageType);
+ }
+
+ protected void showMessageDialog(String keyword) {
+ showMessageDialog(keyword, ERROR_MESSAGE);
+ }
+
+ protected int showConfirmDialog(String keyword, int messageType ) {
+ return CMSAdminUtil.showConfirmDialog(mModel.getFrame(), mResource, mPanelName, keyword, messageType);
+ }
+
+ protected int showConfirmDialog(String keyword) {
+ return showConfirmDialog(keyword, WARNING_MESSAGE);
+ }
+
+ protected void showErrorDialog(String message) {
+ CMSAdminUtil.showErrorDialog(mModel.getFrame(), mResource, message, ERROR_MESSAGE);
+ }
+
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMSUserCertSettingPanel.java b/base/console/src/com/netscape/admin/certsrv/config/CMSUserCertSettingPanel.java
new file mode 100644
index 000000000..ca424c3a0
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMSUserCertSettingPanel.java
@@ -0,0 +1,155 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.*;
+
+import java.awt.event.*;
+
+/**
+ * User Certificate Setting
+ *
+ * @author Christine Ho
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public class CMSUserCertSettingPanel extends CMSCertSettingPanel {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private String _servletName; //destination name
+ private CMSTabPanel mParent;
+ private PanelMapperConfigDialog mDialog = null;
+ private static final String RAHELPINDEX =
+ "configuration-ra-ldappublish-usercert-help";
+ private static final String CAHELPINDEX =
+ "configuration-ca-ldappublish-usercert-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSUserCertSettingPanel(String panelName, CMSTabPanel parent) {
+ super(panelName, parent);
+ _servletName = getServletName(panelName);
+ mParent = parent;
+ if (panelName.equals("RAUSERCERTSETTING"))
+ mHelpToken = RAHELPINDEX;
+ else
+ mHelpToken = CAHELPINDEX;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * Actual UI construction
+ */
+ public void init() {
+ super.init();
+
+ //XXX B1 - disable the publisher configuration
+ mPublisher.setEnabled(false);
+ //XXX B1 - disable the publisher configuration
+
+ refresh();
+ }
+
+ public void refresh() {
+ _model.progressStart();
+ NameValuePairs nvp = new NameValuePairs();
+ nvp.put(Constants.PR_MAPPER, "");
+ nvp.put(Constants.PR_PUBLISHER, "");
+
+ try {
+ NameValuePairs val = _admin.read(_servletName,
+ ScopeDef.SC_USERCERT, Constants.RS_ID_CONFIG, nvp);
+
+ populate(val);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ _model.progressStop();
+ }
+ _model.progressStop();
+ clearDirtyFlag();
+ mParent.setOKCancel();
+ }
+
+
+ /**
+ * Implementation for saving panel information
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean applyCallback() {
+ clearDirtyFlag();
+ return true;
+ }
+
+ /**
+ * Implementation for reset values
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean resetCallback() {
+ refresh();
+ return true;
+ }
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mMapper)) {
+ Debug.println("Edit Mapper Config");
+ mDialog = new PanelMapperConfigDialog(_model.getFrame(), _admin);
+ mDialog.showDialog(_mapper.getText(),
+ _servletName, ScopeDef.SC_USERCERT);
+ if (!mDialog.isOK())
+ return;
+ refresh();
+ } else if (e.getSource().equals(mPublisher)) {
+ //Debug.println("Edit Publisher Config");
+ }
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+ private String getServletName(String panelName) {
+ if (panelName.equals("CAUSERCERTSETTING"))
+ return DestDef.DEST_CA_ADMIN;
+ return DestDef.DEST_RA_ADMIN;
+ }
+
+ private void populate(NameValuePairs nvps) {
+ for (String name : nvps.keySet()) {
+ String value = nvps.get(name);
+ if (name.equals(Constants.PR_MAPPER)) {
+ _mapper.setText(value);
+ } else if (name.equals(Constants.PR_PUBLISHER)) {
+ _publisher.setText(value);
+ }
+ }
+ }
+
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CMStoAdminEncryptionPane.java b/base/console/src/com/netscape/admin/certsrv/config/CMStoAdminEncryptionPane.java
new file mode 100644
index 000000000..ea448b4e0
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CMStoAdminEncryptionPane.java
@@ -0,0 +1,67 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.security.EncryptionPane;
+import com.netscape.management.client.console.*;
+import com.netscape.management.client.util.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.connection.*;
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.event.*;
+
+/**
+ * Encryption set preference panel glue between CMS and KingPin
+ *
+ * @author Christina Fu (cfu)
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ * @see com.netscape.management.admserv.config
+ */
+
+/* replace "implements ActionListener" with
+ *"implements IPluginConfigPanel" when the
+ * com.netscape.management.admserv.config.* package is available
+
+public class CMStoAdminEncryptionPane extends EncryptionPane implements IPluginConfigPanel{
+*/
+public class CMStoAdminEncryptionPane extends EncryptionPane
+ implements ActionListener
+{
+ protected boolean mEncryptionPaneDirty = false;
+
+ public CMStoAdminEncryptionPane(ConsoleInfo consoleInfo) {
+ super(consoleInfo);
+ }
+
+ /**
+ * overrides the super class action listener
+ */
+ public void actionPerformed(ActionEvent e) {
+ Debug.println("CMStoAdminEncryptionPane: actionPerformed()");
+ mEncryptionPaneDirty = true;
+ }
+
+ public boolean isDirty() {
+ return mEncryptionPaneDirty;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CRLExtensionsConfigDialog.java b/base/console/src/com/netscape/admin/certsrv/config/CRLExtensionsConfigDialog.java
new file mode 100644
index 000000000..9a4f5ae17
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CRLExtensionsConfigDialog.java
@@ -0,0 +1,76 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import javax.swing.table.*;
+import javax.swing.text.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * CRL Extensions Parameter Configuration Dialog
+ *
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class CRLExtensionsConfigDialog extends CMSBaseConfigDialog
+ implements ActionListener
+{
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CRLExtensionsConfigDialog(NameValuePairs nvp,
+ JFrame parent,
+ AdminConnection conn,
+ String dest) {
+
+ super(parent, dest);
+ PREFIX = "CRLEXTCONFIGDIALOG";
+ CAHELPINDEX = "configuration-ca-edit-crlextensionrule-dbox-help";
+
+ mImplName_token = Constants.PR_CRLEXT_IMPL_NAME;
+ mImplType = Constants.PR_EXT_PLUGIN_IMPLTYPE_CRLEXTSRULE;
+
+ init(nvp,parent,conn,dest);
+ }
+
+ public CRLExtensionsConfigDialog(NameValuePairs nvp,
+ JFrame parent,
+ AdminConnection conn,
+ String dest,
+ String id) {
+
+ super(parent, dest);
+ PREFIX = "CRLEXTCONFIGDIALOG";
+ CAHELPINDEX = "configuration-ca-edit-crlextensionrule-dbox-help";
+
+ mImplName_token = Constants.PR_CRLEXT_IMPL_NAME;
+ mImplType = Constants.PR_EXT_PLUGIN_IMPLTYPE_CRLEXTSRULE;
+
+ init(nvp,parent,conn,dest,id);
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CRLExtensionsInstanceTab.java b/base/console/src/com/netscape/admin/certsrv/config/CRLExtensionsInstanceTab.java
new file mode 100644
index 000000000..5c687ea90
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CRLExtensionsInstanceTab.java
@@ -0,0 +1,114 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.ug.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+
+/**
+ * CRL Extensions - Instances Management Tab
+ *
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+
+public class CRLExtensionsInstanceTab extends CMSPluginInstanceTab {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PANEL_NAME = "CRLEXTSRULE";
+
+ private final static String CAHELPINDEX = "configuration-ca-crlinstances-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CRLExtensionsInstanceTab(CMSBaseResourceModel model, String dest) {
+ super(model,dest,PANEL_NAME);
+ Debug.println("CRLExtensionsInstanceTab::CRLExtensionsInstanceTab(<model>,"+dest);
+ mConnection = model.getServerInfo().getAdmin();
+ mDataModel = new RuleRuleDataModel();
+ mScope = ScopeDef.SC_CRLEXTS_RULES;
+ RULE_NAME = CRLExtensionsRuleDataModel.RULE_NAME;
+ RULE_STAT = CRLExtensionsRuleDataModel.RULE_STAT;
+ mHelpToken = CAHELPINDEX;
+ }
+
+ public CRLExtensionsInstanceTab(CMSBaseResourceModel model, String dest, String id) {
+ super(model,dest,PANEL_NAME);
+ Debug.println("CRLExtensionsInstanceTab::CRLExtensionsInstanceTab(<model>,"+dest);
+ mConnection = model.getServerInfo().getAdmin();
+ mDataModel = new RuleRuleDataModel();
+ mScope = ScopeDef.SC_CRLEXTS_RULES;
+ RULE_NAME = CRLExtensionsRuleDataModel.RULE_NAME;
+ RULE_STAT = CRLExtensionsRuleDataModel.RULE_STAT;
+ mHelpToken = CAHELPINDEX;
+ mId = id;
+ }
+
+
+ public CMSBaseConfigDialog makeNewConfigDialog(
+ NameValuePairs nvp,
+ JFrame parent,
+ AdminConnection conn,
+ String dest)
+ {
+ if (mId != null && mId.length() > 0)
+ return new CRLExtensionsConfigDialog(nvp, parent, conn, dest, mId);
+ else
+ return new CRLExtensionsConfigDialog(nvp, parent, conn, dest);
+ }
+
+ public PluginSelectionDialog getPluginSelectionDialog(
+ JFrame parent,
+ AdminConnection conn,
+ String dest,
+ CMSPluginInstanceTab pluginType)
+ {
+ return new CRLExtensionsPluginSelectionDialog(parent, conn, dest, pluginType);
+ }
+
+
+ /**
+ * create the user action button panel
+ */
+ protected JPanel createUserButtonPanel() {
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mAdd = makeJButton("ADD");
+ mDelete = makeJButton("DELETE");
+ mAdd.setEnabled(false);
+ mDelete.setEnabled(false);
+ mEdit = makeJButton("EDIT");
+ JButton[] buttons = {mEdit};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonVPanel( buttons );
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CRLExtensionsPluginSelectionDialog.java b/base/console/src/com/netscape/admin/certsrv/config/CRLExtensionsPluginSelectionDialog.java
new file mode 100644
index 000000000..aa169235d
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CRLExtensionsPluginSelectionDialog.java
@@ -0,0 +1,67 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * CRL Extensions Plugin Selection Dialog
+ *
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class CRLExtensionsPluginSelectionDialog extends PluginSelectionDialog
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PREFIX = "CRLEXTSELECTIONDIALOG";
+ private static final String CAHELPINDEX =
+ "configuration-ca-add-crlextensionrule-dbox-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CRLExtensionsPluginSelectionDialog(
+ JFrame parent,
+ AdminConnection conn,
+ String dest,
+ CMSPluginInstanceTab pluginType)
+ {
+ super(PREFIX, parent,conn, dest, pluginType);
+// mScope = ScopeDef.SC_RULE_IMPLS;
+ mInstanceScope = ScopeDef.SC_CRLEXTS_RULES;
+ mImageName = CMSAdminResources.IMAGE_RULE_PLUGIN;
+ mHelpToken = CAHELPINDEX;
+ setDisplay();
+ }
+
+ /*==========================================================
+ * EVENT HANDLER METHODS
+ *==========================================================*/
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CRLExtensionsRuleDataModel.java b/base/console/src/com/netscape/admin/certsrv/config/CRLExtensionsRuleDataModel.java
new file mode 100644
index 000000000..e5ae9352a
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CRLExtensionsRuleDataModel.java
@@ -0,0 +1,69 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.Debug;
+
+
+/**
+ * CRL Extensions instance Data model - represents the instance
+ * table information
+ *
+ * @version $Revision$, $Date$
+ */
+
+public class CRLExtensionsRuleDataModel extends CMSRuleDataModel
+{
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CRLExtensionsRuleDataModel() {
+ super();
+ }
+
+ protected String[] getColumns() {
+ Debug.println("PolicyRuleDataModel.getColumns()");
+ String x[] = {CRLEXTS_RULE, STATUS};
+ return x;
+ }
+
+ public void processData(Object data) {
+ Vector v = new Vector();
+ NameValuePairs obj = (NameValuePairs) data;
+
+ if (obj.get(RULE_STAT).equalsIgnoreCase("enabled")) {
+ v.addElement(new JLabel(obj.get(RULE_NAME),
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE),
+ JLabel.LEFT));
+ v.addElement(mResource.getString("CRLEXTSRULE_LABEL_ENABLED_LABEL"));
+ } else {
+ v.addElement(new JLabel(obj.get(RULE_NAME),
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE_DISABLE),
+ JLabel.LEFT));
+ v.addElement(mResource.getString("CRLEXTSRULE_LABEL_DISABLED_LABEL"));
+ }
+ addRow(v, data);
+ mRules.addElement(obj.get(RULE_NAME));
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/CRLIPEditor.java b/base/console/src/com/netscape/admin/certsrv/config/CRLIPEditor.java
new file mode 100644
index 000000000..040b21b83
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/CRLIPEditor.java
@@ -0,0 +1,330 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * CRL IP Editor
+ *
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class CRLIPEditor extends JDialog implements ActionListener {
+
+ private final static String PREFIX = "CRLIPEDITOR";
+ private final static String HELPINDEX =
+ "configuration-revocation";
+ private JButton mOK, mCancel, mHelp;
+ private String mName;
+ private JTextField mNameText, mDescText;
+ private ResourceBundle mResource;
+ private JFrame mParentFrame;
+ private AdminConnection mAdmin;
+ private JLabel nameLabel, descLabel;
+ private Color mActiveColor;
+ private String mDest;
+ private JCheckBox mEnableBox;
+ private boolean mEnable = true;
+ private String mInstanceName;
+ private Vector mNames;
+
+ public CRLIPEditor(AdminConnection admin, JFrame parent,
+ String name, String dest, String instanceName, Vector names) {
+ super(parent,true);
+ mParentFrame = parent;
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ mAdmin = admin;
+ mName = name;
+ mNames = names;
+ mInstanceName = instanceName;
+ mDest = dest;
+ setSize(600, 180);
+ setTitle(mResource.getString(PREFIX+"_TITLE"));
+ setLocationRelativeTo(parent);
+ getRootPane().setDoubleBuffered(true);
+ setDisplay();
+ }
+
+ private void setDisplay() {
+ getContentPane().setLayout(new BorderLayout());
+ JPanel center = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ center.setLayout(gb);
+
+ //content panel
+ JPanel content = makeContentPanel();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ //gbc.insets = CMSAdminUtil.DEFAULT_EMPTY_INSETS;
+ gb.setConstraints(content, gbc);
+ center.add(content);
+
+ //action panel
+ JPanel action = makeActionPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints(action, gbc);
+ center.add(action);
+
+ getContentPane().add("Center",center);
+ }
+
+ public void showDialog(NameValuePairs values) {
+
+ for (String name : values.keySet()) {
+ String val = values.get(name);
+ if ((mName == null || mName.length() == 0) &&
+ name.equals(Constants.PR_ID)) {
+ mNameText.setText(val);
+ } else if (name.equals(Constants.PR_DESCRIPTION)) {
+ mDescText.setText(val);
+ } else if (name.equals(Constants.PR_ENABLED)) {
+ if (val.equalsIgnoreCase(Constants.TRUE))
+ mEnable = true;
+ else
+ mEnable = false;
+ }
+ }
+
+ mEnableBox.setSelected(mEnable);
+ enableCRLIP();
+ this.show();
+ }
+
+ public String getCRLName() {
+ return mNameText.getText().trim();
+ }
+
+ private void enableCRLIP() {
+ if (mName == null || mName.length() == 0) {
+ nameLabel.setEnabled(true);
+ mNameText.setBackground(mActiveColor);
+ mNameText.setEnabled(true);
+ mNameText.setEditable(true);
+
+ descLabel.setEnabled(true);
+ mDescText.setBackground(mActiveColor);
+ mDescText.setEnabled(true);
+ mDescText.setEditable(true);
+
+ CMSAdminUtil.repaintComp(nameLabel);
+ CMSAdminUtil.repaintComp(mNameText);
+ } else if (mEnable) {
+ descLabel.setEnabled(true);
+ mDescText.setBackground(mActiveColor);
+ mDescText.setEnabled(true);
+ mDescText.setEditable(true);
+ } else {
+ descLabel.setEnabled(false);
+ mDescText.setBackground(getBackground());
+ mDescText.setEnabled(false);
+ mDescText.setEditable(false);
+ }
+
+ CMSAdminUtil.repaintComp(descLabel);
+ CMSAdminUtil.repaintComp(mDescText);
+ }
+
+ private JPanel makeContentPanel() {
+ JPanel mainPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mainPanel.setLayout(gb);
+
+ if (mName != null && mName.length() > 0) {
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label1 = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "CRLIPNAME", null);
+ gbc.anchor = gbc.WEST;
+ //gbc.weightx = 1.0;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE);
+ gb.setConstraints(label1, gbc);
+ mainPanel.add(label1);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label2 = new JLabel(mName);
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 0.0;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE);
+ gb.setConstraints(label2, gbc);
+ mainPanel.add(label2);
+ }
+
+ CMSAdminUtil.resetGBC(gbc);
+ mEnableBox = CMSAdminUtil.makeJCheckBox(mResource, PREFIX,
+ "ENABLE", null, false, this);
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE, CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE);
+ gb.setConstraints(mEnableBox, gbc);
+ mainPanel.add(mEnableBox);
+
+ if (mName == null || mName.length() == 0) {
+ CMSAdminUtil.resetGBC(gbc);
+ nameLabel = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "CRLIPNAME", null);
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.insets = new Insets(0, 0,
+ CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE);
+ gb.setConstraints(nameLabel, gbc);
+ mainPanel.add(nameLabel);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mNameText = new JTextField(30);
+ gbc.anchor = gbc.WEST;
+ gbc.weightx = 0.0;
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ //gbc.gridheight = gbc.REMAINDER;
+ gbc.insets = new Insets(0, CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE);
+ gb.setConstraints(mNameText, gbc);
+ mainPanel.add(mNameText);
+ //mActiveColor = mNameText.getBackground();
+ }
+
+ CMSAdminUtil.resetGBC(gbc);
+ descLabel = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "DESCRIPTION", null);
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, 0,
+ CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE);
+ gbc.weightx = 0.0;
+ gb.setConstraints(descLabel, gbc);
+ mainPanel.add(descLabel);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mDescText = new JTextField(30);
+ gbc.anchor = gbc.WEST;
+ gbc.weightx = 0.0;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE, CMSAdminUtil.COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ //gbc.gridheight = gbc.REMAINDER;
+ gb.setConstraints(mDescText, gbc);
+ mainPanel.add(mDescText);
+ mActiveColor = mDescText.getBackground();
+
+ return mainPanel;
+ }
+
+ private JPanel makeActionPane() {
+ mOK = CMSAdminUtil.makeJButton(mResource, PREFIX, "OK", null, this);
+ mCancel = CMSAdminUtil.makeJButton(mResource, PREFIX, "CANCEL", null, this);
+ mHelp = CMSAdminUtil.makeJButton(mResource, PREFIX, "HELP", null, this);
+ //JButton[] buttons = { mOK, mCancel, mHelp};
+ JButton[] buttons = { mOK, mCancel};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonPanel( buttons, true);
+ }
+
+ public void actionPerformed(ActionEvent e) {
+
+ if (e.getSource().equals(mEnableBox)) {
+ mEnable = mEnableBox.isSelected();
+ enableCRLIP();
+ } else if (e.getSource().equals(mCancel)) {
+ this.dispose();
+ } else if (e.getSource().equals(mOK)) {
+ NameValuePairs nvps = new NameValuePairs();
+
+ if (mName != null && mName.length() > 0) {
+ nvps.put(Constants.PR_ID, mName);
+ } else {
+ nvps.put(Constants.PR_ID, mNameText.getText().trim());
+ }
+
+ nvps.put(Constants.PR_DESCRIPTION, mDescText.getText().trim());
+
+ if (mEnable) {
+ nvps.put(Constants.PR_ENABLED, Constants.TRUE);
+ } else {
+ nvps.put(Constants.PR_ENABLED, Constants.FALSE);
+ }
+
+ try {
+ if (mName != null && mName.length() > 0) {
+ mAdmin.modify(mDest, ScopeDef.SC_CRLIPS, Constants.OP_SET, nvps);
+ } else {
+ for (int i = 0; i < mNames.size(); i++) {
+ String name = (String)mNames.elementAt(i);
+ if (name.equalsIgnoreCase(mNameText.getText().trim())) {
+ CMSAdminUtil.showMessageDialog(mParentFrame, "Error",
+ mNameText.getText().trim()+" already exists",
+ CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ if (mNameText.getText().trim().indexOf(' ') > -1 ||
+ mNameText.getText().trim().indexOf('.') > -1 ||
+ mNameText.getText().trim().indexOf(',') > -1) {
+ CMSAdminUtil.showMessageDialog(mParentFrame, "Error",
+ "Invalid name: "+mNameText.getText(),
+ CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ }
+
+ mAdmin.add(mDest, ScopeDef.SC_CRLIPS,
+ mNameText.getText().trim(), nvps);
+ mNames.addElement(mNameText.getText());
+ }
+ this.dispose();
+ } catch (EAdminException ex) {
+ CMSAdminUtil.showMessageDialog(mParentFrame,
+ "Error", ex.toString(), CMSAdminUtil.ERROR_MESSAGE);
+ }
+ } else if (e.getSource().equals(mHelp)) {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/ConfigTableModel.java b/base/console/src/com/netscape/admin/certsrv/config/ConfigTableModel.java
new file mode 100644
index 000000000..8608e943a
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/ConfigTableModel.java
@@ -0,0 +1,42 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+
+/**
+ * Table Model for configuration parameters
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class ConfigTableModel extends CMSTableModel {
+ private static String[] mColumns = {CONFIG, VALUE};
+
+ public ConfigTableModel() {
+ init(mColumns);
+ }
+
+ public boolean isCellEditable(int row, int col) {
+ if(col == 1)
+ return true;
+ return false;
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/ConnectorEditor.java b/base/console/src/com/netscape/admin/certsrv/config/ConnectorEditor.java
new file mode 100644
index 000000000..6f711eca9
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/ConnectorEditor.java
@@ -0,0 +1,634 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.ug.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import javax.swing.table.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Connector Editor
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class ConnectorEditor extends JDialog implements ActionListener, MouseListener {
+
+ private final static String PREFIX = "CONNECTOREDITOR";
+ private final static String HELPINDEX =
+ "configuration-ra-connector-editor-help";
+ private final static String HELPINDEX1 =
+ "configuration-overview";
+ private JButton mOK, mCancel, mHelp;
+ private String mName;
+ private ListCertsModel mDataModel;
+ // Changed by beomsuk
+ //private JTextField mLocalText, mURIText, mHostText, mPortText;
+ private JTextField mLocalText, mURIText, mHostText, mPortText, mTimeoutText, mNicknameText;
+ // Change end
+ private ResourceBundle mResource;
+ private JFrame mParentFrame;
+ private AdminConnection mAdmin;
+ // Changed by beomsuk
+ //private JLabel idLabel, uriLabel, hostLabel, portLabel;
+ private JLabel idLabel, uriLabel, hostLabel, portLabel, timeoutLabel, timeunitLabel,
+ nicknameLabel;
+ // Change end
+ private Color mActiveColor;
+ private String mDest;
+ private JCheckBox mEnableBox;
+ private boolean mEnable = false;
+ private String mInstanceName;
+ private boolean mColocated;
+ private JTable mCertTable;
+ private JTextArea mHeading;
+
+ public ConnectorEditor(AdminConnection admin, JFrame parent, String name,
+ String dest, String instanceName, boolean colocated) {
+ super(parent,true);
+ mParentFrame = parent;
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ mAdmin = admin;
+ mName = name;
+ mInstanceName = instanceName;
+ mDest = dest;
+ mColocated = colocated;
+ setSize(460, 516);
+ setTitle(mResource.getString(PREFIX+"_TITLE"));
+ setLocationRelativeTo(parent);
+ getRootPane().setDoubleBuffered(true);
+ setDisplay();
+ }
+
+ private void setDisplay() {
+ getContentPane().setLayout(new BorderLayout());
+ JPanel center = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ center.setLayout(gb);
+
+ //content panel
+ JPanel content = makeContentPanel();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.fill = gbc.BOTH;
+ //gbc.insets = CMSAdminUtil.DEFAULT_EMPTY_INSETS;
+ gb.setConstraints(content, gbc);
+ center.add(content);
+
+ NameValuePairs response = getCertsList(ScopeDef.SC_USERCERTSLIST);
+ mDataModel.removeAllRows();
+ if (response != null) {
+ String[] vals = new String[response.size()];
+ int i=0;
+ for (String entry : response.keySet()) {
+ vals[i++] = entry.trim();
+ }
+
+ int sindex = 0;
+ String snickname = "";
+ CMSAdminUtil.quickSort(vals, 0, response.size() - 1);
+ for (i=0; i<vals.length; i++) {
+ Vector v = new Vector();
+ String entry = vals[i];
+ String value = response.get(entry);
+
+ // look for the comma separator
+ int lastindex = entry.lastIndexOf(",");
+ if (lastindex != -1) {
+ String fullnickname = entry.substring(0, lastindex);
+ int tindex = fullnickname.indexOf(":");
+ String tokenname = fullnickname.substring(0, tindex);
+ String nickname = fullnickname.substring(tindex+1);
+ if (mName.equals("Data Recovery Manager Connector")) {
+ if (fullnickname.indexOf("subsystemCert") > -1) {
+ sindex = i;
+ snickname = fullnickname;
+ }
+ } else {
+ if (fullnickname.indexOf("raSigningCert") > -1) {
+ sindex = i;
+ snickname = fullnickname;
+ }
+ }
+ v.addElement(nickname);
+ v.addElement(entry.substring(lastindex+1));
+ v.addElement(value);
+ v.addElement(tokenname);
+ mDataModel.addRow(v);
+ }
+ }
+ mCertTable.setRowSelectionInterval(sindex, sindex);
+ mNicknameText.setText(snickname);
+ }
+
+ //action panel
+ JPanel action = makeActionPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints(action, gbc);
+ center.add(action);
+
+ getContentPane().add("Center",center);
+ }
+
+ protected void setLabelCellRenderer(JTable table, int index) {
+ table.getColumnModel().getColumn(index).setCellRenderer(
+ new DefaultTableCellRenderer());
+ }
+
+ private void displayCert(int row) {
+ String nickname = (String)(mCertTable.getValueAt(row, 3)) + ":" +
+ (String)(mCertTable.getValueAt(row, 0));
+ String serialno = (String)(mCertTable.getValueAt(row, 1));
+ String issuername = (String)(mCertTable.getValueAt(row, 2));
+
+ try {
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_NICK_NAME, nickname);
+ nvps.put(Constants.PR_SERIAL_NUMBER, serialno);
+ nvps.put(Constants.PR_ISSUER_NAME, issuername);
+ NameValuePairs results = mAdmin.process(
+ DestDef.DEST_SERVER_ADMIN, ScopeDef.SC_CERT_PRETTY_PRINT,
+ Constants.RS_ID_CONFIG, nvps);
+ if (nvps.size() <= 0)
+ return;
+ String name = results.keySet().iterator().next(); // first element
+ String print = results.get(name);
+ CertViewDialog certdialog = new CertViewDialog(mParentFrame);
+ certdialog.showDialog(nickname, print);
+ } catch (EAdminException ex) {
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource, ex.toString(),
+ CMSAdminUtil.ERROR_MESSAGE);
+ }
+ }
+
+ public void mouseClicked(MouseEvent e) {
+ //setButtons();
+
+ //we track the double click action on the table entry - View op
+ int row = mCertTable.getSelectedRow();
+ if(row >= 0) {
+ mNicknameText.setText((String)(mCertTable.getValueAt(row, 0)));
+ if(e.getClickCount() == 2) {
+ displayCert(row);
+ }
+ }
+ }
+
+ public void mouseReleased(MouseEvent e) {
+ }
+
+ public void mousePressed(MouseEvent e) {
+ }
+
+ public void mouseEntered(MouseEvent e) {
+ }
+
+ public void mouseExited(MouseEvent e) {
+ }
+
+ public void showDialog(NameValuePairs values) {
+
+ for (String name : values.keySet()) {
+ String val = values.get(name);
+ if (name.equals(Constants.PR_HOST)) {
+ mHostText.setText(val);
+ } else if (name.equals(Constants.PR_PORT)) {
+ mPortText.setText(val);
+ // Inserted by beomsuk
+ } else if (name.equals(Constants.PR_TIMEOUT)) {
+ if (val == null || val.equals(""))
+ mTimeoutText.setText("30");
+ else
+ mTimeoutText.setText(val);
+ // Insert end
+ } else if (name.equals(Constants.PR_ENABLED)) {
+ if (val.equals(Constants.TRUE))
+ mEnable = true;
+ else
+ mEnable = false;
+ }
+ }
+
+ mEnableBox.setSelected(mEnable);
+ enableConnector();
+ //update(local);
+ this.show();
+ }
+
+ private void enableConnector() {
+ if (mEnable) {
+ update();
+ } else {
+ hostLabel.setEnabled(false);
+ portLabel.setEnabled(false);
+ nicknameLabel.setEnabled(false);
+ timeoutLabel.setEnabled(false);
+ //timeunitLabel.setEnabled(false);
+ mHostText.setBackground(getBackground());
+ mPortText.setBackground(getBackground());
+ mNicknameText.setBackground(getBackground());
+ mTimeoutText.setBackground(getBackground());
+ mHostText.setEnabled(false);
+ mPortText.setEnabled(false);
+ mNicknameText.setEnabled(false);
+ mTimeoutText.setEnabled(false);
+ mHostText.setEditable(false);
+ mPortText.setEditable(false);
+ mNicknameText.setEditable(false);
+ mTimeoutText.setEditable(false);
+ mHeading.setEnabled(false);
+ mCertTable.setEnabled(false);
+ mCertTable.setBackground(getBackground());
+ CMSAdminUtil.repaintComp(hostLabel);
+ CMSAdminUtil.repaintComp(portLabel);
+ CMSAdminUtil.repaintComp(timeoutLabel);
+ //CMSAdminUtil.repaintComp(timeunitLabel);
+ CMSAdminUtil.repaintComp(mHostText);
+ CMSAdminUtil.repaintComp(mPortText);
+ CMSAdminUtil.repaintComp(mTimeoutText);
+ }
+ }
+
+ private void update() {
+ hostLabel.setEnabled(true);
+ portLabel.setEnabled(true);
+ nicknameLabel.setEnabled(true);
+ timeoutLabel.setEnabled(true);
+ mHostText.setEditable(true);
+ mPortText.setEditable(true);
+ mNicknameText.setEditable(true);
+ mTimeoutText.setEditable(true);
+ mHostText.setBackground(mActiveColor);
+ mPortText.setBackground(mActiveColor);
+ mNicknameText.setBackground(mActiveColor);
+ mTimeoutText.setBackground(mActiveColor);
+ mHostText.setEnabled(true);
+ mPortText.setEnabled(true);
+ mTimeoutText.setEnabled(true);
+ mNicknameText.setEnabled(true);
+ mHeading.setEnabled(true);
+ mCertTable.setEnabled(true);
+ mCertTable.setBackground(mActiveColor);
+
+ CMSAdminUtil.repaintComp(hostLabel);
+ CMSAdminUtil.repaintComp(portLabel);
+ CMSAdminUtil.repaintComp(timeoutLabel);
+ //CMSAdminUtil.repaintComp(timeunitLabel);
+ CMSAdminUtil.repaintComp(mHostText);
+ CMSAdminUtil.repaintComp(mPortText);
+ CMSAdminUtil.repaintComp(mTimeoutText);
+ }
+
+ private JPanel makeContentPanel() {
+ JPanel mainPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mainPanel.setLayout(gb);
+
+/*
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label1 = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "CONNECTORNAME", null);
+ gbc.anchor = gbc.WEST;
+ //gbc.weightx = 1.0;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE, CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE);
+ gb.setConstraints(label1, gbc);
+ mainPanel.add(label1);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label2 = new JLabel(mName);
+ gbc.anchor = gbc.WEST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.DIFFERENT_COMPONENT_SPACE,
+ 0, CMSAdminUtil.COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 0.0;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE, CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE);
+ gb.setConstraints(label2, gbc);
+ mainPanel.add(label2);
+*/
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label2 = new JLabel(mName+":");
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.fill = gbc.HORIZONTAL;
+ gb.setConstraints(label2, gbc);
+ mainPanel.add(label2);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mEnableBox = CMSAdminUtil.makeJCheckBox(mResource, PREFIX,
+ "ENABLE", null, false, this);
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+/*
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE, CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE);
+*/
+ gb.setConstraints(mEnableBox, gbc);
+ mainPanel.add(mEnableBox);
+
+ CMSAdminUtil.resetGBC(gbc);
+ hostLabel = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "HOST", null);
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.insets = new Insets(0, CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE, CMSAdminUtil.COMPONENT_SPACE);
+ gb.setConstraints(hostLabel, gbc);
+ mainPanel.add(hostLabel);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mHostText = new JTextField(20);
+ gbc.anchor = gbc.WEST;
+ gbc.weightx = 1.0;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.gridwidth = gbc.REMAINDER;
+ //gbc.gridheight = gbc.REMAINDER;
+/*
+ gbc.insets = new Insets(0, CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE, CMSAdminUtil.COMPONENT_SPACE);
+*/
+ gb.setConstraints(mHostText, gbc);
+ mainPanel.add(mHostText);
+ mActiveColor = mHostText.getBackground();
+
+ CMSAdminUtil.resetGBC(gbc);
+ portLabel = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "PORT", null);
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE, CMSAdminUtil.COMPONENT_SPACE);
+ gbc.weightx = 0.0;
+ gb.setConstraints(portLabel, gbc);
+ mainPanel.add(portLabel);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mPortText = new JTextField(20);
+ gbc.anchor = gbc.WEST;
+ gbc.weightx = 1.0;
+ gbc.fill = gbc.HORIZONTAL;
+/*
+ gbc.insets = new Insets(0, CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE, CMSAdminUtil.COMPONENT_SPACE);
+*/
+ gbc.gridwidth = gbc.REMAINDER;
+ //gbc.gridheight = gbc.REMAINDER;
+ gb.setConstraints(mPortText, gbc);
+ mainPanel.add(mPortText);
+
+ CMSAdminUtil.resetGBC(gbc);
+ timeoutLabel = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "TIMEOUT", null);
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, 4*CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE, CMSAdminUtil.COMPONENT_SPACE);
+ gbc.weightx = 0.0;
+ gb.setConstraints(timeoutLabel, gbc);
+ mainPanel.add(timeoutLabel);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mTimeoutText = new JTextField(20);
+ gbc.anchor = gbc.WEST;
+ gbc.weightx = 1.0;
+ gbc.fill = gbc.HORIZONTAL;
+/*
+ gbc.insets = new Insets(0, CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE, CMSAdminUtil.COMPONENT_SPACE);
+*/
+ gbc.gridwidth = gbc.REMAINDER;
+ //gbc.gridheight = gbc.REMAINDER;
+ gb.setConstraints(mTimeoutText, gbc);
+ mTimeoutText.setText("30");
+ mainPanel.add(mTimeoutText);
+
+ CMSAdminUtil.resetGBC(gbc);
+ nicknameLabel = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "NICKNAME", null);
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.insets = new Insets(0, CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE, CMSAdminUtil.COMPONENT_SPACE);
+ gb.setConstraints(nicknameLabel, gbc);
+ mainPanel.add(nicknameLabel);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mNicknameText = new JTextField(50);
+ gbc.anchor = gbc.WEST;
+ gbc.weightx = 1.0;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.gridwidth = gbc.REMAINDER;
+ gb.setConstraints(mNicknameText, gbc);
+ mainPanel.add(mNicknameText);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mHeading = createTextArea(mResource.getString(
+ PREFIX+"_TEXT_CERTHEADING_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.weightx = 1.0;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.insets = new Insets(2*CMSAdminUtil.COMPONENT_SPACE,
+ 4*CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE, CMSAdminUtil.COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ gb.setConstraints(mHeading, gbc);
+ mainPanel.add(mHeading);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mDataModel = new ListCertsModel();
+ mCertTable = new JTable(mDataModel);
+ JScrollPane scrollPane = JTable.createScrollPaneForTable(mCertTable);
+ scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
+ scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ mCertTable.setPreferredScrollableViewportSize(new Dimension(200, 350));
+ mCertTable.setAutoscrolls(true);
+ mCertTable.sizeColumnsToFit(true);
+ mCertTable.addMouseListener(this);
+ scrollPane.setBackground(Color.white);
+ setLabelCellRenderer(mCertTable, 0);
+ setLabelCellRenderer(mCertTable, 1);
+ setLabelCellRenderer(mCertTable, 2);
+
+/*
+ Vector v = new Vector();
+ v.addElement("abc1");
+ v.addElement("def1");
+ v.addElement("hij1");
+ mDataModel.addRow(v);
+ Vector v1 = new Vector();
+ v1.addElement("abc1");
+ v1.addElement("def1");
+ v1.addElement("hij1");
+ mDataModel.addRow(v1);
+ Vector v2 = new Vector();
+ v2.addElement("abc1");
+ v2.addElement("def1");
+ v2.addElement("hij1");
+ mDataModel.addRow(v2);
+*/
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.fill = gbc.BOTH;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ 4*CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE, CMSAdminUtil.COMPONENT_SPACE);
+ gb.setConstraints(scrollPane, gbc);
+ mainPanel.add(scrollPane);
+
+
+ return mainPanel;
+ }
+
+ private JTextArea createTextArea(String str) {
+ JTextArea desc = new JTextArea(str);
+ desc.setBackground(getBackground());
+ desc.setEditable(false);
+ desc.setCaretColor(getBackground());
+ desc.setLineWrap(true);
+ desc.setWrapStyleWord(true);
+
+ return desc;
+ }
+
+ private JPanel makeActionPane() {
+ mOK = CMSAdminUtil.makeJButton(mResource, PREFIX, "OK", null, this);
+ mCancel = CMSAdminUtil.makeJButton(mResource, PREFIX, "CANCEL", null, this);
+ mHelp = CMSAdminUtil.makeJButton(mResource, PREFIX, "HELP", null, this);
+ //JButton[] buttons = { mOK, mCancel, mHelp};
+ JButton[] buttons = { mOK, mCancel};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonPanel( buttons, true);
+ }
+
+ public void actionPerformed(ActionEvent e) {
+
+ if (e.getSource().equals(mEnableBox)) {
+ mEnable = mEnableBox.isSelected();
+ enableConnector();
+ } else if (e.getSource().equals(mCancel))
+ this.dispose();
+ else if (e.getSource().equals(mOK)) {
+ NameValuePairs nvps = new NameValuePairs();
+
+ if (mEnable) {
+ nvps.put(Constants.PR_LOCAL, Constants.FALSE);
+ nvps.put(Constants.PR_HOST, mHostText.getText());
+ String portStr = mPortText.getText().trim();
+ try {
+ int port = Integer.parseInt(portStr);
+ if (port <= 0) {
+ CMSAdminUtil.showMessageDialog(mParentFrame, mResource, PREFIX,
+ "OUTOFRANGE", CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ } catch (NumberFormatException ex) {
+ CMSAdminUtil.showMessageDialog(mParentFrame, mResource, PREFIX,
+ "NONINTEGER", CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ nvps.put(Constants.PR_PORT, portStr);
+
+ String timeoutStr = mTimeoutText.getText().trim();
+ try {
+ int timeout = Integer.parseInt(timeoutStr);
+ if (timeout < 0) {
+ CMSAdminUtil.showMessageDialog(mParentFrame, mResource, PREFIX,
+ "TIMEOUTOUTOFRANGE", CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ } catch (NumberFormatException ex) {
+ CMSAdminUtil.showMessageDialog(mParentFrame, mResource, PREFIX,
+ "TIMEOUTNONINTEGER", CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ nvps.put(Constants.PR_TIMEOUT, timeoutStr);
+
+ if (mName.equals("Data Recovery Manager Connector")) {
+ nvps.put(Constants.PR_URI, "/kra/agent/kra/connector");
+ } else if (mName.equals("Registration Manager Connector")) {
+ nvps.put(Constants.PR_URI, "/ra/connector");
+ } else if (mName.equals("Certificate Manager Connector")) {
+ nvps.put(Constants.PR_URI, "/ca/connector");
+ }
+ nvps.put(Constants.PR_NICK_NAME, mNicknameText.getText().trim());
+ nvps.put(Constants.PR_ENABLED, Constants.TRUE);
+ } else {
+ nvps.put(Constants.PR_ENABLED, Constants.FALSE);
+ }
+
+ try {
+ mAdmin.modify(mDest, ScopeDef.SC_CONNECTOR,
+ mName, nvps);
+ this.dispose();
+ } catch (EAdminException ex) {
+ CMSAdminUtil.showMessageDialog(mParentFrame,
+ "Error", ex.toString(), CMSAdminUtil.ERROR_MESSAGE);
+ }
+ } else if (e.getSource().equals(mHelp)) {
+ CMSAdminUtil.help(HELPINDEX1);
+ }
+ }
+
+ private NameValuePairs getCertsList(String scope) {
+ try {
+ NameValuePairs nvps =
+ mAdmin.search(DestDef.DEST_SERVER_ADMIN, scope, new NameValuePairs());
+ return nvps;
+ } catch (EAdminException ex) {
+ CMSAdminUtil.showMessageDialog(mParentFrame,
+ "Error", ex.toString(), CMSAdminUtil.ERROR_MESSAGE);
+ return null;
+ }
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/EvaluatorRegisterDialog.java b/base/console/src/com/netscape/admin/certsrv/config/EvaluatorRegisterDialog.java
new file mode 100644
index 000000000..d4dff2e25
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/EvaluatorRegisterDialog.java
@@ -0,0 +1,41 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.config.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+
+/**
+ * Evaluator Implementation Registration Editor
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+
+public class EvaluatorRegisterDialog extends RegisterDialog {
+
+ private final static String PREFIX = "EVALUATORREGISTERDIALOG";
+
+ public EvaluatorRegisterDialog(JFrame parent, AdminConnection conn) {
+ super(PREFIX, parent, conn);
+ setDisplay();
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/GeneralLogPanel.java b/base/console/src/com/netscape/admin/certsrv/config/GeneralLogPanel.java
new file mode 100644
index 000000000..66e9b4397
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/GeneralLogPanel.java
@@ -0,0 +1,250 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.*;
+
+/**
+ * LDAP server setting tab
+ *
+ * @author Ade Lee
+ * @version $Revision: 1211 $, $Date: 2010-08-18 13:15:37 -0400 (Wed, 18 Aug 2010) $
+ */
+public class GeneralLogPanel extends CMSBaseTab {
+
+ private static String PANEL_NAME = "GENERALLOG";
+ private static final String HELPINDEX =
+ "configuration-general-logs-settings-help";
+ private JCheckBox mEnable;
+ private Color mActiveColor;
+ private JLabel mLevelLabel;
+ private JTextField mLevelText;
+ private JCheckBox mShowCaller;
+
+ protected AdminConnection mAdmin;
+ protected CMSBaseResourceModel mModel;
+ private String mServletName;
+ private CMSTabPanel mParent;
+
+ public GeneralLogPanel(CMSTabPanel parent) {
+ super(PANEL_NAME, parent);
+ mHelpToken = HELPINDEX;
+ mServletName = DestDef.DEST_LOG_ADMIN;
+ mModel = parent.getResourceModel();
+ mParent = parent;
+ }
+
+ public void init() {
+ mAdmin = mModel.getServerInfo().getAdmin();
+ JPanel serverInfo = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mCenterPanel.setLayout(gb);
+
+ //add the enable checkbox
+ mEnable = makeJCheckBox("ENABLE");
+ mEnable.setSelected(true);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(DIFFERENT_COMPONENT_SPACE,
+ DIFFERENT_COMPONENT_SPACE,
+ 0,
+ DIFFERENT_COMPONENT_SPACE);
+ gb.setConstraints(mEnable, gbc);
+ mCenterPanel.add(mEnable);
+
+ //add the debug properties panel
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(serverInfo, gbc);
+ mCenterPanel.add(serverInfo);
+
+ GridBagLayout gb1 = new GridBagLayout();
+ serverInfo.setLayout(gb1);
+ serverInfo.setBorder(makeTitledBorder("DEBUG"));
+
+ // add frequency label and text field
+ CMSAdminUtil.resetGBC(gbc);
+ mLevelLabel = makeJLabel("LEVEL");
+ mLevelText = makeJTextField(30);
+ mActiveColor = mLevelText.getBackground();
+ CMSAdminUtil.addEntryField(serverInfo,
+ mLevelLabel, mLevelText, gbc);
+
+ // add show caller checkbox
+ /*
+ CMSAdminUtil.resetGBC(gbc);
+ mShowCaller = makeJCheckBox("SHOWCALLER");
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE - COMPONENT_SPACE,0,COMPONENT_SPACE);
+ gb1.setConstraints(mShowCaller, gbc);
+ serverInfo.add(mShowCaller);
+ */
+ refresh();
+ }
+
+
+ public void refresh() {
+ mModel.progressStart();
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_DEBUG_LOG_ENABLE, "true");
+ nvps.put(Constants.PR_DEBUG_LOG_LEVEL, "0");
+ /*nvps.add(Constants.PR_DEBUG_LOG_SHOWCALLER, ""); */
+
+ try {
+ NameValuePairs val = mAdmin.read(mServletName,
+ ScopeDef.SC_GENERAL, Constants.RS_ID_CONFIG, nvps);
+
+ populate(val);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ }
+ mModel.progressStop();
+ clearDirtyFlag();
+ mParent.setOKCancel();
+ }
+
+ private void enableFields(boolean enable, Color color) {
+ mLevelText.setEnabled(enable);
+ mLevelText.setEditable(enable);
+ mLevelText.setBackground(color);
+ mLevelLabel.setEnabled(enable);
+ mLevelLabel.setBackground(color);
+
+ mLevelLabel.invalidate();
+ mLevelLabel.validate();
+ mLevelLabel.repaint(1);
+ }
+
+ protected void populate(NameValuePairs nvps) {
+ for (String name : nvps.keySet()) {
+ String value = nvps.get(name);
+ if (name.equals(Constants.PR_DEBUG_LOG_ENABLE)) {
+ if (value.equals(Constants.TRUE))
+ mEnable.setSelected(true);
+ else
+ mEnable.setSelected(false);
+ } else if (name.equals(Constants.PR_DEBUG_LOG_LEVEL)) {
+ mLevelText.setText(value);
+ }
+
+ /* else if (name.equals(Constants.PR_DEBUG_LOG_SHOWCALLER)) {
+ if (value.equals(Constants.TRUE))
+ mShowCaller.setSelected(true);
+ else
+ mShowCaller.setSelected(false);
+ } */
+
+ }
+
+ if (mEnable.isSelected())
+ enableFields(true, mActiveColor);
+ else
+ enableFields(false, getBackground());
+
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ super.actionPerformed(e);
+ if (mEnable.isSelected()) {
+ enableFields(true, mActiveColor);
+ } else {
+ enableFields(false, getBackground());
+ }
+ }
+
+ /**
+ * Implementation for saving panel information
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean applyCallback() {
+ // check blank fields
+ String level = mLevelText.getText().trim();
+
+ if (mEnable.isSelected() && level.equals("")) {
+ showMessageDialog("BLANKFIELD");
+ return false;
+ }
+
+ try {
+ int num = Integer.parseInt(level);
+ if (num < 0) {
+ showMessageDialog("LEVELRANGE");
+ return false;
+ }
+ } catch (NumberFormatException e) {
+ showMessageDialog("NUMBERFORMAT");
+ return false;
+ }
+
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_DEBUG_LOG_LEVEL, level);
+
+ /*
+ if (mShowCaller.isSelected())
+ nvps.add(Constants.PR_DEBUG_LOG_SHOWCALLER, Constants.TRUE);
+ else
+ nvps.add(Constants.PR_DEBUG_LOG_SHOWCALLER, Constants.FALSE);
+ */
+
+ if (mEnable.isSelected())
+ nvps.put(Constants.PR_DEBUG_LOG_ENABLE, Constants.TRUE);
+ else
+ nvps.put(Constants.PR_DEBUG_LOG_ENABLE, Constants.FALSE);
+
+ mModel.progressStart();
+ try {
+ mAdmin.modify(mServletName, ScopeDef.SC_GENERAL,
+ Constants.RS_ID_CONFIG, nvps, false);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ return false;
+ }
+
+ mModel.progressStop();
+ clearDirtyFlag();
+ return true;
+ }
+
+ /**
+ * Implementation for reset values
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean resetCallback() {
+ refresh();
+ return true;
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/JobsConfigDialog.java b/base/console/src/com/netscape/admin/certsrv/config/JobsConfigDialog.java
new file mode 100644
index 000000000..307ddbbc4
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/JobsConfigDialog.java
@@ -0,0 +1,62 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import javax.swing.table.*;
+import javax.swing.text.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Jobs Parameter Configuration Dialog
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class JobsConfigDialog extends CMSBaseConfigDialog
+ implements ActionListener
+{
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public JobsConfigDialog(NameValuePairs nvp,
+ JFrame parent,
+ AdminConnection conn,
+ String dest) {
+
+ super(parent, dest);
+
+ PREFIX = "JOBSCONFIGDIALOG";
+ mImplName_token = Constants.PR_JOBS_IMPL_NAME;
+ mImplType = Constants.PR_EXT_PLUGIN_IMPLTYPE_JOBS;
+ mHelpToken = "configuration-jobs";
+
+ init(nvp,parent,conn,dest);
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/JobsImplDataModel.java b/base/console/src/com/netscape/admin/certsrv/config/JobsImplDataModel.java
new file mode 100644
index 000000000..d3a605433
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/JobsImplDataModel.java
@@ -0,0 +1,68 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Jobs Implementation Data model - represents the implementation
+ * table information
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class JobsImplDataModel extends CMSContentTableModel
+ implements IDataProcessor
+{
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ public static final String IMPL_NAME = "NAME";
+ public static final String IMPL_CLASS = "CLASS";
+ public static final String IMPL_DESC = "DESC";
+
+ private static String[] mColumns = {JOBS_IMPL, CLASSNAME};
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public JobsImplDataModel() {
+ super();
+ init(mColumns);
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public void processData(Object data) {
+ Vector v = new Vector();
+ NameValuePairs obj = (NameValuePairs) data;
+ v.addElement(new JLabel(obj.get(IMPL_NAME),
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE_PLUGIN),
+ JLabel.LEFT));
+ v.addElement(obj.get(IMPL_CLASS));
+ //v.addElement(obj.getValue(IMPL_DESC));
+ addRow(v, data);
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/JobsImplTab.java b/base/console/src/com/netscape/admin/certsrv/config/JobsImplTab.java
new file mode 100644
index 000000000..57848c649
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/JobsImplTab.java
@@ -0,0 +1,323 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.ug.*;
+import javax.swing.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Jobs Instances Management Tab
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class JobsImplTab extends CMSBaseUGTab {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String IMPL_NAME = JobsImplDataModel.IMPL_NAME;
+ private static final String IMPL_CLASS = JobsImplDataModel.IMPL_CLASS;
+ private static final String IMPL_DESC = JobsImplDataModel.IMPL_DESC;
+
+ private static final String PANEL_NAME = "JOBSIMPL";
+ private static final String DIALOG_PREFIX = "JOBSREGISTERDIALOG";
+
+ private AdminConnection mConnection;
+ private String mDestination;
+
+ protected JScrollPane mScrollPane;
+ protected JTable mTable; //table
+ protected JobsImplDataModel mDataModel; //table model
+ protected JobsRegisterDialog mEditor=null; //keep single copy
+ protected ViewDialog mViewer=null; //keep single copy
+
+ protected JButton mRefresh, mAdd, mDelete, mView, mHelp;
+ private final static String HELPINDEX = "jobsscheduler-certsrv-jobplugin-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public JobsImplTab(CMSBaseResourceModel model) {
+ super(PANEL_NAME, model);
+ mConnection = model.getServerInfo().getAdmin();
+ mDataModel = new JobsImplDataModel();
+ mDestination = DestDef.DEST_JOBS_ADMIN;
+ mHelpToken = HELPINDEX;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mRefresh)) {
+ refresh();
+ }
+ if (e.getSource().equals(mAdd)) {
+ if (mEditor==null)
+ mEditor = new JobsRegisterDialog(mModel.getFrame(),
+ mConnection);
+ mEditor.showDialog(mDestination, ScopeDef.SC_JOBS_IMPLS);
+ refresh();
+ }
+ if (e.getSource().equals(mDelete)) {
+ Debug.println("Delete");
+ if(mTable.getSelectedRow()< 0)
+ return;
+ int i = showConfirmDialog("DELETE");
+ if (i == JOptionPane.YES_OPTION) {
+ delete();
+ Debug.println("Deleted");
+ }
+ }
+ if (e.getSource().equals(mView)) {
+ Debug.println("View");
+ if(mTable.getSelectedRow()< 0)
+ return;
+ NameValuePairs obj = (NameValuePairs)
+ mDataModel.getObjectValueAt(mTable.getSelectedRow());
+ if (mViewer==null)
+ mViewer = new ViewDialog(mModel.getFrame());
+ mViewer.showDialog(obj.get(IMPL_NAME),
+ obj.get(IMPL_CLASS),
+ obj.get(IMPL_DESC));
+ }
+ if (e.getSource().equals(mHelp)) {
+ helpCallback();
+ }
+ }
+
+ //==== MOUSELISTENER ======================
+ public void mouseClicked(MouseEvent e) {
+ setButtons();
+ }
+
+ public void mouseReleased(MouseEvent e) {
+ setButtons();
+ }
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+ public void refresh() {
+
+ mDataModel.removeAllRows();
+ update();
+
+ setButtons();
+ mTable.invalidate();
+ mTable.validate();
+ mTable.repaint(1);
+ }
+
+ /**
+ * create the user action button panel
+ */
+ protected JPanel createButtonPanel() {
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mAdd = makeJButton("ADD");
+ mDelete = makeJButton("DELETE");
+ mView = makeJButton("VIEW");
+ JButton[] buttons = {mAdd, mDelete, mView};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonVPanel( buttons );
+ }
+
+ protected JPanel createActionPanel() {
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mRefresh = makeJButton("REFRESH");
+ mHelp = makeJButton("HELP");
+ //JButton[] buttons = { mRefresh, mHelp };
+ JButton[] buttons = { mRefresh };
+ return makeJButtonPanel(buttons, true);
+ }
+
+ protected JPanel createListPanel() {
+ mListPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mListPanel.setLayout(gb);
+
+ //center table
+ mTable = new JTable(mDataModel);
+ mScrollPane = JTable.createScrollPaneForTable(mTable);
+ //mScrollPane.setBorder(CMSAdminUtil.makeTitledBorder(mResource,PANEL_NAME,"USERS"));
+ mScrollPane.setHorizontalScrollBarPolicy(mScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mScrollPane.setVerticalScrollBarPolicy(mScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ mTable.setAutoscrolls(true);
+ mTable.sizeColumnsToFit(true);
+ mTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ mTable.getSelectionModel().addListSelectionListener(this);
+ mScrollPane.setBackground(Color.white);
+ mTable.addMouseListener(this);
+ setLabelCellRenderer(mTable,0);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = 1;
+ gbc.weightx = 1.0;
+ gbc.insets = EMPTY_INSETS;
+ gb.setConstraints(mScrollPane, gbc);
+ mListPanel.add(mScrollPane);
+
+ JPanel buttonPanel = createButtonPanel();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 0.0;
+ gbc.weighty = 1.0;
+ gbc.insets = EMPTY_INSETS;
+ gb.setConstraints(buttonPanel, gbc);
+ mListPanel.add(buttonPanel);
+
+ refresh();
+
+ return mListPanel;
+ }
+
+ //Set the first column's cellrender as label cell
+ protected void setLabelCellRenderer(JTable table, int index) {
+ table.getColumnModel().getColumn(index).setCellRenderer(new LabelCellRenderer(new JLabel()));
+ }
+
+
+ //set buttons
+ private void setButtons() {
+
+ //enable and diable buttons accordingly
+ //Debug.println("setButtons() - "+mTable.getSelectedRow());
+ //Debug.println("setButtons() - "+mTable.getSelectionModel().isSelectionEmpty());
+ if (mTable.getSelectionModel().isSelectionEmpty()) {
+ mDelete.setEnabled(false);
+ mView.setEnabled(false);
+ return;
+ }
+
+ if(mDataModel.getRowCount()<=0) {
+ mDelete.setEnabled(false);
+ mView.setEnabled(false);
+ return;
+ }
+
+ mDelete.setEnabled(true);
+ mView.setEnabled(true);
+
+ }
+
+ //=============================================
+ // SEND REQUESTS TO THE SERVER SIDE
+ //=============================================
+ private void update() {
+ //send request and parse data
+
+ mModel.progressStart();
+ NameValuePairs response;
+ try {
+ response = mConnection.search(mDestination,
+ ScopeDef.SC_JOBS_IMPLS,
+ new NameValuePairs());
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ mModel.progressStop();
+ return;
+ }
+
+ Debug.println(response.toString());
+
+ //parse the data
+ int i=0;
+ String[] vals = new String[response.size()];
+ Hashtable<String, NameValuePairs> data = new Hashtable<String, NameValuePairs>();
+ for (String entry : response.keySet()) {
+ entry = entry.trim();
+ String value = response.get(entry);
+ Debug.println("entry= "+entry);
+ Debug.println("value= " + value);
+ int x = value.indexOf(",");
+ Debug.println("x = " + x);
+ NameValuePairs obj = new NameValuePairs();
+ obj.put(IMPL_NAME, entry);
+ vals[i++]= entry ;
+ if (x != -1) {
+ obj.put(IMPL_CLASS, value.substring(0, x));
+ obj.put(IMPL_DESC, value.substring(x + 1));
+ }
+ else {
+ obj.put(IMPL_CLASS, value);
+ }
+ data.put(entry,obj);
+ }
+
+ CMSAdminUtil.bubbleSort(vals);
+
+ for (int y=0; y< vals.length ; y++) {
+ mDataModel.processData(data.get(vals[y]));
+ }
+
+ data.clear();
+
+ if (mDataModel.getRowCount() >0)
+ mTable.setRowSelectionInterval(0,0);
+
+ mModel.progressStop();
+ }
+
+ private void delete() {
+ //get entry name
+ mModel.progressStart();
+ NameValuePairs obj = (NameValuePairs)
+ mDataModel.getObjectValueAt(mTable.getSelectedRow());
+
+ //send comment to server for the removal of user
+ try {
+ mConnection.delete(mDestination,
+ ScopeDef.SC_JOBS_IMPLS,
+ obj.get(IMPL_NAME));
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ mModel.progressStop();
+ return;
+ }
+ mModel.progressStop();
+ //send comment to server and refetch the content
+ refresh();
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/JobsInstanceTab.java b/base/console/src/com/netscape/admin/certsrv/config/JobsInstanceTab.java
new file mode 100644
index 000000000..059a741ce
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/JobsInstanceTab.java
@@ -0,0 +1,104 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.ug.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Jobs Instances Management Tab
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class JobsInstanceTab extends CMSPluginInstanceTab {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PANEL_NAME = "JOBSRULE";
+
+ private final static String HELPINDEX = "jobsscheduler-certsrv-jobrules-help";
+
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public JobsInstanceTab(CMSBaseResourceModel model) {
+ super(model,DestDef.DEST_JOBS_ADMIN,PANEL_NAME);
+ Debug.println("JobsInstanceTab::JobsInstanceTab(<model>");
+ mConnection = model.getServerInfo().getAdmin();
+ mDataModel = new JobsRuleDataModel();
+ mScope = ScopeDef.SC_JOBS_INSTANCE;
+ RULE_NAME = JobsRuleDataModel.RULE_NAME;
+ RULE_STAT = JobsRuleDataModel.RULE_STAT;
+
+ mHelpToken = HELPINDEX;
+ }
+
+
+ public CMSBaseConfigDialog makeNewConfigDialog(
+ NameValuePairs nvp,
+ JFrame parent,
+ AdminConnection conn,
+ String dest
+ )
+ {
+
+ return new JobsConfigDialog(nvp,
+ parent,
+ conn,
+ dest);
+ }
+
+ public PluginSelectionDialog getPluginSelectionDialog(
+ JFrame parent,
+ AdminConnection conn,
+ String dest,
+ CMSPluginInstanceTab pluginType
+ )
+ {
+ return new JobsPluginSelectionDialog(parent,conn,dest,pluginType);
+ }
+
+
+ /**
+ * create the user action button panel
+ */
+ protected JPanel createUserButtonPanel() {
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mEdit = makeJButton("EDIT");
+ mAdd = makeJButton("ADD");
+ mDelete = makeJButton("DELETE");
+ JButton[] buttons = {mAdd, mDelete, mEdit};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonVPanel( buttons );
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/JobsPluginSelectionDialog.java b/base/console/src/com/netscape/admin/certsrv/config/JobsPluginSelectionDialog.java
new file mode 100644
index 000000000..d07e5ed32
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/JobsPluginSelectionDialog.java
@@ -0,0 +1,66 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Jobs Plugin Selection Dialog
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class JobsPluginSelectionDialog extends PluginSelectionDialog
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PREFIX = "JOBSSELECTIONDIALOG";
+ private static final String HELPINDEX =
+ "jobsscheduler-certsrv-add-jobrule-dbox-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public JobsPluginSelectionDialog(
+ JFrame parent,
+ AdminConnection conn,
+ String dest,
+ CMSPluginInstanceTab pluginType)
+ {
+ super(PREFIX, parent,conn, dest, pluginType);
+ mScope = ScopeDef.SC_JOBS_IMPLS;
+ mInstanceScope = ScopeDef.SC_JOBS_INSTANCE;
+ mImageName = CMSAdminResources.IMAGE_RULE_PLUGIN;
+ if (dest.equals(DestDef.DEST_JOBS_ADMIN))
+ mHelpToken = HELPINDEX;
+
+ setDisplay();
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/JobsRegisterDialog.java b/base/console/src/com/netscape/admin/certsrv/config/JobsRegisterDialog.java
new file mode 100644
index 000000000..bdb448eeb
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/JobsRegisterDialog.java
@@ -0,0 +1,40 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+
+/**
+ * Jobs Implementation Registration Editor
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+
+public class JobsRegisterDialog extends RegisterDialog {
+
+ private final static String PREFIX = "JOBSREGISTERDIALOG";
+
+ public JobsRegisterDialog(JFrame parent, AdminConnection conn) {
+ super(PREFIX, parent, conn);
+ setDisplay();
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/JobsRuleDataModel.java b/base/console/src/com/netscape/admin/certsrv/config/JobsRuleDataModel.java
new file mode 100644
index 000000000..76fbd9a38
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/JobsRuleDataModel.java
@@ -0,0 +1,71 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.Debug;
+
+
+/**
+ * Jobs instance Data model - represents the instance
+ * table information
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public class JobsRuleDataModel extends CMSRuleDataModel
+{
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public JobsRuleDataModel() {
+ super();
+ }
+
+ protected String[] getColumns() {
+ Debug.println("JobsRuleDataModel.getColumns()");
+ String x[] = {JOBS_RULE, STATUS};
+ return x;
+ }
+
+ public void processData(Object data) {
+ Vector v = new Vector();
+ NameValuePairs obj = (NameValuePairs) data;
+
+ //XXX NEED TO ADD STUFF
+ if (obj.get(RULE_STAT).equalsIgnoreCase("enabled")) {
+ v.addElement(new JLabel(obj.get(RULE_NAME),
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE),
+ JLabel.LEFT));
+ v.addElement(mResource.getString("JOBSRULE_LABEL_ENABLED_LABEL"));
+ } else {
+ v.addElement(new JLabel(obj.get(RULE_NAME),
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE_DISABLE),
+ JLabel.LEFT));
+ v.addElement(mResource.getString("JOBSRULE_LABEL_DISABLED_LABEL"));
+ }
+ addRow(v, data);
+ mRules.addElement(obj.get(RULE_NAME));
+ }
+
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/JobsSettingPanel.java b/base/console/src/com/netscape/admin/certsrv/config/JobsSettingPanel.java
new file mode 100644
index 000000000..b6a93d191
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/JobsSettingPanel.java
@@ -0,0 +1,240 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.connection.*;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.*;
+
+/**
+ * Jobs Scheduler setting tab
+ *
+ * @author cfu
+ * @version $Revision$, $Date$
+ */
+public class JobsSettingPanel extends CMSBaseTab implements ItemListener {
+ private static final String HELPINDEX =
+ "jobsscheduler-certsrv-setting-jobrule-help";
+ private JTextField mFrequencyText;
+ private JCheckBox mEnable;
+ private Color mActiveColor;
+ private JLabel mFrequencyLabel;
+ protected AdminConnection mAdmin;
+ protected CMSBaseResourceModel mModel;
+ private String mServletName;
+ private CMSTabPanel mParent;
+ private String mPanelName;
+
+ public JobsSettingPanel(String panelName, CMSTabPanel parent) {
+ this(panelName, parent, true);
+ mPanelName = panelName;
+ }
+
+ public JobsSettingPanel(String panelName, CMSTabPanel parent, boolean flag) {
+ super(panelName, parent);
+ mServletName = DestDef.DEST_JOBS_ADMIN;
+ mHelpToken = HELPINDEX;
+ mModel = parent.getResourceModel();
+ mParent = parent;
+ }
+
+ public void init() {
+ mAdmin = mModel.getServerInfo().getAdmin();
+ JPanel serverInfo = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mCenterPanel.setLayout(gb);
+
+ //add the enable checkbox
+ mEnable = makeJCheckBox("ENABLE");
+ mEnable.setSelected(true);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(DIFFERENT_COMPONENT_SPACE,
+ DIFFERENT_COMPONENT_SPACE,
+ 0,
+ DIFFERENT_COMPONENT_SPACE);
+ gb.setConstraints(mEnable, gbc);
+ mCenterPanel.add(mEnable);
+
+ //add the frequency panel
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(serverInfo, gbc);
+ mCenterPanel.add(serverInfo);
+
+ GridBagLayout gb1 = new GridBagLayout();
+ serverInfo.setLayout(gb1);
+ serverInfo.setBorder(makeTitledBorder("FREQUENCY"));
+
+ // add frequency label and text field
+ CMSAdminUtil.resetGBC(gbc);
+ mFrequencyLabel = makeJLabel("FREQUENCY");
+ mFrequencyText = makeJTextField(30);
+ mActiveColor = mFrequencyText.getBackground();
+ JLabel dateLabel = makeJLabel("MINUTES");
+ CMSAdminUtil.addEntryField(serverInfo,
+ mFrequencyLabel, mFrequencyText, dateLabel, gbc);
+
+ refresh();
+ }
+
+ public void refresh() {
+ mModel.progressStart();
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_ENABLE, "");
+ nvps.put(Constants.PR_JOBS_FREQUENCY, "");
+
+ try {
+ NameValuePairs val = mAdmin.read(mServletName,
+ ScopeDef.SC_JOBS, Constants.RS_ID_CONFIG, nvps);
+
+ populate(val);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ }
+ mModel.progressStop();
+ clearDirtyFlag();
+ mParent.setOKCancel();
+ }
+
+ protected void populate(NameValuePairs nvps) {
+ String clientCert = "";
+
+ String version = "";
+ for (String name : nvps.keySet()) {
+ String value = nvps.get(name);
+ if (name.equals(Constants.PR_JOBS_FREQUENCY)) {
+ mFrequencyText.setText(value);
+ } else if (name.equals(Constants.PR_ENABLE)) {
+ if (value.equals(Constants.TRUE))
+ mEnable.setSelected(true);
+ else
+ mEnable.setSelected(false);
+ }
+ }
+
+ if (mEnable.isSelected())
+ enableFields(true, mActiveColor);
+ else
+ enableFields(false, getBackground());
+ }
+
+ private int getIndex(String val, String[] array) {
+ for (int i=0; i<array.length; i++) {
+ if (val.equals(array[i]))
+ return i;
+ }
+ return -1;
+ }
+
+ private void enableFields(boolean enable, Color color) {
+ mFrequencyText.setEnabled(enable);
+ mFrequencyText.setEditable(enable);
+ mFrequencyText.setBackground(color);
+ mFrequencyLabel.setEnabled(enable);
+ mFrequencyLabel.setBackground(color);
+
+ mFrequencyLabel.invalidate();
+ mFrequencyLabel.validate();
+ mFrequencyLabel.repaint(1);
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ super.actionPerformed(e);
+ if (mEnable.isSelected()) {
+ enableFields(true, mActiveColor);
+ } else {
+ enableFields(false, getBackground());
+ }
+ }
+
+ /**
+ * Implementation for saving panel information
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean applyCallback() {
+ // check blank fields
+ String freq = mFrequencyText.getText().trim();
+
+ if (freq.equals("")) {
+ showMessageDialog("BLANKFIELD");
+ return false;
+ }
+
+ int ifreq = 0;
+ // make sure it's a positive integer
+ try {
+ ifreq = Integer.parseInt(freq);
+ } catch (NumberFormatException e) {
+ showMessageDialog("NEEDINTEGER");
+ return false;
+ }
+
+ if (ifreq < 0) {
+ showMessageDialog("NEEDINTEGER");
+ return false;
+ }
+
+ NameValuePairs nvps = new NameValuePairs();
+ if (mEnable.isSelected())
+ nvps.put(Constants.PR_ENABLE, Constants.TRUE);
+ else
+ nvps.put(Constants.PR_ENABLE, Constants.FALSE);
+
+ if (mEnable.isSelected()){
+ nvps.put(Constants.PR_JOBS_FREQUENCY, freq);
+ }
+
+ mModel.progressStart();
+ try {
+ mAdmin.modify(mServletName, ScopeDef.SC_JOBS,
+ Constants.RS_ID_CONFIG, nvps);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ return false;
+ }
+
+ mModel.progressStop();
+ clearDirtyFlag();
+ return true;
+ }
+
+ /**
+ * Implementation for reset values
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean resetCallback() {
+ refresh();
+ return true;
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/KeyCreateDialog.java b/base/console/src/com/netscape/admin/certsrv/config/KeyCreateDialog.java
new file mode 100644
index 000000000..5821127d4
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/KeyCreateDialog.java
@@ -0,0 +1,299 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Log Implementation Registration Editor
+ *
+ * @author Michelle Zhao
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+
+public class KeyCreateDialog extends JDialog
+ implements ActionListener, DocumentListener, MouseListener {
+
+ private final static String PREFIX = "KEYCREATEDIALOG";
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private JFrame mParentFrame;
+ private AdminConnection mConnection;
+ private ResourceBundle mResource;
+
+ private JTextField mNameField; //mClassField,mTypeField
+ private JButton mOK, mCancel;
+
+ protected String mDestination; //DEST_TAG to support RA/KRA/CA dest
+ protected String mScope;
+ protected String mPrefix;
+ protected String selectedToken;
+ private boolean mIsOK = false;
+ protected boolean mType = false;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+
+ public KeyCreateDialog(JFrame parent, AdminConnection conn) {
+ super(parent,true);
+ KeyCreateDialog2(PREFIX, parent, conn);
+ setDisplay();
+ }
+ public void KeyCreateDialog2(String prefix, JFrame parent, AdminConnection conn) {
+
+ mParentFrame = parent;
+ mPrefix = prefix;
+ mConnection = conn;
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ setSize(360, 216);
+ setTitle(mResource.getString(mPrefix+"_TITLE"));
+ setLocationRelativeTo(parent);
+ getRootPane().setDoubleBuffered(true);
+ //setDisplay(); SUBCLASS MUST call setDiaply() in its constructor
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * show the windows
+ */
+ public void showDialog(String destination, String scope) {
+ //initialize and setup
+ mNameField.setText("");
+ //mClassField.setText("");
+ //if (mType) {
+ // mTypeField.setText("");
+ //}
+ mDestination=destination;
+ mScope=scope;
+ this.show();
+ }
+
+ protected void setDestination(String destination) {
+ mDestination = destination;
+ }
+
+ protected void setScope(String scope) {
+ mScope = scope;
+ }
+
+ public boolean isOK() {
+ return mIsOK;
+ }
+ public void setToken(String thisToken)
+ {
+ selectedToken = thisToken;
+ }
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent evt) {
+
+ if (evt.getSource().equals(mCancel)) {
+ mIsOK = false;
+ this.hide();
+ }
+
+ if (evt.getSource().equals(mOK)) {
+
+ /* REPLACED BY PROACTIVE ENFORCEMENT
+ if (mNameField.getText().trim().equals("")) {
+ CMSAdminUtil.showMessageDialog(mParentFrame, mResource, mPrefix,
+ "NONAME", CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ if (mClassField.getText().trim().equals("")) {
+ CMSAdminUtil.showMessageDialog(mParentFrame, mResource, mPrefix,
+ "NOCLASS", CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ */
+
+ //save value
+ try {
+ addImpl();
+ } catch (EAdminException e) {
+ //display error dialog
+ Debug.println(e.toString());
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ e.toString(), CMSAdminUtil.ERROR_MESSAGE);
+ mIsOK = false;
+ return;
+ }
+ mIsOK = true;
+ this.hide();
+ }
+ }
+
+ //== DocumentListener ==
+ public void insertUpdate(DocumentEvent e) {
+ setButtons();
+ }
+
+ public void removeUpdate(DocumentEvent e){
+ setButtons();
+ }
+
+ public void changedUpdate(DocumentEvent e){
+ setButtons();
+ }
+
+ //==== MOUSELISTENER ======================
+ public void mouseClicked(MouseEvent e) {
+ setButtons();
+ }
+
+ public void mousePressed(MouseEvent e) {}
+ public void mouseReleased(MouseEvent e) {}
+ public void mouseEntered(MouseEvent e) {}
+ public void mouseExited(MouseEvent e) {
+ setButtons();
+ }
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+
+ protected void setDisplay() {
+ getContentPane().setLayout(new BorderLayout());
+ JPanel center = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ center.setLayout(gb);
+
+ //content panel
+ JPanel content = makeContentPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(content, gbc);
+ center.add(content);
+
+ //action panel
+ JPanel action = makeActionPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints(action, gbc);
+ center.add(action);
+
+ getContentPane().add("Center",center);
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+
+ //set arrow buttons
+ private void setButtons() {
+ if ( mNameField.getText().trim().equals("")) {
+ //||
+ //(mClassField.getText().trim().equals("")) ) {
+ mOK.setEnabled(false);
+ } else {
+ mOK.setEnabled(true);
+ }
+ }
+
+ private JPanel makeActionPane() {
+ mOK = CMSAdminUtil.makeJButton(mResource, mPrefix, "OK", null, this);
+ mOK.setEnabled(false);
+ mCancel = CMSAdminUtil.makeJButton(mResource, mPrefix, "CANCEL", null, this);
+ JButton[] buttons = { mOK, mCancel};
+ return CMSAdminUtil.makeJButtonPanel( buttons );
+ }
+
+ private JPanel makeContentPane() {
+ JPanel content = new JPanel();
+ GridBagLayout gb3 = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ content.setLayout(gb3);
+ //content.setBorder(CMSAdminUtil.makeEtchedBorder());
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label1 = CMSAdminUtil.makeJLabel(mResource, mPrefix, "NAME", null);
+ mNameField = new JTextField();
+ mNameField.getDocument().addDocumentListener(this);
+ mNameField.addMouseListener(this);
+ CMSAdminUtil.addEntryField(content, label1, mNameField, gbc);
+
+ //CMSAdminUtil.resetGBC(gbc);
+ // gbc.gridheight = gbc.REMAINDER;
+ //JLabel label2 = CMSAdminUtil.makeJLabel(mResource, mPrefix, "CLASS", null);
+ //mClassField = new JTextField();
+ //mClassField.getDocument().addDocumentListener(this);
+ //mClassField.addMouseListener(this);
+ //CMSAdminUtil.addEntryField(content, label2, mClassField, gbc);
+
+ //if (mType) {
+ // CMSAdminUtil.resetGBC(gbc);
+ // gbc.gridheight = gbc.REMAINDER;
+ // JLabel label3 = CMSAdminUtil.makeJLabel(mResource, mPrefix, "TYPE", null);
+ // mTypeField = new JTextField();
+ // mTypeField.getDocument().addDocumentListener(this);
+ // mTypeField.addMouseListener(this);
+ // CMSAdminUtil.addEntryField(content, label3, mTypeField, gbc);
+ //}
+
+ return content;
+ }
+
+ //=================================================
+ // CONNECT TO SERVER SIDE
+ //=================================================
+
+ //add new group information
+ private void addImpl() throws EAdminException {
+
+ //construct NVP
+ NameValuePairs config = new NameValuePairs();
+ config.put(Constants.PR_KEY_LIST, mNameField.getText());
+ config.put(Constants.PR_TOKEN_LIST, selectedToken);
+
+
+
+
+ //send request
+ mConnection.process(mDestination,
+ ScopeDef.SC_TKSKEYSLIST,
+ mNameField.getText().trim(),
+ config);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/ListCertsModel.java b/base/console/src/com/netscape/admin/certsrv/config/ListCertsModel.java
new file mode 100644
index 000000000..b239edfb9
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/ListCertsModel.java
@@ -0,0 +1,56 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Manage certificate data model - represents the instance
+ * table information
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ */
+public class ListCertsModel extends CMSTableModel
+{
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ public static final String COL1 = "CERTNICKNAMENAME";
+ public static final String COL2 = "SERIALNUMBER";
+ public static final String COL3 = "ISSUERNAME";
+ public static final String COL4 = "TOKENNAME";
+
+ private static String[] mColumns = {COL1, COL2, COL3, COL4};
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public ListCertsModel() {
+ super();
+ init(mColumns);
+ }
+
+ public boolean isCellEditable(int row, int col) {
+ return false;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/ListKeysModel.java b/base/console/src/com/netscape/admin/certsrv/config/ListKeysModel.java
new file mode 100644
index 000000000..78f033be5
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/ListKeysModel.java
@@ -0,0 +1,56 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Manage Keys data model - represents the instance
+ * table information
+ *
+ * @author Khai
+ * @version $Revision$, $Date$
+ */
+public class ListKeysModel extends CMSTableModel
+{
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ public static final String COL1 = "KEYNAME";
+ public static final String COL2 = "SERIALNUMBER";
+ public static final String COL3 = "ISSUERNAME";
+ public static final String COL4 = "TOKENNAME";
+
+ private static String[] mColumns = {COL1};
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public ListKeysModel() {
+ super();
+ init(mColumns);
+ }
+
+ public boolean isCellEditable(int row, int col) {
+ return false;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/LogConfigDialog.java b/base/console/src/com/netscape/admin/certsrv/config/LogConfigDialog.java
new file mode 100644
index 000000000..7f3833034
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/LogConfigDialog.java
@@ -0,0 +1,62 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import javax.swing.table.*;
+import javax.swing.text.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Log Parameter Configuration Dialog
+ *
+ * @author Michelle Zhao
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class LogConfigDialog extends CMSBaseConfigDialog
+ implements ActionListener
+{
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public LogConfigDialog(NameValuePairs nvp,
+ JFrame parent,
+ AdminConnection conn,
+ String dest) {
+
+ super(parent, dest);
+
+ PREFIX = "LOGCONFIGDIALOG";
+ mHelpToken = "configuration-overview";
+ mImplName_token = Constants.PR_LOG_IMPL_NAME;
+ mImplType = Constants.PR_EXT_PLUGIN_IMPLTYPE_LOG;
+
+ init(nvp,parent,conn,dest);
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/LogImplDataModel.java b/base/console/src/com/netscape/admin/certsrv/config/LogImplDataModel.java
new file mode 100644
index 000000000..a5af0b1dc
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/LogImplDataModel.java
@@ -0,0 +1,68 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Log Implementation Data model - represents the implementation
+ * table information
+ *
+ * @author Michelle Zhao
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class LogImplDataModel extends CMSContentTableModel
+ implements IDataProcessor
+{
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ public static final String IMPL_NAME = "NAME";
+ public static final String IMPL_CLASS = "CLASS";
+ public static final String IMPL_DESC = "DESC";
+
+ private static String[] mColumns = {LOG_IMPL, CLASSNAME};
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public LogImplDataModel() {
+ super();
+ init(mColumns);
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public void processData(Object data) {
+ Vector v = new Vector();
+ NameValuePairs obj = (NameValuePairs) data;
+ v.addElement(new JLabel(obj.get(IMPL_NAME),
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE_PLUGIN),
+ JLabel.LEFT));
+ v.addElement(obj.get(IMPL_CLASS));
+ //v.addElement(obj.getValue(IMPL_DESC));
+ addRow(v, data);
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/LogImplTab.java b/base/console/src/com/netscape/admin/certsrv/config/LogImplTab.java
new file mode 100644
index 000000000..1b654fead
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/LogImplTab.java
@@ -0,0 +1,315 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.ug.*;
+import javax.swing.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Log Plugins Management Tab
+ *
+ * @author Michelle Zhao
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class LogImplTab extends CMSBaseUGTab {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String IMPL_NAME = LogImplDataModel.IMPL_NAME;
+ private static final String IMPL_CLASS = LogImplDataModel.IMPL_CLASS;
+ private static final String IMPL_DESC = LogImplDataModel.IMPL_DESC;
+
+ private static final String PANEL_NAME = "LOGIMPL";
+ private static final String DIALOG_PREFIX = "LOGREGISTERDIALOG";
+
+ private AdminConnection mConnection;
+ private String mDestination;
+
+ protected JScrollPane mScrollPane;
+ protected JTable mTable; //table
+ protected LogImplDataModel mDataModel; //table model
+ protected LogRegisterDialog mEditor=null; //keep single copy
+ protected ViewDialog mViewer=null; //keep single copy
+
+ protected JButton mRefresh, mAdd, mDelete, mView, mHelp;
+ private final static String HELPINDEX = "configuration-log-plugin-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public LogImplTab(CMSBaseResourceModel model, String destination) {
+ super(PANEL_NAME, model);
+ mConnection = model.getServerInfo().getAdmin();
+ mDataModel = new LogImplDataModel();
+ mDestination = destination;
+ mHelpToken = HELPINDEX;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mRefresh)) {
+ refresh();
+ }
+ if (e.getSource().equals(mAdd)) {
+ if (mEditor==null)
+ mEditor = new LogRegisterDialog(mModel.getFrame(),
+ mConnection);
+ mEditor.showDialog(mDestination, ScopeDef.SC_LOG_IMPLS);
+ refresh();
+ }
+ if (e.getSource().equals(mDelete)) {
+ Debug.println("Delete");
+ if(mTable.getSelectedRow()< 0)
+ return;
+ int i = showConfirmDialog("DELETE");
+ if (i == JOptionPane.YES_OPTION) {
+ delete();
+ Debug.println("Deleted");
+ }
+ }
+ if (e.getSource().equals(mView)) {
+ Debug.println("View");
+ if(mTable.getSelectedRow()< 0)
+ return;
+ NameValuePairs obj = (NameValuePairs)
+ mDataModel.getObjectValueAt(mTable.getSelectedRow());
+ if (mViewer==null)
+ mViewer = new ViewDialog(mModel.getFrame());
+ mViewer.showDialog(obj.get(IMPL_NAME),
+ obj.get(IMPL_CLASS),
+ obj.get(IMPL_DESC));
+ }
+ if (e.getSource().equals(mHelp)) {
+ helpCallback();
+ }
+ }
+
+ //==== MOUSELISTENER ======================
+ public void mouseClicked(MouseEvent e) {
+ setButtons();
+ }
+
+ public void mouseReleased(MouseEvent e) {
+ setButtons();
+ }
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+ public void refresh() {
+
+ mDataModel.removeAllRows();
+ update();
+
+ setButtons();
+ mTable.invalidate();
+ mTable.validate();
+ mTable.repaint(1);
+ }
+
+ /**
+ * create the user action button panel
+ */
+ protected JPanel createButtonPanel() {
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mAdd = makeJButton("ADD");
+ mDelete = makeJButton("DELETE");
+ mView = makeJButton("VIEW");
+ JButton[] buttons = {mAdd, mDelete, mView};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonVPanel( buttons );
+ }
+
+ protected JPanel createActionPanel() {
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mRefresh = makeJButton("REFRESH");
+ mHelp = makeJButton("HELP");
+ //JButton[] buttons = { mRefresh, mHelp };
+ JButton[] buttons = { mRefresh };
+ return makeJButtonPanel(buttons, true);
+ }
+
+ protected JPanel createListPanel() {
+ mListPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mListPanel.setLayout(gb);
+
+ //center table
+ mTable = new JTable(mDataModel);
+ mScrollPane = JTable.createScrollPaneForTable(mTable);
+ //mScrollPane.setBorder(CMSAdminUtil.makeTitledBorder(mResource,PANEL_NAME,"USERS"));
+ mScrollPane.setHorizontalScrollBarPolicy(mScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mScrollPane.setVerticalScrollBarPolicy(mScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ mTable.setAutoscrolls(true);
+ mTable.sizeColumnsToFit(true);
+ mTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ mTable.getSelectionModel().addListSelectionListener(this);
+ mScrollPane.setBackground(Color.white);
+ mTable.addMouseListener(this);
+ setLabelCellRenderer(mTable,0);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = 1;
+ gbc.weightx = 1.0;
+ gbc.insets = EMPTY_INSETS;
+ gb.setConstraints(mScrollPane, gbc);
+ mListPanel.add(mScrollPane);
+
+ JPanel buttonPanel = createButtonPanel();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 0.0;
+ gbc.weighty = 1.0;
+ gbc.insets = EMPTY_INSETS;
+ gb.setConstraints(buttonPanel, gbc);
+ mListPanel.add(buttonPanel);
+
+ refresh();
+
+ return mListPanel;
+ }
+
+ //Set the first column's cellrender as label cell
+ protected void setLabelCellRenderer(JTable table, int index) {
+ table.getColumnModel().getColumn(index).setCellRenderer(new LabelCellRenderer(new JLabel()));
+ }
+
+
+ //set buttons
+ private void setButtons() {
+
+ //enable and diable buttons accordingly
+ //Debug.println("setButtons() - "+mTable.getSelectedRow());
+ //Debug.println("setButtons() - "+mTable.getSelectionModel().isSelectionEmpty());
+ if (mTable.getSelectionModel().isSelectionEmpty()) {
+ mDelete.setEnabled(false);
+ mView.setEnabled(false);
+ return;
+ }
+
+ if(mDataModel.getRowCount()<=0) {
+ mDelete.setEnabled(false);
+ mView.setEnabled(false);
+ return;
+ }
+
+ mDelete.setEnabled(true);
+ mView.setEnabled(true);
+
+ }
+
+ //=============================================
+ // SEND REQUESTS TO THE SERVER SIDE
+ //=============================================
+ private void update() {
+ //send request and parse data
+
+ mModel.progressStart();
+ NameValuePairs response;
+ try {
+ response = mConnection.search(mDestination,
+ "logImpls",
+ new NameValuePairs());
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ mModel.progressStop();
+ return;
+ }
+
+ Debug.println(response.toString());
+
+ //parse the data
+ int i=0;
+ String[] vals = new String[response.size()];
+ Hashtable<String, NameValuePairs> data = new Hashtable<String, NameValuePairs>();
+ for (String entry : response.keySet()) {
+ entry = entry.trim();
+ String value = response.get(entry);
+ int x = value.indexOf(",");
+ NameValuePairs obj = new NameValuePairs();
+ obj.put(IMPL_NAME, entry);
+ vals[i++]= entry ;
+ obj.put(IMPL_CLASS, value.substring(0, x));
+ obj.put(IMPL_DESC, value.substring(x + 1));
+ data.put(entry,obj);
+ }
+
+ CMSAdminUtil.bubbleSort(vals);
+
+ for (int y=0; y< vals.length ; y++) {
+ mDataModel.processData(data.get(vals[y]));
+ }
+
+ data.clear();
+
+ if (mDataModel.getRowCount() >0)
+ mTable.setRowSelectionInterval(0,0);
+
+ mModel.progressStop();
+ }
+
+ private void delete() {
+ //get entry name
+ mModel.progressStart();
+ NameValuePairs obj = (NameValuePairs)
+ mDataModel.getObjectValueAt(mTable.getSelectedRow());
+
+ //send comment to server for the removal of user
+ try {
+ mConnection.delete(mDestination,
+ ScopeDef.SC_LOG_IMPLS,
+ obj.get(IMPL_NAME));
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ mModel.progressStop();
+ return;
+ }
+ mModel.progressStop();
+ //send comment to server and refetch the content
+ refresh();
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/LogInstanceTab.java b/base/console/src/com/netscape/admin/certsrv/config/LogInstanceTab.java
new file mode 100644
index 000000000..99b86e5eb
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/LogInstanceTab.java
@@ -0,0 +1,95 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.ug.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Log Instances Management Tab
+ *
+ * @author Michelle Zhao
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class LogInstanceTab extends CMSPluginInstanceTab {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PANEL_NAME = "LOGRULE";
+
+ private final static String HELPINDEX = "configuration-loginstances-help";
+
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public LogInstanceTab(CMSBaseResourceModel model, String dest) {
+ super(model,dest,PANEL_NAME);
+ Debug.println("LogInstanceTab::LogInstanceTab(<model>,"+dest);
+ mConnection = model.getServerInfo().getAdmin();
+ mDataModel = new LogRuleDataModel();
+ mScope = ScopeDef.SC_LOG_RULES;
+ RULE_NAME = LogRuleDataModel.RULE_NAME;
+ RULE_IMPL = LogRuleDataModel.RULE_IMPL;
+ RULE_STAT = LogRuleDataModel.RULE_STAT;
+
+ mHelpToken = HELPINDEX;
+ }
+
+
+ public CMSBaseConfigDialog makeNewConfigDialog(
+ NameValuePairs nvp,
+ JFrame parent,
+ AdminConnection conn,
+ String dest
+ )
+ {
+
+ return new LogConfigDialog(nvp,
+ parent,
+ conn,
+ dest);
+ }
+
+ public PluginSelectionDialog getPluginSelectionDialog(
+ JFrame parent,
+ AdminConnection conn,
+ String dest,
+ CMSPluginInstanceTab pluginType
+ )
+ {
+ return new LogPluginSelectionDialog(parent,conn,dest,pluginType);
+ }
+
+
+}
+
+
+
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/LogPluginSelectionDialog.java b/base/console/src/com/netscape/admin/certsrv/config/LogPluginSelectionDialog.java
new file mode 100644
index 000000000..83c8ab2e8
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/LogPluginSelectionDialog.java
@@ -0,0 +1,69 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Log Plugin Selection Dialog
+ *
+ * @author Michelle Zhao
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class LogPluginSelectionDialog extends PluginSelectionDialog
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PREFIX = "LOGSELECTIONDIALOG";
+ private static final String HELPINDEX =
+ "configuration-add-logrule-dbox-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public LogPluginSelectionDialog(
+ JFrame parent,
+ AdminConnection conn,
+ String dest,
+ CMSPluginInstanceTab pluginType)
+ {
+ super(PREFIX, parent,conn, dest, pluginType);
+ mScope = ScopeDef.SC_LOG_IMPLS;
+ mInstanceScope = ScopeDef.SC_LOG_RULES;
+ mImageName = CMSAdminResources.IMAGE_RULE_PLUGIN;
+ mHelpToken = HELPINDEX;
+ setDisplay();
+ }
+
+ /*==========================================================
+ * EVENT HANDLER METHODS
+ *==========================================================*/
+
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/LogRegisterDialog.java b/base/console/src/com/netscape/admin/certsrv/config/LogRegisterDialog.java
new file mode 100644
index 000000000..2360c860a
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/LogRegisterDialog.java
@@ -0,0 +1,40 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+
+/**
+ * Log Implementation Registration Editor
+ *
+ * @author Michelle Zhao
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+
+public class LogRegisterDialog extends RegisterDialog {
+
+ private final static String PREFIX = "LOGREGISTERDIALOG";
+
+ public LogRegisterDialog(JFrame parent, AdminConnection conn) {
+ super(PREFIX, parent, conn);
+ setDisplay();
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/LogRuleDataModel.java b/base/console/src/com/netscape/admin/certsrv/config/LogRuleDataModel.java
new file mode 100644
index 000000000..1a64226f0
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/LogRuleDataModel.java
@@ -0,0 +1,62 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.Debug;
+
+
+/**
+ * Log instance Data model - represents the instance
+ * table information
+ *
+ * @author Michelle Zhao
+ * @version $Revision$, $Date$
+ */
+public class LogRuleDataModel extends CMSRuleDataModel
+{
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public LogRuleDataModel() {
+ super();
+ }
+
+ protected String[] getColumns() {
+ Debug.println("LogRuleDataModel.getColumns()");
+ String x[] = {LOG_RULE, PLUGIN};
+ return x;
+ }
+
+ public void processData(Object data) {
+ Vector v = new Vector();
+ NameValuePairs obj = (NameValuePairs) data;
+
+ v.addElement(new JLabel(obj.get(RULE_NAME),
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE),
+ JLabel.LEFT));
+ v.addElement(obj.get(RULE_IMPL));
+ addRow(v, data);
+ }
+
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/MNSchemeWizard.java b/base/console/src/com/netscape/admin/certsrv/config/MNSchemeWizard.java
new file mode 100644
index 000000000..cd10c5575
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/MNSchemeWizard.java
@@ -0,0 +1,64 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Wizard for reconfiguring the Recovery MN Scheme
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class MNSchemeWizard extends WizardWidget {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public MNSchemeWizard(JFrame parent, MNSchemeWizardInfo info) {
+ super(parent);
+ setWizardInfo(info);
+ //add page here
+ addPage(new WMNSelection());
+ addPage(new WMNOldAgent());
+ addPage(new WMNNewAgent());
+ addPage(new WMNResultPage());
+ show();
+ }
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+ protected void callHelp() {
+ if (mCurrent instanceof IWizardPanel) {
+ ((IWizardPanel)mCurrent).callHelp();
+ }
+ }
+
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/MNSchemeWizardInfo.java b/base/console/src/com/netscape/admin/certsrv/config/MNSchemeWizardInfo.java
new file mode 100644
index 000000000..8d90914b3
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/MNSchemeWizardInfo.java
@@ -0,0 +1,107 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * WizardInfo for reconfiguring the Recovery MN Scheme
+ * Once complete, we need to zap this object.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class MNSchemeWizardInfo extends WizardInfo {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private AdminConnection mConnection;
+ private int mM, mN;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public MNSchemeWizardInfo(AdminConnection conn, int m, int n) {
+ super();
+ mConnection = conn;
+ mM = m;
+ mN = n;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ //get m
+ public String getM() {
+ return Integer.toString(mM);
+ }
+
+ //get n
+ public String getN() {
+ return Integer.toString(mN);
+ }
+
+ public String getNewM() {
+ if(containsKey(Constants.PR_RECOVERY_M))
+ return (String) get(Constants.PR_RECOVERY_M);
+ return getM();
+ }
+
+ public String getNewN() {
+ if(containsKey(Constants.PR_RECOVERY_N))
+ return (String) get(Constants.PR_RECOVERY_N);
+ return getN();
+ }
+
+
+ //add information into info
+ public void add(String name, String value) {
+ put(name,value);
+ }
+
+ /**
+ * Clean up the data struture stored within this container
+ */
+ public void cleanup() {
+ clear();
+ }
+
+ /**
+ * Perform Operation
+ */
+ public void changeScheme() throws EAdminException {
+
+ NameValuePairs param = new NameValuePairs();
+ param.put(Constants.PR_RECOVERY_M, (String) get(Constants.PR_RECOVERY_M));
+ param.put(Constants.PR_RECOVERY_N, (String) get(Constants.PR_RECOVERY_N));
+ param.put(Constants.PR_RECOVERY_AGENT, (String) get(Constants.PR_RECOVERY_AGENT));
+ param.put(Constants.PR_OLD_RECOVERY_AGENT, (String) get(Constants.PR_OLD_RECOVERY_AGENT));
+
+ mConnection.modify(DestDef.DEST_KRA_ADMIN,
+ ScopeDef.SC_MNSCHEME,
+ Constants.RS_ID_CONFIG,
+ param);
+
+ //param.clear();
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/MapperConfigDialog.java b/base/console/src/com/netscape/admin/certsrv/config/MapperConfigDialog.java
new file mode 100644
index 000000000..119823d58
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/MapperConfigDialog.java
@@ -0,0 +1,64 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import javax.swing.table.*;
+import javax.swing.text.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Mapper Parameter Configuration Dialog
+ *
+ * @author Steve Parkinson
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class MapperConfigDialog extends CMSBaseConfigDialog
+ implements ActionListener
+{
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public MapperConfigDialog(NameValuePairs nvp,
+ JFrame parent,
+ AdminConnection conn,
+ String dest) {
+
+ super(parent, dest);
+
+ PREFIX = "MAPPERCONFIGDIALOG";
+ RAHELPINDEX = "configuration-ra-edit-mapperrule-dbox-help";
+ KRAHELPINDEX = "configuration-kra-edit-mapperrule-dbox-help";
+ CAHELPINDEX = "configuration-ca-edit-mapperrule-dbox-help";
+ mImplName_token = Constants.PR_MAPPER_IMPL_NAME;
+ mImplType = Constants.PR_EXT_PLUGIN_IMPLTYPE_MAPPER;
+
+ init(nvp,parent,conn,dest);
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/MapperImplDataModel.java b/base/console/src/com/netscape/admin/certsrv/config/MapperImplDataModel.java
new file mode 100644
index 000000000..23d6ee0b4
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/MapperImplDataModel.java
@@ -0,0 +1,68 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Mapper Implementation Data model - represents the implementation
+ * table information
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class MapperImplDataModel extends CMSContentTableModel
+ implements IDataProcessor
+{
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ public static final String IMPL_NAME = "NAME";
+ public static final String IMPL_CLASS = "CLASS";
+ public static final String IMPL_DESC = "DESC";
+
+ private static String[] mColumns = {MAPPER_IMPL, CLASSNAME};
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public MapperImplDataModel() {
+ super();
+ init(mColumns);
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public void processData(Object data) {
+ Vector v = new Vector();
+ NameValuePairs obj = (NameValuePairs) data;
+ v.addElement(new JLabel(obj.get(IMPL_NAME),
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE_PLUGIN),
+ JLabel.LEFT));
+ v.addElement(obj.get(IMPL_CLASS));
+ //v.addElement(obj.getValue(IMPL_DESC));
+ addRow(v, data);
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/MapperImplTab.java b/base/console/src/com/netscape/admin/certsrv/config/MapperImplTab.java
new file mode 100644
index 000000000..2ad54da60
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/MapperImplTab.java
@@ -0,0 +1,320 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.ug.*;
+import javax.swing.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Mapper Instances Management Tab
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class MapperImplTab extends CMSBaseUGTab {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String IMPL_NAME = MapperImplDataModel.IMPL_NAME;
+ private static final String IMPL_CLASS = MapperImplDataModel.IMPL_CLASS;
+ private static final String IMPL_DESC = MapperImplDataModel.IMPL_DESC;
+
+ private static final String PANEL_NAME = "MAPPERIMPL";
+ private static final String DIALOG_PREFIX = "MAPPERREGISTERDIALOG";
+
+ private AdminConnection mConnection;
+ private String mDestination;
+
+ protected JScrollPane mScrollPane;
+ protected JTable mTable; //table
+ protected MapperImplDataModel mDataModel; //table model
+ protected MapperRegisterDialog mEditor=null; //keep single copy
+ protected ViewDialog mViewer=null; //keep single copy
+
+ protected JButton mRefresh, mAdd, mDelete, mView, mHelp;
+ private final static String RAHELPINDEX = "configuration-ra-mapperplugin-help";
+ private final static String CAHELPINDEX = "configuration-ca-mapperplugin-help";
+ private final static String KRAHELPINDEX = "configuration-kra-mapperplugin-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public MapperImplTab(CMSBaseResourceModel model, String destination) {
+ super(PANEL_NAME, model);
+ mConnection = model.getServerInfo().getAdmin();
+ mDataModel = new MapperImplDataModel();
+ mDestination = destination;
+ if (mDestination.equals(DestDef.DEST_RA_MAPPER_ADMIN))
+ mHelpToken = RAHELPINDEX;
+ else
+ mHelpToken = CAHELPINDEX;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mRefresh)) {
+ refresh();
+ }
+ if (e.getSource().equals(mAdd)) {
+ if (mEditor==null)
+ mEditor = new MapperRegisterDialog(mModel.getFrame(),
+ mConnection);
+ mEditor.showDialog(mDestination, ScopeDef.SC_MAPPER_IMPLS);
+ refresh();
+ }
+ if (e.getSource().equals(mDelete)) {
+ Debug.println("Delete");
+ if(mTable.getSelectedRow()< 0)
+ return;
+ int i = showConfirmDialog("DELETE");
+ if (i == JOptionPane.YES_OPTION) {
+ delete();
+ Debug.println("Deleted");
+ }
+ }
+ if (e.getSource().equals(mView)) {
+ Debug.println("View");
+ if(mTable.getSelectedRow()< 0)
+ return;
+ NameValuePairs obj = (NameValuePairs)
+ mDataModel.getObjectValueAt(mTable.getSelectedRow());
+ if (mViewer==null)
+ mViewer = new ViewDialog(mModel.getFrame());
+ mViewer.showDialog(obj.get(IMPL_NAME),
+ obj.get(IMPL_CLASS),
+ obj.get(IMPL_DESC));
+ }
+ if (e.getSource().equals(mHelp)) {
+ helpCallback();
+ }
+ }
+
+ //==== MOUSELISTENER ======================
+ public void mouseClicked(MouseEvent e) {
+ setButtons();
+ }
+
+ public void mouseReleased(MouseEvent e) {
+ setButtons();
+ }
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+ public void refresh() {
+
+ mDataModel.removeAllRows();
+ update();
+
+ setButtons();
+ mTable.invalidate();
+ mTable.validate();
+ mTable.repaint(1);
+ }
+
+ /**
+ * create the user action button panel
+ */
+ protected JPanel createButtonPanel() {
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mAdd = makeJButton("ADD");
+ mDelete = makeJButton("DELETE");
+ mView = makeJButton("VIEW");
+ JButton[] buttons = {mAdd, mDelete, mView};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonVPanel( buttons );
+ }
+
+ protected JPanel createActionPanel() {
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mRefresh = makeJButton("REFRESH");
+ mHelp = makeJButton("HELP");
+ // JButton[] buttons = { mRefresh, mHelp };
+ JButton[] buttons = { mRefresh };
+ return makeJButtonPanel(buttons, true);
+ }
+
+ protected JPanel createListPanel() {
+ mListPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mListPanel.setLayout(gb);
+
+ //center table
+ mTable = new JTable(mDataModel);
+ mScrollPane = JTable.createScrollPaneForTable(mTable);
+ //mScrollPane.setBorder(CMSAdminUtil.makeTitledBorder(mResource,PANEL_NAME,"USERS"));
+ mScrollPane.setHorizontalScrollBarPolicy(mScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mScrollPane.setVerticalScrollBarPolicy(mScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ mTable.setAutoscrolls(true);
+ mTable.sizeColumnsToFit(true);
+ mTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ mTable.getSelectionModel().addListSelectionListener(this);
+ mScrollPane.setBackground(Color.white);
+ mTable.addMouseListener(this);
+ setLabelCellRenderer(mTable,0);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = 1;
+ gbc.weightx = 1.0;
+ gbc.insets = EMPTY_INSETS;
+ gb.setConstraints(mScrollPane, gbc);
+ mListPanel.add(mScrollPane);
+
+ JPanel buttonPanel = createButtonPanel();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 0.0;
+ gbc.weighty = 1.0;
+ gbc.insets = EMPTY_INSETS;
+ gb.setConstraints(buttonPanel, gbc);
+ mListPanel.add(buttonPanel);
+
+ refresh();
+
+ return mListPanel;
+ }
+
+ //Set the first column's cellrender as label cell
+ protected void setLabelCellRenderer(JTable table, int index) {
+ table.getColumnModel().getColumn(index).setCellRenderer(new LabelCellRenderer(new JLabel()));
+ }
+
+
+ //set buttons
+ private void setButtons() {
+
+ //enable and diable buttons accordingly
+ //Debug.println("setButtons() - "+mTable.getSelectedRow());
+ //Debug.println("setButtons() - "+mTable.getSelectionModel().isSelectionEmpty());
+ if (mTable.getSelectionModel().isSelectionEmpty()) {
+ mDelete.setEnabled(false);
+ mView.setEnabled(false);
+ return;
+ }
+
+ if(mDataModel.getRowCount()<=0) {
+ mDelete.setEnabled(false);
+ mView.setEnabled(false);
+ return;
+ }
+
+ mDelete.setEnabled(true);
+ mView.setEnabled(true);
+
+ }
+
+ //=============================================
+ // SEND REQUESTS TO THE SERVER SIDE
+ //=============================================
+ private void update() {
+ //send request and parse data
+
+ mModel.progressStart();
+ NameValuePairs response;
+ try {
+ response = mConnection.search(mDestination,
+ ScopeDef.SC_MAPPER_IMPLS,
+ new NameValuePairs());
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ mModel.progressStop();
+ return;
+ }
+
+ Debug.println(response.toString());
+
+ //parse the data
+ int i=0;
+ String[] vals = new String[response.size()];
+ Hashtable<String, NameValuePairs> data = new Hashtable<String, NameValuePairs>();
+ for (String entry : response.keySet()) {
+ entry = entry.trim();
+ String value = response.get(entry);
+ int x = value.indexOf(",");
+ NameValuePairs obj = new NameValuePairs();
+ obj.put(IMPL_NAME, entry);
+ vals[i++]= entry ;
+ obj.put(IMPL_CLASS, value.substring(0, x));
+ obj.put(IMPL_DESC, value.substring(x + 1));
+ data.put(entry,obj);
+ }
+
+ CMSAdminUtil.bubbleSort(vals);
+
+ for (int y=0; y< vals.length ; y++) {
+ mDataModel.processData(data.get(vals[y]));
+ }
+
+ data.clear();
+
+ if (mDataModel.getRowCount() >0)
+ mTable.setRowSelectionInterval(0,0);
+
+ mModel.progressStop();
+ }
+
+ private void delete() {
+ //get entry name
+ mModel.progressStart();
+ NameValuePairs obj = (NameValuePairs)
+ mDataModel.getObjectValueAt(mTable.getSelectedRow());
+
+ //send comment to server for the removal of user
+ try {
+ mConnection.delete(mDestination,
+ ScopeDef.SC_MAPPER_IMPLS,
+ obj.get(IMPL_NAME));
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ mModel.progressStop();
+ return;
+ }
+ mModel.progressStop();
+ //send comment to server and refetch the content
+ refresh();
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/MapperInstanceTab.java b/base/console/src/com/netscape/admin/certsrv/config/MapperInstanceTab.java
new file mode 100644
index 000000000..a531ecf30
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/MapperInstanceTab.java
@@ -0,0 +1,95 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.ug.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Mapper Instances Management Tab
+ *
+ * @author Steve Parkinson
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class MapperInstanceTab extends CMSPluginInstanceTab {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PANEL_NAME = "MAPPERRULE";
+
+ private final static String RAHELPINDEX = "configuration-ra-mapperinstances-help";
+ private final static String CAHELPINDEX = "configuration-ca-mapperinstances-help";
+ private final static String KRAHELPINDEX = "configuration-kra-mapperinstances-help";
+
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public MapperInstanceTab(CMSBaseResourceModel model, String dest) {
+ super(model,dest,PANEL_NAME);
+ Debug.println("MapperInstanceTab::MapperInstanceTab(<model>,"+dest);
+ mConnection = model.getServerInfo().getAdmin();
+ mDataModel = new MapperRuleDataModel();
+ mScope = ScopeDef.SC_MAPPER_RULES;
+ RULE_NAME = MapperRuleDataModel.RULE_NAME;
+ RULE_STAT = MapperRuleDataModel.RULE_STAT;
+
+ if (mDestination.equals(DestDef.DEST_RA_MAPPER_ADMIN))
+ mHelpToken = RAHELPINDEX;
+ else
+ mHelpToken = CAHELPINDEX;
+ }
+
+
+ public CMSBaseConfigDialog makeNewConfigDialog(
+ NameValuePairs nvp,
+ JFrame parent,
+ AdminConnection conn,
+ String dest
+ )
+ {
+
+ return new MapperConfigDialog(nvp,
+ parent,
+ conn,
+ dest);
+ }
+
+ public PluginSelectionDialog getPluginSelectionDialog(
+ JFrame parent,
+ AdminConnection conn,
+ String dest,
+ CMSPluginInstanceTab pluginType
+ )
+ {
+ return new MapperPluginSelectionDialog(parent,conn,dest,pluginType);
+ }
+
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/MapperPluginSelectionDialog.java b/base/console/src/com/netscape/admin/certsrv/config/MapperPluginSelectionDialog.java
new file mode 100644
index 000000000..ce0e10e9a
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/MapperPluginSelectionDialog.java
@@ -0,0 +1,74 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Mapper Plugin Selection Dialog
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class MapperPluginSelectionDialog extends PluginSelectionDialog
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PREFIX = "MAPPERSELECTIONDIALOG";
+ private static final String CAHELPINDEX =
+ "configuration-ca-add-mapperrule-dbox-help";
+ private static final String RAHELPINDEX =
+ "configuration-ra-add-mapperrule-dbox-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public MapperPluginSelectionDialog(
+ JFrame parent,
+ AdminConnection conn,
+ String dest,
+ CMSPluginInstanceTab pluginType)
+ {
+ super(PREFIX, parent,conn, dest, pluginType);
+ mScope = ScopeDef.SC_MAPPER_IMPLS;
+ mInstanceScope = ScopeDef.SC_MAPPER_RULES;
+ mImageName = CMSAdminResources.IMAGE_RULE_PLUGIN;
+ if (dest.equals(DestDef.DEST_RA_MAPPER_ADMIN))
+ mHelpToken = RAHELPINDEX;
+ else
+ mHelpToken = CAHELPINDEX;
+ setDisplay();
+ }
+
+ /*==========================================================
+ * EVENT HANDLER METHODS
+ *==========================================================*/
+
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/MapperRegisterDialog.java b/base/console/src/com/netscape/admin/certsrv/config/MapperRegisterDialog.java
new file mode 100644
index 000000000..3f6be3234
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/MapperRegisterDialog.java
@@ -0,0 +1,40 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+
+/**
+ * Mapper Implementation Registration Editor
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+
+public class MapperRegisterDialog extends RegisterDialog {
+
+ private final static String PREFIX = "MAPPERREGISTERDIALOG";
+
+ public MapperRegisterDialog(JFrame parent, AdminConnection conn) {
+ super(PREFIX, parent, conn);
+ setDisplay();
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/MapperRuleDataModel.java b/base/console/src/com/netscape/admin/certsrv/config/MapperRuleDataModel.java
new file mode 100644
index 000000000..a72b59f7c
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/MapperRuleDataModel.java
@@ -0,0 +1,62 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.Debug;
+
+
+/**
+ * Mapper instance Data model - represents the instance
+ * table information
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public class MapperRuleDataModel extends CMSRuleDataModel
+{
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public MapperRuleDataModel() {
+ super();
+ }
+
+ protected String[] getColumns() {
+ Debug.println("MapperRuleDataModel.getColumns()");
+ String x[] = {MAPPER_RULE, PLUGIN};
+ return x;
+ }
+
+ public void processData(Object data) {
+ Vector v = new Vector();
+ NameValuePairs obj = (NameValuePairs) data;
+
+ v.addElement(new JLabel(obj.get(RULE_NAME),
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE),
+ JLabel.LEFT));
+ v.addElement(obj.get(RULE_IMPL));
+ addRow(v, data);
+ }
+
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/OCSPStoresConfigDialog.java b/base/console/src/com/netscape/admin/certsrv/config/OCSPStoresConfigDialog.java
new file mode 100644
index 000000000..87097ddc0
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/OCSPStoresConfigDialog.java
@@ -0,0 +1,60 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import javax.swing.table.*;
+import javax.swing.text.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * CRL Extensions Parameter Configuration Dialog
+ *
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class OCSPStoresConfigDialog extends CMSBaseConfigDialog
+ implements ActionListener
+{
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public OCSPStoresConfigDialog(NameValuePairs nvp,
+ JFrame parent,
+ AdminConnection conn,
+ String dest) {
+
+ super(parent, dest);
+ PREFIX = "OCSPSTORECONFIGDIALOG";
+ CAHELPINDEX = "configuration-ocsp-edit-crlextensionrule-dbox-help";
+
+ mImplName_token = Constants.PR_OCSPSTORE_IMPL_NAME;
+ mImplType = Constants.PR_EXT_PLUGIN_IMPLTYPE_OCSPSTORESRULE;
+
+ init(nvp,parent,conn,dest);
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/OCSPStoresInstanceTab.java b/base/console/src/com/netscape/admin/certsrv/config/OCSPStoresInstanceTab.java
new file mode 100644
index 000000000..ff234c7fd
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/OCSPStoresInstanceTab.java
@@ -0,0 +1,132 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+
+import javax.swing.*;
+import java.awt.event.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+
+/**
+ * CRL Extensions - Instances Management Tab
+ *
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+
+public class OCSPStoresInstanceTab extends CMSPluginInstanceTab {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PANEL_NAME = "OCSPSTORESRULE";
+
+ private final static String OCSPHELPINDEX = "configuration-ocsp-storeinstances-help";
+
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public OCSPStoresInstanceTab(CMSBaseResourceModel model, String dest) {
+ super(model,dest,PANEL_NAME);
+ Debug.println("OCSPStoresInstanceTab::OCSPStoresInstanceTab(<model>,"+dest);
+ mConnection = model.getServerInfo().getAdmin();
+ mDataModel = new OCSPStoresRuleDataModel();
+ mScope = ScopeDef.SC_OCSPSTORES_RULES;
+ RULE_NAME = OCSPStoresRuleDataModel.RULE_NAME;
+ RULE_IMPL = OCSPStoresRuleDataModel.RULE_IMPL;
+ RULE_STAT = OCSPStoresRuleDataModel.RULE_STAT;
+ mHelpToken = OCSPHELPINDEX;
+ }
+
+
+ public CMSBaseConfigDialog makeNewConfigDialog(
+ NameValuePairs nvp,
+ JFrame parent,
+ AdminConnection conn,
+ String dest)
+ {
+ return new OCSPStoresConfigDialog(nvp, parent, conn, dest);
+ }
+
+ public PluginSelectionDialog getPluginSelectionDialog(
+ JFrame parent,
+ AdminConnection conn,
+ String dest,
+ CMSPluginInstanceTab pluginType)
+ {
+ return new OCSPStoresPluginSelectionDialog(parent, conn, dest, pluginType);
+ }
+
+
+ /**
+ * create the user action button panel
+ */
+ protected JPanel createUserButtonPanel() {
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mAdd = makeJButton("DEFAULT");
+ mDelete = makeJButton("DELETE");
+ mAdd.setEnabled(true);
+ mDelete.setEnabled(false);
+ mEdit = makeJButton("EDIT");
+ JButton[] buttons = {mAdd, mEdit};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonVPanel( buttons );
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mAdd)) {
+ setDefault();
+ } else {
+ super.actionPerformed(e);
+ }
+ }
+
+ private void setDefault() {
+
+ mModel.progressStart();
+ //get entry name
+ NameValuePairs data = (NameValuePairs)
+ mDataModel.getObjectValueAt(mTable.getSelectedRow());
+ NameValuePairs nvps = new NameValuePairs();
+
+ //send comment to server for the removal of user
+ try {
+ mConnection.modify(DestDef.DEST_OCSP_ADMIN,
+ ScopeDef.SC_OCSPSTORE_DEFAULT,
+ data.get(RULE_NAME), nvps);
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ mModel.progressStop();
+ return;
+ }
+
+ mModel.progressStop();
+ //send comment to server and refetch the content
+ refresh();
+
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/OCSPStoresPluginSelectionDialog.java b/base/console/src/com/netscape/admin/certsrv/config/OCSPStoresPluginSelectionDialog.java
new file mode 100644
index 000000000..32365c27c
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/OCSPStoresPluginSelectionDialog.java
@@ -0,0 +1,67 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * CRL Extensions Plugin Selection Dialog
+ *
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class OCSPStoresPluginSelectionDialog extends PluginSelectionDialog
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PREFIX = "OCSPSTORESELECTIONDIALOG";
+ private static final String OCSPHELPINDEX =
+ "configuration-ocsp-add-crlextensionrule-dbox-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public OCSPStoresPluginSelectionDialog(
+ JFrame parent,
+ AdminConnection conn,
+ String dest,
+ CMSPluginInstanceTab pluginType)
+ {
+ super(PREFIX, parent,conn, dest, pluginType);
+// mScope = ScopeDef.SC_RULE_IMPLS;
+ mInstanceScope = ScopeDef.SC_OCSPSTORES_RULES;
+ mImageName = CMSAdminResources.IMAGE_RULE_PLUGIN;
+ mHelpToken = OCSPHELPINDEX;
+ setDisplay();
+ }
+
+ /*==========================================================
+ * EVENT HANDLER METHODS
+ *==========================================================*/
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/OCSPStoresRuleDataModel.java b/base/console/src/com/netscape/admin/certsrv/config/OCSPStoresRuleDataModel.java
new file mode 100644
index 000000000..5cd67e276
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/OCSPStoresRuleDataModel.java
@@ -0,0 +1,69 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.Debug;
+
+
+/**
+ * CRL Extensions instance Data model - represents the instance
+ * table information
+ *
+ * @version $Revision$, $Date$
+ */
+
+public class OCSPStoresRuleDataModel extends CMSRuleDataModel
+{
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public OCSPStoresRuleDataModel() {
+ super();
+ }
+
+ protected String[] getColumns() {
+ Debug.println("PolicyRuleDataModel.getColumns()");
+ String x[] = {OCSPSTORES_RULE, STATUS};
+ return x;
+ }
+
+ public void processData(Object data) {
+ Vector v = new Vector();
+ NameValuePairs obj = (NameValuePairs) data;
+
+ if (obj.get(RULE_STAT).equalsIgnoreCase("enabled")) {
+ v.addElement(new JLabel(obj.get(RULE_NAME),
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE),
+ JLabel.LEFT));
+ v.addElement(mResource.getString("OCSPSTORESRULE_LABEL_ENABLED_LABEL"));
+ } else {
+ v.addElement(new JLabel(obj.get(RULE_NAME),
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE_DISABLE),
+ JLabel.LEFT));
+ v.addElement(mResource.getString("OCSPSTORESRULE_LABEL_DISABLED_LABEL"));
+ }
+ addRow(v, data);
+ mRules.addElement(obj.get(RULE_NAME));
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/PanelMapperConfigDialog.java b/base/console/src/com/netscape/admin/certsrv/config/PanelMapperConfigDialog.java
new file mode 100644
index 000000000..5de06c7f9
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/PanelMapperConfigDialog.java
@@ -0,0 +1,409 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import javax.swing.table.*;
+import javax.swing.text.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * LDAP Mapper Parameter Configuration Dialog
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class PanelMapperConfigDialog extends JDialog
+ implements ActionListener, ItemListener
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private String PREFIX = "MAPPERCONFIGDIALOG";
+
+ private JFrame mParentFrame;
+ private ResourceBundle mResource;
+ protected ConfigTableModel mDataModel;
+ protected boolean mIsOK = false;
+ protected NameValuePairs mData;
+ private JScrollPane mScrollPane;
+ private JTable mTable;
+ private String mRuleName;
+ private String mDest;
+ private String mScope; //SC_USERCERT or SC_CACERT
+ private AdminConnection mConn;
+ private JButton mOK, mCancel, mHelp;
+ private JComboBox mSelection;
+
+ private static final String CAHELPINDEX =
+ "configuration-ldappublish-camapper-dbox-help";
+ private static final String RAHELPINDEX =
+ "configuration-ldappublish-ramapper-dbox-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public PanelMapperConfigDialog(JFrame parent, AdminConnection conn) {
+ super(parent,true);
+ mConn = conn;
+ mParentFrame = parent;
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ mDataModel = new ConfigTableModel();
+ setSize(360, 216);
+ setTitle(mResource.getString(PREFIX+"_TITLE"));
+ setLocationRelativeTo(parent);
+ getRootPane().setDoubleBuffered(true);
+ setDisplay();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * show the windows
+ * @param users list of current groups
+ */
+ public void showDialog(String name, String destination, String scope) {
+ mIsOK = false;
+
+ mDataModel.removeAllRows();
+ mData = new NameValuePairs();
+ mRuleName = name;
+ mDest = destination;
+ mScope = scope;
+ Debug.println("MapperConfigDialog: showDialog() - mapper: "+
+ mRuleName+" dest: "+mDest+" scope: "+mScope);
+
+ if (!refresh(name))
+ return;
+
+ this.show();
+ }
+
+ public boolean isOK() {
+ return mIsOK;
+ }
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent evt) {
+
+ if (evt.getSource().equals(mOK)) {
+
+ //save any current edit component
+ Component component = mTable.getEditorComponent();
+ if (component!= null) {
+ int col = mTable.getEditingColumn();
+ int row = mTable.getEditingRow();
+ if ((col>-1)&&(row>-1)) {
+ String str = ((JTextComponent)component).getText();
+ mTable.setValueAt(str, row, col);
+ }
+ }
+
+ try {
+ saveConfiguration();
+ } catch (EAdminException e) {
+ //display error dialog
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ e.toString(), CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+
+ mIsOK = true;
+ this.dispose();
+ }
+
+ if (evt.getSource().equals(mCancel)) {
+ this.dispose();
+ }
+ if (evt.getSource().equals(mHelp)) {
+ if (mDest.equals(DestDef.DEST_CA_ADMIN))
+ CMSAdminUtil.help(CAHELPINDEX);
+ else if (mDest.equals(DestDef.DEST_RA_ADMIN))
+ CMSAdminUtil.help(RAHELPINDEX);
+ }
+ }
+
+ //== ItemListener ==
+ public void itemStateChanged(ItemEvent e){
+ if (e.getSource().equals(mSelection)) {
+ if (e.getStateChange() == e.SELECTED) {
+ //take care of current editing
+ mTable.getColumnModel().getColumn(1).
+ getCellEditor().stopCellEditing();
+ Debug.println("Selected: "+ (String) mSelection.getSelectedItem());
+ setupConfigUI((String) mSelection.getSelectedItem());
+ }
+ }
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+
+ private void saveEdit() {
+
+ //save any current edit component
+ Component component = mTable.getEditorComponent();
+
+ }
+
+ //setup and refresh the UI components
+ private boolean refresh(String mapperName) {
+
+ //get mapper listing
+ if (!getMapperListing(mapperName))
+ return false;
+
+ //setup UI
+ if (! setupConfigUI(mapperName))
+ return false;
+
+ return true;
+ }
+
+ //retrieve the mapper class listing and update
+ //the selection UI
+ private boolean getMapperListing(String mapperName) {
+ NameValuePairs response;
+
+ try {
+ response = getMapperList();
+ }catch (EAdminException e) {
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ e.toString(), CMSAdminUtil.ERROR_MESSAGE);
+ return false;
+ }
+
+ Debug.println("MapperList: "+response.toString());
+ mSelection.removeAllItems();
+
+ for (String name : response.keySet()) {
+ mSelection.addItem(name.trim());
+ }
+
+ mSelection.setSelectedItem(mapperName);
+ return true;
+ }
+
+ //retrieve the config parameters for the mapper
+ //and update the config UI
+ private boolean setupConfigUI(String mapperName) {
+
+ try {
+ mData = getConfiguration(mapperName);
+ }catch (EAdminException e) {
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ e.toString(), CMSAdminUtil.ERROR_MESSAGE);
+ return false;
+ }
+ Debug.println("MapperConfigDialog: showDialog() config: "+mData.toString());
+
+ mDataModel.removeAllRows();
+
+ for (String entry : mData.keySet()) {
+ entry = entry.trim();
+ if (!entry.equals(Constants.PR_MAPPER)) {
+ String value = mData.get(entry);
+ Vector<String> v = new Vector<String>();
+ v.addElement(entry);
+ v.addElement(value);
+ mDataModel.addRow(v);
+ }
+ }
+ mScrollPane.repaint();
+ mTable.repaint();
+ return true;
+ }
+
+ private void setDisplay() {
+ getContentPane().setLayout(new BorderLayout());
+ JPanel center = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ center.setLayout(gb);
+
+ //content panel
+ JPanel content = makeContentPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(content, gbc);
+ center.add(content);
+
+ //action panel
+ JPanel action = makeActionPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints(action, gbc);
+ center.add(action);
+
+ getContentPane().add("Center",center);
+ }
+
+ //create botton action panel
+ private JPanel makeActionPane() {
+ mOK = CMSAdminUtil.makeJButton(mResource, PREFIX, "OK", null, this);
+ mCancel = CMSAdminUtil.makeJButton(mResource, PREFIX, "CANCEL", null, this);
+ mHelp = CMSAdminUtil.makeJButton(mResource, PREFIX, "HELP", null, this);
+ //JButton[] buttons = { mOK, mCancel, mHelp};
+ JButton[] buttons = { mOK, mCancel};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonPanel( buttons, true);
+ }
+
+ private JPanel makeContentPane() {
+ JPanel mListPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mListPanel.setLayout(gb);
+ //content.setBorder(CMSAdminUtil.makeEtchedBorder());
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label3 = CMSAdminUtil.makeJLabel(mResource, PREFIX, "IMPLNAME", null);
+ mSelection = new JComboBox();
+ mSelection.addItemListener(this);
+ addEntryField(mListPanel, label3, mSelection, gbc);
+
+ //left side certificate table
+ mTable = new JTable(mDataModel);
+ mScrollPane = JTable.createScrollPaneForTable(mTable);
+ //mScrollPane.setBorder(CMSAdminUtil.makeTitledBorder(mResource,PANEL_NAME,"USERS"));
+ mScrollPane.setHorizontalScrollBarPolicy(mScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mScrollPane.setVerticalScrollBarPolicy(mScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ mTable.setAutoscrolls(true);
+ mTable.sizeColumnsToFit(true);
+ mTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
+ //mTable.getSelectionModel().addListSelectionListener(this);
+ mScrollPane.setBackground(Color.white);
+ //setLabelCellRenderer(mTable,1);
+ setCellEditor(mTable,1);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(CMSAdminUtil.DIFFERENT_COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,
+ 0,CMSAdminUtil.COMPONENT_SPACE);
+ gb.setConstraints(mScrollPane, gbc);
+ mListPanel.add(mScrollPane);
+
+ return mListPanel;
+ }
+
+ //Set the index column's cellrender as label cell
+ private void setLabelCellRenderer(JTable table, int index) {
+ table.getColumnModel().getColumn(index).setCellRenderer(
+ new DefaultTableCellRenderer());
+ }
+
+ //set the index column's cell editor
+ private void setCellEditor(JTable table, int index) {
+ table.getColumnModel().getColumn(index).setCellEditor(
+ new DefaultCellEditor(new JTextField()));
+ }
+
+ //retrieve the mapper listing from the server side
+ private NameValuePairs getMapperList()
+ throws EAdminException
+ {
+ return mConn.search(mDest, getMapperScope(),
+ new NameValuePairs());
+ }
+
+ //retrieve the configuration parameters for specific
+ //mapper class
+ private NameValuePairs getConfiguration(String mapper)
+ throws EAdminException
+ {
+ return mConn.read(mDest, getMapperScope(),
+ mapper, new NameValuePairs());
+ }
+
+ //get the mapper scope
+ private String getMapperScope() {
+
+ if (mScope.equals(ScopeDef.SC_CACERT))
+ return ScopeDef.SC_CAMAPPER;
+ else
+ return ScopeDef.SC_USERMAPPER;
+ }
+
+ //save the configuration settings for the mapper
+ private void saveConfiguration() throws EAdminException {
+ NameValuePairs nvp = getData();
+ nvp.put(Constants.PR_MAPPER, (String) mSelection.getSelectedItem());
+ mConn.modify(mDest, mScope, Constants.RS_ID_CONFIG, nvp);
+ }
+
+ private NameValuePairs getData() {
+ NameValuePairs response = new NameValuePairs();
+ for (int i=0; i< mDataModel.getRowCount(); i++) {
+ response.put((String) mDataModel.getValueAt(i, 0),
+ (String) mDataModel.getValueAt(i, 1));
+ }
+ return response;
+ }
+
+ /**
+ * Add a label and a textfield to a panel, assumed to be using
+ * GridBagLayout.
+ */
+ private static void addEntryField(JPanel panel, JComponent label,
+ JComponent field, GridBagConstraints gbc) {
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.gridx = 0;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ panel.add( label, gbc );
+
+ gbc.gridx++;
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,
+ 0,CMSAdminUtil.COMPONENT_SPACE);
+ panel.add( field, gbc );
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/PluginSelectionDialog.java b/base/console/src/com/netscape/admin/certsrv/config/PluginSelectionDialog.java
new file mode 100644
index 000000000..437881186
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/PluginSelectionDialog.java
@@ -0,0 +1,375 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Plugin Selection Dialog
+ *
+ * @author Jack Pan-chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class PluginSelectionDialog extends JDialog
+ implements ActionListener, MouseListener
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ protected JFrame mParentFrame;
+ protected AdminConnection mConnection;
+ protected ResourceBundle mResource;
+ protected DefaultListModel mDataModel;
+ protected String mDestination; //dest flag
+ protected String mExtraDestination = null; //dest flag
+
+ private JScrollPane mScrollPane;
+ protected JList mList;
+
+ protected JButton mOK, mCancel, mHelp;
+ protected String mPrefix;
+ protected String mScope;
+ protected String mInstanceScope;
+ protected String mImageName;
+ protected String mHelpToken;
+ protected CMSPluginInstanceTab mPluginInstanceDialog;
+ protected CMSBaseResourceModel mModel=null;
+
+ public PluginSelectionDialog(
+ String prefix,
+ JFrame parent,
+ AdminConnection conn,
+ String dest)
+ {
+ this( prefix,
+ parent,
+ conn,
+ dest,
+ null );
+ }
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public PluginSelectionDialog(
+ String prefix,
+ JFrame parent,
+ AdminConnection conn,
+ String dest,
+ CMSPluginInstanceTab pluginType)
+ {
+ super(parent,true);
+ mParentFrame = parent;
+ mConnection = conn;
+ mDestination = dest;
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ mDataModel = new DefaultListModel();
+ mPrefix = prefix;
+ mPluginInstanceDialog = pluginType;
+
+ setTitle(mResource.getString(mPrefix+"_TITLE"));
+ setSize(360, 216);
+ setLocationRelativeTo(parent);
+ getRootPane().setDoubleBuffered(true);
+ }
+
+ public PluginSelectionDialog(
+ String prefix,
+ JFrame parent,
+ AdminConnection conn,
+ String dest, String extraDest,
+ CMSPluginInstanceTab pluginType)
+ {
+ super(parent,true);
+ mParentFrame = parent;
+ mConnection = conn;
+ mDestination = dest;
+ mExtraDestination = extraDest;
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ mDataModel = new DefaultListModel();
+ mPrefix = prefix;
+ mPluginInstanceDialog = pluginType;
+
+ setTitle(mResource.getString(mPrefix+"_TITLE"));
+ setSize(360, 216);
+ setLocationRelativeTo(parent);
+ getRootPane().setDoubleBuffered(true);
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ public void setModel(CMSBaseResourceModel model)
+ {
+ mModel = model;
+ }
+
+ /**
+ * show the windows
+ * @param users list of current groups
+ */
+ public void showDialog() {
+
+ mDataModel.clear();
+
+ if(!update())
+ return;
+ refresh();
+ setArrowButtons();
+ this.show();
+ }
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent evt) {
+
+ if (evt.getSource().equals(mOK)) {
+ NameValuePairs response;
+ try {
+ response = getDefaultConfig();
+ } catch (EAdminException e) {
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ e.getMessage(), CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ Debug.println(response.toString());
+ String id = ((JLabel)mDataModel.elementAt(mList.getSelectedIndex())).getText();
+ response.put(Constants.PR_POLICY_IMPL_NAME, id);
+
+ CMSBaseConfigDialog dialog = null;
+ if (mExtraDestination == null) {
+ dialog = mPluginInstanceDialog.makeNewConfigDialog(
+ response, mParentFrame, mConnection, mDestination);
+ } else {
+ dialog = mPluginInstanceDialog.makeNewConfigDialog(
+ response, mParentFrame, mConnection, mExtraDestination);
+ }
+
+ dialog.setModel(mModel);
+ dialog.setInstanceScope(mInstanceScope);
+
+ dialog.showDialog(response,"");
+
+ if(!dialog.isOK()) {
+ this.dispose();
+ return;
+ }
+
+ response = dialog.getData();
+ String name = dialog.getRuleName();
+
+ Debug.println(response.toString());
+
+ dialog.dispose();
+ this.dispose();
+ }
+
+
+ if (evt.getSource().equals(mCancel)) {
+ this.dispose();
+ }
+ if (evt.getSource().equals(mHelp)) {
+ CMSAdminUtil.help(mHelpToken);
+ }
+ }
+
+ //==== MOUSELISTENER ======================
+ public void mouseClicked(MouseEvent e) {
+ setArrowButtons();
+ }
+
+ public void mousePressed(MouseEvent e) {}
+ public void mouseReleased(MouseEvent e) {
+ setArrowButtons();
+ }
+ public void mouseEntered(MouseEvent e) {}
+ public void mouseExited(MouseEvent e) {
+ setArrowButtons();
+ }
+
+ protected void setDisplay() {
+ Debug.println("*** PluginSelectionDialog.setDisplay() - 1");
+ getContentPane().setLayout(new BorderLayout());
+ JPanel center = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ center.setLayout(gb);
+
+ //content panel
+ JPanel content = makeContentPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.fill = gbc.BOTH;
+ gb.setConstraints(content, gbc);
+ center.add(content);
+
+ //action panel
+ JPanel action = makeActionPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints(action, gbc);
+ center.add(action);
+
+ getContentPane().add("Center",center);
+ }
+
+ //create botton action panel
+ private JPanel makeActionPane() {
+ mOK = CMSAdminUtil.makeJButton(mResource, mPrefix, "OK", null, this);
+ mCancel = CMSAdminUtil.makeJButton(mResource, mPrefix, "CANCEL", null, this);
+ mHelp = CMSAdminUtil.makeJButton(mResource, mPrefix, "HELP", null, this);
+ //JButton[] buttons = { mOK, mCancel, mHelp};
+ JButton[] buttons = { mOK, mCancel};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonPanel( buttons, true);
+ }
+
+ private JPanel makeContentPane() {
+ Debug.println("*** PluginSelectionDialog.makeContentPane() - 0");
+ JPanel mListPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ Debug.println("*** PluginSelectionDialog.makeContentPane() - 1");
+ mListPanel.setLayout(gb);
+ //content.setBorder(CMSAdminUtil.makeEtchedBorder());
+
+ Debug.println("*** PluginSelectionDialog.makeContentPane() - 2");
+ //left side certificate table
+ mList = CMSAdminUtil.makeJList(mDataModel,9);
+ Debug.println("PluginSelectionDialog.makeContentPane() - making mList("+mList+")");
+ mScrollPane = new JScrollPane(mList,
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION );
+ mList.addMouseListener(this);
+ mScrollPane.setBackground(Color.white);
+ mScrollPane.setBorder(BorderFactory.createLoweredBevelBorder());
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.fill = gbc.BOTH;
+ gb.setConstraints(mScrollPane, gbc);
+ mListPanel.add(mScrollPane);
+
+ return mListPanel;
+ }
+
+
+ //set arrow buttons
+ private void setArrowButtons() {
+
+ //enable and diable buttons accordingly
+ //Debug.println("setArrowButtons() - "+mList.getSelectedIndex());
+
+ if (mList.getSelectedIndex()< 0) {
+ mOK.setEnabled(false);
+ return;
+ }
+
+ mOK.setEnabled(true);
+ }
+
+ //refresh the table content
+ private void refresh() {
+ //mScrollPane.invalidate();
+ //mScrollPane.validate();
+ //repaint();
+ }
+
+ //=================================================
+ // RETRIEVE INFO FROM SERVER SIDE
+ //=================================================
+
+ //save order information to the server
+ protected boolean update() {
+
+ NameValuePairs response;
+ try {
+ response = mConnection.search(mDestination, mScope,
+ new NameValuePairs());
+ } catch (EAdminException e) {
+ //display error dialog
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ e.getMessage(), CMSAdminUtil.ERROR_MESSAGE);
+ return false;
+ }
+
+ Debug.println(response.toString());
+
+ //parse the data
+ String[] vals = new String[response.size()];
+ int i=0;
+ for (String name : response.keySet()) {
+ vals[i++] = name.trim();
+ Debug.println("PluginSelectionDialog::update() - adding '" + vals[i - 1] + "'");
+ }
+
+ CMSAdminUtil.bubbleSort(vals);
+
+ for (int y=0; y< vals.length ; y++) {
+ try {
+ mDataModel.addElement(new JLabel(vals[y],
+ CMSAdminUtil.getImage(mImageName), JLabel.LEFT));
+ }
+ catch (Exception ex) {
+ Debug.println("PluginSelectionDialog could not get image for '"+
+ mImageName+"'. Adding without image");
+ mDataModel.addElement(new JLabel(vals[y],
+ JLabel.LEFT));
+ }
+ }
+
+ return true;
+ }
+
+ //this returns the default configuration
+ protected NameValuePairs getDefaultConfig() throws EAdminException {
+ String id = ((JLabel)mDataModel.elementAt(mList.getSelectedIndex())).getText();
+ NameValuePairs response;
+ response = mConnection.read(mDestination, mScope, id,
+ new NameValuePairs());
+
+ Debug.println(response.toString());
+
+ return response;
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/PolicyConfigDialog.java b/base/console/src/com/netscape/admin/certsrv/config/PolicyConfigDialog.java
new file mode 100644
index 000000000..8dec3cabf
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/PolicyConfigDialog.java
@@ -0,0 +1,64 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import javax.swing.table.*;
+import javax.swing.text.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Policy Parameter Configuration Dialog
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class PolicyConfigDialog extends CMSBaseConfigDialog
+ implements ActionListener
+{
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public PolicyConfigDialog(NameValuePairs nvp,
+ JFrame parent,
+ AdminConnection conn,
+ String dest) {
+
+ super(parent, dest);
+
+ PREFIX = "POLICYCONFIGDIALOG";
+ RAHELPINDEX = "configuration-ra-edit-policyrule-dbox-help";
+ KRAHELPINDEX = "configuration-kra-edit-policyrule-dbox-help";
+ CAHELPINDEX = "configuration-ca-edit-policyrule-dbox-help";
+ mImplName_token = Constants.PR_POLICY_IMPL_NAME;
+ mImplType = Constants.PR_EXT_PLUGIN_IMPLTYPE_POLICY;
+
+ init(nvp,parent,conn,dest);
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/PolicyImplDataModel.java b/base/console/src/com/netscape/admin/certsrv/config/PolicyImplDataModel.java
new file mode 100644
index 000000000..59ea36ec8
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/PolicyImplDataModel.java
@@ -0,0 +1,68 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Policy Implementation Data model - represents the implementation
+ * table information
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class PolicyImplDataModel extends CMSContentTableModel
+ implements IDataProcessor
+{
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ public static final String IMPL_NAME = "NAME";
+ public static final String IMPL_CLASS = "CLASS";
+ public static final String IMPL_DESC = "DESC";
+
+ private static String[] mColumns = {POLICY_IMPL, CLASSNAME};
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public PolicyImplDataModel() {
+ super();
+ init(mColumns);
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public void processData(Object data) {
+ Vector v = new Vector();
+ NameValuePairs obj = (NameValuePairs) data;
+ v.addElement(new JLabel(obj.get(IMPL_NAME),
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE_PLUGIN),
+ JLabel.LEFT));
+ v.addElement(obj.get(IMPL_CLASS));
+ //v.addElement(obj.getValue(IMPL_DESC));
+ addRow(v, data);
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/PolicyImplTab.java b/base/console/src/com/netscape/admin/certsrv/config/PolicyImplTab.java
new file mode 100644
index 000000000..f4fab7260
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/PolicyImplTab.java
@@ -0,0 +1,322 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.ug.*;
+import javax.swing.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Policy Instances Management Tab
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class PolicyImplTab extends CMSBaseUGTab {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String IMPL_NAME = PolicyImplDataModel.IMPL_NAME;
+ private static final String IMPL_CLASS = PolicyImplDataModel.IMPL_CLASS;
+ private static final String IMPL_DESC = PolicyImplDataModel.IMPL_DESC;
+
+ private static final String PANEL_NAME = "POLICYIMPL";
+ private static final String DIALOG_PREFIX = "POLICYREGISTERDIALOG";
+
+ private AdminConnection mConnection;
+ private String mDestination;
+
+ protected JScrollPane mScrollPane;
+ protected JTable mTable; //table
+ protected PolicyImplDataModel mDataModel; //table model
+ protected PolicyRegisterDialog mEditor=null; //keep single copy
+ protected ViewDialog mViewer=null; //keep single copy
+
+ protected JButton mRefresh, mAdd, mDelete, mView, mHelp;
+ private final static String RAHELPINDEX = "configuration-ra-policyplugin-help";
+ private final static String CAHELPINDEX = "configuration-ca-policyplugin-help";
+ private final static String KRAHELPINDEX = "configuration-kra-policyplugin-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public PolicyImplTab(CMSBaseResourceModel model, String destination) {
+ super(PANEL_NAME, model);
+ mConnection = model.getServerInfo().getAdmin();
+ mDataModel = new PolicyImplDataModel();
+ mDestination = destination;
+ if (mDestination.equals(DestDef.DEST_RA_POLICY_ADMIN))
+ mHelpToken = RAHELPINDEX;
+ else if (mDestination.equals(DestDef.DEST_KRA_POLICY_ADMIN))
+ mHelpToken = KRAHELPINDEX;
+ else
+ mHelpToken = CAHELPINDEX;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mRefresh)) {
+ refresh();
+ }
+ if (e.getSource().equals(mAdd)) {
+ if (mEditor==null)
+ mEditor = new PolicyRegisterDialog(mModel.getFrame(),
+ mConnection);
+ mEditor.showDialog(mDestination, ScopeDef.SC_POLICY_IMPLS);
+ refresh();
+ }
+ if (e.getSource().equals(mDelete)) {
+ Debug.println("Delete");
+ if(mTable.getSelectedRow()< 0)
+ return;
+ int i = showConfirmDialog("DELETE");
+ if (i == JOptionPane.YES_OPTION) {
+ delete();
+ Debug.println("Deleted");
+ }
+ }
+ if (e.getSource().equals(mView)) {
+ Debug.println("View");
+ if(mTable.getSelectedRow()< 0)
+ return;
+ NameValuePairs obj = (NameValuePairs)
+ mDataModel.getObjectValueAt(mTable.getSelectedRow());
+ if (mViewer==null)
+ mViewer = new ViewDialog(mModel.getFrame());
+ mViewer.showDialog(obj.get(IMPL_NAME),
+ obj.get(IMPL_CLASS),
+ obj.get(IMPL_DESC));
+ }
+ if (e.getSource().equals(mHelp)) {
+ helpCallback();
+ }
+ }
+
+ //==== MOUSELISTENER ======================
+ public void mouseClicked(MouseEvent e) {
+ setButtons();
+ }
+
+ public void mouseReleased(MouseEvent e) {
+ setButtons();
+ }
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+ public void refresh() {
+
+ mDataModel.removeAllRows();
+ update();
+
+ setButtons();
+ mTable.invalidate();
+ mTable.validate();
+ mTable.repaint(1);
+ }
+
+ /**
+ * create the user action button panel
+ */
+ protected JPanel createButtonPanel() {
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mAdd = makeJButton("ADD");
+ mDelete = makeJButton("DELETE");
+ mView = makeJButton("VIEW");
+ JButton[] buttons = {mAdd, mDelete, mView};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonVPanel( buttons );
+ }
+
+ protected JPanel createActionPanel() {
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mRefresh = makeJButton("REFRESH");
+ mHelp = makeJButton("HELP");
+ //JButton[] buttons = { mRefresh, mHelp };
+ JButton[] buttons = { mRefresh };
+ return makeJButtonPanel(buttons, true);
+ }
+
+ protected JPanel createListPanel() {
+ mListPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mListPanel.setLayout(gb);
+
+ //center table
+ mTable = new JTable(mDataModel);
+ mScrollPane = JTable.createScrollPaneForTable(mTable);
+ //mScrollPane.setBorder(CMSAdminUtil.makeTitledBorder(mResource,PANEL_NAME,"USERS"));
+ mScrollPane.setHorizontalScrollBarPolicy(mScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mScrollPane.setVerticalScrollBarPolicy(mScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ mTable.setAutoscrolls(true);
+ mTable.sizeColumnsToFit(true);
+ mTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ mTable.getSelectionModel().addListSelectionListener(this);
+ mScrollPane.setBackground(Color.white);
+ mTable.addMouseListener(this);
+ setLabelCellRenderer(mTable,0);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = 1;
+ gbc.weightx = 1.0;
+ gbc.insets = EMPTY_INSETS;
+ gb.setConstraints(mScrollPane, gbc);
+ mListPanel.add(mScrollPane);
+
+ JPanel buttonPanel = createButtonPanel();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 0.0;
+ gbc.weighty = 1.0;
+ gbc.insets = EMPTY_INSETS;
+ gb.setConstraints(buttonPanel, gbc);
+ mListPanel.add(buttonPanel);
+
+ refresh();
+
+ return mListPanel;
+ }
+
+ //Set the first column's cellrender as label cell
+ protected void setLabelCellRenderer(JTable table, int index) {
+ table.getColumnModel().getColumn(index).setCellRenderer(new LabelCellRenderer(new JLabel()));
+ }
+
+
+ //set buttons
+ private void setButtons() {
+
+ //enable and diable buttons accordingly
+ //Debug.println("setButtons() - "+mTable.getSelectedRow());
+ //Debug.println("setButtons() - "+mTable.getSelectionModel().isSelectionEmpty());
+ if (mTable.getSelectionModel().isSelectionEmpty()) {
+ mDelete.setEnabled(false);
+ mView.setEnabled(false);
+ return;
+ }
+
+ if(mDataModel.getRowCount()<=0) {
+ mDelete.setEnabled(false);
+ mView.setEnabled(false);
+ return;
+ }
+
+ mDelete.setEnabled(true);
+ mView.setEnabled(true);
+
+ }
+
+ //=============================================
+ // SEND REQUESTS TO THE SERVER SIDE
+ //=============================================
+ private void update() {
+ //send request and parse data
+
+ mModel.progressStart();
+ NameValuePairs response;
+ try {
+ response = mConnection.search(mDestination,
+ ScopeDef.SC_POLICY_IMPLS,
+ new NameValuePairs());
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ mModel.progressStop();
+ return;
+ }
+
+ Debug.println(response.toString());
+
+ //parse the data
+ int i=0;
+ String[] vals = new String[response.size()];
+ Hashtable<String, NameValuePairs> data = new Hashtable<String, NameValuePairs>();
+ for (String entry : response.keySet()) {
+ entry = entry.trim();
+ String value = response.get(entry);
+ int x = value.indexOf(",");
+ NameValuePairs obj = new NameValuePairs();
+ obj.put(IMPL_NAME, entry);
+ vals[i++]= entry ;
+ obj.put(IMPL_CLASS, value.substring(0, x));
+ obj.put(IMPL_DESC, value.substring(x + 1));
+ data.put(entry,obj);
+ }
+
+ CMSAdminUtil.bubbleSort(vals);
+
+ for (int y=0; y< vals.length ; y++) {
+ mDataModel.processData(data.get(vals[y]));
+ }
+
+ data.clear();
+
+ if (mDataModel.getRowCount() >0)
+ mTable.setRowSelectionInterval(0,0);
+
+ mModel.progressStop();
+ }
+
+ private void delete() {
+ //get entry name
+ mModel.progressStart();
+ NameValuePairs obj = (NameValuePairs)
+ mDataModel.getObjectValueAt(mTable.getSelectedRow());
+
+ //send comment to server for the removal of user
+ try {
+ mConnection.delete(mDestination,
+ ScopeDef.SC_POLICY_IMPLS,
+ obj.get(IMPL_NAME));
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ mModel.progressStop();
+ return;
+ }
+ mModel.progressStop();
+ //send comment to server and refetch the content
+ refresh();
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/PolicyInstanceTab.java b/base/console/src/com/netscape/admin/certsrv/config/PolicyInstanceTab.java
new file mode 100644
index 000000000..9bf8fb54b
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/PolicyInstanceTab.java
@@ -0,0 +1,139 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.ug.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Policy Instances Management Tab
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class PolicyInstanceTab extends CMSPluginInstanceTab {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PANEL_NAME = "POLICYRULE";
+
+ protected JButton mOrder;
+ private final static String RAHELPINDEX = "configuration-ra-policyrules-help";
+ private final static String CAHELPINDEX = "configuration-ca-policyrules-help";
+ private final static String KRAHELPINDEX = "configuration-kra-policyrules-help";
+
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public PolicyInstanceTab(CMSBaseResourceModel model, String dest) {
+ super(model,dest,PANEL_NAME);
+ Debug.println("PolicyInstanceTab::PolicyInstanceTab(<model>,"+dest);
+ mConnection = model.getServerInfo().getAdmin();
+ mDataModel = new PolicyRuleDataModel();
+ mScope = ScopeDef.SC_POLICY_RULES;
+ RULE_NAME = PolicyRuleDataModel.RULE_NAME;
+ RULE_STAT = PolicyRuleDataModel.RULE_STAT;
+
+ if (mDestination.equals(DestDef.DEST_RA_POLICY_ADMIN))
+ mHelpToken = RAHELPINDEX;
+ else if (mDestination.equals(DestDef.DEST_KRA_POLICY_ADMIN))
+ mHelpToken = KRAHELPINDEX;
+ else
+ mHelpToken = CAHELPINDEX;
+ }
+
+
+ public CMSBaseConfigDialog makeNewConfigDialog(
+ NameValuePairs nvp,
+ JFrame parent,
+ AdminConnection conn,
+ String dest
+ )
+ {
+
+ return new PolicyConfigDialog(nvp,
+ parent,
+ conn,
+ dest);
+ }
+
+ public PluginSelectionDialog getPluginSelectionDialog(
+ JFrame parent,
+ AdminConnection conn,
+ String dest,
+ CMSPluginInstanceTab pluginType
+ )
+ {
+ return new PolicyPluginSelectionDialog(parent,conn,dest,pluginType);
+ }
+
+
+ //=== ACTIONLISTENER =====================
+ public void moreActionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mOrder)) {
+ Debug.println("Order");
+ PolicyRuleOrderDialog dialog =
+ new PolicyRuleOrderDialog(mModel.getFrame(),
+ mConnection, mDestination);
+ dialog.showDialog(mDataModel.getRules());
+ refresh();
+ }
+ }
+
+ /**
+ * create the user action button panel
+ */
+ protected JPanel createUserButtonPanel() {
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mOrder = makeJButton("ORDER");
+ mEdit = makeJButton("EDIT");
+ mAdd = makeJButton("ADD");
+ mDelete = makeJButton("DELETE");
+ JButton[] buttons = {mAdd, mDelete, mEdit, mOrder};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonVPanel( buttons );
+ }
+
+
+ //set buttons
+ protected void setButtons() {
+ super.setButtons();
+
+ if (mDataModel.getRowCount()<=0) {
+ mOrder.setEnabled(false);
+ }
+ else {
+ mOrder.setEnabled(true);
+ }
+ }
+
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/PolicyPluginSelectionDialog.java b/base/console/src/com/netscape/admin/certsrv/config/PolicyPluginSelectionDialog.java
new file mode 100644
index 000000000..6ef26b767
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/PolicyPluginSelectionDialog.java
@@ -0,0 +1,73 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Policy Plugin Selection Dialog
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class PolicyPluginSelectionDialog extends PluginSelectionDialog
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PREFIX = "POLICYSELECTIONDIALOG";
+ private static final String CAHELPINDEX =
+ "configuration-ca-add-policyrule-dbox-help";
+ private static final String RAHELPINDEX =
+ "configuration-ra-add-policyrule-dbox-help";
+ private static final String KRAHELPINDEX =
+ "configuration-kra-add-policyrule-dbox-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public PolicyPluginSelectionDialog(
+ JFrame parent,
+ AdminConnection conn,
+ String dest,
+ CMSPluginInstanceTab pluginType)
+ {
+ super(PREFIX, parent,conn, dest, pluginType);
+ mScope = ScopeDef.SC_POLICY_IMPLS;
+ mInstanceScope = ScopeDef.SC_POLICY_RULES;
+ mImageName = CMSAdminResources.IMAGE_RULE_PLUGIN;
+ if (dest.equals(DestDef.DEST_RA_POLICY_ADMIN))
+ mHelpToken = RAHELPINDEX;
+ else if (dest.equals(DestDef.DEST_KRA_POLICY_ADMIN))
+ mHelpToken = KRAHELPINDEX;
+ else
+ mHelpToken = CAHELPINDEX;
+ setDisplay();
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/PolicyRegisterDialog.java b/base/console/src/com/netscape/admin/certsrv/config/PolicyRegisterDialog.java
new file mode 100644
index 000000000..cbc961c5b
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/PolicyRegisterDialog.java
@@ -0,0 +1,40 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+
+/**
+ * Policy Implementation Registration Editor
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+
+public class PolicyRegisterDialog extends RegisterDialog {
+
+ private final static String PREFIX = "POLICYREGISTERDIALOG";
+
+ public PolicyRegisterDialog(JFrame parent, AdminConnection conn) {
+ super(PREFIX, parent, conn);
+ setDisplay();
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/PolicyRuleDataModel.java b/base/console/src/com/netscape/admin/certsrv/config/PolicyRuleDataModel.java
new file mode 100644
index 000000000..9bbeda334
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/PolicyRuleDataModel.java
@@ -0,0 +1,71 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.Debug;
+
+
+/**
+ * Policy instance Data model - represents the instance
+ * table information
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public class PolicyRuleDataModel extends CMSRuleDataModel
+{
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public PolicyRuleDataModel() {
+ super();
+ }
+
+ protected String[] getColumns() {
+ Debug.println("PolicyRuleDataModel.getColumns()");
+ String x[] = {POLICY_RULE, STATUS};
+ return x;
+ }
+
+ public void processData(Object data) {
+ Vector v = new Vector();
+ NameValuePairs obj = (NameValuePairs) data;
+
+ //XXX NEED TO ADD STUFF
+ if (obj.get(RULE_STAT).equalsIgnoreCase("enabled")) {
+ v.addElement(new JLabel(obj.get(RULE_NAME),
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE),
+ JLabel.LEFT));
+ v.addElement(mResource.getString("POLICYRULE_LABEL_ENABLED_LABEL"));
+ } else {
+ v.addElement(new JLabel(obj.get(RULE_NAME),
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE_DISABLE),
+ JLabel.LEFT));
+ v.addElement(mResource.getString("POLICYRULE_LABEL_DISABLED_LABEL"));
+ }
+ addRow(v, data);
+ mRules.addElement(obj.get(RULE_NAME));
+ }
+
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/PolicyRuleOrderDialog.java b/base/console/src/com/netscape/admin/certsrv/config/PolicyRuleOrderDialog.java
new file mode 100644
index 000000000..1c99d999f
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/PolicyRuleOrderDialog.java
@@ -0,0 +1,331 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Policy Rule Order Dialog - <p>
+ *
+ * The administrator can use this dialog to reconfig the ordering
+ * of the existing policy rules.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class PolicyRuleOrderDialog extends JDialog
+ implements ActionListener, MouseListener
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private String PREFIX = "POLICYORDERDIALOG";
+
+ private JFrame mParentFrame;
+ private AdminConnection mConnection;
+ private ResourceBundle mResource;
+ protected DefaultListModel mDataModel;
+ protected String mDestination; //dest flag
+
+ private JScrollPane mScrollPane;
+ private JList mList;
+
+ private JButton mOK, mCancel, mUp, mDown, mHelp;
+ private final static String RAHELPINDEX =
+ "configuration-ra-reorder-policyrule-dbox-help";
+ private final static String KRAHELPINDEX =
+ "configuration-kra-reorder-policyrule-dbox-help";
+ private final static String CAHELPINDEX =
+ "configuration-ca-reorder-policyrule-dbox-help";
+ private String mHelpToken;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public PolicyRuleOrderDialog(JFrame parent, AdminConnection conn, String dest) {
+ super(parent,true);
+ mParentFrame = parent;
+ mConnection = conn;
+ mDestination = dest;
+ if (mDestination.equals(DestDef.DEST_RA_POLICY_ADMIN))
+ mHelpToken = RAHELPINDEX;
+ else if (mDestination.equals(DestDef.DEST_KRA_POLICY_ADMIN))
+ mHelpToken = KRAHELPINDEX;
+ else
+ mHelpToken = CAHELPINDEX;
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ mDataModel = new DefaultListModel();
+ setSize(360, 216);
+ setTitle(mResource.getString(PREFIX+"_TITLE"));
+ setLocationRelativeTo(parent);
+ getRootPane().setDoubleBuffered(true);
+ setDisplay();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * show the windows
+ * @param users list of current groups
+ */
+ public void showDialog(Vector rules) {
+
+ mDataModel.clear();
+ for (int i=0; i<rules.size(); i++)
+ mDataModel.addElement(
+ new JLabel((String)rules.elementAt(i),
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE),
+ JLabel.LEFT));
+ if (mDataModel.getSize() >0)
+ mList.setSelectedIndex(0);
+
+ refresh();
+ setArrowButtons();
+ this.show();
+ }
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent evt) {
+
+ if (evt.getSource().equals(mOK)) {
+ try {
+ saveOrder();
+ } catch (EAdminException e) {
+ //display error dialog
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ e.getMessage(), CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ this.dispose();
+ }
+ if (evt.getSource().equals(mCancel)) {
+ this.dispose();
+ }
+ if (evt.getSource().equals(mUp)) {
+ int index = mList.getSelectedIndex();
+ Object obj = mDataModel.elementAt(index);
+ mDataModel.removeElementAt(index);
+ mDataModel.insertElementAt(obj,index-1);
+ mList.setSelectedIndex(index-1);
+ setArrowButtons();
+ refresh();
+ }
+ if (evt.getSource().equals(mDown)) {
+ int index = mList.getSelectedIndex();
+ Object obj = mDataModel.elementAt(index);
+ mDataModel.removeElementAt(index);
+ mDataModel.insertElementAt(obj,index+1);
+ mList.setSelectedIndex(index+1);
+ setArrowButtons();
+ refresh();
+ }
+ if (evt.getSource().equals(mHelp)) {
+ CMSAdminUtil.help(mHelpToken);
+ }
+ }
+
+ //==== MOUSELISTENER ======================
+ public void mouseClicked(MouseEvent e) {
+ setArrowButtons();
+ }
+
+ public void mousePressed(MouseEvent e) {}
+ public void mouseReleased(MouseEvent e) {
+ setArrowButtons();
+ }
+ public void mouseEntered(MouseEvent e) {}
+ public void mouseExited(MouseEvent e) {
+ setArrowButtons();
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+ private void setDisplay() {
+ getContentPane().setLayout(new BorderLayout());
+ JPanel center = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ center.setLayout(gb);
+
+ //content panel
+ JPanel content = makeContentPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.fill = gbc.BOTH;
+ gb.setConstraints(content, gbc);
+ center.add(content);
+
+ //action panel
+ JPanel action = makeActionPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints(action, gbc);
+ center.add(action);
+
+ getContentPane().add("Center",center);
+ }
+
+ /**
+ * create the bottom action button panel
+ */
+ protected JPanel createUDButtonPanel() {
+ //up, down buttons required
+ //actionlister to this object
+ mUp = CMSAdminUtil.makeJButton(mResource, PREFIX, "UP", null, this);
+ mDown = CMSAdminUtil.makeJButton(mResource, PREFIX, "DOWN", null, this);
+ JButton[] buttons = { mUp, mDown};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonVPanel( buttons );
+ }
+
+ //create botton action panel
+ private JPanel makeActionPane() {
+ mOK = CMSAdminUtil.makeJButton(mResource, PREFIX, "OK", null, this);
+ mCancel = CMSAdminUtil.makeJButton(mResource, PREFIX, "CANCEL", null, this);
+ mHelp = CMSAdminUtil.makeJButton(mResource, PREFIX, "HELP", null, this);
+ //JButton[] buttons = { mOK, mCancel, mHelp};
+ JButton[] buttons = { mOK, mCancel};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonPanel( buttons, true);
+ }
+
+ private JPanel makeContentPane() {
+ JPanel mListPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mListPanel.setLayout(gb);
+ //content.setBorder(CMSAdminUtil.makeEtchedBorder());
+
+ //left side certificate table
+ mList = CMSAdminUtil.makeJList(mDataModel,10);
+ mScrollPane = new JScrollPane(mList,
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION );
+ mList.addMouseListener(this);
+ mScrollPane.setBackground(Color.white);
+ mScrollPane.setBorder(BorderFactory.createLoweredBevelBorder());
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = 1;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.fill = gbc.BOTH;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,CMSAdminUtil.COMPONENT_SPACE,0,0);
+ gb.setConstraints(mScrollPane, gbc);
+ mListPanel.add(mScrollPane);
+
+ JPanel buttonPanel = createUDButtonPanel();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 0.0;
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,0,0,0);
+ gb.setConstraints(buttonPanel, gbc);
+ mListPanel.add(buttonPanel);
+
+ return mListPanel;
+ }
+
+ //=================================================
+ // RETRIEVE INFO FROM SERVER SIDE
+ //=================================================
+
+ //save order information to the server
+ private void saveOrder() throws EAdminException {
+ StringBuffer buf = new StringBuffer();
+
+ int x = 0;
+ for(int i=0; i<mDataModel.size(); i++) {
+ if (x > 0)
+ buf.append(",");
+ x++;
+ buf.append(((JLabel)mDataModel.getElementAt(i)).getText());
+ }
+
+ NameValuePairs nvp = new NameValuePairs();
+ nvp.put(Constants.PR_POLICY_ORDER, buf.toString());
+
+ Debug.println("ORDER: "+buf.toString());
+
+ mConnection.modify(mDestination,
+ ScopeDef.SC_POLICY_RULES,
+ Constants.RS_ID_ORDER,
+ nvp);
+ }
+
+ //set arrow buttons
+ private void setArrowButtons() {
+
+ //enable and diable buttons accordingly
+ Debug.println("setArrowButtons() - "+mList.getSelectedIndex());
+ if (mList.getSelectedIndex()< 0) {
+ mUp.setEnabled(false);
+ mDown.setEnabled(false);
+ mOK.setEnabled(false);
+ return;
+ }
+
+ if (mList.getSelectedIndex()==0)
+ mUp.setEnabled(false);
+ else
+ mUp.setEnabled(true);
+ if (mList.getSelectedIndex()< mDataModel.getSize()-1)
+ mDown.setEnabled(true);
+ else
+ mDown.setEnabled(false);
+ mOK.setEnabled(true);
+ }
+
+ //refresh the table content
+ private void refresh() {
+ //mTable.invalidate();
+ //mTable.validate();
+ //mTable.repaint(1);
+ mScrollPane.invalidate();
+ mScrollPane.validate();
+ //mScrollPane.repaint(1);
+ repaint();
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/ProfileComponentCellEditor.java b/base/console/src/com/netscape/admin/certsrv/config/ProfileComponentCellEditor.java
new file mode 100644
index 000000000..b1e2769db
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/ProfileComponentCellEditor.java
@@ -0,0 +1,109 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.awt.Component;
+import java.awt.event.*;
+import java.awt.AWTEvent;
+import java.lang.Boolean;
+import javax.swing.table.*;
+import javax.swing.event.*;
+import java.util.EventObject;
+import javax.swing.tree.*;
+import java.io.Serializable;
+import javax.swing.*;
+
+public class ProfileComponentCellEditor implements TableCellEditor {
+ protected EventListenerList listenerList = new EventListenerList();
+ protected ChangeEvent changeEvent = null;
+
+ protected JComponent editorComponent = null;
+ protected JComponent container = null; // Can be tree or table
+
+ public Component getComponent() {
+ return editorComponent;
+ }
+
+ public Object getCellEditorValue() {
+ return editorComponent;
+ }
+
+ public boolean isCellEditable(EventObject anEvent) {
+ return true;
+ }
+
+ public boolean shouldSelectCell(EventObject anEvent) {
+ return true;
+ }
+
+ public boolean stopCellEditing() {
+ fireEditingStopped();
+ return true;
+ }
+
+ public void cancelCellEditing() {
+ fireEditingCanceled();
+ }
+
+ public void addCellEditorListener(CellEditorListener l) {
+ listenerList.add(CellEditorListener.class, l);
+ }
+
+ public void removeCellEditorListener(CellEditorListener l) {
+ listenerList.remove(CellEditorListener.class, l);
+ }
+
+ protected void fireEditingStopped() {
+ Object[] listeners = listenerList.getListenerList();
+ // Process the listeners last to first, notifying
+ // those that are interested in this event
+ for (int i = listeners.length-2; i>=0; i-=2) {
+ if (listeners[i]==CellEditorListener.class) {
+ // Lazily create the event:
+ if (changeEvent == null)
+ changeEvent = new ChangeEvent(this);
+ ((CellEditorListener)listeners[i+1]).editingStopped(changeEvent);
+ }
+ }
+ }
+
+ protected void fireEditingCanceled() {
+ // Guaranteed to return a non-null array
+ Object[] listeners = listenerList.getListenerList();
+ // Process the listeners last to first, notifying
+ // those that are interested in this event
+ for (int i = listeners.length-2; i>=0; i-=2) {
+ if (listeners[i]==CellEditorListener.class) {
+ // Lazily create the event:
+ if (changeEvent == null)
+ changeEvent = new ChangeEvent(this);
+ ((CellEditorListener)listeners[i+1]).editingCanceled(changeEvent);
+ }
+ }
+ }
+
+ // implements javax.swing.table.TableCellEditor
+ public Component getTableCellEditorComponent(JTable table, Object value,
+ boolean isSelected, int row, int column) {
+
+ editorComponent = (JComponent)value;
+ container = table;
+ return editorComponent;
+ }
+} // End of class JComponentCellEditor
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/ProfileConfigDataModel.java b/base/console/src/com/netscape/admin/certsrv/config/ProfileConfigDataModel.java
new file mode 100644
index 000000000..af20b4e99
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/ProfileConfigDataModel.java
@@ -0,0 +1,83 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import javax.swing.table.*;
+import javax.swing.text.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Policy Parameter Configuration Dialog
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class ProfileConfigDataModel extends AbstractTableModel
+{
+ Vector rowData;
+ Vector columnNames;
+
+ public ProfileConfigDataModel()
+ {
+ }
+
+ public void setInfo(Vector _rowData, Vector _columnNames)
+ {
+ rowData = _rowData;
+ columnNames = _columnNames;
+ }
+
+ public String getColumnName(int column)
+ {
+ return columnNames.elementAt(column).toString();
+ }
+ public int getRowCount()
+ {
+ return rowData.size();
+ }
+ public int getColumnCount()
+ {
+ return columnNames.size();
+ }
+
+ public Object getValueAt(int row, int column)
+ {
+ return ((Vector)rowData.elementAt(row)).elementAt(column);
+ }
+
+ public boolean isCellEditable(int row, int column)
+ {
+ return false;
+ }
+
+ public void setValueAt(Object value, int row, int column)
+ {
+ ((Vector)rowData.elementAt(row)).setElementAt(value, column);
+ fireTableCellUpdated(row, column);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/ProfileConfigDialog.java b/base/console/src/com/netscape/admin/certsrv/config/ProfileConfigDialog.java
new file mode 100644
index 000000000..a8d312d2a
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/ProfileConfigDialog.java
@@ -0,0 +1,396 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Policy Parameter Configuration Dialog
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class ProfileConfigDialog extends CMSBaseConfigDialog
+ implements ActionListener
+{
+ protected JButton mRefresh, mEdit, mAdd, mDelete, mOrder, mHelp;
+ protected JTextField mAuthField=null,mNameField=null, mDescField=null, mConfigField=null;
+ protected JComboBox mVisibleField = null;
+ protected JLabel mVisibleLabel=null,mAuthLabel=null,mNameLabel=null, mDescLabel = null, mConfigLabel =null;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public ProfileConfigDialog(NameValuePairs nvp,
+ JFrame parent,
+ AdminConnection conn,
+ String dest) {
+
+ super(parent, dest);
+
+ PREFIX = "PROFILECONFIGDIALOG";
+ mHelpToken = "configuration-certificateprofiles";
+ mImplName_token = Constants.PR_POLICY_IMPL_NAME;
+ mImplType = Constants.PR_EXT_PLUGIN_IMPLTYPE_POLICY;
+ init(nvp,parent,conn,dest);
+ }
+
+
+ protected JPanel makeContentPane() {
+ JPanel mListPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mListPanel.setLayout(gb);
+
+ // 'Policy Rule ID' here
+ CMSAdminUtil.resetGBC(gbc);
+ mRulenameCaption = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "RULENAME", null);
+ mRulenameCaption.addMouseListener(this);
+ mPluginLabel = new JLabel();
+ mPluginLabel.setVisible(false);
+ mPluginName = new JTextField();
+
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ mListPanel.add(mRulenameCaption, gbc);
+
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,
+ 0,CMSAdminUtil.COMPONENT_SPACE);
+ mListPanel.add( mPluginName, gbc );
+ mListPanel.add( mPluginLabel, gbc );
+
+ // name
+ CMSAdminUtil.resetGBC(gbc);
+ mNameLabel = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "NAMENAME", null);
+ mNameLabel.addMouseListener(this);
+
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ mListPanel.add( mNameLabel, gbc );
+
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ mNameField = new JTextField();
+ mListPanel.add( mNameField, gbc );
+
+ // desc
+ CMSAdminUtil.resetGBC(gbc);
+ mDescLabel = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "DESCNAME", null);
+ mDescLabel.addMouseListener(this);
+
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ mListPanel.add( mDescLabel, gbc );
+
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ mDescField = new JTextField();
+ mListPanel.add( mDescField, gbc );
+
+ // visible
+ CMSAdminUtil.resetGBC(gbc);
+ mVisibleLabel = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "VISIBLENAME", null);
+ mVisibleLabel.addMouseListener(this);
+
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ mListPanel.add( mVisibleLabel, gbc );
+
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ String[] item = {"true", "false"};
+ mVisibleField = new JComboBox(item);
+ mListPanel.add( mVisibleField, gbc );
+
+ // authentication
+ CMSAdminUtil.resetGBC(gbc);
+ mAuthLabel = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "AUTHNAME", null);
+ mAuthLabel.addMouseListener(this);
+
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ mListPanel.add( mAuthLabel, gbc );
+
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ mAuthField = new JTextField();
+ mListPanel.add( mAuthField, gbc );
+
+ // config file
+/*
+ CMSAdminUtil.resetGBC(gbc);
+ mConfigLabel = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "CONFIGNAME", null);
+ mConfigLabel.addMouseListener(this);
+
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ mListPanel.add( mConfigLabel, gbc );
+
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ mConfigField = new JTextField();
+ mListPanel.add( mConfigField, gbc );
+*/
+
+
+ // 'Policy Plugin ID' here
+ CMSAdminUtil.resetGBC(gbc);
+ mImplnameCaption = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "IMPLNAME", null);
+ mImplnameCaption.addMouseListener(this);
+
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ mListPanel.add( mImplnameCaption, gbc );
+
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ mImplName = new JLabel();
+ mListPanel.add( mImplName, gbc );
+
+ /* Tab */
+/*
+ JTabbedPane tabPane = new JTabbedPane();
+ JPanel lpanel = createListPanel();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.fill = gbc.BOTH;
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ tabPane.addTab("Policies", lpanel);
+ gb.setConstraints(tabPane, gbc);
+ mListPanel.add(tabPane);
+*/
+
+ /* Panel for list of plugin's parameters */
+ mParamPanel = new JPanel();
+/*
+ mScrollPane = new JScrollPane(mParamPanel);
+ mScrollPane.setBorder(CMSAdminUtil.makeEtchedBorder());
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.fill = gbc.BOTH;
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(mScrollPane, gbc);
+ mListPanel.add(mScrollPane);
+*/
+
+ /* Panel in which to put plugin's help text */
+ mHelpPanel = new JPanel();
+ mHelpPanel.setBorder(CMSAdminUtil.makeEtchedBorder());
+ mHelpLabel = new JTextArea(3,0);
+ mHelpLabel.setLineWrap(true);
+ mHelpLabel.setWrapStyleWord(true);
+ mHelpLabel.setBackground(mHelpPanel.getBackground());
+ mHelpLabel.setEditable(false);
+ GridBagLayout gb2 = new GridBagLayout();
+ GridBagConstraints gbc2 = new GridBagConstraints();
+
+ CMSAdminUtil.resetGBC(gbc2);
+ gbc2.fill = gbc.BOTH;
+ gbc2.anchor = gbc.WEST;
+ gbc2.gridwidth = gbc.REMAINDER;
+ gbc2.weightx = 1.0;
+ gbc2.weighty = 1.0;
+ gb2.setConstraints(mHelpLabel, gbc2);
+ mHelpPanel.setLayout(gb2);
+ mHelpPanel.add(mHelpLabel);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.SOUTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gb.setConstraints(mHelpPanel, gbc);
+ mListPanel.add(mHelpPanel);
+
+ return mListPanel;
+ }
+
+ public JPanel createListPanel()
+ {
+ // GridBagLayout gb = new GridBagLayout();
+ // GridBagConstraints gbc = new GridBagConstraints();
+
+ Vector colNames = new Vector();
+ colNames.addElement("Defaults");
+ colNames.addElement("Constraints");
+ Vector data = new Vector();
+ Vector row = new Vector();
+ row.addElement("NoDefault");
+ row.addElement("NoConstraint");
+ data.addElement(row);
+
+ JPanel mListPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mListPanel.setLayout(gb);
+
+ //center table
+ ProfileConfigDataModel model = new ProfileConfigDataModel();
+ model.setInfo(data, colNames);
+ JTable mTable = new JTable(model);
+ JScrollPane mScrollPane = JTable.createScrollPaneForTable(mTable);
+ mScrollPane.setHorizontalScrollBarPolicy(mScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mScrollPane.setVerticalScrollBarPolicy(mScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ mTable.setAutoscrolls(true);
+ mTable.sizeColumnsToFit(true);
+ mTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ // mTable.getSelectionModel().addListSelectionListener(this);
+ mScrollPane.setBackground(Color.white);
+ mTable.addMouseListener(this);
+// setLabelCellRenderer(mTable,0);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = 1;
+ gbc.weightx = 1.0;
+ gbc.insets = CMSAdminUtil.DEFAULT_EMPTY_INSETS;
+ gb.setConstraints(mScrollPane, gbc);
+ mListPanel.add(mScrollPane);
+
+ JPanel buttonPanel = createUserButtonPanel();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 0.0;
+ gbc.weighty = 1.0;
+ gbc.insets = CMSAdminUtil.DEFAULT_EMPTY_INSETS;
+ gb.setConstraints(buttonPanel, gbc);
+ mListPanel.add(buttonPanel);
+
+ return mListPanel;
+ }
+
+ protected JPanel createUserButtonPanel() {
+ Debug.println("CMSPluginInstanceTab::createUserButtonPanel()");
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mEdit = CMSAdminUtil.makeJButton(mResource, PREFIX, "EDIT", null, this);
+ mAdd = CMSAdminUtil.makeJButton(mResource, PREFIX, "ADD", null, this);
+ mDelete = CMSAdminUtil.makeJButton(mResource, PREFIX, "DELETE", null, this);
+ JButton[] buttons = {mAdd, mDelete, mEdit};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonVPanel( buttons );
+ }
+
+ public void actionPerformed(ActionEvent evt) {
+
+ if (evt.getSource().equals(mOK)) {
+
+ NameValuePairs nvp = new NameValuePairs();
+ try {
+ if (mModel != null) { mModel.progressStart(); }
+
+ String instanceName = mPluginName.getText();
+ nvp.put("impl", mImplName.getText());
+ nvp.put("name", mNameField.getText());
+ nvp.put("visible", (String) (mVisibleField.getSelectedItem()));
+ nvp.put("auth", mAuthField.getText());
+ nvp.put("desc", mDescField.getText());
+ // nvp.add("config", mConfigField.getText());
+ // mAdminConnection.add(DestDef.DEST_CA_PROFILE_ADMIN,
+ mAdminConnection.add(mDest,
+ ScopeDef.SC_PROFILE_RULES, instanceName, nvp);
+
+ mIsOK = true;
+ if (mModel != null) { mModel.progressStop(); }
+ this.dispose();
+ }
+ catch (EAdminException ex) {
+ mModel.progressStop();
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ ex.toString(),CMSAdminUtil.ERROR_MESSAGE);
+ }
+ }
+
+ if (evt.getSource().equals(mCancel)) {
+ this.dispose();
+ }
+ if (evt.getSource().equals(mHelp)) {
+ CMSAdminUtil.help(mHelpToken);
+ }
+
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/ProfileDataTable.java b/base/console/src/com/netscape/admin/certsrv/config/ProfileDataTable.java
new file mode 100644
index 000000000..94d3b65f2
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/ProfileDataTable.java
@@ -0,0 +1,68 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.awt.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import javax.swing.table.*;
+
+/**
+ * class used to creat the password label
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public class ProfileDataTable extends JTable
+{
+
+ public ProfileDataTable(TableModel model) {
+ super(model);
+ }
+
+ public TableCellRenderer getCellRenderer(int row, int column) {
+ TableColumn tableColumn = getColumnModel().getColumn(column);
+ TableCellRenderer renderer = tableColumn.getCellRenderer();
+ if (renderer == null) {
+ Class c = getColumnClass(column);
+ if( c.equals(Object.class) ) {
+ Object o = getValueAt(row,column);
+ if( o != null ) {
+ c = getValueAt(row,column).getClass();
+ }
+ }
+ renderer = getDefaultRenderer(c);
+ }
+ return renderer;
+ }
+
+ public TableCellEditor getCellEditor(int row, int column) {
+ TableColumn tableColumn = getColumnModel().getColumn(column);
+ TableCellEditor editor = tableColumn.getCellEditor();
+ if (editor == null) {
+ Class c = getColumnClass(column);
+ if( c.equals(Object.class) ) {
+ Object o = getValueAt(row,column);
+ if( o != null )
+ c = getValueAt(row,column).getClass();
+ }
+ editor = getDefaultEditor(c);
+ }
+ return editor;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/ProfileEditDataModel.java b/base/console/src/com/netscape/admin/certsrv/config/ProfileEditDataModel.java
new file mode 100644
index 000000000..096a4075c
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/ProfileEditDataModel.java
@@ -0,0 +1,88 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import javax.swing.table.*;
+import javax.swing.text.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Policy Parameter Configuration Dialog
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class ProfileEditDataModel extends AbstractTableModel
+{
+ Vector rowData;
+ Vector columnNames;
+
+ public ProfileEditDataModel()
+ {
+ }
+
+ public void setInfo(Vector _rowData, Vector _columnNames)
+ {
+ rowData = _rowData;
+ columnNames = _columnNames;
+ }
+
+ public String getColumnName(int column)
+ {
+ return columnNames.elementAt(column).toString();
+ }
+ public int getRowCount()
+ {
+ return rowData.size();
+ }
+ public int getColumnCount()
+ {
+ return columnNames.size();
+ }
+
+ public Object getValueAt(int row, int column)
+ {
+ return ((Vector)rowData.elementAt(row)).elementAt(column);
+ }
+
+ public boolean isCellEditable(int row, int column)
+ {
+ return false;
+ }
+
+ public void setValueAt(Object value, int row, int column)
+ {
+ ((Vector)rowData.elementAt(row)).setElementAt(value, column);
+ fireTableCellUpdated(row, column);
+ }
+
+ public void removeRow(int row) {
+ rowData.removeElementAt(row);
+ fireTableRowsDeleted(row, rowData.size());
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/ProfileEditDialog.java b/base/console/src/com/netscape/admin/certsrv/config/ProfileEditDialog.java
new file mode 100644
index 000000000..d10e19215
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/ProfileEditDialog.java
@@ -0,0 +1,931 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Policy Parameter Configuration Dialog
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class ProfileEditDialog extends CMSBaseConfigDialog
+ implements ActionListener, ChangeListener
+{
+ protected JButton mRefresh, mOrder, mHelp;
+ protected JTextField mAuthField=null,mNameField=null, mDescField=null, mConfigField=null;
+ protected JLabel mVisibleLabel=null,mAuthLabel=null,mNameLabel=null, mDescLabel = null, mConfigLabel =null;
+ protected JComboBox mVisibleField = null;
+ protected JTable mPolicyTable=null, mInputTable=null, mOutputTable=null,
+ mAuthTable=null;
+
+ protected String mDefSetId = null;
+ protected String mName = null;
+ protected JTabbedPane mTabbedPane = null;
+ protected JButton mPolicyEdit, mPolicyAdd, mPolicyDelete;
+ protected JButton mInputEdit, mInputAdd, mInputDelete;
+ protected JButton mOutputEdit, mOutputAdd, mOutputDelete;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public ProfileEditDialog(NameValuePairs nvp,
+ JFrame parent,
+ AdminConnection conn,
+ String dest) {
+
+ super(parent, dest);
+
+ PREFIX = "PROFILEEDITDIALOG";
+ mHelpToken = "configuration-certificateprofiles";
+ mImplName_token = Constants.PR_POLICY_IMPL_NAME;
+ mImplType = Constants.PR_EXT_PLUGIN_IMPLTYPE_POLICY;
+
+ init(nvp,parent,conn,dest);
+ setSize(540, 440);
+ }
+
+
+ protected JPanel makeContentPane() {
+ JPanel mListPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mListPanel.setLayout(gb);
+
+ // 'Policy Rule ID' here
+ CMSAdminUtil.resetGBC(gbc);
+ mRulenameCaption = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "RULENAME", null);
+ mRulenameCaption.addMouseListener(this);
+ mPluginLabel = new JLabel();
+ mPluginLabel.setVisible(false);
+ mPluginName = new JTextField();
+
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ mListPanel.add(mRulenameCaption, gbc);
+
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,
+ 0,CMSAdminUtil.COMPONENT_SPACE);
+ mListPanel.add( mPluginName, gbc );
+ mListPanel.add( mPluginLabel, gbc );
+
+ // name
+ CMSAdminUtil.resetGBC(gbc);
+ mNameLabel = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "NAMENAME", null);
+ mNameLabel.addMouseListener(this);
+
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ mListPanel.add( mNameLabel, gbc );
+
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ mNameField = new JTextField();
+ mListPanel.add( mNameField, gbc );
+
+ // desc
+ CMSAdminUtil.resetGBC(gbc);
+ mDescLabel = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "DESCNAME", null);
+ mDescLabel.addMouseListener(this);
+
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ mListPanel.add( mDescLabel, gbc );
+
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ mDescField = new JTextField();
+ mListPanel.add( mDescField, gbc );
+
+ // visible
+ CMSAdminUtil.resetGBC(gbc);
+ mVisibleLabel = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "VISIBLENAME", null);
+ mVisibleLabel.addMouseListener(this);
+
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ mListPanel.add( mVisibleLabel, gbc );
+
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ String[] item = {"true", "false"};
+ mVisibleField = new JComboBox(item);
+ mListPanel.add( mVisibleField, gbc );
+
+ // auth
+ CMSAdminUtil.resetGBC(gbc);
+ mAuthLabel = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "AUTHNAME", null);
+ mAuthLabel.addMouseListener(this);
+
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ mListPanel.add( mAuthLabel, gbc );
+
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ mAuthField = new JTextField();
+ mListPanel.add( mAuthField, gbc );
+
+ // config file
+/*
+ CMSAdminUtil.resetGBC(gbc);
+ mConfigLabel = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "CONFIGNAME", null);
+ mConfigLabel.addMouseListener(this);
+
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ // mListPanel.add( mConfigLabel, gbc );
+
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ mConfigField = new JTextField();
+ // mListPanel.add( mConfigField, gbc );
+
+*/
+
+ // 'Policy Plugin ID' here
+ CMSAdminUtil.resetGBC(gbc);
+ mImplnameCaption = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "IMPLNAME", null);
+ mImplnameCaption.addMouseListener(this);
+
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ mListPanel.add( mImplnameCaption, gbc );
+
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ mImplName = new JLabel();
+ mListPanel.add( mImplName, gbc );
+
+ /* Tab */
+ mTabbedPane = new JTabbedPane();
+ Vector policyColNames = new Vector();
+ policyColNames.addElement("Set Id");
+ policyColNames.addElement("Id");
+ policyColNames.addElement("Defaults");
+ policyColNames.addElement("Constraints");
+ Vector policyData = new Vector();
+ Vector policyRow = new Vector();
+ policyRow.addElement("p1");
+ policyRow.addElement("p1");
+ policyRow.addElement("NoDefault");
+ policyRow.addElement("NoConstraint");
+ policyData.addElement(policyRow);
+ ProfileEditDataModel model = new ProfileEditDataModel();
+ model.setInfo(policyData, policyColNames);
+ mPolicyTable = new JTable(model);
+ mPolicyEdit = CMSAdminUtil.makeJButton(mResource, PREFIX, "EDIT", null, this);
+ mPolicyAdd = CMSAdminUtil.makeJButton(mResource, PREFIX, "ADD", null, this);
+ mPolicyDelete = CMSAdminUtil.makeJButton(mResource, PREFIX, "DELETE", null, this);
+ JPanel buttonPanel = createUserButtonPanel(mPolicyAdd,
+ mPolicyDelete, mPolicyEdit);
+ JPanel lpanel = createListPanel(mPolicyTable, buttonPanel,
+ policyColNames, policyData);
+
+ Vector inputColNames = new Vector();
+ inputColNames.addElement("Id");
+ inputColNames.addElement("Inputs");
+ Vector inputData = new Vector();
+ Vector inputRow = new Vector();
+ inputRow.addElement("i1");
+ inputRow.addElement("NoInput");
+ inputData.addElement(inputRow);
+ ProfileEditDataModel model1 = new ProfileEditDataModel();
+ model1.setInfo(inputData, inputColNames);
+ mInputTable = new JTable(model1);
+ mInputEdit = CMSAdminUtil.makeJButton(mResource, PREFIX, "EDIT", null, this);
+ mInputAdd = CMSAdminUtil.makeJButton(mResource, PREFIX, "ADD", null, this);
+ mInputDelete = CMSAdminUtil.makeJButton(mResource, PREFIX, "DELETE", null, this);
+ JPanel buttonPanel1 = createUserButtonPanel(mInputAdd,
+ mInputDelete, mInputEdit);
+ JPanel lpanel1 = createListPanel(mInputTable, buttonPanel1,
+ inputColNames, inputData);
+
+ Vector outputColNames = new Vector();
+ outputColNames.addElement("Id");
+ outputColNames.addElement("Outputs");
+ Vector outputData = new Vector();
+ Vector outputRow = new Vector();
+ outputRow.addElement("i1");
+ outputRow.addElement("NoOutput");
+ outputData.addElement(outputRow);
+ ProfileEditDataModel model2 = new ProfileEditDataModel();
+ model2.setInfo(outputData, outputColNames);
+ mOutputTable = new JTable(model2);
+ mOutputEdit = CMSAdminUtil.makeJButton(mResource, PREFIX, "EDIT", null, this);
+ mOutputAdd = CMSAdminUtil.makeJButton(mResource, PREFIX, "ADD", null, this);
+ mOutputDelete = CMSAdminUtil.makeJButton(mResource, PREFIX, "DELETE",
+ null , this);
+ JPanel buttonPanel2 = createUserButtonPanel(mOutputAdd,
+ mOutputDelete, mOutputEdit);
+ JPanel lpanel2 = createListPanel(mOutputTable, buttonPanel2,
+ outputColNames, outputData);
+
+// JPanel lpanel2 = createOutputPanel();
+// JPanel lpanel3 = createAuthPanel();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.fill = gbc.BOTH;
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ mTabbedPane.addTab(mResource.getString(PREFIX+"_POLICIES_TAB"), lpanel);
+ mTabbedPane.addTab(mResource.getString(PREFIX+"_INPUTS_TAB"), lpanel1);
+ mTabbedPane.addTab(mResource.getString(PREFIX+"_OUTPUTS_TAB"), lpanel2);
+
+ //mTabbedPane.addTab(mResource.getString(PREFIX+"_OUTPUTS_TAB"), lpanel2);
+ //mTabbedPane.addTab(mResource.getString(PREFIX+"_AUTHS_TAB"), lpanel3);
+ gb.setConstraints(mTabbedPane, gbc);
+ mListPanel.add(mTabbedPane);
+
+ /* Panel for list of plugin's parameters */
+ mParamPanel = new JPanel();
+/*
+ mScrollPane = new JScrollPane(mParamPanel);
+ mScrollPane.setBorder(CMSAdminUtil.makeEtchedBorder());
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.fill = gbc.BOTH;
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(mScrollPane, gbc);
+ mListPanel.add(mScrollPane);
+*/
+
+ /* Panel in which to put plugin's help text */
+ mHelpPanel = new JPanel();
+ mHelpPanel.setBorder(CMSAdminUtil.makeEtchedBorder());
+ mHelpLabel = new JTextArea(3,0);
+ mHelpLabel.setLineWrap(true);
+ mHelpLabel.setWrapStyleWord(true);
+ mHelpLabel.setBackground(mHelpPanel.getBackground());
+ mHelpLabel.setEditable(false);
+ GridBagLayout gb2 = new GridBagLayout();
+ GridBagConstraints gbc2 = new GridBagConstraints();
+
+ CMSAdminUtil.resetGBC(gbc2);
+ gbc2.fill = gbc.BOTH;
+ gbc2.anchor = gbc.WEST;
+ gbc2.gridwidth = gbc.REMAINDER;
+ gbc2.weightx = 1.0;
+ gbc2.weighty = 1.0;
+ gb2.setConstraints(mHelpLabel, gbc2);
+ mHelpPanel.setLayout(gb2);
+ mHelpPanel.add(mHelpLabel);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.SOUTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gb.setConstraints(mHelpPanel, gbc);
+ mListPanel.add(mHelpPanel);
+ mTabbedPane.addChangeListener(this);
+
+ return mListPanel;
+ }
+
+ private JTable getTable() {
+ int i = mTabbedPane.getSelectedIndex();
+ if (i == 0) {
+ return mPolicyTable;
+ } else if (i == 1) {
+ return mInputTable;
+ } else if (i == 2) {
+ return mOutputTable;
+ }
+ return null;
+ }
+
+ public JPanel createListPanel(JTable table, JPanel buttonPanel,
+ Vector column, Vector datav)
+ {
+ Vector colNames = column;
+ Vector data = datav;
+
+ JPanel listPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ listPanel.setLayout(gb);
+
+ //center table
+ JScrollPane mScrollPane = JTable.createScrollPaneForTable(table);
+ mScrollPane.setHorizontalScrollBarPolicy(mScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mScrollPane.setVerticalScrollBarPolicy(mScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ table.setAutoscrolls(true);
+ table.sizeColumnsToFit(true);
+ table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ // table.getSelectionModel().addListSelectionListener(this);
+ mScrollPane.setBackground(Color.white);
+ table.addMouseListener(this);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = 1;
+ gbc.weightx = 1.0;
+ gbc.insets = CMSAdminUtil.DEFAULT_EMPTY_INSETS;
+ gb.setConstraints(mScrollPane, gbc);
+ listPanel.add(mScrollPane);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 0.0;
+ gbc.weighty = 1.0;
+ gbc.insets = CMSAdminUtil.DEFAULT_EMPTY_INSETS;
+ gb.setConstraints(buttonPanel, gbc);
+ listPanel.add(buttonPanel);
+
+ return listPanel;
+ }
+
+ protected JPanel createUserButtonPanel(JButton add, JButton delete,
+ JButton edit) {
+ Debug.println("CMSPluginInstanceTab::createUserButtonPanel()");
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ JButton[] buttons = {add, delete, edit};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonVPanel( buttons );
+ }
+
+ public void refresh()
+ {
+ showDialog(null, mName);
+ }
+
+ public void stateChanged(ChangeEvent evt) {
+ setProfileOtherInfo(mName);
+ }
+
+ public void actionPerformed(ActionEvent evt) {
+
+ if (evt.getSource().equals(mHelp)) {
+ CMSAdminUtil.help(mHelpToken);
+ }
+
+ if (evt.getSource().equals(mPolicyAdd)) {
+ String profileId = mPluginName.getText();
+ Debug.println("Add Policy");
+ ProfilePolicySelectionDialog dialog =
+ new ProfilePolicySelectionDialog(mDefSetId, profileId,
+ "PROFILEPOLICYSELDIALOG",
+ mModel.getFrame(),
+ mAdminConnection,
+ DestDef.DEST_REGISTRY_ADMIN, mDest);
+
+ dialog.setModel(mModel);
+ dialog.setDisplay();
+ dialog.showDialog();
+ refresh();
+ }
+
+ if (evt.getSource().equals(mInputAdd)) {
+ String profileId = mPluginName.getText();
+ Debug.println("Add Input");
+ ProfileNonPolicySelDialog dialog =
+ new ProfileNonPolicySelDialog(profileId,
+ "PROFILEINPUTSELDIALOG", mModel.getFrame(),
+ mAdminConnection, DestDef.DEST_REGISTRY_ADMIN, mDest,
+ ScopeDef.SC_PROFILE_INPUT);
+ dialog.setModel(mModel);
+ dialog.setDisplay();
+ dialog.showDialog();
+ refresh();
+ }
+
+ if (evt.getSource().equals(mOutputAdd)) {
+ String profileId = mPluginName.getText();
+ Debug.println("Add Output");
+ ProfileNonPolicySelDialog dialog =
+ new ProfileNonPolicySelDialog(profileId,
+ "PROFILEOUTPUTSELDIALOG", mModel.getFrame(),
+ mAdminConnection, DestDef.DEST_REGISTRY_ADMIN, mDest,
+ ScopeDef.SC_PROFILE_OUTPUT);
+ dialog.setModel(mModel);
+ dialog.setDisplay();
+ dialog.showDialog();
+ refresh();
+ }
+
+ if (evt.getSource().equals(mPolicyDelete)) {
+ JTable table = getTable();
+ if (table.getSelectedRowCount() <= 0) {
+ String msg = mResource.getString(
+ PREFIX+"_DIALOG_NOPOLICY_MESSAGE");
+ CMSAdminUtil.showErrorDialog(mModel.getFrame(),
+ mResource, msg, CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ int i = CMSAdminUtil.showConfirmDialog(mParentFrame,
+ mResource, PREFIX, "DELETE", CMSAdminUtil.WARNING_MESSAGE);
+ if (i == JOptionPane.YES_OPTION) {
+ String policyId = (String)
+ table.getValueAt(table.getSelectedRow(), 0) + ":" +
+ table.getValueAt(table.getSelectedRow(), 1);
+ try {
+ deletePolicy(mPluginName.getText().trim(),policyId);
+
+ ProfileEditDataModel model =
+ (ProfileEditDataModel)table.getModel();
+ model.removeRow(table.getSelectedRow());
+ table.invalidate();
+ table.validate();
+ table.repaint(1);
+ } catch (EAdminException e) {
+ CMSAdminUtil.showErrorDialog(mParentFrame,
+ mResource, e.toString(), CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ Debug.println("Deleted");
+ }
+ }
+
+ if (evt.getSource().equals(mInputDelete)) {
+ JTable table = getTable();
+ if (table.getSelectedRowCount() <= 0) {
+ String msg = mResource.getString(
+ PREFIX+"_DIALOG_NOPOLICY_MESSAGE");
+ CMSAdminUtil.showErrorDialog(mModel.getFrame(),
+ mResource, msg, CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ int i = CMSAdminUtil.showConfirmDialog(mParentFrame,
+ mResource, PREFIX, "DELETE", CMSAdminUtil.WARNING_MESSAGE);
+ if (i == JOptionPane.YES_OPTION) {
+ String inputId = (String)
+ table.getValueAt(table.getSelectedRow(), 0);
+ try {
+ deleteInput(mPluginName.getText().trim(),inputId);
+
+ ProfileEditDataModel model =
+ (ProfileEditDataModel)table.getModel();
+ model.removeRow(table.getSelectedRow());
+ table.invalidate();
+ table.validate();
+ table.repaint(1);
+ } catch (EAdminException e) {
+ CMSAdminUtil.showErrorDialog(mParentFrame,
+ mResource, e.toString(), CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ Debug.println("Deleted");
+ }
+ }
+
+ if (evt.getSource().equals(mOutputDelete)) {
+ JTable table = getTable();
+ if (table.getSelectedRowCount() <= 0) {
+ String msg = mResource.getString(
+ PREFIX+"_DIALOG_NOPOLICY_MESSAGE");
+ CMSAdminUtil.showErrorDialog(mModel.getFrame(),
+ mResource, msg, CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ int i = CMSAdminUtil.showConfirmDialog(mParentFrame,
+ mResource, PREFIX, "DELETE", CMSAdminUtil.WARNING_MESSAGE);
+ if (i == JOptionPane.YES_OPTION) {
+ String outputId = (String)
+ table.getValueAt(table.getSelectedRow(), 0);
+ try {
+ deleteOutput(mPluginName.getText().trim(),outputId);
+
+ ProfileEditDataModel model =
+ (ProfileEditDataModel)table.getModel();
+ model.removeRow(table.getSelectedRow());
+ table.invalidate();
+ table.validate();
+ table.repaint(1);
+ } catch (EAdminException e) {
+ CMSAdminUtil.showErrorDialog(mParentFrame,
+ mResource, e.toString(), CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ Debug.println("Deleted");
+ }
+ }
+
+ if (evt.getSource().equals(mPolicyEdit)) {
+ JTable table = getTable();
+ // pick selected entry
+ if (table.getSelectedRowCount() <= 0) {
+ CMSAdminUtil.showErrorDialog(mModel.getFrame(),
+ mResource,
+ "You must select a policy first",
+ CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ String policyId = (String)
+ table.getValueAt(table.getSelectedRow(), 0) + ":" +
+ table.getValueAt(table.getSelectedRow(), 1);
+
+ Debug.println("Edit");
+ NameValuePairs nvp = new NameValuePairs();
+ ProfilePolicyEditDialog dialog =
+ new ProfilePolicyEditDialog(nvp,
+ mModel.getFrame(),
+ mAdminConnection,
+ // DestDef.DEST_CA_PROFILE_ADMIN);
+ mDest);
+ dialog.setModel(mModel);
+
+ String name = mPluginName.getText() + ";" + policyId;
+ Debug.println(" XXXX name=" + name);
+ dialog.showDialog(null, name);
+ }
+
+ if (evt.getSource().equals(mInputEdit)) {
+ JTable table = getTable();
+ // pick selected entry
+ if (table.getSelectedRowCount() <= 0) {
+ CMSAdminUtil.showErrorDialog(mModel.getFrame(),
+ mResource,
+ "You must select an input first",
+ CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ String inputId = (String)
+ table.getValueAt(table.getSelectedRow(), 0);
+
+ Debug.println("Edit input");
+ NameValuePairs nvp = new NameValuePairs();
+ ProfileNonPolicyNewDialog dialog =
+ new ProfileNonPolicyNewDialog(nvp,
+ mModel.getFrame(),
+ mAdminConnection,
+ //DestDef.DEST_CA_PROFILE_ADMIN,
+ mDest,
+ ScopeDef.SC_PROFILE_INPUT_CONFIG, false);
+ dialog.setModel(mModel);
+
+ String name = mPluginName.getText() + ";" + inputId;
+ Debug.println(" XXXX name=" + name);
+ dialog.showDialog(null, mPluginName.getText().trim(), inputId);
+ }
+
+ if (evt.getSource().equals(mOutputEdit)) {
+ JTable table = getTable();
+ // pick selected entry
+ if (table.getSelectedRowCount() <= 0) {
+ CMSAdminUtil.showErrorDialog(mModel.getFrame(),
+ mResource,
+ "You must select an output first",
+ CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ String outputId = (String)
+ table.getValueAt(table.getSelectedRow(), 0);
+
+ Debug.println("Edit output");
+ NameValuePairs nvp = new NameValuePairs();
+ ProfileNonPolicyNewDialog dialog =
+ new ProfileNonPolicyNewDialog(nvp,
+ mModel.getFrame(),
+ mAdminConnection,
+ // DestDef.DEST_CA_PROFILE_ADMIN,
+ mDest,
+ ScopeDef.SC_PROFILE_OUTPUT_CONFIG, false);
+ dialog.setModel(mModel);
+
+ String name = mPluginName.getText() + ";" + outputId;
+ Debug.println(" XXXX name=" + name);
+ dialog.showDialog(null, mPluginName.getText().trim(), outputId);
+ }
+
+ if (evt.getSource().equals(mOK)) {
+
+ NameValuePairs nvp = new NameValuePairs();
+ try {
+ if (mModel != null)
+ mModel.progressStart();
+
+ String instanceName = mPluginName.getText();
+ nvp.put("impl", mImplName.getText());
+ nvp.put("name", mNameField.getText());
+ nvp.put("desc", mDescField.getText());
+ nvp.put("visible", (String) (mVisibleField.getSelectedItem()));
+ nvp.put("auth", mAuthField.getText());
+ // nvp.add("config", mConfigField.getText());
+
+/*
+ // mAdminConnection.add(DestDef.DEST_CA_PROFILE_ADMIN,
+ ScopeDef.SC_PROFILE_RULES, instanceName, nvp);
+*/
+ //DestDef.DEST_CA_PROFILE_ADMIN,
+ mAdminConnection.modify(mDest,
+ ScopeDef.SC_PROFILE_RULES, instanceName, nvp);
+
+ mIsOK = true;
+ if (mModel != null)
+ mModel.progressStop();
+ this.dispose();
+ } catch (EAdminException ex) {
+ mModel.progressStop();
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ ex.toString(),CMSAdminUtil.ERROR_MESSAGE);
+ }
+ }
+
+ if (evt.getSource().equals(mCancel)) {
+ this.dispose();
+ }
+
+ }
+
+ private void deletePolicy(String profileId, String policyId)
+ throws EAdminException{
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put("POLICYID", policyId);
+ //mAdminConnection.delete(DestDef.DEST_CA_PROFILE_ADMIN,
+ mAdminConnection.delete(mDest,
+ ScopeDef.SC_PROFILE_POLICIES, profileId, nvps);
+ }
+
+ private void deleteInput(String profileId, String inputId)
+ throws EAdminException{
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put("INPUTID", inputId);
+ //mAdminConnection.delete(DestDef.DEST_CA_PROFILE_ADMIN,
+ mAdminConnection.delete(mDest,
+ ScopeDef.SC_PROFILE_INPUT, profileId, nvps);
+ }
+
+ private void deleteOutput(String profileId, String outputId)
+ throws EAdminException{
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put("OUTPUTID", outputId);
+ //mAdminConnection.delete(DestDef.DEST_CA_PROFILE_ADMIN,
+ mAdminConnection.delete(mDest,
+ ScopeDef.SC_PROFILE_OUTPUT, profileId, nvps);
+ }
+
+ public void showDialog(NameValuePairs data, String name) {
+
+ mName = name;
+ setProfileInfo(name);
+ setProfileOtherInfo(name);
+
+ this.show();
+ }
+
+ private void setProfileInfo(String name) {
+ mModel.progressStart();
+
+ // retrieve profile information
+ NameValuePairs response = null;
+ NameValuePairs request = new NameValuePairs();
+ try {
+ //response = mAdminConnection.read(DestDef.DEST_CA_PROFILE_ADMIN,
+ response = mAdminConnection.read(mDest,
+ ScopeDef.SC_PROFILE_RULES,
+ name, request);
+ } catch (EAdminException e) {
+// CMSAdminUtil.showErrorDialog(mParentFrame, mResource, e.toString());
+ mModel.progressStop();
+ }
+ mModel.progressStop();
+
+ String enable = response.get("enable");
+
+ if (response != null) {
+ mPluginName.setEnabled(false);
+ mPluginName.setBackground(getBackground());
+ mPluginName.setText(name);
+ mNameField.setText(response.get("name"));
+ mDescField.setText(response.get("desc"));
+ mAuthField.setText(response.get("auth"));
+ mVisibleField.setSelectedItem(response.get("visible"));
+ mImplName.setText(response.get("plugin"));
+ // mConfigField.setText(response.getValue("config"));
+ }
+ if (enable != null && enable.equals("true")) {
+ // disable everything
+ mNameField.setEnabled(false);
+ mDescField.setEnabled(false);
+ mAuthField.setEnabled(false);
+ mVisibleField.setEnabled(false);
+ mImplName.setEnabled(false);
+
+ mPolicyEdit.setEnabled(false);
+ mPolicyAdd.setEnabled(false);
+ mPolicyDelete.setEnabled(false);
+
+ mInputEdit.setEnabled(false);
+ mInputAdd.setEnabled(false);
+ mInputDelete.setEnabled(false);
+
+ mOutputEdit.setEnabled(false);
+ mOutputAdd.setEnabled(false);
+ mOutputDelete.setEnabled(false);
+ }
+ }
+
+ private void setProfileOtherInfo(String name) {
+ if (mModel != null)
+ mModel.progressStart();
+ JTable table = getTable();
+ NameValuePairs request = new NameValuePairs();
+ NameValuePairs response = null;
+ if (table == mPolicyTable) {
+ try {
+ response = mAdminConnection.read(
+ mDest,
+ ScopeDef.SC_PROFILE_POLICIES, name, request);
+ } catch (EAdminException e) {
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ e.toString(), CMSAdminUtil.ERROR_MESSAGE);
+ if (mModel != null)
+ mModel.progressStop();
+ return;
+ }
+
+ if (mModel != null)
+ mModel.progressStop();
+ if (response != null) {
+ populatePolicies(response, table);
+ }
+ } else if (table == mInputTable) {
+ try {
+ response = mAdminConnection.read(
+ mDest,
+ ScopeDef.SC_PROFILE_INPUT, name, request);
+ } catch (EAdminException e) {
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ e.toString(), CMSAdminUtil.ERROR_MESSAGE);
+ if (mModel != null)
+ mModel.progressStop();
+ return;
+ }
+
+ if (mModel != null)
+ mModel.progressStop();
+ if (response != null) {
+ populateNonPolicy(response, table);
+ }
+ } else if (table == mOutputTable) {
+ try {
+ response = mAdminConnection.read(
+ mDest,
+ ScopeDef.SC_PROFILE_OUTPUT, name, request);
+ } catch (EAdminException e) {
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ e.toString(), CMSAdminUtil.ERROR_MESSAGE);
+ if (mModel != null)
+ mModel.progressStop();
+ return;
+ }
+
+ if (mModel != null)
+ mModel.progressStop();
+ if (response != null) {
+ populateNonPolicy(response, table);
+ }
+ } else {
+ // do nothing
+ }
+ }
+
+ private void populatePolicies(NameValuePairs response, JTable table) {
+ Vector<String> colNames = new Vector<String>();
+ colNames.addElement("Set Id");
+ colNames.addElement("Id");
+ colNames.addElement("Defaults");
+ colNames.addElement("Constraints");
+ Vector<Vector<String>> d = new Vector<Vector<String>>();
+
+ for (String entry : response.keySet()) {
+ entry = entry.trim();
+ String value = response.get(entry);
+ Debug.println("populatePolicies entry= "+entry);
+ Debug.println("populatePolicies value= "+value);
+
+ StringTokenizer st = new StringTokenizer(value, ";");
+ String def = st.nextToken();
+ String con = st.nextToken();
+ Vector<String> row = new Vector<String>();
+
+ StringTokenizer st1 = new StringTokenizer(entry, ":");
+ String setId = st1.nextToken();
+ String id = st1.nextToken();
+
+ if (mDefSetId == null) {
+ mDefSetId = setId;
+ }
+ row.addElement(setId);
+ row.addElement(id);
+ row.addElement(def);
+ row.addElement(con);
+ d.addElement(row);
+ }
+ ProfileEditDataModel model = new ProfileEditDataModel();
+ model.setInfo(d, colNames);
+ table.setModel(model);
+ }
+
+ private void populateNonPolicy(NameValuePairs response, JTable table) {
+ Vector<String> colNames = new Vector<String>();
+ colNames.addElement("Id");
+ if (table == mInputTable)
+ colNames.addElement("Inputs");
+ else if (table == mOutputTable)
+ colNames.addElement("Outputs");
+ Vector<Vector<String>> d = new Vector<Vector<String>>();
+
+ for (String entry : response.keySet()) {
+ entry = entry.trim();
+ String value = response.get(entry);
+ Debug.println("populateNonPolicy entry= " + entry);
+ Debug.println("populateNonPolicy value= " + value);
+
+ Vector<String> row = new Vector<String>();
+ row.addElement(entry);
+ row.addElement(value);
+ d.addElement(row);
+ }
+ ProfileEditDataModel model = new ProfileEditDataModel();
+ model.setInfo(d, colNames);
+ table.setModel(model);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/ProfileImplDataModel.java b/base/console/src/com/netscape/admin/certsrv/config/ProfileImplDataModel.java
new file mode 100644
index 000000000..eee2531cf
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/ProfileImplDataModel.java
@@ -0,0 +1,70 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Policy Implementation Data model - represents the implementation
+ * table information
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class ProfileImplDataModel extends CMSContentTableModel
+ implements IDataProcessor
+{
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ public static final String IMPL_NAME = "NAME";
+ public static final String IMPL_CLASS = "CLASS";
+ public static final String IMPL_TYPE = "TYPE";
+ public static final String IMPL_DESC = "DESC";
+
+ private static String[] mColumns = {POLICY_IMPL, IMPL_TYPE, CLASSNAME};
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public ProfileImplDataModel() {
+ super();
+ init(mColumns);
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public void processData(Object data) {
+ Vector v = new Vector();
+ NameValuePairs obj = (NameValuePairs) data;
+ v.addElement(new JLabel(obj.get(IMPL_NAME),
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE_PLUGIN),
+ JLabel.LEFT));
+ v.addElement(obj.get(IMPL_TYPE));
+ v.addElement(obj.get(IMPL_CLASS));
+ //v.addElement(obj.getValue(IMPL_DESC));
+ addRow(v, data);
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/ProfileImplTab.java b/base/console/src/com/netscape/admin/certsrv/config/ProfileImplTab.java
new file mode 100644
index 000000000..c7d28dd07
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/ProfileImplTab.java
@@ -0,0 +1,382 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.ug.*;
+import javax.swing.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Policy Instances Management Tab
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class ProfileImplTab extends CMSBaseUGTab {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String IMPL_NAME = ProfileImplDataModel.IMPL_NAME;
+ private static final String IMPL_TYPE = ProfileImplDataModel.IMPL_TYPE;
+ private static final String IMPL_CLASS = ProfileImplDataModel.IMPL_CLASS;
+ private static final String IMPL_DESC = ProfileImplDataModel.IMPL_DESC;
+
+ private static final String PANEL_NAME = "PROFILEIMPL";
+ private static final String DIALOG_PREFIX = "PROFILEREGISTERDIALOG";
+
+ private AdminConnection mConnection;
+ private String mDestination;
+
+ protected JScrollPane mScrollPane;
+ protected JTable mTable; //table
+ protected ProfileImplDataModel mDataModel; //table model
+ protected ProfileRegisterDialog mEditor=null; //keep single copy
+ protected ViewDialog mViewer=null; //keep single copy
+
+ protected JButton mRefresh, mAdd, mDelete, mView, mHelp;
+ private final static String HELPINDEX = "configuration-certificateprofiles";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public ProfileImplTab(CMSBaseResourceModel model, String destination) {
+ super(PANEL_NAME, model);
+ mConnection = model.getServerInfo().getAdmin();
+ mDataModel = new ProfileImplDataModel();
+ mDestination = destination;
+ mHelpToken = HELPINDEX;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mRefresh)) {
+ refresh();
+ }
+ if (e.getSource().equals(mAdd)) {
+ if (mEditor==null)
+ mEditor = new ProfileRegisterDialog(mModel.getFrame(),
+ mConnection);
+ mEditor.showDialog(mDestination, ScopeDef.SC_POLICY_IMPLS);
+ refresh();
+ }
+ if (e.getSource().equals(mDelete)) {
+ Debug.println("Delete");
+ if(mTable.getSelectedRow()< 0)
+ return;
+ int i = showConfirmDialog("DELETE");
+ if (i == JOptionPane.YES_OPTION) {
+ delete();
+ Debug.println("Deleted");
+ }
+ }
+ if (e.getSource().equals(mView)) {
+ Debug.println("View");
+ if(mTable.getSelectedRow()< 0)
+ return;
+ NameValuePairs obj = (NameValuePairs)
+ mDataModel.getObjectValueAt(mTable.getSelectedRow());
+ if (mViewer==null)
+ mViewer = new ViewDialog(mModel.getFrame());
+ mViewer.showDialog(obj.get(IMPL_NAME),
+ obj.get(IMPL_CLASS),
+ obj.get(IMPL_DESC));
+ }
+ if (e.getSource().equals(mHelp)) {
+ helpCallback();
+ }
+ }
+
+ //==== MOUSELISTENER ======================
+ public void mouseClicked(MouseEvent e) {
+ setButtons();
+ }
+
+ public void mouseReleased(MouseEvent e) {
+ setButtons();
+ }
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+ public void refresh() {
+
+ mDataModel.removeAllRows();
+ update();
+
+ setButtons();
+ mTable.invalidate();
+ mTable.validate();
+ mTable.repaint(1);
+ }
+
+ /**
+ * create the user action button panel
+ */
+ protected JPanel createButtonPanel() {
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mAdd = makeJButton("ADD");
+ mDelete = makeJButton("DELETE");
+ mView = makeJButton("VIEW");
+ JButton[] buttons = {mAdd, mDelete, mView};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonVPanel( buttons );
+ }
+
+ protected JPanel createActionPanel() {
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mRefresh = makeJButton("REFRESH");
+ mHelp = makeJButton("HELP");
+ //JButton[] buttons = { mRefresh, mHelp };
+ JButton[] buttons = { mRefresh };
+ return makeJButtonPanel(buttons, true);
+ }
+
+ protected JPanel createListPanel() {
+ mListPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mListPanel.setLayout(gb);
+
+ //center table
+ mTable = new JTable(mDataModel);
+ mScrollPane = JTable.createScrollPaneForTable(mTable);
+ //mScrollPane.setBorder(CMSAdminUtil.makeTitledBorder(mResource,PANEL_NAME,"USERS"));
+ mScrollPane.setHorizontalScrollBarPolicy(mScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mScrollPane.setVerticalScrollBarPolicy(mScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ mTable.setAutoscrolls(true);
+ mTable.sizeColumnsToFit(true);
+ mTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ mTable.getSelectionModel().addListSelectionListener(this);
+ mScrollPane.setBackground(Color.white);
+ mTable.addMouseListener(this);
+ setLabelCellRenderer(mTable,0);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = 1;
+ gbc.weightx = 1.0;
+ gbc.insets = EMPTY_INSETS;
+ gb.setConstraints(mScrollPane, gbc);
+ mListPanel.add(mScrollPane);
+
+ JPanel buttonPanel = createButtonPanel();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 0.0;
+ gbc.weighty = 1.0;
+ gbc.insets = EMPTY_INSETS;
+ gb.setConstraints(buttonPanel, gbc);
+ mListPanel.add(buttonPanel);
+
+ refresh();
+
+ return mListPanel;
+ }
+
+ //Set the first column's cellrender as label cell
+ protected void setLabelCellRenderer(JTable table, int index) {
+ table.getColumnModel().getColumn(index).setCellRenderer(new LabelCellRenderer(new JLabel()));
+ }
+
+
+ //set buttons
+ private void setButtons() {
+
+ //enable and diable buttons accordingly
+ //Debug.println("setButtons() - "+mTable.getSelectedRow());
+ //Debug.println("setButtons() - "+mTable.getSelectionModel().isSelectionEmpty());
+ if (mTable.getSelectionModel().isSelectionEmpty()) {
+ mDelete.setEnabled(false);
+ mView.setEnabled(false);
+ return;
+ }
+
+ if(mDataModel.getRowCount()<=0) {
+ mDelete.setEnabled(false);
+ mView.setEnabled(false);
+ return;
+ }
+
+ mDelete.setEnabled(true);
+ mView.setEnabled(true);
+
+ }
+
+ //=============================================
+ // SEND REQUESTS TO THE SERVER SIDE
+ //=============================================
+ private void update() {
+ //send request and parse data
+
+ mModel.progressStart();
+ NameValuePairs response = new NameValuePairs();
+ NameValuePairs response1;
+ NameValuePairs response2;
+ NameValuePairs response3;
+ NameValuePairs response4;
+ NameValuePairs response5;
+ try {
+ response1 = mConnection.search(mDestination,
+ "profile",
+ new NameValuePairs());
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ mModel.progressStop();
+ return;
+ }
+ for (String entry : response1.keySet()) {
+ entry = entry.trim();
+ response.put(entry + ";profile", response1.get(entry));
+ }
+ try {
+ response2 = mConnection.search(mDestination,
+ "profileInput",
+ new NameValuePairs());
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ mModel.progressStop();
+ return;
+ }
+ for (String entry : response2.keySet()) {
+ entry = entry.trim();
+ response.put(entry + ";profileInput", response2.get(entry));
+ }
+ try {
+ response3 = mConnection.search(mDestination,
+ "profileOutput",
+ new NameValuePairs());
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ mModel.progressStop();
+ return;
+ }
+ for (String entry : response3.keySet()) {
+ entry = entry.trim();
+ response.put(entry + ";profileOutput", response3.get(entry));
+ }
+ try {
+ response4 = mConnection.search(mDestination,
+ "defaultPolicy",
+ new NameValuePairs());
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ mModel.progressStop();
+ return;
+ }
+ for (String entry : response4.keySet()) {
+ entry = entry.trim();
+ response.put(entry + ";defaultPolicy", response4.get(entry));
+ }
+ try {
+ response5 = mConnection.search(mDestination,
+ "constraintPolicy",
+ new NameValuePairs());
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ mModel.progressStop();
+ return;
+ }
+ for (String entry : response5.keySet()) {
+ entry = entry.trim();
+ response.put(entry + ";constraintPolicy", response5.get(entry));
+ }
+
+ //parse the data
+ int i=0;
+ String[] vals = new String[response.size()];
+ Hashtable data = new Hashtable();
+ for (String entry : response.keySet()) {
+ entry = entry.trim();
+ String value = response.get(entry);
+ int x = value.indexOf(",");
+ int x_end = value.lastIndexOf(",");
+ int y = entry.indexOf(";");
+ NameValuePairs obj = new NameValuePairs();
+ obj.put(IMPL_NAME, entry.substring(0, y));
+ obj.put(IMPL_TYPE, entry.substring(y + 1));
+ vals[i++]= entry ;
+ obj.put(IMPL_CLASS, value.substring(0, x));
+ obj.put(IMPL_DESC, value.substring(x + 1, x_end));
+ data.put(entry,obj);
+ }
+
+ CMSAdminUtil.bubbleSort(vals);
+
+ for (int y=0; y< vals.length ; y++) {
+ mDataModel.processData(data.get(vals[y]));
+ }
+
+ data.clear();
+
+ if (mDataModel.getRowCount() >0)
+ mTable.setRowSelectionInterval(0,0);
+
+ mModel.progressStop();
+ }
+
+ private void delete() {
+ //get entry name
+ mModel.progressStart();
+ NameValuePairs obj = (NameValuePairs)
+ mDataModel.getObjectValueAt(mTable.getSelectedRow());
+
+ //send comment to server for the removal of user
+ try {
+ mConnection.delete(mDestination,
+ obj.get(IMPL_TYPE),
+ obj.get(IMPL_NAME));
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ mModel.progressStop();
+ return;
+ }
+ mModel.progressStop();
+ //send comment to server and refetch the content
+ refresh();
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/ProfileInstanceTab.java b/base/console/src/com/netscape/admin/certsrv/config/ProfileInstanceTab.java
new file mode 100644
index 000000000..6dbc1dceb
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/ProfileInstanceTab.java
@@ -0,0 +1,161 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.ug.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Profile Instances Management Tab
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class ProfileInstanceTab extends CMSPluginInstanceTab {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PANEL_NAME = "PROFILERULE";
+
+ protected JButton mOrder;
+ private final static String HELPINDEX = "configuration-certificateprofiles";
+ private ResourceBundle mResource;
+ private String mDest;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public ProfileInstanceTab(CMSBaseResourceModel model, String dest) {
+ super(model,dest,PANEL_NAME);
+ Debug.println("PolicyInstanceTab::PolicyInstanceTab(<model>,"+dest);
+ mConnection = model.getServerInfo().getAdmin();
+ mDataModel = new ProfileRuleDataModel();
+ mScope = ScopeDef.SC_POLICY_RULES;
+ mDest = dest;
+ RULE_NAME = PolicyRuleDataModel.RULE_NAME;
+ RULE_STAT = PolicyRuleDataModel.RULE_STAT;
+ mResource = ResourceBundle.getBundle(
+ CMSAdminResources.class.getName());
+
+ mHelpToken = HELPINDEX;
+ }
+
+ public CMSBaseConfigDialog makeEditConfigDialog(
+ NameValuePairs nvp,
+ JFrame parent,
+ AdminConnection conn,
+ String dest
+ )
+ {
+ return new ProfileEditDialog(nvp,
+ parent,
+ conn,
+ dest);
+ }
+
+ public CMSBaseConfigDialog makeNewConfigDialog(
+ NameValuePairs nvp,
+ JFrame parent,
+ AdminConnection conn,
+ String dest
+ )
+ {
+
+ return new ProfileConfigDialog(nvp,
+ parent,
+ conn,
+ dest);
+ }
+
+ public PluginSelectionDialog getPluginSelectionDialog(
+ JFrame parent,
+ AdminConnection conn,
+ String dest,
+ CMSPluginInstanceTab pluginType
+ )
+ {
+ return new ProfilePluginSelectionDialog(parent,conn,DestDef.DEST_REGISTRY_ADMIN, dest, pluginType);
+ }
+
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mEdit) || e.getSource().equals(mDelete)) {
+ if(mTable.getSelectedRow()< 0)
+ return;
+ NameValuePairs data = (NameValuePairs)
+ mDataModel.getObjectValueAt(mTable.getSelectedRow());
+ // dont check enable and disable here. We want to
+ // view profile even though it is enabled
+ }
+
+ super.actionPerformed(e);
+ }
+
+ public void moreActionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mOrder)) {
+ Debug.println("Order");
+ PolicyRuleOrderDialog dialog =
+ new PolicyRuleOrderDialog(mModel.getFrame(),
+ mConnection, mDestination);
+ dialog.showDialog(mDataModel.getRules());
+ refresh();
+ }
+ }
+
+ /**
+ * create the user action button panel
+ */
+ protected JPanel createUserButtonPanel() {
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mOrder = makeJButton("ORDER");
+ mEdit = makeJButton("EDIT");
+ mAdd = makeJButton("ADD");
+ mDelete = makeJButton("DELETE");
+ JButton[] buttons = {mAdd, mDelete, mEdit };
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonVPanel( buttons );
+ }
+
+
+ //set buttons
+ protected void setButtons() {
+ super.setButtons();
+
+ if (mDataModel.getRowCount()<=0) {
+ mOrder.setEnabled(false);
+ }
+ else {
+ mOrder.setEnabled(true);
+ }
+ }
+
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/ProfileListDataModel.java b/base/console/src/com/netscape/admin/certsrv/config/ProfileListDataModel.java
new file mode 100644
index 000000000..2e4633046
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/ProfileListDataModel.java
@@ -0,0 +1,60 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Profile List Model
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class ProfileListDataModel extends DefaultListModel {
+
+ private Vector mObjectContainer = new Vector();
+
+ public Object getObjectValueAt(int row) {
+ return mObjectContainer.elementAt(row);
+ }
+
+ public void removeAllRows() {
+ super.removeAllElements();
+ mObjectContainer.removeAllElements();
+ }
+
+ public void addElement(Object displayData, Object extraData) {
+ super.addElement(displayData);
+ mObjectContainer.addElement(extraData);
+ }
+
+ public void clear() {
+ super.clear();
+ mObjectContainer.clear();
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/ProfileNonPolicyNewDialog.java b/base/console/src/com/netscape/admin/certsrv/config/ProfileNonPolicyNewDialog.java
new file mode 100644
index 000000000..e597b242b
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/ProfileNonPolicyNewDialog.java
@@ -0,0 +1,429 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Policy Parameter Configuration Dialog
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class ProfileNonPolicyNewDialog extends CMSBaseConfigDialog
+ implements ActionListener
+{
+ protected JButton mRefresh, mEdit, mAdd, mDelete, mOrder, mHelp;
+ protected JTextField mNameField=null, mDescField=null, mConfigField=null;
+ protected JLabel mNameLabel=null, mDescLabel = null, mConfigLabel =null;
+ protected JTable mTable = null;
+ private String mParamId = null, mInputId = null;
+ private String mScope = null;
+ private boolean mIsNew = true;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public ProfileNonPolicyNewDialog(NameValuePairs nvp,
+ JFrame parent,
+ AdminConnection conn,
+ String dest, String scope, boolean new1) {
+
+ super(parent, dest);
+
+ PREFIX = "PROFILEREGISTRYNEWDIALOG";
+ mHelpToken = "configuration-certificateprofiles";
+ mImplName_token = Constants.PR_POLICY_IMPL_NAME;
+ mImplType = Constants.PR_EXT_PLUGIN_IMPLTYPE_POLICY;
+ mIsNew = new1;
+ mScope = scope;
+
+ init(nvp,parent,conn,dest);
+ setSize(500, 415);
+ }
+
+
+ protected JPanel makeContentPane() {
+ JPanel mListPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mListPanel.setLayout(gb);
+
+ // 'Policy Rule ID' here
+ CMSAdminUtil.resetGBC(gbc);
+ mRulenameCaption = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "RULENAME", null);
+ mRulenameCaption.addMouseListener(this);
+ mPluginLabel = new JLabel();
+ mPluginLabel.setVisible(false);
+ mPluginName = new JTextField();
+
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ mListPanel.add(mRulenameCaption, gbc);
+
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,
+ 0,CMSAdminUtil.COMPONENT_SPACE);
+ mListPanel.add( mPluginName, gbc );
+ // mListPanel.add( mPluginLabel, gbc );
+
+ // name
+ CMSAdminUtil.resetGBC(gbc);
+ mNameLabel = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "NAMENAME", null);
+ mNameLabel.addMouseListener(this);
+
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ // mListPanel.add( mNameLabel, gbc );
+ mNameLabel.setBackground(getBackground());
+ mNameLabel.setEnabled(false);
+
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ mNameField = new JTextField();
+ // mListPanel.add( mNameField, gbc );
+
+ // desc
+ CMSAdminUtil.resetGBC(gbc);
+ mDescLabel = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "DESCNAME", null);
+ // mDescLabel.addMouseListener(this);
+
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ mListPanel.add( mDescLabel, gbc );
+
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ mDescField = new JTextField();
+ mListPanel.add( mDescField, gbc );
+
+ // config file
+/*
+ CMSAdminUtil.resetGBC(gbc);
+ mConfigLabel = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "CONFIGNAME", null);
+ mConfigLabel.addMouseListener(this);
+
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ // mListPanel.add( mConfigLabel, gbc );
+
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ mConfigField = new JTextField();
+ // mListPanel.add( mConfigField, gbc );
+*/
+
+
+ // 'Policy Plugin ID' here
+ CMSAdminUtil.resetGBC(gbc);
+ mImplnameCaption = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "IMPLNAME", null);
+ mImplnameCaption.addMouseListener(this);
+
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ // mListPanel.add( mImplnameCaption, gbc );
+
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ mImplName = new JLabel();
+// mListPanel.add( mImplName, gbc );
+
+ JPanel lpanel1 = createListPanel();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.fill = gbc.BOTH;
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(lpanel1, gbc);
+ mListPanel.add(lpanel1);
+
+ /* Panel in which to put plugin's help text */
+ mHelpPanel = new JPanel();
+ mHelpPanel.setBorder(CMSAdminUtil.makeEtchedBorder());
+ mHelpLabel = new JTextArea(3,0);
+ mHelpLabel.setLineWrap(true);
+ mHelpLabel.setWrapStyleWord(true);
+ mHelpLabel.setBackground(mHelpPanel.getBackground());
+ mHelpLabel.setEditable(false);
+ GridBagLayout gb2 = new GridBagLayout();
+ GridBagConstraints gbc2 = new GridBagConstraints();
+
+ CMSAdminUtil.resetGBC(gbc2);
+ gbc2.fill = gbc.BOTH;
+ gbc2.anchor = gbc.WEST;
+ gbc2.gridwidth = gbc.REMAINDER;
+ gbc2.weightx = 1.0;
+ gbc2.weighty = 1.0;
+ gb2.setConstraints(mHelpLabel, gbc2);
+ mHelpPanel.setLayout(gb2);
+ mHelpPanel.add(mHelpLabel);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.SOUTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gb.setConstraints(mHelpPanel, gbc);
+ mListPanel.add(mHelpPanel);
+
+ return mListPanel;
+ }
+
+ public JPanel createListPanel()
+ {
+ Vector colNames = new Vector();
+ colNames.addElement("Parameter");
+ colNames.addElement("Value");
+ Vector data = new Vector();
+ Vector row = new Vector();
+ row.addElement("x");
+ row.addElement("x");
+ data.addElement(row);
+
+ JPanel mListPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mListPanel.setLayout(gb);
+
+ //center table
+ ProfilePolicyEditDataModel model = new ProfilePolicyEditDataModel();
+ model.setInfo(data, colNames);
+ mTable = new JTable(model);
+ JScrollPane mScrollPane = JTable.createScrollPaneForTable(mTable);
+ mScrollPane.setHorizontalScrollBarPolicy(mScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mScrollPane.setVerticalScrollBarPolicy(mScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ mTable.setAutoscrolls(true);
+ mTable.sizeColumnsToFit(true);
+ mTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ // mTable.getSelectionModel().addListSelectionListener(this);
+ mScrollPane.setBackground(Color.white);
+ mTable.addMouseListener(this);
+// setLabelCellRenderer(mTable,0);
+setLabelCellEditor(mTable, 1);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ // gbc.gridwidth = 1;
+ // gbc.weightx = 1.0;
+ gbc.insets = CMSAdminUtil.DEFAULT_EMPTY_INSETS;
+ gb.setConstraints(mScrollPane, gbc);
+ mListPanel.add(mScrollPane);
+
+ return mListPanel;
+ }
+
+ public void actionPerformed(ActionEvent evt) {
+
+ if (evt.getSource().equals(mHelp)) {
+ CMSAdminUtil.help(mHelpToken);
+ }
+
+ if (evt.getSource().equals(mOK)) {
+
+ try {
+ if (mModel != null) {
+ mModel.progressStart();
+ }
+
+ NameValuePairs nvp = new NameValuePairs();
+ String instanceName = mPluginName.getText();
+
+ String id = mDescField.getText();
+ if (id == null || id.trim().equals("")) {
+ String msg = mResource.getString(
+ PREFIX+"_DIALOG_BLANKPOLICYID_MESSAGE");
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ msg ,CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+
+ for (int i = 0; i < mTable.getRowCount(); i++) {
+ nvp.put((String) mTable.getValueAt(i, 0),
+ (String) mTable.getValueAt(i, 1));
+ }
+
+ if (mIsNew) {
+ String name = instanceName + ";" + id + ";" + mParamId;
+ // mAdminConnection.add(DestDef.DEST_CA_PROFILE_ADMIN,
+ mAdminConnection.add(mDest,
+ mScope, name, nvp);
+ //ScopeDef.SC_PROFILE_INPUT, name, nvp);
+ } else {
+ String name = instanceName + ";" + id;
+ //mAdminConnection.modify(DestDef.DEST_CA_PROFILE_ADMIN,
+ mAdminConnection.modify(mDest,
+ mScope, name, nvp);
+ //ScopeDef.SC_PROFILE_INPUT_CONFIG, name, nvp);
+ }
+
+ mIsOK = true;
+ if (mModel != null) {
+ mModel.progressStop();
+ }
+
+ this.dispose();
+ }
+ catch (EAdminException ex) {
+ mModel.progressStop();
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ ex.toString(),CMSAdminUtil.ERROR_MESSAGE);
+ }
+ }
+
+ if (evt.getSource().equals(mCancel)) {
+ this.dispose();
+ }
+
+ }
+
+ public void showDialog(NameValuePairs data, String profileId, String paramId) {
+
+ if (mIsNew)
+ mParamId = paramId;
+ else {
+ mInputId = paramId;
+ mDescField.setText(paramId);
+ mDescField.setBackground(getBackground());
+ mDescField.setEnabled(false);
+ }
+
+ mModel.progressStart();
+
+ // retrieve profile information
+ NameValuePairs response = null;
+ NameValuePairs request = new NameValuePairs();
+ try {
+ if (mIsNew)
+ response = mAdminConnection.read(DestDef.DEST_REGISTRY_ADMIN,
+ //ScopeDef.SC_PROFILE_INPUT,
+ mScope, paramId, request);
+ else
+ // response = mAdminConnection.read(DestDef.DEST_CA_PROFILE_ADMIN,
+ response = mAdminConnection.read(mDest,
+ //ScopeDef.SC_PROFILE_INPUT_CONFIG,
+ mScope, profileId+";"+mInputId, request);
+ } catch (EAdminException e) {
+// CMSAdminUtil.showErrorDialog(mParentFrame, mResource, e.toString());
+ mModel.progressStop();
+ }
+ mModel.progressStop();
+
+ Vector defcolNames = new Vector();
+ defcolNames.addElement("Parameter");
+ defcolNames.addElement("Value");
+ Vector defdata = new Vector();
+
+ for (String entry : response.keySet()) {
+ entry = entry.trim();
+ String value = response.get(entry);
+ Debug.println("entry= " + entry);
+ Debug.println("value= " + value);
+
+ int start_pos = value.indexOf(';');
+ int end_pos = value.lastIndexOf(';');
+ String syntax = null;
+ String syntaxVal = null;
+ String val = null;
+
+ syntax = value.substring(0,start_pos);
+ syntaxVal = value.substring(start_pos+1, end_pos);
+ val = value.substring(end_pos+1);
+
+ Vector row = new Vector();
+ row.addElement(entry);
+ row.addElement(val);
+ defdata.addElement(row);
+ }
+ ProfilePolicyEditDataModel model = new ProfilePolicyEditDataModel();
+ model.setInfo(defdata, defcolNames);
+ mTable.setModel(model);
+
+ if (response != null) {
+ mPluginName.setText(profileId);
+ mPluginName.setBackground(getBackground());
+ mPluginName.setEnabled(false);
+ mNameField.setText(response.get("name"));
+ if (mIsNew)
+ mDescField.setText(response.get("desc"));
+ }
+
+ this.show();
+ }
+
+ protected void setLabelCellEditor(JTable table, int index) {
+/*
+ table.getColumnModel().getColumn(index).setCellRenderer(
+ new PasswordCellRenderer());
+*/
+ table.getColumnModel().getColumn(index).setCellEditor(
+ new DefaultCellEditor(new JTextField()));
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/ProfileNonPolicySelDialog.java b/base/console/src/com/netscape/admin/certsrv/config/ProfileNonPolicySelDialog.java
new file mode 100644
index 000000000..8d97ffd13
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/ProfileNonPolicySelDialog.java
@@ -0,0 +1,386 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Plugin Selection Dialog
+ *
+ * @author Jack Pan-chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class ProfileNonPolicySelDialog extends JDialog
+ implements ActionListener, MouseListener
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ protected JFrame mParentFrame;
+ protected AdminConnection mConnection;
+ protected ResourceBundle mResource;
+ protected DefaultListModel mListModel;
+ protected Hashtable mListData;
+ protected String mDestination; //dest flag
+
+ private JScrollPane mScrollPane;
+ protected JList mList;
+
+ protected JLabel mLabel;
+ protected JButton mOK, mCancel, mHelp;
+ protected String mPrefix;
+ protected String mScope;
+ protected String mInstanceScope;
+ protected String mProfileId;
+ protected String mHelpToken;
+ protected String mExtraDestination;
+ protected CMSPluginInstanceTab mPluginInstanceDialog;
+ protected CMSBaseResourceModel mModel=null;
+
+
+ public ProfileNonPolicySelDialog (
+ String profileId,
+ String prefix,
+ JFrame parent,
+ AdminConnection conn,
+ String dest, String scope)
+ {
+ this(profileId, prefix, parent, conn, dest, null, scope, null);
+ }
+
+ public ProfileNonPolicySelDialog (
+ String profileId,
+ String prefix,
+ JFrame parent,
+ AdminConnection conn,
+ String dest, String extraDest, String scope)
+ {
+ this( profileId, prefix,
+ parent,
+ conn,
+ dest, extraDest, scope,
+ null );
+ }
+
+ public ProfileNonPolicySelDialog(
+ String profileId,
+ String prefix,
+ JFrame parent,
+ AdminConnection conn,
+ String dest, String scope,
+ CMSPluginInstanceTab pluginType)
+ {
+ this(profileId, prefix, parent, conn, dest, null, scope, pluginType);
+ }
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public ProfileNonPolicySelDialog(
+ String profileId,
+ String prefix,
+ JFrame parent,
+ AdminConnection conn,
+ String dest, String extraDest, String scope,
+ CMSPluginInstanceTab pluginType)
+ {
+ super(parent,true);
+ mProfileId = profileId;
+ mParentFrame = parent;
+ mConnection = conn;
+ mDestination = dest;
+ mExtraDestination = extraDest;
+ mScope = scope;
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ mListModel = new DefaultListModel();
+ mListData = new Hashtable();
+ mPrefix = prefix;
+ mPluginInstanceDialog = pluginType;
+
+ setTitle(mResource.getString(mPrefix+"_TITLE"));
+ setSize(400, 230);
+ setLocationRelativeTo(parent);
+ getRootPane().setDoubleBuffered(true);
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ public void setModel(CMSBaseResourceModel model)
+ {
+ mModel = model;
+ }
+
+ /**
+ * show the windows
+ * @param users list of current groups
+ */
+ public void showDialog() {
+
+ mListModel.clear();
+
+ if(!update())
+ return;
+ this.show();
+ }
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent evt) {
+
+ if (evt.getSource().equals(mOK)) {
+
+ // check selection lists
+ if (mList.getSelectedIndex() < 0) {
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource, "Must select default", CMSAdminUtil.ERROR_MESSAGE);
+ }
+
+ NameValuePairs response = null;
+
+ String scope = "";
+ if (mPrefix.equals("PROFILEINPUTSELDIALOG")) {
+ scope = ScopeDef.SC_PROFILE_INPUT;
+ } else if (mPrefix.equals("PROFILEOUTPUTSELDIALOG")) {
+ scope = ScopeDef.SC_PROFILE_OUTPUT;
+ }
+
+ ProfileNonPolicyNewDialog dialog =
+ new ProfileNonPolicyNewDialog(
+ response,
+ mParentFrame,
+ mConnection,
+ mExtraDestination, scope, true);
+
+ dialog.setModel(mModel);
+
+ String name = ((JLabel)mListModel.elementAt(mList.getSelectedIndex())).getText();
+
+ dialog.showDialog(response, mProfileId, getID(name));
+
+ if(!dialog.isOK()) {
+ this.dispose();
+ return;
+ }
+
+ //response = dialog.getData();
+ // String name = dialog.getRuleName();
+
+ // Debug.println(response.toString());
+
+ dialog.dispose();
+ this.dispose();
+ }
+
+ if (evt.getSource().equals(mCancel)) {
+ this.dispose();
+ }
+ if (evt.getSource().equals(mHelp)) {
+ CMSAdminUtil.help(mHelpToken);
+ }
+ }
+
+ //==== MOUSELISTENER ======================
+ public void mouseClicked(MouseEvent e) {
+ setArrowButtons();
+ }
+
+ public void mousePressed(MouseEvent e) {}
+ public void mouseReleased(MouseEvent e) {
+ setArrowButtons();
+ }
+ public void mouseEntered(MouseEvent e) {}
+ public void mouseExited(MouseEvent e) {
+ setArrowButtons();
+ }
+
+ protected void setDisplay() {
+ Debug.println("*** PluginSelectionDialog.setDisplay() - 1");
+ getContentPane().setLayout(new BorderLayout());
+ JPanel center = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ center.setLayout(gb);
+
+ JPanel content = makeContentPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.fill = gbc.BOTH;
+ gb.setConstraints(content, gbc);
+ center.add(content);
+
+ //action panel
+ JPanel action = makeActionPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints(action, gbc);
+ center.add(action);
+
+ getContentPane().add("Center",center);
+ }
+
+ //create botton action panel
+ private JPanel makeActionPane() {
+ mOK = CMSAdminUtil.makeJButton(mResource, mPrefix, "OK", null, this);
+ mCancel = CMSAdminUtil.makeJButton(mResource, mPrefix, "CANCEL", null, this);
+ mHelp = CMSAdminUtil.makeJButton(mResource, mPrefix, "HELP", null, this);
+ //JButton[] buttons = { mOK, mCancel, mHelp};
+ JButton[] buttons = { mOK, mCancel};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonPanel( buttons, true);
+ }
+
+ private JPanel makeContentPane() {
+ Debug.println("*** PluginSelectionDialog.makeContentPane() - 0");
+ JPanel mListPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ Debug.println("*** PluginSelectionDialog.makeContentPane() - 1");
+ mListPanel.setLayout(gb);
+ //content.setBorder(CMSAdminUtil.makeEtchedBorder());
+
+ JLabel label = CMSAdminUtil.makeJLabel(mResource, mPrefix,
+ "SELECT", null);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.fill = gbc.HORIZONTAL;
+ gb.setConstraints(label, gbc);
+ mListPanel.add(label);
+
+ Debug.println("*** PluginSelectionDialog.makeContentPane() - 2");
+ mList = CMSAdminUtil.makeJList(mListModel,9);
+ mScrollPane = new JScrollPane(mList,
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION );
+ mList.addMouseListener(this);
+ mScrollPane.setBackground(Color.white);
+ mScrollPane.setBorder(BorderFactory.createLoweredBevelBorder());
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.fill = gbc.BOTH;
+ gb.setConstraints(mScrollPane, gbc);
+ mListPanel.add(mScrollPane);
+
+ return mListPanel;
+ }
+
+ //set arrow buttons
+ private void setArrowButtons() {
+
+ if (mList.getSelectedIndex()< 0) {
+ mOK.setEnabled(false);
+ return;
+ }
+
+ mOK.setEnabled(true);
+ }
+
+ //refresh the table content
+ private void refresh() {
+ //mScrollPane.invalidate();
+ //mScrollPane.validate();
+ //repaint();
+ }
+
+ //=================================================
+ // RETRIEVE INFO FROM SERVER SIDE
+ //=================================================
+
+ //save order information to the server
+ protected boolean update() {
+
+ NameValuePairs response;
+ NameValuePairs params = new NameValuePairs();
+ try {
+ response = mConnection.search(mDestination, mScope,
+ params);
+ } catch (EAdminException e) {
+ //display error dialog
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ e.getMessage(), CMSAdminUtil.ERROR_MESSAGE);
+ return false;
+ }
+
+ Debug.println(response.toString());
+
+ //parse the data
+ String[] vals = new String[response.size()];
+ int i=0;
+ for (String name : response.keySet()) {
+ name = name.trim();
+ String val = response.get(name);
+ StringTokenizer st = new StringTokenizer(val, ",");
+ String className = st.nextToken();
+ String desc = st.nextToken();
+ String friendlyName = st.nextToken();
+ vals[i++] = friendlyName.trim();
+ mListData.put(name, friendlyName);
+ // vals[i++] = ((String)e.nextElement()).trim();
+ Debug.println("PluginSelectionDialog::update() - adding '"+vals[i-1]+"'");
+ }
+
+ CMSAdminUtil.bubbleSort(vals);
+
+ for (int y=0; y< vals.length ; y++) {
+ try {
+ mListModel.addElement(new JLabel(vals[y], JLabel.LEFT));
+ } catch (Exception ex) {
+ }
+ }
+
+ return true;
+ }
+
+ private String getID(String name) {
+ Enumeration keys = mListData.keys();
+ while (keys.hasMoreElements()) {
+ String key = (String)keys.nextElement();
+ String val = (String)mListData.get(key);
+ if (val.equals(name)) {
+ return key;
+ }
+ }
+ return "";
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/ProfilePluginSelectionDialog.java b/base/console/src/com/netscape/admin/certsrv/config/ProfilePluginSelectionDialog.java
new file mode 100644
index 000000000..ec3bb4c7c
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/ProfilePluginSelectionDialog.java
@@ -0,0 +1,187 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import java.awt.event.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Policy Plugin Selection Dialog
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class ProfilePluginSelectionDialog extends PluginSelectionDialog
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PREFIX = "PROFILESELECTIONDIALOG";
+ private static final String HELPINDEX = "configuration-certificateprofiles";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public ProfilePluginSelectionDialog(
+ JFrame parent,
+ AdminConnection conn,
+ String dest,
+ CMSPluginInstanceTab pluginType)
+ {
+ super(PREFIX, parent,conn, dest, pluginType);
+ mScope = ScopeDef.SC_PROFILE_IMPLS;
+ mInstanceScope = ScopeDef.SC_PROFILE_RULES;
+ mImageName = CMSAdminResources.IMAGE_RULE_PLUGIN;
+ mHelpToken = HELPINDEX;
+ mDataModel = new ProfileListDataModel();
+ setDisplay();
+ }
+
+ public ProfilePluginSelectionDialog(
+ JFrame parent,
+ AdminConnection conn,
+ String dest, String extraDest,
+ CMSPluginInstanceTab pluginType)
+ {
+ super(PREFIX, parent,conn, dest, extraDest, pluginType);
+ mScope = ScopeDef.SC_PROFILE_IMPLS;
+ mInstanceScope = ScopeDef.SC_PROFILE_RULES;
+ mImageName = CMSAdminResources.IMAGE_RULE_PLUGIN;
+ mHelpToken = HELPINDEX;
+ mDataModel = new ProfileListDataModel();
+ setDisplay();
+ }
+
+ public void actionPerformed(ActionEvent evt) {
+
+ if (evt.getSource().equals(mOK)) {
+ NameValuePairs response;
+ try {
+ response = getDefaultConfig();
+ } catch (EAdminException e) {
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ e.getMessage(), CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ Debug.println(response.toString());
+ String id =(String)(((ProfileListDataModel)mDataModel).getObjectValueAt(mList.getSelectedIndex()));
+ response.put(Constants.PR_POLICY_IMPL_NAME, id);
+
+ CMSBaseConfigDialog dialog = null;
+ if (mExtraDestination == null) {
+ dialog = mPluginInstanceDialog.makeNewConfigDialog(
+ response, mParentFrame, mConnection, mDestination);
+ } else {
+ dialog = mPluginInstanceDialog.makeNewConfigDialog(
+ response, mParentFrame, mConnection, mExtraDestination);
+ }
+
+ dialog.setModel(mModel);
+ dialog.setInstanceScope(mInstanceScope);
+
+ dialog.showDialog(response,"");
+
+ if(!dialog.isOK()) {
+ this.dispose();
+ return;
+ }
+
+ response = dialog.getData();
+ String name = dialog.getRuleName();
+
+ Debug.println(response.toString());
+
+ dialog.dispose();
+ this.dispose();
+ }
+
+
+ if (evt.getSource().equals(mCancel)) {
+ this.dispose();
+ }
+ if (evt.getSource().equals(mHelp)) {
+ CMSAdminUtil.help(mHelpToken);
+ }
+ }
+
+ //this returns the default configuration
+ protected NameValuePairs getDefaultConfig() throws EAdminException {
+ String id = (String)(((ProfileListDataModel)mDataModel).getObjectValueAt(mList.getSelectedIndex()));
+ NameValuePairs response;
+ response = mConnection.read(mDestination, mScope, id,
+ new NameValuePairs());
+
+ Debug.println(response.toString());
+
+ return response;
+ }
+
+ //save order information to the server
+ protected boolean update() {
+
+ NameValuePairs response;
+ try {
+ response = mConnection.search(mDestination, mScope,
+ new NameValuePairs());
+ } catch (EAdminException e) {
+ //display error dialog
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ e.getMessage(), CMSAdminUtil.ERROR_MESSAGE);
+ return false;
+ }
+
+ Debug.println(response.toString());
+
+ //parse the data
+ String[] classnames = new String[response.size()];
+ String[] ids = new String[response.size()];
+ int i=0;
+ for (String id : response.keySet()) {
+ String value = response.get(id);
+ int pos = value.lastIndexOf(",");
+ String className = value.substring(pos+1);
+
+ classnames[i] = className;
+ ids[i++] = id;
+ Debug.println("PluginSelectionDialog::update() - adding '"+classnames[i-1]+"'");
+ }
+
+ CMSAdminUtil.bubbleSort(classnames, ids);
+
+ for (int y=0; y< classnames.length ; y++) {
+ try {
+ ((ProfileListDataModel)mDataModel).addElement(new JLabel(classnames[y],
+ CMSAdminUtil.getImage(mImageName), JLabel.LEFT), ids[y]);
+ }
+ catch (Exception ex) {
+ Debug.println("PluginSelectionDialog could not get image for '"+
+ mImageName+"'. Adding without image");
+ ((ProfileListDataModel)mDataModel).addElement(new JLabel(classnames[y],
+ JLabel.LEFT), ids[y]);
+ }
+ }
+
+ return true;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/ProfilePolicyEditDataModel.java b/base/console/src/com/netscape/admin/certsrv/config/ProfilePolicyEditDataModel.java
new file mode 100644
index 000000000..7b306d1da
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/ProfilePolicyEditDataModel.java
@@ -0,0 +1,85 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import javax.swing.table.*;
+import javax.swing.text.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Policy Parameter Configuration Dialog
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class ProfilePolicyEditDataModel extends AbstractTableModel
+{
+ Vector rowData;
+ Vector columnNames;
+
+ public ProfilePolicyEditDataModel()
+ {
+ }
+
+ public void setInfo(Vector _rowData, Vector _columnNames)
+ {
+ rowData = _rowData;
+ columnNames = _columnNames;
+ }
+
+ public String getColumnName(int column)
+ {
+ return columnNames.elementAt(column).toString();
+ }
+ public int getRowCount()
+ {
+ return rowData.size();
+ }
+ public int getColumnCount()
+ {
+ return columnNames.size();
+ }
+
+ public Object getValueAt(int row, int column)
+ {
+ return ((Vector)rowData.elementAt(row)).elementAt(column);
+ }
+
+ public boolean isCellEditable(int row, int column)
+ {
+ if (column == 1)
+ return true;
+ return false;
+ }
+
+ public void setValueAt(Object value, int row, int column)
+ {
+ ((Vector)rowData.elementAt(row)).setElementAt(value, column);
+ fireTableCellUpdated(row, column);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/ProfilePolicyEditDialog.java b/base/console/src/com/netscape/admin/certsrv/config/ProfilePolicyEditDialog.java
new file mode 100644
index 000000000..34b95c0f1
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/ProfilePolicyEditDialog.java
@@ -0,0 +1,698 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import javax.swing.table.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Policy Parameter Configuration Dialog
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class ProfilePolicyEditDialog extends CMSBaseConfigDialog
+ implements ActionListener, FocusListener
+{
+ protected JButton mRefresh, mEdit, mAdd, mDelete, mOrder, mHelp;
+ protected JTextField mNameField=null, mIdField=null, mDescField=null, mConfigField=null;
+ protected JLabel mNameLabel=null, mIdLabel=null, mDescLabel = null, mConfigLabel =null;
+ protected JTable mConstraintTable = null;
+ protected ProfileDataTable mDefaultTable = null;
+ protected Hashtable mHelpDesc = new Hashtable();
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public ProfilePolicyEditDialog(NameValuePairs nvp,
+ JFrame parent,
+ AdminConnection conn,
+ String dest) {
+
+ super(parent, dest);
+
+ PREFIX = "PROFILEEDITDIALOG";
+ mHelpToken = "configuration-certificateprofiles";
+ mImplName_token = Constants.PR_POLICY_IMPL_NAME;
+ mImplType = Constants.PR_EXT_PLUGIN_IMPLTYPE_POLICY;
+ init(nvp,parent,conn,dest);
+ setSize(500, 415);
+ }
+
+
+ protected JPanel makeContentPane() {
+ JPanel mListPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mListPanel.setLayout(gb);
+
+ // 'Policy Rule ID' here
+ CMSAdminUtil.resetGBC(gbc);
+ mRulenameCaption = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "RULENAME", null);
+ mRulenameCaption.addMouseListener(this);
+ mPluginLabel = new JLabel();
+ mPluginLabel.setVisible(false);
+ mPluginName = new JTextField();
+
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ mListPanel.add(mRulenameCaption, gbc);
+
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,
+ 0,CMSAdminUtil.COMPONENT_SPACE);
+ mListPanel.add( mPluginName, gbc );
+ // mListPanel.add( mPluginLabel, gbc );
+
+ // name
+ CMSAdminUtil.resetGBC(gbc);
+ mNameLabel = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "NAMENAME", null);
+ mNameLabel.addMouseListener(this);
+
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ // mListPanel.add( mNameLabel, gbc );
+ mNameLabel.setBackground(getBackground());
+ mNameLabel.setEnabled(false);
+
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ mNameField = new JTextField();
+ // mListPanel.add( mNameField, gbc );
+
+ // desc
+ CMSAdminUtil.resetGBC(gbc);
+ mDescLabel = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "DESCNAME", null);
+ // mDescLabel.addMouseListener(this);
+
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ mListPanel.add( mDescLabel, gbc );
+
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ mDescField = new JTextField();
+ mListPanel.add( mDescField, gbc );
+
+ CMSAdminUtil.resetGBC(gbc);
+ mIdLabel = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "IDNAME", null);
+
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ mListPanel.add( mIdLabel, gbc );
+
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ mIdField = new JTextField();
+ mListPanel.add( mIdField, gbc );
+
+ // config file
+/*
+ CMSAdminUtil.resetGBC(gbc);
+ mConfigLabel = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "CONFIGNAME", null);
+ mConfigLabel.addMouseListener(this);
+
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ // mListPanel.add( mConfigLabel, gbc );
+
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ mConfigField = new JTextField();
+ // mListPanel.add( mConfigField, gbc );
+*/
+
+
+ // 'Policy Plugin ID' here
+ CMSAdminUtil.resetGBC(gbc);
+ mImplnameCaption = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "IMPLNAME", null);
+ mImplnameCaption.addMouseListener(this);
+
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ // mListPanel.add( mImplnameCaption, gbc );
+
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ mImplName = new JLabel();
+// mListPanel.add( mImplName, gbc );
+
+ /* Tab */
+ JTabbedPane tabPane = new JTabbedPane();
+ JPanel lpanel1 = createDefaultListPanel();
+ JPanel lpanel2 = createConstraintListPanel();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.fill = gbc.BOTH;
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(tabPane, gbc);
+ tabPane.addTab("Default", lpanel1);
+ tabPane.addTab("Constraint", lpanel2);
+ mListPanel.add(tabPane);
+
+ /* Panel for list of plugin's parameters */
+ mParamPanel = new JPanel();
+/*
+ mScrollPane = new JScrollPane(mParamPanel);
+ mScrollPane.setBorder(CMSAdminUtil.makeEtchedBorder());
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.fill = gbc.BOTH;
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(mScrollPane, gbc);
+ mListPanel.add(mScrollPane);
+*/
+
+ /* Panel in which to put plugin's help text */
+ mHelpPanel = new JPanel();
+ mHelpPanel.setBorder(CMSAdminUtil.makeEtchedBorder());
+ mHelpLabel = new JTextArea(3,0);
+ mHelpLabel.setLineWrap(true);
+ mHelpLabel.setWrapStyleWord(true);
+ mHelpLabel.setBackground(mHelpPanel.getBackground());
+ mHelpLabel.setEditable(false);
+ GridBagLayout gb2 = new GridBagLayout();
+ GridBagConstraints gbc2 = new GridBagConstraints();
+
+ CMSAdminUtil.resetGBC(gbc2);
+ gbc2.fill = gbc.BOTH;
+ gbc2.anchor = gbc.WEST;
+ gbc2.gridwidth = gbc.REMAINDER;
+ gbc2.weightx = 1.0;
+ gbc2.weighty = 1.0;
+ gb2.setConstraints(mHelpLabel, gbc2);
+ mHelpPanel.setLayout(gb2);
+ mHelpPanel.add(mHelpLabel);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.SOUTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gb.setConstraints(mHelpPanel, gbc);
+ mListPanel.add(mHelpPanel);
+
+ return mListPanel;
+ }
+
+ public JPanel createDefaultListPanel()
+ {
+ Vector colNames = new Vector();
+ colNames.addElement("Parameter");
+ colNames.addElement("Value");
+ Vector data = new Vector();
+ Vector row = new Vector();
+ row.addElement("x");
+ row.addElement("x");
+ data.addElement(row);
+
+ JPanel mListPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mListPanel.setLayout(gb);
+
+ //center table
+ ProfilePolicyEditDataModel model = new ProfilePolicyEditDataModel();
+ model.setInfo(data, colNames);
+ mDefaultTable = new ProfileDataTable(model);
+ JScrollPane mScrollPane = JTable.createScrollPaneForTable(mDefaultTable);
+ mScrollPane.setHorizontalScrollBarPolicy(mScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mScrollPane.setVerticalScrollBarPolicy(mScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ mDefaultTable.setAutoscrolls(true);
+ mDefaultTable.sizeColumnsToFit(true);
+ mDefaultTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ // mTable.getSelectionModel().addListSelectionListener(this);
+ mScrollPane.setBackground(Color.white);
+ mDefaultTable.addMouseListener(this);
+// setLabelCellRenderer(mDefaultTable,1);
+//setLabelCellEditor(mDefaultTable, 1);
+ mDefaultTable.setDefaultRenderer(JComponent.class, new JComponentCellRenderer());
+ mDefaultTable.setDefaultEditor(JComponent.class,
+ new ProfileComponentCellEditor());
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ // gbc.gridwidth = 1;
+ // gbc.weightx = 1.0;
+ gbc.insets = CMSAdminUtil.DEFAULT_EMPTY_INSETS;
+ gb.setConstraints(mScrollPane, gbc);
+ mListPanel.add(mScrollPane);
+
+/*
+ JPanel buttonPanel = createUserButtonPanel();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 0.0;
+ gbc.weighty = 1.0;
+ gbc.insets = CMSAdminUtil.DEFAULT_EMPTY_INSETS;
+ gb.setConstraints(buttonPanel, gbc);
+ mListPanel.add(buttonPanel);
+*/
+
+ return mListPanel;
+ }
+
+ public JPanel createConstraintListPanel()
+ {
+ Vector colNames = new Vector();
+ colNames.addElement("Parameter");
+ colNames.addElement("Value");
+ Vector data = new Vector();
+ Vector row = new Vector();
+ row.addElement("x");
+ row.addElement("x");
+ data.addElement(row);
+
+ JPanel mListPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mListPanel.setLayout(gb);
+
+ //center table
+ ProfilePolicyEditDataModel model = new ProfilePolicyEditDataModel();
+ model.setInfo(data, colNames);
+ mConstraintTable = new ProfileDataTable(model);
+ JScrollPane mScrollPane = JTable.createScrollPaneForTable(mConstraintTable);
+ mScrollPane.setHorizontalScrollBarPolicy(mScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mScrollPane.setVerticalScrollBarPolicy(mScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ mConstraintTable.setAutoscrolls(true);
+ mConstraintTable.sizeColumnsToFit(true);
+ mConstraintTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ // mTable.getSelectionModel().addListSelectionListener(this);
+ mScrollPane.setBackground(Color.white);
+ mConstraintTable.addMouseListener(this);
+// setLabelCellRenderer(mConstraintTable,0);
+ mConstraintTable.setDefaultRenderer(JComponent.class, new JComponentCellRenderer());
+ mConstraintTable.setDefaultEditor(JComponent.class,
+ new ProfileComponentCellEditor());
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ // gbc.gridwidth = 1;
+ // gbc.weightx = 1.0;
+ gbc.insets = CMSAdminUtil.DEFAULT_EMPTY_INSETS;
+ gb.setConstraints(mScrollPane, gbc);
+ mListPanel.add(mScrollPane);
+
+/*
+ JPanel buttonPanel = createUserButtonPanel();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 0.0;
+ gbc.weighty = 1.0;
+ gbc.insets = CMSAdminUtil.DEFAULT_EMPTY_INSETS;
+ gb.setConstraints(buttonPanel, gbc);
+ mListPanel.add(buttonPanel);
+*/
+
+ return mListPanel;
+ }
+
+ protected JPanel createUserButtonPanel() {
+ Debug.println("CMSPluginInstanceTab::createUserButtonPanel()");
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mEdit = CMSAdminUtil.makeJButton(mResource, PREFIX, "EDIT", null, this);
+ mAdd = CMSAdminUtil.makeJButton(mResource, PREFIX, "ADD", null, this);
+ mDelete = CMSAdminUtil.makeJButton(mResource, PREFIX, "DELETE", null, this);
+ JButton[] buttons = {mAdd, mDelete, mEdit};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonVPanel( buttons );
+ }
+
+ public void actionPerformed(ActionEvent evt) {
+ if (evt.getSource().equals(mHelp)) {
+ CMSAdminUtil.help(mHelpToken);
+ }
+
+ if (evt.getSource().equals(mAdd)) {
+/*
+ Debug.println("Add");
+ PluginSelectionDialog dialog =
+ getPluginSelectionDialog(
+ mModel.getFrame(),
+ mConnection,
+ mDestination,
+ this
+ );
+
+ dialog.setModel(mModel);
+ dialog.showDialog();
+ refresh();
+*/
+ }
+ if (evt.getSource().equals(mDelete)) {
+ }
+ if (evt.getSource().equals(mEdit)) {
+ }
+
+ if (evt.getSource().equals(mOK)) {
+
+ try {
+ if (mModel != null) { mModel.progressStart(); }
+
+ NameValuePairs nvp = new NameValuePairs();
+ String instanceName = mPluginName.getText();
+
+ String policyId = mDescField.getText() + ":" + mIdField.getText();
+ String name = instanceName + ";" + policyId;
+
+/*
+ nvp.add("impl", mImplName.getText());
+ nvp.add("name", mNameField.getText());
+ nvp.add("desc", mDescField.getText());
+ nvp.add("config", mConfigField.getText());
+*/
+
+ for (int i = 0; i < mDefaultTable.getRowCount(); i++) {
+ JComponent comp = (JComponent)mDefaultTable.getValueAt(i,1);
+ String val = null;
+ if (comp instanceof JTextField) {
+ val = ((JTextField)comp).getText().trim();
+ } else if (comp instanceof JComboBox) {
+ val = (String)(((JComboBox)comp).getSelectedItem());
+ }
+ String name1 = ((JLabel)(mDefaultTable.getValueAt(i,0))).getText();
+ nvp.put(name1, val);
+ }
+
+
+ //mAdminConnection.modify(DestDef.DEST_CA_PROFILE_ADMIN,
+ mAdminConnection.modify(mDest,
+ ScopeDef.SC_PROFILE_DEFAULT_POLICY, name, nvp);
+
+ mIsOK = true;
+ if (mModel != null) { mModel.progressStop(); }
+
+ nvp = new NameValuePairs();
+ for (int i = 0; i < mConstraintTable.getRowCount(); i++) {
+
+ JComponent comp = (JComponent)mConstraintTable.getValueAt(i,1);
+ String val = null;
+ if (comp instanceof JTextField) {
+ val = ((JTextField)comp).getText().trim();
+ } else if (comp instanceof JComboBox) {
+ val = (String)(((JComboBox)comp).getSelectedItem());
+ }
+
+ String name1 = ((JLabel)(mConstraintTable.getValueAt(i,0))).getText();
+ nvp.put(name1, val);
+ }
+ instanceName = mPluginName.getText();
+//DestDef.DEST_CA_PROFILE_ADMIN,
+ mAdminConnection.modify(mDest,
+ ScopeDef.SC_PROFILE_CONSTRAINT_POLICY, name, nvp);
+
+ this.dispose();
+ }
+ catch (EAdminException ex) {
+ mModel.progressStop();
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ ex.toString(),CMSAdminUtil.ERROR_MESSAGE);
+ }
+ }
+
+ if (evt.getSource().equals(mCancel)) {
+ this.dispose();
+ }
+
+ }
+
+ private String getHelpDescription(String value) {
+ int start_pos = value.indexOf(';');
+ int end_pos = value.lastIndexOf(';');
+ int end1_pos = value.lastIndexOf(';',end_pos-1);
+ String syntax = null;
+ String syntaxVal = null;
+ String v = null;
+ syntax = value.substring(0,start_pos);
+ syntaxVal = value.substring(start_pos+1, end_pos);
+ v = value.substring(end1_pos+1,end_pos);
+ return v;
+ }
+
+ private Object getComponent(String value) {
+ int start_pos = value.indexOf(';');
+ int end_pos = value.lastIndexOf(';');
+ int end1_pos = value.lastIndexOf(';',end_pos-1);
+ String syntax = null;
+ String syntaxVal = null;
+ String v = null;
+
+ syntax = value.substring(0,start_pos);
+ syntaxVal = value.substring(start_pos+1, end1_pos);
+ v = value.substring(end_pos+1);
+/*
+ StringTokenizer st = new StringTokenizer(value, ";");
+ while (st.hasMoreTokens()) {
+ try {
+ syntax = st.nextToken();
+ syntaxVal = st.nextToken();
+ v = st.nextToken();
+ } catch (Exception e) {
+ }
+ }
+*/
+
+ if (syntax != null) {
+ return CMSAdminUtil.createTableCell(syntax, syntaxVal, v);
+ }
+
+ return null;
+ }
+
+ public void showDialog(NameValuePairs data, String name) {
+
+ mHelpDesc.clear();
+
+ mModel.progressStart();
+
+ StringTokenizer st = new StringTokenizer(name, ";");
+ String profileId = st.nextToken();
+ String policyId = st.nextToken();
+ StringTokenizer st1 = new StringTokenizer(policyId, ":");
+ String setid = st1.nextToken();
+ String pid = st1.nextToken();
+
+ // retrieve profile information
+ NameValuePairs response = null;
+ NameValuePairs request = new NameValuePairs();
+ try {
+ //response = mAdminConnection.read(DestDef.DEST_CA_PROFILE_ADMIN,
+ response = mAdminConnection.read(mDest,
+ ScopeDef.SC_PROFILE_DEFAULT_POLICY,
+ name, request);
+ } catch (EAdminException e) {
+// CMSAdminUtil.showErrorDialog(mParentFrame, mResource, e.toString());
+ mModel.progressStop();
+ }
+ mModel.progressStop();
+
+ Vector defcolNames = new Vector();
+ defcolNames.addElement("Parameter");
+ defcolNames.addElement("Value");
+ Vector defdata = new Vector();
+
+ for (String entry : response.keySet()) {
+ entry = entry.trim();
+ String value = response.get(entry);
+ Debug.println("ProfilePolicyEditDialog entry= "+entry);
+ Debug.println("ProfilePolicyEditDialog value= "+value);
+
+ Object obj = getComponent(value);
+ Vector row = new Vector();
+ JLabel label = new JLabel(entry);
+ ((Component)obj).addFocusListener(this);
+ mHelpDesc.put(obj, getHelpDescription(value));
+ row.addElement(label);
+ row.addElement(obj);
+ defdata.addElement(row);
+ }
+ ProfilePolicyEditDataModel defmodel = new ProfilePolicyEditDataModel();
+ defmodel.setInfo(defdata, defcolNames);
+ mDefaultTable.setModel(defmodel);
+
+ if (response != null) {
+ mPluginName.setText(profileId);
+ mPluginName.setBackground(getBackground());
+ mPluginName.setEnabled(false);
+ mNameField.setText(response.get("name"));
+ mDescField.setText(setid);
+ mDescField.setBackground(getBackground());
+ mDescField.setEnabled(false);
+ mIdField.setText(pid);
+ mIdField.setBackground(getBackground());
+ mIdField.setEnabled(false);
+ }
+
+ // retrieve policy information
+ mModel.progressStart();
+ try {
+ //response = mAdminConnection.read(DestDef.DEST_CA_PROFILE_ADMIN,
+ response = mAdminConnection.read(mDest,
+ ScopeDef.SC_PROFILE_CONSTRAINT_POLICY,
+ name,
+ request);
+ } catch (EAdminException e) {
+// CMSAdminUtil.showErrorDialog(mParentFrame, mResource, e.toString());
+ mModel.progressStop();
+ }
+ mModel.progressStop();
+
+ Vector colNames = new Vector();
+ colNames.addElement("Parameter");
+ colNames.addElement("Value");
+ Vector d = new Vector();
+
+ for (String entry : response.keySet()) {
+ entry = entry.trim();
+ String value = response.get(entry);
+ Debug.println("entry= "+entry);
+ Debug.println("value= "+value);
+
+ Object obj = getComponent(value);
+ Vector row = new Vector();
+ JLabel label = new JLabel(entry);
+ ((Component)obj).addFocusListener(this);
+ mHelpDesc.put(obj, getHelpDescription(value));
+ row.addElement(label);
+ row.addElement(obj);
+ d.addElement(row);
+ }
+ ProfilePolicyEditDataModel model = new ProfilePolicyEditDataModel();
+ model.setInfo(d, colNames);
+ mConstraintTable.setModel(model);
+
+ this.show();
+ }
+
+ protected void setLabelCellRenderer(JTable table, int index) {
+ table.getColumnModel().getColumn(index).setCellRenderer(
+ new DefaultTableCellRenderer());
+ }
+
+ protected void setLabelCellEditor(JTable table, int index) {
+/*
+ table.getColumnModel().getColumn(index).setCellRenderer(
+ new PasswordCellRenderer());
+*/
+ table.getColumnModel().getColumn(index).setCellEditor(
+ new DefaultCellEditor(new JTextField()));
+ }
+
+ class JComponentCellRenderer implements TableCellRenderer {
+ public Component getTableCellRendererComponent(JTable table,
+ Object value, boolean isSelected, boolean hasFocus, int row,
+ int column) {
+ return (JComponent)value;
+ }
+ }
+
+ /**
+ * From focuslistener interface. This lets us know when a component
+ * has received focus, so we can update the help text.
+ */
+ public void focusGained(FocusEvent f) {
+ Debug.println("focusGained");
+ Component comp = f.getComponent();
+ String desc = (String)mHelpDesc.get(comp);
+ if (desc != null) {
+ mHelpLabel.setText(desc);
+ }
+ }
+
+ /** need to supply this method for focuslistener, but we
+ * really don't care about it
+ */
+ public void focusLost(FocusEvent f) {
+ Debug.println("focusLost");
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/ProfilePolicyNewDialog.java b/base/console/src/com/netscape/admin/certsrv/config/ProfilePolicyNewDialog.java
new file mode 100644
index 000000000..941917808
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/ProfilePolicyNewDialog.java
@@ -0,0 +1,714 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import javax.swing.table.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Policy Parameter Configuration Dialog
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class ProfilePolicyNewDialog extends CMSBaseConfigDialog
+ implements ActionListener, FocusListener
+{
+ protected JButton mRefresh, mEdit, mAdd, mDelete, mOrder, mHelp;
+ protected JTextField mNameField=null, mIdField=null, mDescField=null, mConfigField=null;
+ protected JLabel mNameLabel=null, mIdLabel=null, mDescLabel = null, mConfigLabel =null;
+ protected JTable mDefaultTable = null, mConstraintTable = null;
+
+ private String mConstraintId = null, mDefaultId = null;
+
+ public String mDefSetId = null;
+ protected Hashtable mHelpDesc = new Hashtable();
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public ProfilePolicyNewDialog(String defSetId, NameValuePairs nvp,
+ JFrame parent,
+ AdminConnection conn,
+ String dest) {
+
+ super(parent, dest);
+
+ mDefSetId = defSetId;
+ PREFIX = "PROFILENEWDIALOG";
+ mHelpToken = "configuration-certificateprofiles";
+ mImplName_token = Constants.PR_POLICY_IMPL_NAME;
+ mImplType = Constants.PR_EXT_PLUGIN_IMPLTYPE_POLICY;
+
+ init(nvp,parent,conn,dest);
+ setSize(500, 415);
+ }
+
+
+ protected JPanel makeContentPane() {
+ JPanel mListPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mListPanel.setLayout(gb);
+
+ // 'Policy Rule ID' here
+ CMSAdminUtil.resetGBC(gbc);
+ mRulenameCaption = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "RULENAME", null);
+ mRulenameCaption.addMouseListener(this);
+ mPluginLabel = new JLabel();
+ mPluginLabel.setVisible(false);
+ mPluginName = new JTextField();
+
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ mListPanel.add(mRulenameCaption, gbc);
+
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,
+ 0,CMSAdminUtil.COMPONENT_SPACE);
+ mListPanel.add( mPluginName, gbc );
+ // mListPanel.add( mPluginLabel, gbc );
+
+ // name
+ CMSAdminUtil.resetGBC(gbc);
+ mNameLabel = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "NAMENAME", null);
+ mNameLabel.addMouseListener(this);
+
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ // mListPanel.add( mNameLabel, gbc );
+ mNameLabel.setBackground(getBackground());
+ mNameLabel.setEnabled(false);
+
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ mNameField = new JTextField();
+ // mListPanel.add( mNameField, gbc );
+
+ // desc
+ CMSAdminUtil.resetGBC(gbc);
+ mDescLabel = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "DESCNAME", null);
+ // mDescLabel.addMouseListener(this);
+
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ mListPanel.add( mDescLabel, gbc );
+
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ mDescField = new JTextField();
+ mListPanel.add( mDescField, gbc );
+
+
+ CMSAdminUtil.resetGBC(gbc);
+ mIdLabel = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "IDNAME", null);
+
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ mListPanel.add( mIdLabel, gbc );
+
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ mIdField = new JTextField();
+ mListPanel.add( mIdField, gbc );
+
+ // config file
+/*
+ CMSAdminUtil.resetGBC(gbc);
+ mConfigLabel = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "CONFIGNAME", null);
+ mConfigLabel.addMouseListener(this);
+
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ // mListPanel.add( mConfigLabel, gbc );
+
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ mConfigField = new JTextField();
+ // mListPanel.add( mConfigField, gbc );
+*/
+
+
+ // 'Policy Plugin ID' here
+ CMSAdminUtil.resetGBC(gbc);
+ mImplnameCaption = CMSAdminUtil.makeJLabel(mResource, PREFIX,
+ "IMPLNAME", null);
+ mImplnameCaption.addMouseListener(this);
+
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ // mListPanel.add( mImplnameCaption, gbc );
+
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ mImplName = new JLabel();
+// mListPanel.add( mImplName, gbc );
+
+ /* Tab */
+ JTabbedPane tabPane = new JTabbedPane();
+ JPanel lpanel1 = createDefaultListPanel();
+ JPanel lpanel2 = createConstraintListPanel();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.fill = gbc.BOTH;
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(tabPane, gbc);
+ tabPane.addTab("Default", lpanel1);
+ tabPane.addTab("Constraint", lpanel2);
+ mListPanel.add(tabPane);
+
+ /* Panel for list of plugin's parameters */
+ mParamPanel = new JPanel();
+/*
+ mScrollPane = new JScrollPane(mParamPanel);
+ mScrollPane.setBorder(CMSAdminUtil.makeEtchedBorder());
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.fill = gbc.BOTH;
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(mScrollPane, gbc);
+ mListPanel.add(mScrollPane);
+*/
+
+ /* Panel in which to put plugin's help text */
+ mHelpPanel = new JPanel();
+ mHelpPanel.setBorder(CMSAdminUtil.makeEtchedBorder());
+ mHelpLabel = new JTextArea(3,0);
+ mHelpLabel.setLineWrap(true);
+ mHelpLabel.setWrapStyleWord(true);
+ mHelpLabel.setBackground(mHelpPanel.getBackground());
+ mHelpLabel.setEditable(false);
+ GridBagLayout gb2 = new GridBagLayout();
+ GridBagConstraints gbc2 = new GridBagConstraints();
+
+ CMSAdminUtil.resetGBC(gbc2);
+ gbc2.fill = gbc.BOTH;
+ gbc2.anchor = gbc.WEST;
+ gbc2.gridwidth = gbc.REMAINDER;
+ gbc2.weightx = 1.0;
+ gbc2.weighty = 1.0;
+ gb2.setConstraints(mHelpLabel, gbc2);
+ mHelpPanel.setLayout(gb2);
+ mHelpPanel.add(mHelpLabel);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.SOUTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gb.setConstraints(mHelpPanel, gbc);
+ mListPanel.add(mHelpPanel);
+
+ return mListPanel;
+ }
+
+ public JPanel createDefaultListPanel()
+ {
+ Vector colNames = new Vector();
+ colNames.addElement("Parameter");
+ colNames.addElement("Value");
+ Vector data = new Vector();
+ Vector row = new Vector();
+ row.addElement("x");
+ row.addElement("x");
+ data.addElement(row);
+
+ JPanel mListPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mListPanel.setLayout(gb);
+
+ //center table
+ ProfilePolicyEditDataModel model = new ProfilePolicyEditDataModel();
+ model.setInfo(data, colNames);
+ mDefaultTable = new ProfileDataTable(model);
+ JScrollPane mScrollPane = JTable.createScrollPaneForTable(mDefaultTable);
+ mScrollPane.setHorizontalScrollBarPolicy(mScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mScrollPane.setVerticalScrollBarPolicy(mScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ mDefaultTable.setAutoscrolls(true);
+ mDefaultTable.sizeColumnsToFit(true);
+ mDefaultTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ // mTable.getSelectionModel().addListSelectionListener(this);
+ mScrollPane.setBackground(Color.white);
+ mDefaultTable.addMouseListener(this);
+ mDefaultTable.setDefaultRenderer(JComponent.class, new JComponentCellRenderer());
+ mDefaultTable.setDefaultEditor(JComponent.class, new ProfileComponentCellEditor());
+
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ // gbc.gridwidth = 1;
+ // gbc.weightx = 1.0;
+ gbc.insets = CMSAdminUtil.DEFAULT_EMPTY_INSETS;
+ gb.setConstraints(mScrollPane, gbc);
+ mListPanel.add(mScrollPane);
+
+/*
+ JPanel buttonPanel = createUserButtonPanel();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 0.0;
+ gbc.weighty = 1.0;
+ gbc.insets = CMSAdminUtil.DEFAULT_EMPTY_INSETS;
+ gb.setConstraints(buttonPanel, gbc);
+ mListPanel.add(buttonPanel);
+*/
+
+ return mListPanel;
+ }
+
+ public JPanel createConstraintListPanel()
+ {
+ Vector colNames = new Vector();
+ colNames.addElement("Parameter");
+ colNames.addElement("Value");
+ Vector data = new Vector();
+ Vector row = new Vector();
+ row.addElement("x");
+ row.addElement("x");
+ data.addElement(row);
+
+ JPanel mListPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mListPanel.setLayout(gb);
+
+ //center table
+ ProfilePolicyEditDataModel model = new ProfilePolicyEditDataModel();
+ model.setInfo(data, colNames);
+ mConstraintTable = new ProfileDataTable(model);
+ JScrollPane mScrollPane = JTable.createScrollPaneForTable(mConstraintTable);
+ mScrollPane.setHorizontalScrollBarPolicy(mScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mScrollPane.setVerticalScrollBarPolicy(mScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ mConstraintTable.setAutoscrolls(true);
+ mConstraintTable.sizeColumnsToFit(true);
+ mConstraintTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ // mTable.getSelectionModel().addListSelectionListener(this);
+ mScrollPane.setBackground(Color.white);
+ mConstraintTable.addMouseListener(this);
+ mConstraintTable.setDefaultRenderer(JComponent.class, new JComponentCellRenderer());
+ mConstraintTable.setDefaultEditor(JComponent.class, new ProfileComponentCellEditor());
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ // gbc.gridwidth = 1;
+ // gbc.weightx = 1.0;
+ gbc.insets = CMSAdminUtil.DEFAULT_EMPTY_INSETS;
+ gb.setConstraints(mScrollPane, gbc);
+ mListPanel.add(mScrollPane);
+
+/*
+ JPanel buttonPanel = createUserButtonPanel();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 0.0;
+ gbc.weighty = 1.0;
+ gbc.insets = CMSAdminUtil.DEFAULT_EMPTY_INSETS;
+ gb.setConstraints(buttonPanel, gbc);
+ mListPanel.add(buttonPanel);
+*/
+
+ return mListPanel;
+ }
+
+ protected JPanel createUserButtonPanel() {
+ Debug.println("CMSPluginInstanceTab::createUserButtonPanel()");
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mEdit = CMSAdminUtil.makeJButton(mResource, PREFIX, "EDIT", null, this);
+ mAdd = CMSAdminUtil.makeJButton(mResource, PREFIX, "ADD", null, this);
+ mDelete = CMSAdminUtil.makeJButton(mResource, PREFIX, "DELETE", null, this);
+ JButton[] buttons = {mAdd, mDelete, mEdit};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonVPanel( buttons );
+ }
+
+ public void actionPerformed(ActionEvent evt) {
+
+ if (evt.getSource().equals(mHelp)) {
+ CMSAdminUtil.help(mHelpToken);
+ }
+ if (evt.getSource().equals(mAdd)) {
+/*
+ Debug.println("Add");
+ PluginSelectionDialog dialog =
+ getPluginSelectionDialog(
+ mModel.getFrame(),
+ mConnection,
+ mDestination,
+ this
+ );
+
+ dialog.setModel(mModel);
+ dialog.showDialog();
+ refresh();
+*/
+ }
+ if (evt.getSource().equals(mDelete)) {
+ }
+ if (evt.getSource().equals(mEdit)) {
+ }
+
+ if (evt.getSource().equals(mOK)) {
+ try {
+ String policySetStr = mDescField.getText().trim();
+ String policyIDStr = mIdField.getText().trim();
+ if (policySetStr == null || policySetStr.length() == 0) {
+ String msg = mResource.getString(
+ PREFIX+"_DIALOG_BLANKPOLICYSET_MESSAGE");
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ msg ,CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ if (policyIDStr == null || policyIDStr.length() == 0) {
+ String msg = mResource.getString(
+ PREFIX+"_DIALOG_BLANKPOLICYID_MESSAGE");
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ msg ,CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ if (mModel != null) { mModel.progressStart(); }
+
+ NameValuePairs nvp = new NameValuePairs();
+ String instanceName = mPluginName.getText().trim();
+
+ // create policy
+ String policyId = policySetStr + ":" + policyIDStr;
+ String name = instanceName + ";" + policyId + ";" + mDefaultId + ";" + mConstraintId;
+ //mAdminConnection.add(DestDef.DEST_CA_PROFILE_ADMIN,
+ mAdminConnection.add(mDest,
+ ScopeDef.SC_PROFILE_POLICIES, name, nvp);
+
+/*
+ nvp.add("impl", mImplName.getText());
+ nvp.add("name", mNameField.getText());
+ nvp.add("desc", mDescField.getText());
+ nvp.add("config", mConfigField.getText());
+*/
+
+ for (int i = 0; i < mDefaultTable.getRowCount(); i++) {
+ JComponent comp = (JComponent)mDefaultTable.getValueAt(i,1);
+ String val = null;
+ if (comp instanceof JTextField) {
+ val = ((JTextField)comp).getText().trim();
+ } else if (comp instanceof JComboBox) {
+ val = (String)(((JComboBox)comp).getSelectedItem());
+ }
+ String name1 = ((JLabel)(mDefaultTable.getValueAt(i,0))).getText();
+ nvp.put(name1, val);
+ }
+
+
+ //mAdminConnection.add(DestDef.DEST_CA_PROFILE_ADMIN,
+ mAdminConnection.add(mDest,
+ ScopeDef.SC_PROFILE_DEFAULT_POLICY, name, nvp);
+
+ mIsOK = true;
+ if (mModel != null) { mModel.progressStop(); }
+
+ nvp = new NameValuePairs();
+ for (int i = 0; i < mConstraintTable.getRowCount(); i++) {
+ JComponent comp = (JComponent)mConstraintTable.getValueAt(i,1);
+ String val = null;
+ if (comp instanceof JTextField) {
+ val = ((JTextField)comp).getText().trim();
+ } else if (comp instanceof JComboBox) {
+ val = (String)(((JComboBox)comp).getSelectedItem());
+ }
+
+ String name1 = ((JLabel)(mConstraintTable.getValueAt(i,0))).getText();
+ nvp.put(name1, val);
+ }
+ instanceName = mPluginName.getText();
+ //mAdminConnection.add(DestDef.DEST_CA_PROFILE_ADMIN,
+ mAdminConnection.add(mDest,
+ ScopeDef.SC_PROFILE_CONSTRAINT_POLICY, name, nvp);
+
+ this.dispose();
+ }
+ catch (EAdminException ex) {
+ mModel.progressStop();
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ ex.toString(),CMSAdminUtil.ERROR_MESSAGE);
+ }
+ }
+
+ if (evt.getSource().equals(mCancel)) {
+ this.dispose();
+ }
+
+ }
+
+ public void showDialog(NameValuePairs data, String name) {
+
+ mModel.progressStart();
+
+ // name = profileId;defId;configid
+ StringTokenizer st = new StringTokenizer(name, ";");
+ String profileId = st.nextToken();
+ String defId = st.nextToken();
+ String conId = st.nextToken();
+
+ mDefaultId = defId;
+ mConstraintId = conId;
+
+ // retrieve profile information
+ NameValuePairs response = null;
+ NameValuePairs request = new NameValuePairs();
+ try {
+ name = profileId + ";" + defId;
+ response = mAdminConnection.read(DestDef.DEST_REGISTRY_ADMIN,
+ ScopeDef.SC_PROFILE_DEFAULT_POLICY,
+ defId, request);
+ } catch (EAdminException e) {
+// CMSAdminUtil.showErrorDialog(mParentFrame, mResource, e.toString());
+ mModel.progressStop();
+ }
+ mModel.progressStop();
+
+ Vector defcolNames = new Vector();
+ defcolNames.addElement("Parameter");
+ defcolNames.addElement("Value");
+ Vector defdata = new Vector();
+
+ for (String entry : response.keySet()) {
+ entry = entry.trim();
+ String value = response.get(entry);
+ Debug.println("entry= "+entry);
+ Debug.println("value= "+value);
+
+ Object obj = getComponent(value);
+ Vector row = new Vector();
+ ((Component)obj).addFocusListener(this);
+ mHelpDesc.put(obj, getHelpDescription(value));
+ row.addElement(new JLabel(entry));
+ row.addElement(obj);
+ defdata.addElement(row);
+ }
+ ProfilePolicyEditDataModel defmodel = new ProfilePolicyEditDataModel();
+ defmodel.setInfo(defdata, defcolNames);
+ mDefaultTable.setModel(defmodel);
+
+ if (response != null) {
+ mPluginName.setText(profileId);
+ mPluginName.setBackground(getBackground());
+ mPluginName.setEnabled(false);
+ mNameField.setText(response.get("name"));
+ mDescField.setText(response.get("desc"));
+ }
+
+ // retrieve policy information
+ mModel.progressStart();
+ try {
+ name = profileId + ";" + conId;
+ response = mAdminConnection.read(DestDef.DEST_REGISTRY_ADMIN,
+ ScopeDef.SC_PROFILE_CONSTRAINT_POLICY,
+ conId,
+ request);
+ } catch (EAdminException e) {
+// CMSAdminUtil.showErrorDialog(mParentFrame, mResource, e.toString());
+ mModel.progressStop();
+ }
+ mModel.progressStop();
+
+ Vector colNames = new Vector();
+ colNames.addElement("Parameter");
+ colNames.addElement("Value");
+ Vector d = new Vector();
+
+ for (String entry : response.keySet()) {
+ entry = entry.trim();
+ String value = response.get(entry);
+ Debug.println("entry= "+entry);
+ Debug.println("value= "+value);
+
+ Object obj = getComponent(value);
+ Vector row = new Vector();
+ ((Component)obj).addFocusListener(this);
+ mHelpDesc.put(obj, getHelpDescription(value));
+ row.addElement(new JLabel(entry));
+ row.addElement(obj);
+ d.addElement(row);
+ }
+ ProfilePolicyEditDataModel model = new ProfilePolicyEditDataModel();
+ model.setInfo(d, colNames);
+ mConstraintTable.setModel(model);
+
+ String desc = mDescField.getText();
+ if (desc == null || desc.equals("")) {
+ if (mDefSetId != null) {
+ mDescField.setText(mDefSetId);
+ }
+ }
+
+ this.show();
+ }
+
+ protected void setLabelCellEditor(JTable table, int index) {
+/*
+ table.getColumnModel().getColumn(index).setCellRenderer(
+ new PasswordCellRenderer());
+*/
+ table.getColumnModel().getColumn(index).setCellEditor(
+ new DefaultCellEditor(new JTextField()));
+ }
+
+ class JComponentCellRenderer implements TableCellRenderer {
+ public Component getTableCellRendererComponent(JTable table,
+ Object value, boolean isSelected, boolean hasFocus, int row,
+ int column) {
+ return (JComponent)value;
+ }
+ }
+
+ private Object getComponent(String value) {
+ int start_pos = value.indexOf(';');
+ int end_pos = value.lastIndexOf(';');
+ int end1_pos = value.lastIndexOf(';',end_pos-1);
+ String syntax = null;
+ String syntaxVal = null;
+ String v = null;
+
+ syntax = value.substring(0,start_pos);
+ syntaxVal = value.substring(start_pos+1, end1_pos);
+ v = value.substring(end_pos+1);
+/*
+ StringTokenizer st = new StringTokenizer(value, ";");
+ String syntax = null;
+ String syntaxVal = null;
+ String v = null;
+ while (st.hasMoreTokens()) {
+ try {
+ syntax = st.nextToken();
+ syntaxVal = st.nextToken();
+ v = st.nextToken();
+ } catch (Exception e) {
+ }
+ }
+*/
+ if (syntax != null) {
+ return CMSAdminUtil.createTableCell(syntax, syntaxVal, v);
+ }
+
+ return null;
+ }
+
+ private String getHelpDescription(String value) {
+ int start_pos = value.indexOf(';');
+ int end_pos = value.lastIndexOf(';');
+ int end1_pos = value.lastIndexOf(';',end_pos-1);
+ String syntax = null;
+ String syntaxVal = null;
+ String v = null;
+ syntax = value.substring(0,start_pos);
+ syntaxVal = value.substring(start_pos+1, end_pos);
+ v = value.substring(end1_pos+1,end_pos);
+ return v;
+ }
+
+ /**
+ * From focuslistener interface. This lets us know when a component
+ * has received focus, so we can update the help text.
+ */
+ public void focusGained(FocusEvent f) {
+ Debug.println("focusGained");
+ Component comp = f.getComponent();
+ String desc = (String)mHelpDesc.get(comp);
+ if (desc != null) {
+ mHelpLabel.setText(desc);
+ }
+ }
+
+ /** need to supply this method for focuslistener, but we
+ * really don't care about it
+ */
+ public void focusLost(FocusEvent f) {
+ Debug.println("focusLost");
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/ProfilePolicySelectionDialog.java b/base/console/src/com/netscape/admin/certsrv/config/ProfilePolicySelectionDialog.java
new file mode 100644
index 000000000..44fe9886b
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/ProfilePolicySelectionDialog.java
@@ -0,0 +1,515 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Plugin Selection Dialog
+ *
+ * @author Jack Pan-chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class ProfilePolicySelectionDialog extends JDialog
+ implements ActionListener, MouseListener, ListSelectionListener
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ protected JFrame mParentFrame;
+ protected AdminConnection mConnection;
+ protected ResourceBundle mResource;
+ protected DefaultListModel mConstraintModel;
+ protected DefaultListModel mDefaultModel;
+ protected String mDestination; //dest flag
+
+ private JScrollPane mScrollPane;
+ protected JList mDefaultList, mConstraintList;
+ protected Hashtable mDefaultData, mConstraintData;
+ protected JLabel mDefaultLabel, mConstraintLabel;
+ protected JButton mOK, mCancel, mHelp;
+ protected String mDefSetId;
+ protected String mPrefix;
+ protected String mScope;
+ protected String mInstanceScope;
+ protected String mImageName;
+ protected String mProfileId;
+ protected String mHelpToken="configuration-certificateprofiles";
+ protected CMSPluginInstanceTab mPluginInstanceDialog;
+ protected CMSBaseResourceModel mModel=null;
+ protected String mExtraDestination;
+
+ public ProfilePolicySelectionDialog(
+ String defSetId,
+ String profileId,
+ String prefix,
+ JFrame parent,
+ AdminConnection conn,
+ String dest)
+ {
+ this(defSetId, profileId, prefix, parent, conn, dest, null, null);
+ }
+
+ public ProfilePolicySelectionDialog(
+ String defSetId,
+ String profileId,
+ String prefix,
+ JFrame parent,
+ AdminConnection conn,
+ String dest, String extraDest)
+ {
+ this(defSetId, profileId, prefix,
+ parent,
+ conn,
+ dest, extraDest,
+ null );
+ }
+
+ public ProfilePolicySelectionDialog(
+ String defSetId,
+ String profileId,
+ String prefix,
+ JFrame parent,
+ AdminConnection conn,
+ String dest,
+ CMSPluginInstanceTab pluginType) {
+ this(defSetId, profileId, prefix, parent, conn, dest, null, pluginType);
+ }
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public ProfilePolicySelectionDialog(
+ String defSetId,
+ String profileId,
+ String prefix,
+ JFrame parent,
+ AdminConnection conn,
+ String dest, String extraDest,
+ CMSPluginInstanceTab pluginType)
+ {
+ super(parent,true);
+ mDefSetId = defSetId;
+ mProfileId = profileId;
+ mParentFrame = parent;
+ mConnection = conn;
+ mDestination = dest;
+ mExtraDestination = extraDest;
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ mDefaultModel = new DefaultListModel();
+ mConstraintModel = new DefaultListModel();
+ mDefaultData = new Hashtable();
+ mConstraintData = new Hashtable();
+ mPrefix = prefix;
+ mPluginInstanceDialog = pluginType;
+
+ setTitle(mResource.getString(mPrefix+"_TITLE"));
+ setSize(440, 250);
+ setLocationRelativeTo(parent);
+ getRootPane().setDoubleBuffered(true);
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ public void setModel(CMSBaseResourceModel model)
+ {
+ mModel = model;
+ }
+
+ /**
+ * show the windows
+ * @param users list of current groups
+ */
+ public void showDialog() {
+
+ mConstraintModel.clear();
+ mDefaultModel.clear();
+
+ if(!update("defaultPolicy", mDefaultModel, mDefaultData))
+ return;
+/*
+ if(!update("constraintPolicy", mConstraintModel))
+ return;
+*/
+/*
+ refresh();
+ setArrowButtons();
+*/
+ this.show();
+ }
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent evt) {
+
+ if (evt.getSource().equals(mOK)) {
+
+ // check selection lists
+ if (mDefaultList.getSelectedIndex() < 0) {
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource, "Must select default", CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+
+ if (mConstraintList.getSelectedIndex() < 0) {
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource, "Must select constraint", CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+
+ NameValuePairs response = null;
+/*
+ try {
+ response = getDefaultConfig();
+ } catch (EAdminException e) {
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ e.getMessage(), CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ Debug.println(response.toString());
+ String id = ((JLabel)mDefaultModel.elementAt(mDefaultList.getSelectedIndex())).getText();
+ response.add(Constants.PR_POLICY_IMPL_NAME,id);
+*/
+ ProfilePolicyNewDialog dialog =
+ new ProfilePolicyNewDialog(
+ mDefSetId,
+ response,
+ mParentFrame,
+ mConnection,
+ mExtraDestination);
+
+ dialog.setModel(mModel);
+ dialog.setInstanceScope(mInstanceScope);
+
+ // profile;defClass;conClass
+ String defaultName = ((JLabel)mDefaultModel.elementAt(mDefaultList.getSelectedIndex())).getText();
+ String conName = ((JLabel)mConstraintModel.elementAt(mConstraintList.getSelectedIndex())).getText();
+
+
+ String namex = mProfileId + ";" + getID(defaultName, mDefaultData) +
+ ";" + getID(conName, mConstraintData);
+ dialog.showDialog(response,namex);
+
+ if(!dialog.isOK()) {
+ this.dispose();
+ return;
+ }
+
+ //response = dialog.getData();
+ // String name = dialog.getRuleName();
+
+ // Debug.println(response.toString());
+
+ dialog.dispose();
+ this.dispose();
+ }
+
+
+ if (evt.getSource().equals(mCancel)) {
+ this.dispose();
+ }
+ if (evt.getSource().equals(mHelp)) {
+ CMSAdminUtil.help(mHelpToken);
+ }
+ }
+
+ //==== MOUSELISTENER ======================
+ public void mouseClicked(MouseEvent e) {
+ setArrowButtons();
+ }
+
+ public void mousePressed(MouseEvent e) {}
+ public void mouseReleased(MouseEvent e) {
+ setArrowButtons();
+ }
+ public void mouseEntered(MouseEvent e) {}
+ public void mouseExited(MouseEvent e) {
+ setArrowButtons();
+ }
+
+ protected void setDisplay() {
+ Debug.println("*** PluginSelectionDialog.setDisplay() - 1");
+ getContentPane().setLayout(new BorderLayout());
+ JPanel center = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ center.setLayout(gb);
+
+ // default content panel
+ mDefaultLabel = CMSAdminUtil.makeJLabel(mResource, mPrefix,
+ "DEFAULTNAME", null);
+ center.add(mDefaultLabel);
+
+ JPanel content = makeDefaultContentPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.fill = gbc.BOTH;
+ gb.setConstraints(content, gbc);
+ center.add(content);
+
+ // constraint content panel
+ mConstraintLabel = CMSAdminUtil.makeJLabel(mResource, mPrefix,
+ "CONSTRAINTNAME", null);
+ center.add(mConstraintLabel);
+
+ JPanel content1 = makeConstraintContentPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.fill = gbc.BOTH;
+ gb.setConstraints(content1, gbc);
+ center.add(content1);
+
+ //action panel
+ JPanel action = makeActionPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints(action, gbc);
+ center.add(action);
+
+ getContentPane().add("Center",center);
+ }
+
+ //create botton action panel
+ private JPanel makeActionPane() {
+ mOK = CMSAdminUtil.makeJButton(mResource, mPrefix, "OK", null, this);
+ mCancel = CMSAdminUtil.makeJButton(mResource, mPrefix, "CANCEL", null, this);
+ mHelp = CMSAdminUtil.makeJButton(mResource, mPrefix, "HELP", null, this);
+ //JButton[] buttons = { mOK, mCancel, mHelp};
+ JButton[] buttons = { mOK, mCancel};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonPanel( buttons, true);
+ }
+
+ private JPanel makeDefaultContentPane() {
+ JPanel mListPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mListPanel.setLayout(gb);
+ //content.setBorder(CMSAdminUtil.makeEtchedBorder());
+
+ //left side certificate table
+ mDefaultList = CMSAdminUtil.makeJList(mDefaultModel,9);
+ mDefaultList.addListSelectionListener(this);
+ Debug.println("PluginSelectionDialog.makeContentPane() - making mList("+mDefaultList+")");
+ mScrollPane = new JScrollPane(mDefaultList,
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mDefaultList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION );
+ mDefaultList.addMouseListener(this);
+ mScrollPane.setBackground(Color.white);
+ mScrollPane.setBorder(BorderFactory.createLoweredBevelBorder());
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.fill = gbc.BOTH;
+ gb.setConstraints(mScrollPane, gbc);
+ mListPanel.add(mScrollPane);
+
+ return mListPanel;
+ }
+
+ private JPanel makeConstraintContentPane() {
+ JPanel mListPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mListPanel.setLayout(gb);
+ //content.setBorder(CMSAdminUtil.makeEtchedBorder());
+
+ //left side certificate table
+ mConstraintList = CMSAdminUtil.makeJList(mConstraintModel,9);
+ Debug.println("PluginSelectionDialog.makeContentPane() - making mList("+mConstraintList+")");
+ mScrollPane = new JScrollPane(mConstraintList,
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mConstraintList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION );
+ mConstraintList.addMouseListener(this);
+ mScrollPane.setBackground(Color.white);
+ mScrollPane.setBorder(BorderFactory.createLoweredBevelBorder());
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.fill = gbc.BOTH;
+ gb.setConstraints(mScrollPane, gbc);
+ mListPanel.add(mScrollPane);
+
+ return mListPanel;
+ }
+
+
+ //set arrow buttons
+ private void setArrowButtons() {
+
+ //enable and diable buttons accordingly
+ //Debug.println("setArrowButtons() - "+mList.getSelectedIndex());
+
+ if (mDefaultList.getSelectedIndex()< 0 && mConstraintList.getSelectedIndex()<0) {
+ mOK.setEnabled(false);
+ return;
+ }
+
+ mOK.setEnabled(true);
+ }
+
+ //refresh the table content
+ private void refresh() {
+ //mScrollPane.invalidate();
+ //mScrollPane.validate();
+ //repaint();
+ }
+
+ public void valueChanged(ListSelectionEvent e) {
+ if (e.getSource().equals(mDefaultList)) {
+ if (mDefaultList.getSelectedIndex() < 0)
+ return;
+ String name = ((JLabel)mDefaultModel.elementAt(mDefaultList.getSelectedIndex())).getText();
+ NameValuePairs response=null;
+
+ try {
+ response = mConnection.read(mDestination,
+ ScopeDef.SC_SUPPORTED_CONSTRAINTPOLICIES,
+ getID(name, mDefaultData), new NameValuePairs());
+ Debug.println(response.toString());
+ } catch (Exception ex) {
+ Debug.println(ex.toString());
+ }
+
+ mConstraintModel.clear();
+ mConstraintData.clear();
+ parseData(response, mConstraintModel, mConstraintData);
+ mConstraintList.invalidate();
+ mConstraintList.validate();
+ repaint();
+ }
+ }
+
+ //=================================================
+ // RETRIEVE INFO FROM SERVER SIDE
+ //=================================================
+
+ //save order information to the server
+ protected boolean update(String scope, DefaultListModel model,
+ Hashtable data) {
+
+ NameValuePairs response;
+ NameValuePairs params = new NameValuePairs();
+ try {
+ response = mConnection.search(mDestination, scope,
+ params);
+ } catch (EAdminException e) {
+ //display error dialog
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ e.getMessage(), CMSAdminUtil.ERROR_MESSAGE);
+ return false;
+ }
+
+ Debug.println(response.toString());
+
+ model.clear();
+ data.clear();
+ parseData(response, model, data);
+ return true;
+ }
+
+ private void parseData(NameValuePairs response, DefaultListModel model,
+ Hashtable data) {
+ //parse the data
+ String[] vals = new String[response.size()];
+ int i=0;
+ for (String name : response.keySet()) {
+ name = name.trim();
+ String val = response.get(name);
+ StringTokenizer st = new StringTokenizer(val, ",");
+ String className = st.nextToken();
+ String desc = st.nextToken();
+ String friendlyName = st.nextToken();
+ vals[i++] = friendlyName.trim();
+ data.put(name, friendlyName);
+ Debug.println("PluginSelectionDialog::update() - adding '"+vals[i-1]+"'");
+ }
+
+ CMSAdminUtil.bubbleSort(vals);
+
+ for (int y=0; y< vals.length ; y++) {
+ try {
+ model.addElement(new JLabel(vals[y],
+ CMSAdminUtil.getImage(mImageName), JLabel.LEFT));
+ }
+ catch (Exception ex) {
+ Debug.println("PluginSelectionDialog could not get image for '"+
+ mImageName+"'. Adding without image");
+ model.addElement(new JLabel(vals[y],
+ JLabel.LEFT));
+ }
+ }
+ }
+
+ //this returns the default configuration
+ protected NameValuePairs getDefaultConfig() throws EAdminException {
+ String name = ((JLabel)mDefaultModel.elementAt(mDefaultList.getSelectedIndex())).getText();
+ NameValuePairs response;
+ response = mConnection.read(mDestination,
+ ScopeDef.SC_SUPPORTED_CONSTRAINTPOLICIES, getID(name.trim(), mDefaultData),
+ new NameValuePairs());
+
+ Debug.println(response.toString());
+
+ return response;
+ }
+
+ private String getID(String name, Hashtable t) {
+ Enumeration keys = t.keys();
+ while (keys.hasMoreElements()) {
+ String key = (String)keys.nextElement();
+ String val = (String)t.get(key);
+ if (val.equals(name)) {
+ return key;
+ }
+ }
+ return "";
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/ProfileRegisterDialog.java b/base/console/src/com/netscape/admin/certsrv/config/ProfileRegisterDialog.java
new file mode 100644
index 000000000..c576adbe6
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/ProfileRegisterDialog.java
@@ -0,0 +1,303 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+
+/**
+ * Policy Implementation Registration Editor
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class ProfileRegisterDialog extends JDialog
+ implements ActionListener, DocumentListener, MouseListener
+{
+
+ private final static String PREFIX = "PROFILEREGISTERDIALOG";
+
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private JFrame mParentFrame;
+ private AdminConnection mConnection;
+ private ResourceBundle mResource;
+
+ private JTextField mNameField, mClassField, mTypeField, mDescField;
+ private JButton mOK, mCancel;
+
+ protected String mDestination; //DEST_TAG to support RA/KRA/CA dest
+ protected String mScope;
+ protected String mPrefix;
+ private boolean mIsOK = false;
+ protected boolean mType = false;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public ProfileRegisterDialog(String prefix, JFrame parent, AdminConnection conn) {
+ super(parent,true);
+ mParentFrame = parent;
+ mPrefix = prefix;
+ mConnection = conn;
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ setSize(360, 216);
+ setTitle(mResource.getString(mPrefix+"_TITLE"));
+ setLocationRelativeTo(parent);
+ getRootPane().setDoubleBuffered(true);
+ //setDisplay(); SUBCLASS MUST call setDiaply() in its constructor
+ }
+
+ public ProfileRegisterDialog(JFrame parent, AdminConnection conn) {
+ this(PREFIX, parent, conn);
+ mType = true;
+ setDisplay();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * show the windows
+ */
+ public void showDialog(String destination, String scope) {
+ //initialize and setup
+ mNameField.setText("");
+ mClassField.setText("");
+ mTypeField.setText("");
+ mDescField.setText("");
+ mDestination=destination;
+ mScope=scope;
+ this.show();
+ }
+
+ protected void setDestination(String destination) {
+ mDestination = destination;
+ }
+
+ protected void setScope(String scope) {
+ mScope = scope;
+ }
+
+ public boolean isOK() {
+ return mIsOK;
+ }
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent evt) {
+
+ if (evt.getSource().equals(mCancel)) {
+ mIsOK = false;
+ this.hide();
+ }
+
+ if (evt.getSource().equals(mOK)) {
+
+ /* REPLACED BY PROACTIVE ENFORCEMENT
+ if (mNameField.getText().trim().equals("")) {
+ CMSAdminUtil.showMessageDialog(mParentFrame, mResource, mPrefix,
+ "NONAME", CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ if (mClassField.getText().trim().equals("")) {
+ CMSAdminUtil.showMessageDialog(mParentFrame, mResource, mPrefix,
+ "NOCLASS", CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ */
+
+ //save value
+ try {
+ addImpl();
+ } catch (EAdminException e) {
+ //display error dialog
+ Debug.println(e.toString());
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ e.toString(), CMSAdminUtil.ERROR_MESSAGE);
+ mIsOK = false;
+ return;
+ }
+ mIsOK = true;
+ this.hide();
+ }
+ }
+
+ //== DocumentListener ==
+ public void insertUpdate(DocumentEvent e) {
+ setButtons();
+ }
+
+ public void removeUpdate(DocumentEvent e){
+ setButtons();
+ }
+
+ public void changedUpdate(DocumentEvent e){
+ setButtons();
+ }
+
+ //==== MOUSELISTENER ======================
+ public void mouseClicked(MouseEvent e) {
+ setButtons();
+ }
+
+ public void mousePressed(MouseEvent e) {}
+ public void mouseReleased(MouseEvent e) {}
+ public void mouseEntered(MouseEvent e) {}
+ public void mouseExited(MouseEvent e) {
+ setButtons();
+ }
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+
+ protected void setDisplay() {
+ getContentPane().setLayout(new BorderLayout());
+ JPanel center = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ center.setLayout(gb);
+
+ //content panel
+ JPanel content = makeContentPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(content, gbc);
+ center.add(content);
+
+ //action panel
+ JPanel action = makeActionPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints(action, gbc);
+ center.add(action);
+
+ getContentPane().add("Center",center);
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+
+ //set arrow buttons
+ private void setButtons() {
+ if ( (mNameField.getText().trim().equals("")) ||
+ (mClassField.getText().trim().equals("")) ) {
+ mOK.setEnabled(false);
+ } else {
+ mOK.setEnabled(true);
+ }
+ }
+
+ private JPanel makeActionPane() {
+ mOK = CMSAdminUtil.makeJButton(mResource, mPrefix, "OK", null, this);
+ mOK.setEnabled(false);
+ mCancel = CMSAdminUtil.makeJButton(mResource, mPrefix, "CANCEL", null, this);
+ JButton[] buttons = { mOK, mCancel};
+ return CMSAdminUtil.makeJButtonPanel( buttons );
+ }
+
+ private JPanel makeContentPane() {
+ JPanel content = new JPanel();
+ GridBagLayout gb3 = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ content.setLayout(gb3);
+ //content.setBorder(CMSAdminUtil.makeEtchedBorder());
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label1 = CMSAdminUtil.makeJLabel(mResource, mPrefix, "NAME", null);
+ mNameField = new JTextField();
+ mNameField.getDocument().addDocumentListener(this);
+ mNameField.addMouseListener(this);
+ CMSAdminUtil.addEntryField(content, label1, mNameField, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ // gbc.gridheight = gbc.REMAINDER;
+ JLabel label2 = CMSAdminUtil.makeJLabel(mResource, mPrefix, "CLASS", null);
+ mClassField = new JTextField();
+ mClassField.getDocument().addDocumentListener(this);
+ mClassField.addMouseListener(this);
+ CMSAdminUtil.addEntryField(content, label2, mClassField, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ // gbc.gridheight = gbc.REMAINDER;
+ JLabel label3 = CMSAdminUtil.makeJLabel(mResource, mPrefix, "TYPE", null);
+ mTypeField = new JTextField();
+ mTypeField.getDocument().addDocumentListener(this);
+ mTypeField.addMouseListener(this);
+ CMSAdminUtil.addEntryField(content, label3, mTypeField, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.gridheight = gbc.REMAINDER;
+ JLabel label4 = CMSAdminUtil.makeJLabel(mResource, mPrefix, "DESC", null);
+ mDescField = new JTextField();
+ mDescField.getDocument().addDocumentListener(this);
+ mDescField.addMouseListener(this);
+ CMSAdminUtil.addEntryField(content, label4, mDescField, gbc);
+
+ return content;
+ }
+
+ //=================================================
+ // CONNECT TO SERVER SIDE
+ //=================================================
+
+ //add new group information
+ private void addImpl() throws EAdminException {
+
+ //construct NVP
+ NameValuePairs config = new NameValuePairs();
+ config.put(Constants.PR_POLICY_CLASS, mClassField.getText());
+ config.put(Constants.PR_POLICY_DESC, mDescField.getText());
+
+ if (mType) {
+ mScope=mTypeField.getText();
+ }
+
+ //send request
+ mConnection.add(mDestination,
+ mScope,
+ mNameField.getText().trim(),
+ config);
+ }
+
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/ProfileRuleDataModel.java b/base/console/src/com/netscape/admin/certsrv/config/ProfileRuleDataModel.java
new file mode 100644
index 000000000..7a3ba2827
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/ProfileRuleDataModel.java
@@ -0,0 +1,69 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+
+
+/**
+ * Policy instance Data model - represents the instance
+ * table information
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public class ProfileRuleDataModel extends CMSRuleDataModel
+{
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public ProfileRuleDataModel() {
+ super();
+ }
+
+ protected String[] getColumns() {
+ String x[] = {PROFILE_RULE, STATUS};
+ return x;
+ }
+
+ public void processData(Object data) {
+ Vector v = new Vector();
+ NameValuePairs obj = (NameValuePairs) data;
+
+ //XXX NEED TO ADD STUFF
+ if (obj.get(RULE_STAT).equalsIgnoreCase("enabled")) {
+ v.addElement(new JLabel(obj.get(RULE_NAME),
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE),
+ JLabel.LEFT));
+ v.addElement(mResource.getString("POLICYRULE_LABEL_ENABLED_LABEL"));
+ } else {
+ v.addElement(new JLabel(obj.get(RULE_NAME),
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE_DISABLE),
+ JLabel.LEFT));
+ v.addElement(mResource.getString("POLICYRULE_LABEL_DISABLED_LABEL"));
+ }
+ addRow(v, data);
+ mRules.addElement(obj.get(RULE_NAME));
+ }
+
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/PublisherConfigDialog.java b/base/console/src/com/netscape/admin/certsrv/config/PublisherConfigDialog.java
new file mode 100644
index 000000000..90d67ba9e
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/PublisherConfigDialog.java
@@ -0,0 +1,64 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import javax.swing.table.*;
+import javax.swing.text.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Publisher Parameter Configuration Dialog
+ *
+ * @author Steve Parkinson
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class PublisherConfigDialog extends CMSBaseConfigDialog
+ implements ActionListener
+{
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public PublisherConfigDialog(NameValuePairs nvp,
+ JFrame parent,
+ AdminConnection conn,
+ String dest) {
+
+ super(parent, dest);
+
+ PREFIX = "PUBLISHERCONFIGDIALOG";
+ RAHELPINDEX = "configuration-ra-edit-publisherrule-dbox-help";
+ KRAHELPINDEX = "configuration-kra-edit-publisherrule-dbox-help";
+ CAHELPINDEX = "configuration-ca-edit-publisherrule-dbox-help";
+ mImplName_token = Constants.PR_PUBLISHER_IMPL_NAME;
+ mImplType = Constants.PR_EXT_PLUGIN_IMPLTYPE_PUBLISHER;
+
+ init(nvp,parent,conn,dest);
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/PublisherImplDataModel.java b/base/console/src/com/netscape/admin/certsrv/config/PublisherImplDataModel.java
new file mode 100644
index 000000000..aefa4b1cc
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/PublisherImplDataModel.java
@@ -0,0 +1,68 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Policy Implementation Data model - represents the implementation
+ * table information
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class PublisherImplDataModel extends CMSContentTableModel
+ implements IDataProcessor
+{
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ public static final String IMPL_NAME = "NAME";
+ public static final String IMPL_CLASS = "CLASS";
+ public static final String IMPL_DESC = "DESC";
+
+ private static String[] mColumns = {PUBLISHER_IMPL, CLASSNAME};
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public PublisherImplDataModel() {
+ super();
+ init(mColumns);
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public void processData(Object data) {
+ Vector v = new Vector();
+ NameValuePairs obj = (NameValuePairs) data;
+ v.addElement(new JLabel(obj.get(IMPL_NAME),
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE_PLUGIN),
+ JLabel.LEFT));
+ v.addElement(obj.get(IMPL_CLASS));
+ //v.addElement(obj.getValue(IMPL_DESC));
+ addRow(v, data);
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/PublisherImplTab.java b/base/console/src/com/netscape/admin/certsrv/config/PublisherImplTab.java
new file mode 100644
index 000000000..79fedfe5e
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/PublisherImplTab.java
@@ -0,0 +1,321 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.ug.*;
+import javax.swing.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Publisher Instances Management Tab
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class PublisherImplTab extends CMSBaseUGTab {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String IMPL_NAME = PublisherImplDataModel.IMPL_NAME;
+ private static final String IMPL_CLASS = PublisherImplDataModel.IMPL_CLASS;
+ private static final String IMPL_DESC = PublisherImplDataModel.IMPL_DESC;
+
+ private static final String PANEL_NAME = "PUBLISHERIMPL";
+ private static final String DIALOG_PREFIX = "PUBLISHERREGISTERDIALOG";
+
+ private AdminConnection mConnection;
+ private String mDestination;
+
+ protected JScrollPane mScrollPane;
+ protected JTable mTable; //table
+ protected PublisherImplDataModel mDataModel; //table model
+ protected PublisherRegisterDialog mEditor=null; //keep single copy
+ protected ViewDialog mViewer=null; //keep single copy
+
+ protected JButton mRefresh, mAdd, mDelete, mView, mHelp;
+ private final static String RAHELPINDEX = "configuration-ra-publisherplugin-help";
+ private final static String CAHELPINDEX = "configuration-ca-publisherplugin-help";
+ private final static String KRAHELPINDEX = "configuration-publisherkra-plugin-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public PublisherImplTab(CMSBaseResourceModel model, String destination) {
+ super(PANEL_NAME, model);
+ mConnection = model.getServerInfo().getAdmin();
+ mDataModel = new PublisherImplDataModel();
+ mDestination = destination;
+ if (mDestination.equals(DestDef.DEST_RA_PUBLISHER_ADMIN))
+ mHelpToken = RAHELPINDEX;
+ else
+ mHelpToken = CAHELPINDEX;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mRefresh)) {
+ refresh();
+ }
+ if (e.getSource().equals(mAdd)) {
+ if (mEditor==null)
+ mEditor = new PublisherRegisterDialog(mModel.getFrame(),
+ mConnection);
+ mEditor.showDialog(mDestination, ScopeDef.SC_PUBLISHER_IMPLS);
+ refresh();
+ }
+ if (e.getSource().equals(mDelete)) {
+ Debug.println("Delete");
+ if(mTable.getSelectedRow()< 0)
+ return;
+ int i = showConfirmDialog("DELETE");
+ if (i == JOptionPane.YES_OPTION) {
+ delete();
+ Debug.println("Deleted");
+ }
+ }
+ if (e.getSource().equals(mView)) {
+ Debug.println("View");
+ if(mTable.getSelectedRow()< 0)
+ return;
+ NameValuePairs obj = (NameValuePairs)
+ mDataModel.getObjectValueAt(mTable.getSelectedRow());
+ if (mViewer==null)
+ mViewer = new ViewDialog(mModel.getFrame());
+ mViewer.showDialog(obj.get(IMPL_NAME),
+ obj.get(IMPL_CLASS),
+ obj.get(IMPL_DESC));
+ }
+ if (e.getSource().equals(mHelp)) {
+ helpCallback();
+ }
+ }
+
+ //==== MOUSELISTENER ======================
+ public void mouseClicked(MouseEvent e) {
+ setButtons();
+ }
+
+ public void mouseReleased(MouseEvent e) {
+ setButtons();
+ }
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+ public void refresh() {
+
+ mDataModel.removeAllRows();
+ update();
+
+ setButtons();
+ mTable.invalidate();
+ mTable.validate();
+ mTable.repaint(1);
+ }
+
+ /**
+ * create the user action button panel
+ */
+ protected JPanel createButtonPanel() {
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mAdd = makeJButton("ADD");
+ mDelete = makeJButton("DELETE");
+ mView = makeJButton("VIEW");
+ JButton[] buttons = {mAdd, mDelete, mView};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonVPanel( buttons );
+ }
+
+ protected JPanel createActionPanel() {
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mRefresh = makeJButton("REFRESH");
+ mHelp = makeJButton("HELP");
+ //JButton[] buttons = { mRefresh, mHelp };
+ JButton[] buttons = { mRefresh };
+ return makeJButtonPanel(buttons, true);
+ }
+
+ protected JPanel createListPanel() {
+ mListPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mListPanel.setLayout(gb);
+
+ //center table
+ mTable = new JTable(mDataModel);
+ mScrollPane = JTable.createScrollPaneForTable(mTable);
+ //mScrollPane.setBorder(CMSAdminUtil.makeTitledBorder(mResource,PANEL_NAME,"USERS"));
+ mScrollPane.setHorizontalScrollBarPolicy(mScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mScrollPane.setVerticalScrollBarPolicy(mScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ mTable.setAutoscrolls(true);
+ mTable.sizeColumnsToFit(true);
+ mTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ mTable.getSelectionModel().addListSelectionListener(this);
+ mScrollPane.setBackground(Color.white);
+ mTable.addMouseListener(this);
+ setLabelCellRenderer(mTable,0);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = 1;
+ gbc.weightx = 1.0;
+ gbc.insets = EMPTY_INSETS;
+ gb.setConstraints(mScrollPane, gbc);
+ mListPanel.add(mScrollPane);
+
+ JPanel buttonPanel = createButtonPanel();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 0.0;
+ gbc.weighty = 1.0;
+ gbc.insets = EMPTY_INSETS;
+ gb.setConstraints(buttonPanel, gbc);
+ mListPanel.add(buttonPanel);
+
+ refresh();
+
+ return mListPanel;
+ }
+
+ //Set the first column's cellrender as label cell
+ protected void setLabelCellRenderer(JTable table, int index) {
+ table.getColumnModel().getColumn(index).setCellRenderer(new LabelCellRenderer(new JLabel()));
+ }
+
+
+ //set buttons
+ private void setButtons() {
+
+ //enable and diable buttons accordingly
+ //Debug.println("setButtons() - "+mTable.getSelectedRow());
+ //Debug.println("setButtons() - "+mTable.getSelectionModel().isSelectionEmpty());
+ if (mTable.getSelectionModel().isSelectionEmpty()) {
+ mDelete.setEnabled(false);
+ mView.setEnabled(false);
+ return;
+ }
+
+ if(mDataModel.getRowCount()<=0) {
+ mDelete.setEnabled(false);
+ mView.setEnabled(false);
+ return;
+ }
+
+ mDelete.setEnabled(true);
+ mView.setEnabled(true);
+
+ }
+
+ //=============================================
+ // SEND REQUESTS TO THE SERVER SIDE
+ //=============================================
+ private void update() {
+ //send request and parse data
+
+ mModel.progressStart();
+ NameValuePairs response;
+ try {
+ response = mConnection.search(mDestination,
+ "publisherImpls",
+ // ScopeDef.SC_PUBLISHER_IMPLS,
+ new NameValuePairs());
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ mModel.progressStop();
+ return;
+ }
+
+ Debug.println(response.toString());
+
+ //parse the data
+ int i=0;
+ String[] vals = new String[response.size()];
+ Hashtable data = new Hashtable();
+ for (String entry : response.keySet()) {
+ entry = entry.trim();
+ String value = response.get(entry);
+ int x = value.indexOf(",");
+ NameValuePairs obj = new NameValuePairs();
+ obj.put(IMPL_NAME, entry);
+ vals[i++]= entry ;
+ obj.put(IMPL_CLASS, value.substring(0, x));
+ obj.put(IMPL_DESC, value.substring(x + 1));
+ data.put(entry,obj);
+ }
+
+ CMSAdminUtil.bubbleSort(vals);
+
+ for (int y=0; y< vals.length ; y++) {
+ mDataModel.processData(data.get(vals[y]));
+ }
+
+ data.clear();
+
+ if (mDataModel.getRowCount() >0)
+ mTable.setRowSelectionInterval(0,0);
+
+ mModel.progressStop();
+ }
+
+ private void delete() {
+ //get entry name
+ mModel.progressStart();
+ NameValuePairs obj = (NameValuePairs)
+ mDataModel.getObjectValueAt(mTable.getSelectedRow());
+
+ //send comment to server for the removal of user
+ try {
+ mConnection.delete(mDestination,
+ ScopeDef.SC_PUBLISHER_IMPLS,
+ obj.get(IMPL_NAME));
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ mModel.progressStop();
+ return;
+ }
+ mModel.progressStop();
+ //send comment to server and refetch the content
+ refresh();
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/PublisherInstanceTab.java b/base/console/src/com/netscape/admin/certsrv/config/PublisherInstanceTab.java
new file mode 100644
index 000000000..e9d3bdbb0
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/PublisherInstanceTab.java
@@ -0,0 +1,95 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.ug.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Publisher Instances Management Tab
+ *
+ * @author Steve Parkinson
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class PublisherInstanceTab extends CMSPluginInstanceTab {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PANEL_NAME = "PUBLISHERRULE";
+
+ private final static String RAHELPINDEX = "configuration-ra-publisherinstances-help";
+ private final static String CAHELPINDEX = "configuration-ca-publisherinstances-help";
+ private final static String KRAHELPINDEX = "configuration-kra-publisherinstances-help";
+
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public PublisherInstanceTab(CMSBaseResourceModel model, String dest) {
+ super(model,dest,PANEL_NAME);
+ Debug.println("PublisherInstanceTab::PublisherInstanceTab(<model>,"+dest);
+ mConnection = model.getServerInfo().getAdmin();
+ mDataModel = new PublisherRuleDataModel();
+ mScope = ScopeDef.SC_PUBLISHER_RULES;
+ RULE_NAME = PublisherRuleDataModel.RULE_NAME;
+ RULE_STAT = PublisherRuleDataModel.RULE_STAT;
+
+ if (mDestination.equals(DestDef.DEST_RA_PUBLISHER_ADMIN))
+ mHelpToken = RAHELPINDEX;
+ else
+ mHelpToken = CAHELPINDEX;
+ }
+
+
+ public CMSBaseConfigDialog makeNewConfigDialog(
+ NameValuePairs nvp,
+ JFrame parent,
+ AdminConnection conn,
+ String dest
+ )
+ {
+
+ return new PublisherConfigDialog(nvp,
+ parent,
+ conn,
+ dest);
+ }
+
+ public PluginSelectionDialog getPluginSelectionDialog(
+ JFrame parent,
+ AdminConnection conn,
+ String dest,
+ CMSPluginInstanceTab pluginType
+ )
+ {
+ return new PublisherPluginSelectionDialog(parent,conn,dest,pluginType);
+ }
+
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/PublisherPluginSelectionDialog.java b/base/console/src/com/netscape/admin/certsrv/config/PublisherPluginSelectionDialog.java
new file mode 100644
index 000000000..536d9096f
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/PublisherPluginSelectionDialog.java
@@ -0,0 +1,74 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Publisher Plugin Selection Dialog
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class PublisherPluginSelectionDialog extends PluginSelectionDialog
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PREFIX = "PUBLISHERSELECTIONDIALOG";
+ private static final String CAHELPINDEX =
+ "configuration-ca-add-publisherrule-dbox-help";
+ private static final String RAHELPINDEX =
+ "configuration-ra-add-publisherrule-dbox-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public PublisherPluginSelectionDialog(
+ JFrame parent,
+ AdminConnection conn,
+ String dest,
+ CMSPluginInstanceTab pluginType)
+ {
+ super(PREFIX, parent,conn, dest, pluginType);
+ mScope = ScopeDef.SC_PUBLISHER_IMPLS;
+ mInstanceScope = ScopeDef.SC_PUBLISHER_RULES;
+ mImageName = CMSAdminResources.IMAGE_RULE_PLUGIN;
+ if (dest.equals(DestDef.DEST_RA_PUBLISHER_ADMIN))
+ mHelpToken = RAHELPINDEX;
+ else
+ mHelpToken = CAHELPINDEX;
+ setDisplay();
+ }
+
+ /*==========================================================
+ * EVENT HANDLER METHODS
+ *==========================================================*/
+
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/PublisherRegisterDialog.java b/base/console/src/com/netscape/admin/certsrv/config/PublisherRegisterDialog.java
new file mode 100644
index 000000000..23e1a5913
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/PublisherRegisterDialog.java
@@ -0,0 +1,40 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+
+/**
+ * Publisher Implementation Registration Editor
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+
+public class PublisherRegisterDialog extends RegisterDialog {
+
+ private final static String PREFIX = "PUBLISHERREGISTERDIALOG";
+
+ public PublisherRegisterDialog(JFrame parent, AdminConnection conn) {
+ super(PREFIX, parent, conn);
+ setDisplay();
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/PublisherRuleDataModel.java b/base/console/src/com/netscape/admin/certsrv/config/PublisherRuleDataModel.java
new file mode 100644
index 000000000..03faeac21
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/PublisherRuleDataModel.java
@@ -0,0 +1,62 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.Debug;
+
+
+/**
+ * Publisher instance Data model - represents the instance
+ * table information
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public class PublisherRuleDataModel extends CMSRuleDataModel
+{
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public PublisherRuleDataModel() {
+ super();
+ }
+
+ protected String[] getColumns() {
+ Debug.println("PublisherRuleDataModel.getColumns()");
+ String x[] = {PUBLISHER_RULE, PLUGIN};
+ return x;
+ }
+
+ public void processData(Object data) {
+ Vector v = new Vector();
+ NameValuePairs obj = (NameValuePairs) data;
+
+ v.addElement(new JLabel(obj.get(RULE_NAME),
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE),
+ JLabel.LEFT));
+ v.addElement(obj.get(RULE_IMPL));
+ addRow(v, data);
+ }
+
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/RegisterDialog.java b/base/console/src/com/netscape/admin/certsrv/config/RegisterDialog.java
new file mode 100644
index 000000000..fe48419c7
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/RegisterDialog.java
@@ -0,0 +1,286 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Registration Editor
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class RegisterDialog extends JDialog
+ implements ActionListener, DocumentListener, MouseListener
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private JFrame mParentFrame;
+ private AdminConnection mConnection;
+ private ResourceBundle mResource;
+
+ private JTextField mNameField, mClassField, mTypeField;
+ private JButton mOK, mCancel;
+
+ protected String mDestination; //DEST_TAG to support RA/KRA/CA dest
+ protected String mScope;
+ protected String mPrefix;
+ private boolean mIsOK = false;
+ protected boolean mType = false;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public RegisterDialog(String prefix, JFrame parent, AdminConnection conn) {
+ super(parent,true);
+ mParentFrame = parent;
+ mPrefix = prefix;
+ mConnection = conn;
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ setSize(360, 216);
+ setTitle(mResource.getString(mPrefix+"_TITLE"));
+ setLocationRelativeTo(parent);
+ getRootPane().setDoubleBuffered(true);
+ //setDisplay(); SUBCLASS MUST call setDiaply() in its constructor
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * show the windows
+ */
+ public void showDialog(String destination, String scope) {
+ //initialize and setup
+ mNameField.setText("");
+ mClassField.setText("");
+ if (mType) {
+ mTypeField.setText("");
+ }
+ mDestination=destination;
+ mScope=scope;
+ this.show();
+ }
+
+ protected void setDestination(String destination) {
+ mDestination = destination;
+ }
+
+ protected void setScope(String scope) {
+ mScope = scope;
+ }
+
+ public boolean isOK() {
+ return mIsOK;
+ }
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent evt) {
+
+ if (evt.getSource().equals(mCancel)) {
+ mIsOK = false;
+ this.hide();
+ }
+
+ if (evt.getSource().equals(mOK)) {
+
+ /* REPLACED BY PROACTIVE ENFORCEMENT
+ if (mNameField.getText().trim().equals("")) {
+ CMSAdminUtil.showMessageDialog(mParentFrame, mResource, mPrefix,
+ "NONAME", CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ if (mClassField.getText().trim().equals("")) {
+ CMSAdminUtil.showMessageDialog(mParentFrame, mResource, mPrefix,
+ "NOCLASS", CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ */
+
+ //save value
+ try {
+ addImpl();
+ } catch (EAdminException e) {
+ //display error dialog
+ Debug.println(e.toString());
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ e.toString(), CMSAdminUtil.ERROR_MESSAGE);
+ mIsOK = false;
+ return;
+ }
+ mIsOK = true;
+ this.hide();
+ }
+ }
+
+ //== DocumentListener ==
+ public void insertUpdate(DocumentEvent e) {
+ setButtons();
+ }
+
+ public void removeUpdate(DocumentEvent e){
+ setButtons();
+ }
+
+ public void changedUpdate(DocumentEvent e){
+ setButtons();
+ }
+
+ //==== MOUSELISTENER ======================
+ public void mouseClicked(MouseEvent e) {
+ setButtons();
+ }
+
+ public void mousePressed(MouseEvent e) {}
+ public void mouseReleased(MouseEvent e) {}
+ public void mouseEntered(MouseEvent e) {}
+ public void mouseExited(MouseEvent e) {
+ setButtons();
+ }
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+
+ protected void setDisplay() {
+ getContentPane().setLayout(new BorderLayout());
+ JPanel center = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ center.setLayout(gb);
+
+ //content panel
+ JPanel content = makeContentPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(content, gbc);
+ center.add(content);
+
+ //action panel
+ JPanel action = makeActionPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints(action, gbc);
+ center.add(action);
+
+ getContentPane().add("Center",center);
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+
+ //set arrow buttons
+ private void setButtons() {
+ if ( (mNameField.getText().trim().equals("")) ||
+ (mClassField.getText().trim().equals("")) ) {
+ mOK.setEnabled(false);
+ } else {
+ mOK.setEnabled(true);
+ }
+ }
+
+ private JPanel makeActionPane() {
+ mOK = CMSAdminUtil.makeJButton(mResource, mPrefix, "OK", null, this);
+ mOK.setEnabled(false);
+ mCancel = CMSAdminUtil.makeJButton(mResource, mPrefix, "CANCEL", null, this);
+ JButton[] buttons = { mOK, mCancel};
+ return CMSAdminUtil.makeJButtonPanel( buttons );
+ }
+
+ private JPanel makeContentPane() {
+ JPanel content = new JPanel();
+ GridBagLayout gb3 = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ content.setLayout(gb3);
+ //content.setBorder(CMSAdminUtil.makeEtchedBorder());
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label1 = CMSAdminUtil.makeJLabel(mResource, mPrefix, "NAME", null);
+ mNameField = new JTextField();
+ mNameField.getDocument().addDocumentListener(this);
+ mNameField.addMouseListener(this);
+ CMSAdminUtil.addEntryField(content, label1, mNameField, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ // gbc.gridheight = gbc.REMAINDER;
+ JLabel label2 = CMSAdminUtil.makeJLabel(mResource, mPrefix, "CLASS", null);
+ mClassField = new JTextField();
+ mClassField.getDocument().addDocumentListener(this);
+ mClassField.addMouseListener(this);
+ CMSAdminUtil.addEntryField(content, label2, mClassField, gbc);
+
+ if (mType) {
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.gridheight = gbc.REMAINDER;
+ JLabel label3 = CMSAdminUtil.makeJLabel(mResource, mPrefix, "TYPE", null);
+ mTypeField = new JTextField();
+ mTypeField.getDocument().addDocumentListener(this);
+ mTypeField.addMouseListener(this);
+ CMSAdminUtil.addEntryField(content, label3, mTypeField, gbc);
+ }
+
+ return content;
+ }
+
+ //=================================================
+ // CONNECT TO SERVER SIDE
+ //=================================================
+
+ //add new group information
+ private void addImpl() throws EAdminException {
+
+ //construct NVP
+ NameValuePairs config = new NameValuePairs();
+ config.put(Constants.PR_POLICY_CLASS, mClassField.getText());
+
+ if (mType) {
+ mScope=mTypeField.getText();
+ }
+
+ //send request
+ mConnection.add(mDestination,
+ mScope,
+ mNameField.getText().trim(),
+ config);
+ }
+
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/RuleConfigDialog.java b/base/console/src/com/netscape/admin/certsrv/config/RuleConfigDialog.java
new file mode 100644
index 000000000..7f7cff092
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/RuleConfigDialog.java
@@ -0,0 +1,64 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import javax.swing.table.*;
+import javax.swing.text.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Rule Parameter Configuration Dialog
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class RuleConfigDialog extends CMSBaseConfigDialog
+ implements ActionListener
+{
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public RuleConfigDialog(NameValuePairs nvp,
+ JFrame parent,
+ AdminConnection conn,
+ String dest) {
+
+ super(parent, dest);
+ PREFIX = "RULECONFIGDIALOG";
+ RAHELPINDEX =
+ "configuration-ra-edit-rulerule-dbox-help";
+ CAHELPINDEX =
+ "configuration-ca-edit-rulerule-dbox-help";
+
+ mImplName_token = Constants.PR_RULE_IMPL_NAME;
+ mImplType = Constants.PR_EXT_PLUGIN_IMPLTYPE_PUBLISHRULE;
+
+ init(nvp,parent,conn,dest);
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/RuleImplDataModel.java b/base/console/src/com/netscape/admin/certsrv/config/RuleImplDataModel.java
new file mode 100644
index 000000000..86a4fa6d4
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/RuleImplDataModel.java
@@ -0,0 +1,68 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Rule Implementation Data model - represents the implementation
+ * table information
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class RuleImplDataModel extends CMSContentTableModel
+ implements IDataProcessor
+{
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ public static final String IMPL_NAME = "NAME";
+ public static final String IMPL_CLASS = "CLASS";
+ public static final String IMPL_DESC = "DESC";
+
+ private static String[] mColumns = {RULE_IMPL, CLASSNAME};
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public RuleImplDataModel() {
+ super();
+ init(mColumns);
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public void processData(Object data) {
+ Vector v = new Vector();
+ NameValuePairs obj = (NameValuePairs) data;
+ v.addElement(new JLabel(obj.get(IMPL_NAME),
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE_PLUGIN),
+ JLabel.LEFT));
+ v.addElement(obj.get(IMPL_CLASS));
+ //v.addElement(obj.getValue(IMPL_DESC));
+ addRow(v, data);
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/RuleImplTab.java b/base/console/src/com/netscape/admin/certsrv/config/RuleImplTab.java
new file mode 100644
index 000000000..098cbcbd1
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/RuleImplTab.java
@@ -0,0 +1,320 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.ug.*;
+import javax.swing.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Rule Instances Management Tab
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class RuleImplTab extends CMSBaseUGTab {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String IMPL_NAME = RuleImplDataModel.IMPL_NAME;
+ private static final String IMPL_CLASS = RuleImplDataModel.IMPL_CLASS;
+ private static final String IMPL_DESC = RuleImplDataModel.IMPL_DESC;
+
+ private static final String PANEL_NAME = "RULEIMPL";
+ private static final String DIALOG_PREFIX = "RULEREGISTERDIALOG";
+
+ private AdminConnection mConnection;
+ private String mDestination;
+
+ protected JScrollPane mScrollPane;
+ protected JTable mTable; //table
+ protected RuleImplDataModel mDataModel; //table model
+ protected RuleRegisterDialog mEditor=null; //keep single copy
+ protected ViewDialog mViewer=null; //keep single copy
+
+ protected JButton mRefresh, mAdd, mDelete, mView, mHelp;
+ private final static String RAHELPINDEX = "configuration-ra-ruleplugin-help";
+ private final static String CAHELPINDEX = "configuration-ca-ruleplugin-help";
+ private final static String KRAHELPINDEX = "configuration-kra-ruleplugin-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public RuleImplTab(CMSBaseResourceModel model, String destination) {
+ super(PANEL_NAME, model);
+ mConnection = model.getServerInfo().getAdmin();
+ mDataModel = new RuleImplDataModel();
+ mDestination = destination;
+ if (mDestination.equals(DestDef.DEST_RA_RULE_ADMIN))
+ mHelpToken = RAHELPINDEX;
+ else
+ mHelpToken = CAHELPINDEX;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mRefresh)) {
+ refresh();
+ }
+ if (e.getSource().equals(mAdd)) {
+ if (mEditor==null)
+ mEditor = new RuleRegisterDialog(mModel.getFrame(),
+ mConnection);
+ mEditor.showDialog(mDestination, ScopeDef.SC_RULE_IMPLS);
+ refresh();
+ }
+ if (e.getSource().equals(mDelete)) {
+ Debug.println("Delete");
+ if(mTable.getSelectedRow()< 0)
+ return;
+ int i = showConfirmDialog("DELETE");
+ if (i == JOptionPane.YES_OPTION) {
+ delete();
+ Debug.println("Deleted");
+ }
+ }
+ if (e.getSource().equals(mView)) {
+ Debug.println("View");
+ if(mTable.getSelectedRow()< 0)
+ return;
+ NameValuePairs obj = (NameValuePairs)
+ mDataModel.getObjectValueAt(mTable.getSelectedRow());
+ if (mViewer==null)
+ mViewer = new ViewDialog(mModel.getFrame());
+ mViewer.showDialog(obj.get(IMPL_NAME),
+ obj.get(IMPL_CLASS),
+ obj.get(IMPL_DESC));
+ }
+ if (e.getSource().equals(mHelp)) {
+ helpCallback();
+ }
+ }
+
+ //==== MOUSELISTENER ======================
+ public void mouseClicked(MouseEvent e) {
+ setButtons();
+ }
+
+ public void mouseReleased(MouseEvent e) {
+ setButtons();
+ }
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+ public void refresh() {
+
+ mDataModel.removeAllRows();
+ update();
+
+ setButtons();
+ mTable.invalidate();
+ mTable.validate();
+ mTable.repaint(1);
+ }
+
+ /**
+ * create the user action button panel
+ */
+ protected JPanel createButtonPanel() {
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mAdd = makeJButton("ADD");
+ mDelete = makeJButton("DELETE");
+ mView = makeJButton("VIEW");
+ JButton[] buttons = {mAdd, mDelete, mView};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonVPanel( buttons );
+ }
+
+ protected JPanel createActionPanel() {
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mRefresh = makeJButton("REFRESH");
+ mHelp = makeJButton("HELP");
+ //JButton[] buttons = { mRefresh, mHelp };
+ JButton[] buttons = { mRefresh };
+ return makeJButtonPanel(buttons, true);
+ }
+
+ protected JPanel createListPanel() {
+ mListPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mListPanel.setLayout(gb);
+
+ //center table
+ mTable = new JTable(mDataModel);
+ mScrollPane = JTable.createScrollPaneForTable(mTable);
+ //mScrollPane.setBorder(CMSAdminUtil.makeTitledBorder(mResource,PANEL_NAME,"USERS"));
+ mScrollPane.setHorizontalScrollBarPolicy(mScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mScrollPane.setVerticalScrollBarPolicy(mScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ mTable.setAutoscrolls(true);
+ mTable.sizeColumnsToFit(true);
+ mTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ mTable.getSelectionModel().addListSelectionListener(this);
+ mScrollPane.setBackground(Color.white);
+ mTable.addMouseListener(this);
+ setLabelCellRenderer(mTable,0);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = 1;
+ gbc.weightx = 1.0;
+ gbc.insets = EMPTY_INSETS;
+ gb.setConstraints(mScrollPane, gbc);
+ mListPanel.add(mScrollPane);
+
+ JPanel buttonPanel = createButtonPanel();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 0.0;
+ gbc.weighty = 1.0;
+ gbc.insets = EMPTY_INSETS;
+ gb.setConstraints(buttonPanel, gbc);
+ mListPanel.add(buttonPanel);
+
+ refresh();
+
+ return mListPanel;
+ }
+
+ //Set the first column's cellrender as label cell
+ protected void setLabelCellRenderer(JTable table, int index) {
+ table.getColumnModel().getColumn(index).setCellRenderer(new LabelCellRenderer(new JLabel()));
+ }
+
+
+ //set buttons
+ private void setButtons() {
+
+ //enable and diable buttons accordingly
+ //Debug.println("setButtons() - "+mTable.getSelectedRow());
+ //Debug.println("setButtons() - "+mTable.getSelectionModel().isSelectionEmpty());
+ if (mTable.getSelectionModel().isSelectionEmpty()) {
+ mDelete.setEnabled(false);
+ mView.setEnabled(false);
+ return;
+ }
+
+ if(mDataModel.getRowCount()<=0) {
+ mDelete.setEnabled(false);
+ mView.setEnabled(false);
+ return;
+ }
+
+ mDelete.setEnabled(true);
+ mView.setEnabled(true);
+
+ }
+
+ //=============================================
+ // SEND REQUESTS TO THE SERVER SIDE
+ //=============================================
+ private void update() {
+ //send request and parse data
+
+ mModel.progressStart();
+ NameValuePairs response;
+ try {
+ response = mConnection.search(mDestination,
+ ScopeDef.SC_RULE_IMPLS,
+ new NameValuePairs());
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ mModel.progressStop();
+ return;
+ }
+
+ Debug.println(response.toString());
+
+ //parse the data
+ int i=0;
+ String[] vals = new String[response.size()];
+ Hashtable data = new Hashtable();
+ for (String entry : response.keySet()) {
+ entry = entry.trim();
+ String value = response.get(entry);
+ int x = value.indexOf(",");
+ NameValuePairs obj = new NameValuePairs();
+ obj.put(IMPL_NAME, entry);
+ vals[i++]= entry ;
+ obj.put(IMPL_CLASS, value.substring(0, x));
+ obj.put(IMPL_DESC, value.substring(x + 1));
+ data.put(entry,obj);
+ }
+
+ CMSAdminUtil.bubbleSort(vals);
+
+ for (int y=0; y< vals.length ; y++) {
+ mDataModel.processData(data.get(vals[y]));
+ }
+
+ data.clear();
+
+ if (mDataModel.getRowCount() >0)
+ mTable.setRowSelectionInterval(0,0);
+
+ mModel.progressStop();
+ }
+
+ private void delete() {
+ //get entry name
+ mModel.progressStart();
+ NameValuePairs obj = (NameValuePairs)
+ mDataModel.getObjectValueAt(mTable.getSelectedRow());
+
+ //send comment to server for the removal of user
+ try {
+ mConnection.delete(mDestination,
+ ScopeDef.SC_RULE_IMPLS,
+ obj.get(IMPL_NAME));
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ mModel.progressStop();
+ return;
+ }
+ mModel.progressStop();
+ //send comment to server and refetch the content
+ refresh();
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/RuleInstanceTab.java b/base/console/src/com/netscape/admin/certsrv/config/RuleInstanceTab.java
new file mode 100644
index 000000000..04a649ed0
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/RuleInstanceTab.java
@@ -0,0 +1,97 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.ug.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Publishing Rules - Instances Management Tab
+ *
+ * @author Steve Parkinson
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+
+/* A Rule Rule? Hmmm */
+
+public class RuleInstanceTab extends CMSPluginInstanceTab {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PANEL_NAME = "RULERULE";
+
+ private final static String RAHELPINDEX = "configuration-ra-ruleinstances-help";
+ private final static String CAHELPINDEX = "configuration-ca-ruleinstances-help";
+
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public RuleInstanceTab(CMSBaseResourceModel model, String dest) {
+ super(model,dest,PANEL_NAME);
+ Debug.println("RuleInstanceTab::RuleInstanceTab(<model>,"+dest);
+ mConnection = model.getServerInfo().getAdmin();
+ mDataModel = new RuleRuleDataModel();
+ mScope = ScopeDef.SC_RULE_RULES;
+ RULE_NAME = RuleRuleDataModel.RULE_NAME;
+ RULE_STAT = RuleRuleDataModel.RULE_STAT;
+
+ if (mDestination.equals(DestDef.DEST_RA_RULE_ADMIN))
+ mHelpToken = RAHELPINDEX;
+ else
+ mHelpToken = CAHELPINDEX;
+ }
+
+
+ public CMSBaseConfigDialog makeNewConfigDialog(
+ NameValuePairs nvp,
+ JFrame parent,
+ AdminConnection conn,
+ String dest
+ )
+ {
+
+ return new RuleConfigDialog(nvp,
+ parent,
+ conn,
+ dest);
+ }
+
+ public PluginSelectionDialog getPluginSelectionDialog(
+ JFrame parent,
+ AdminConnection conn,
+ String dest,
+ CMSPluginInstanceTab pluginType
+ )
+ {
+ return new RulePluginSelectionDialog(parent,conn,dest,pluginType);
+ }
+
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/RulePluginSelectionDialog.java b/base/console/src/com/netscape/admin/certsrv/config/RulePluginSelectionDialog.java
new file mode 100644
index 000000000..f1021bc6c
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/RulePluginSelectionDialog.java
@@ -0,0 +1,74 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Publishing Rule Plugin Selection Dialog
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class RulePluginSelectionDialog extends PluginSelectionDialog
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PREFIX = "RULESELECTIONDIALOG";
+ private static final String CAHELPINDEX =
+ "configuration-ca-add-rulerule-dbox-help";
+ private static final String RAHELPINDEX =
+ "configuration-ra-add-rulerule-dbox-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public RulePluginSelectionDialog(
+ JFrame parent,
+ AdminConnection conn,
+ String dest,
+ CMSPluginInstanceTab pluginType)
+ {
+ super(PREFIX, parent,conn, dest, pluginType);
+ mScope = ScopeDef.SC_RULE_IMPLS;
+ mInstanceScope = ScopeDef.SC_RULE_RULES;
+ mImageName = CMSAdminResources.IMAGE_RULE_PLUGIN;
+ if (dest.equals(DestDef.DEST_RA_RULE_ADMIN))
+ mHelpToken = RAHELPINDEX;
+ else
+ mHelpToken = CAHELPINDEX;
+ setDisplay();
+ }
+
+ /*==========================================================
+ * EVENT HANDLER METHODS
+ *==========================================================*/
+
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/RuleRegisterDialog.java b/base/console/src/com/netscape/admin/certsrv/config/RuleRegisterDialog.java
new file mode 100644
index 000000000..34d1757e6
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/RuleRegisterDialog.java
@@ -0,0 +1,40 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+
+/**
+ * RUle Implementation Registration Editor
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+
+public class RuleRegisterDialog extends RegisterDialog {
+
+ private final static String PREFIX = "RULEREGISTERDIALOG";
+
+ public RuleRegisterDialog(JFrame parent, AdminConnection conn) {
+ super(PREFIX, parent, conn);
+ setDisplay();
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/RuleRuleDataModel.java b/base/console/src/com/netscape/admin/certsrv/config/RuleRuleDataModel.java
new file mode 100644
index 000000000..cee7727a1
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/RuleRuleDataModel.java
@@ -0,0 +1,70 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.Debug;
+
+
+/**
+ * Rule instance Data model - represents the instance
+ * table information
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public class RuleRuleDataModel extends CMSRuleDataModel
+{
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public RuleRuleDataModel() {
+ super();
+ }
+
+ protected String[] getColumns() {
+ Debug.println("PolicyRuleDataModel.getColumns()");
+ String x[] = {RULE_RULE, STATUS};
+ return x;
+ }
+
+ public void processData(Object data) {
+ Vector v = new Vector();
+ NameValuePairs obj = (NameValuePairs) data;
+
+ if (obj.get(RULE_STAT).equalsIgnoreCase("enabled")) {
+ v.addElement(new JLabel(obj.get(RULE_NAME),
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE),
+ JLabel.LEFT));
+ v.addElement(mResource.getString("RULERULE_LABEL_ENABLED_LABEL"));
+ } else {
+ v.addElement(new JLabel(obj.get(RULE_NAME),
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE_DISABLE),
+ JLabel.LEFT));
+ v.addElement(mResource.getString("RULERULE_LABEL_DISABLED_LABEL"));
+ }
+ addRow(v, data);
+ mRules.addElement(obj.get(RULE_NAME));
+ }
+
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/TKSKeysTab.java b/base/console/src/com/netscape/admin/certsrv/config/TKSKeysTab.java
new file mode 100644
index 000000000..ac8b5e610
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/TKSKeysTab.java
@@ -0,0 +1,366 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.ug.*;
+import javax.swing.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+import com.netscape.management.client.console.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+import org.mozilla.jss.CryptoManager;
+/**
+ * User Certs Tab
+ *
+ * @author Khai Truong
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class TKSKeysTab extends CMSBaseUGTab {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PANEL_NAME = "TKSKEYS";
+ private CryptoManager mCryptoManager = null;
+
+ private AdminConnection mConnection;
+ private String mDestination;
+ private CMSBaseResourceModel mModel;
+ private ConsoleInfo mConsoleInfo;
+ private JComboBox mToken;
+ protected JScrollPane mScrollPane;
+ protected JTable mTable; //table
+ protected ListKeysModel mDataModel; //table model
+ protected KeyCreateDialog mEditor=null; //keep single copy
+
+ protected JButton mRefresh, mAdd, mHelp;
+ private final static String HELPINDEX = "configuration-log-plugin-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public TKSKeysTab(CMSBaseResourceModel model, String destination) {
+ super(PANEL_NAME, model);
+ mConnection = model.getServerInfo().getAdmin();
+ mModel = model;
+ mConsoleInfo = mModel.getConsoleInfo();
+ mDataModel = new ListKeysModel();
+ mDestination = destination;
+ mHelpToken = HELPINDEX;
+
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mRefresh)) {
+ refresh();
+ }
+ if (e.getSource().equals(mHelp)) {
+ helpCallback();
+ }
+ if (e.getSource().equals(mAdd)) {
+ if (mEditor==null)
+ mEditor = new KeyCreateDialog(mModel.getFrame(),mConnection);
+ mEditor.setToken((String)mToken.getSelectedItem());
+ mEditor.showDialog(mDestination, ScopeDef.SC_LOG_IMPLS);
+
+ //CertSetupWizardInfo info = new CertSetupWizardInfo(mConnection, mConsoleInfo);
+
+ // if it is "0", then it means it is root cert mode.
+ // if it is "1", then it means it is user cert mode.
+ //info.setMode("1");
+ //CertSetupWizard wizard = new CertSetupWizard(
+ // mModel, info);
+ refresh();
+ return;
+ }
+
+ int row = mTable.getSelectedRow();
+ if(row < 0)
+ return;
+
+
+
+ }
+
+ //==== MOUSELISTENER ======================
+ public void mouseClicked(MouseEvent e) {
+ setButtons();
+ }
+
+ public void mouseReleased(MouseEvent e) {
+ setButtons();
+ }
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+ public void refresh() {
+
+ mDataModel.removeAllRows();
+ update();
+
+ setButtons();
+ mTable.invalidate();
+ mTable.validate();
+ mTable.repaint(1);
+ }
+
+ /**
+ * create the user action button panel
+ */
+ protected JPanel createButtonPanel() {
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+
+
+ mAdd = makeJButton("ADD");
+
+ JButton[] buttons = {mAdd};
+ JButtonFactory.resize( buttons );
+ JPanel rightPanel = CMSAdminUtil.makeJButtonVPanel( buttons );
+
+ return rightPanel;
+ }
+
+ protected JPanel createActionPanel() {
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mRefresh = makeJButton("REFRESH");
+ mHelp = makeJButton("HELP");
+ //JButton[] buttons = { mRefresh, mHelp };
+ JButton[] buttons = { mRefresh };
+ return makeJButtonPanel(buttons, true);
+ }
+
+ protected JPanel createListPanel() {
+ mListPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mListPanel.setLayout(gb);
+
+ mToken = new JComboBox();
+ mToken.setPreferredSize(new java.awt.Dimension(54, 22));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.weightx = 0.0;
+ gbc.weighty = 0.0;
+ gbc.gridheight = 1;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE*30);
+ gb.setConstraints(mToken, gbc);
+ mListPanel.add(mToken);
+
+
+ //center table
+ mTable = new JTable(mDataModel);
+ mScrollPane = JTable.createScrollPaneForTable(mTable);
+ //mScrollPane.setBorder(CMSAdminUtil.makeTitledBorder(mResource,PANEL_NAME,"USERS"));
+ mScrollPane.setHorizontalScrollBarPolicy(mScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mScrollPane.setVerticalScrollBarPolicy(mScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ mTable.setAutoscrolls(true);
+ mTable.sizeColumnsToFit(true);
+ mTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ mTable.getSelectionModel().addListSelectionListener(this);
+ mScrollPane.setBackground(Color.white);
+ mTable.addMouseListener(this);
+ setLabelCellRenderer(mTable,0);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = 1;
+ gbc.gridheight = 10;
+ gbc.weighty = 1.0;
+ gbc.weightx = 1.0;
+ gbc.insets = EMPTY_INSETS;
+ gb.setConstraints(mScrollPane, gbc);
+ mListPanel.add(mScrollPane);
+
+ JPanel buttonPanel = createButtonPanel();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 0.0;
+ gbc.weighty = 1.0;
+ gbc.insets = EMPTY_INSETS;
+ gb.setConstraints(buttonPanel, gbc);
+ mListPanel.add(buttonPanel);
+
+ NameValuePairs response=null;
+ try {
+ response = mConnection.search(mDestination,
+ ScopeDef.SC_TOKEN, new NameValuePairs());
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ mModel.progressStop();
+ }
+ if (response != null) {
+ mToken.removeAllItems();
+ String[] vals = new String[response.size()];
+ int i=0;
+ for (String entry : response.keySet()) {
+ vals[i++] = entry.trim();
+ }
+
+ int sindex = 0;
+ CMSAdminUtil.quickSort(vals, 0, response.size()-1);
+ for (i=0; i<vals.length; i++) {
+ Vector v = new Vector();
+ String entry = vals[i];
+ String value = response.get(entry);
+ // look for the comma separator
+
+ StringTokenizer st = new StringTokenizer(value, ",");
+ while (st.hasMoreTokens()) {
+ String currentToken= st.nextToken();
+ mToken.addItem(currentToken);
+ }
+
+ }
+ }
+
+ refresh();
+
+ return mListPanel;
+ }
+
+ //Set the first column's cellrender as label cell
+ protected void setLabelCellRenderer(JTable table, int index) {
+ table.getColumnModel().getColumn(index).setCellRenderer(new LabelCellRenderer(new JLabel()));
+ }
+
+
+ //set buttons
+ private void setButtons() {
+
+ //enable and diable buttons accordingly
+ //Debug.println("setButtons() - "+mTable.getSelectedRow());
+ //Debug.println("setButtons() - "+mTable.getSelectionModel().isSelectionEmpty());
+
+
+ }
+
+ //=============================================
+ // SEND REQUESTS TO THE SERVER SIDE
+ //=============================================
+ private void update() {
+ //send request and parse data
+
+ mModel.progressStart();
+
+ NameValuePairs response;
+ NameValuePairs request;
+ request = new NameValuePairs();
+ request.put(Constants.PR_TOKEN_LIST, (String) mToken.getSelectedItem());
+ try {
+ response = mConnection.search(mDestination,
+ ScopeDef.SC_TKSKEYSLIST, request);
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ mModel.progressStop();
+ return;
+ }
+
+ Debug.println(response.toString());
+
+ //parse the data
+ mDataModel.removeAllRows();
+ if (response != null) {
+ String[] vals = new String[response.size()];
+ int i=0;
+ for (String entry : response.keySet()) {
+ vals[i++] = entry.trim();
+ }
+
+ int sindex = 0;
+ CMSAdminUtil.quickSort(vals, 0, response.size()-1);
+ for (i=0; i<vals.length; i++) {
+ String entry = vals[i];
+ if (entry.equals(Constants.PR_TOKEN_LIST)) {
+ String value = response.get(entry);
+ // look for the comma separator
+ StringTokenizer st = new StringTokenizer(value, ",");
+ int numberOfKeys = 0;
+ while (st.hasMoreTokens()) {
+ Vector v = new Vector();
+ String currentKey = st.nextToken();
+ v.addElement(currentKey);
+ numberOfKeys++;
+ mDataModel.addRow(v);
+ }
+ if(numberOfKeys==0)
+ {
+ Vector v = new Vector();
+ String currentKey = new String("empty list");
+ v.addElement(currentKey);
+ mDataModel.addRow(v);
+ }
+ }
+ }
+ mTable.setRowSelectionInterval(0,0);
+ }
+
+
+ mModel.progressStop();
+ }
+
+ private void delete() {
+ mModel.progressStart();
+ int row = mTable.getSelectedRow();
+ String nickname = (String)(mDataModel.getValueAt(row, 3))+":"+
+ (String)(mDataModel.getValueAt(row, 0));
+ String id = nickname+":SERIAL#<"+mDataModel.getValueAt(row, 1)+">"
+ +mDataModel.getValueAt(row, 2);
+
+ //send comment to server for the removal of user
+ try {
+ mConnection.delete(mDestination, ScopeDef.SC_USERCERTSLIST, id);
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ mModel.progressStop();
+ return;
+ }
+ mModel.progressStop();
+ //send comment to server and refetch the content
+ refresh();
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/UserCertsTab.java b/base/console/src/com/netscape/admin/certsrv/config/UserCertsTab.java
new file mode 100644
index 000000000..de0a075a1
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/UserCertsTab.java
@@ -0,0 +1,342 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.keycert.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.ug.*;
+import javax.swing.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+import com.netscape.management.client.console.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * User Certs Tab
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class UserCertsTab extends CMSBaseUGTab {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PANEL_NAME = "USERCERTS";
+
+ private AdminConnection mConnection;
+ private String mDestination;
+ private CMSBaseResourceModel mModel;
+ private ConsoleInfo mConsoleInfo;
+
+ protected JScrollPane mScrollPane;
+ protected JTable mTable; //table
+ protected ListCertsModel mDataModel; //table model
+ protected CertViewDialog mEditor=null; //keep single copy
+
+ protected JButton mRefresh, mAdd, mDelete, mView, mHelp;
+ private final static String HELPINDEX = "configuration-log-plugin-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public UserCertsTab(CMSBaseResourceModel model, String destination) {
+ super(PANEL_NAME, model);
+ mConnection = model.getServerInfo().getAdmin();
+ mModel = model;
+ mConsoleInfo = mModel.getConsoleInfo();
+ mDataModel = new ListCertsModel();
+ mDestination = destination;
+ mHelpToken = HELPINDEX;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mRefresh)) {
+ refresh();
+ }
+ if (e.getSource().equals(mHelp)) {
+ helpCallback();
+ }
+ if (e.getSource().equals(mAdd)) {
+ CertSetupWizardInfo info = new CertSetupWizardInfo(mConnection, mConsoleInfo);
+
+ // if it is "0", then it means it is root cert mode.
+ // if it is "1", then it means it is user cert mode.
+ info.setMode("1");
+ CertSetupWizard wizard = new CertSetupWizard(
+ mModel, info);
+ refresh();
+ return;
+ }
+
+ int row = mTable.getSelectedRow();
+ if(row < 0)
+ return;
+
+ if (e.getSource().equals(mDelete)) {
+ Debug.println("Delete");
+ if(mTable.getSelectedRow()< 0)
+ return;
+ int i = showConfirmDialog("DELETE");
+ if (i == JOptionPane.YES_OPTION) {
+ delete();
+ Debug.println("Deleted");
+ }
+ }
+ if (e.getSource().equals(mView)) {
+ Debug.println("View");
+ String nickname = (String)(mTable.getValueAt(row, 3)) + ":" +
+ (String)(mTable.getValueAt(row, 0));
+ String serialno = (String)(mTable.getValueAt(row, 1));
+ String issuername = (String)(mTable.getValueAt(row, 2));
+
+ try {
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_NICK_NAME, nickname);
+ nvps.put(Constants.PR_SERIAL_NUMBER, serialno);
+ nvps.put(Constants.PR_ISSUER_NAME, issuername);
+ NameValuePairs results = mConnection.read(
+ DestDef.DEST_SERVER_ADMIN, ScopeDef.SC_CERT_PRETTY_PRINT,
+ Constants.RS_ID_CONFIG, nvps);
+ if (nvps.size() <= 0)
+ return;
+ String name = results.keySet().iterator().next(); // first element
+ String print = results.get(name);
+ CertViewDialog certdialog = new CertViewDialog(mModel.getFrame());
+ certdialog.showDialog(nickname, print);
+ } catch (EAdminException ex) {
+ CMSAdminUtil.showErrorDialog(mModel.getFrame(), mResource, ex.toString(),
+ CMSAdminUtil.ERROR_MESSAGE);
+ }
+ }
+ }
+
+ //==== MOUSELISTENER ======================
+ public void mouseClicked(MouseEvent e) {
+ setButtons();
+ }
+
+ public void mouseReleased(MouseEvent e) {
+ setButtons();
+ }
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+ public void refresh() {
+
+ mDataModel.removeAllRows();
+ update();
+
+ setButtons();
+ mTable.invalidate();
+ mTable.validate();
+ mTable.repaint(1);
+ }
+
+ /**
+ * create the user action button panel
+ */
+ protected JPanel createButtonPanel() {
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mAdd = makeJButton("ADD");
+ mDelete = makeJButton("DELETE");
+ mView = makeJButton("VIEW");
+ JButton[] buttons = {mAdd, mDelete, mView};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonVPanel( buttons );
+ }
+
+ protected JPanel createActionPanel() {
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mRefresh = makeJButton("REFRESH");
+ mHelp = makeJButton("HELP");
+ //JButton[] buttons = { mRefresh, mHelp };
+ JButton[] buttons = { mRefresh };
+ return makeJButtonPanel(buttons, true);
+ }
+
+ protected JPanel createListPanel() {
+ mListPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mListPanel.setLayout(gb);
+
+ //center table
+ mTable = new JTable(mDataModel);
+ mScrollPane = JTable.createScrollPaneForTable(mTable);
+ //mScrollPane.setBorder(CMSAdminUtil.makeTitledBorder(mResource,PANEL_NAME,"USERS"));
+ mScrollPane.setHorizontalScrollBarPolicy(mScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mScrollPane.setVerticalScrollBarPolicy(mScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ mTable.setAutoscrolls(true);
+ mTable.sizeColumnsToFit(true);
+ mTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ mTable.getSelectionModel().addListSelectionListener(this);
+ mScrollPane.setBackground(Color.white);
+ mTable.addMouseListener(this);
+ setLabelCellRenderer(mTable,0);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = 1;
+ gbc.weightx = 1.0;
+ gbc.insets = EMPTY_INSETS;
+ gb.setConstraints(mScrollPane, gbc);
+ mListPanel.add(mScrollPane);
+
+ JPanel buttonPanel = createButtonPanel();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 0.0;
+ gbc.weighty = 1.0;
+ gbc.insets = EMPTY_INSETS;
+ gb.setConstraints(buttonPanel, gbc);
+ mListPanel.add(buttonPanel);
+
+ refresh();
+
+ return mListPanel;
+ }
+
+ //Set the first column's cellrender as label cell
+ protected void setLabelCellRenderer(JTable table, int index) {
+ table.getColumnModel().getColumn(index).setCellRenderer(new LabelCellRenderer(new JLabel()));
+ }
+
+
+ //set buttons
+ private void setButtons() {
+
+ //enable and diable buttons accordingly
+ //Debug.println("setButtons() - "+mTable.getSelectedRow());
+ //Debug.println("setButtons() - "+mTable.getSelectionModel().isSelectionEmpty());
+ if (mTable.getSelectionModel().isSelectionEmpty()) {
+ mDelete.setEnabled(false);
+ mView.setEnabled(false);
+ return;
+ }
+
+ if(mDataModel.getRowCount()<=0) {
+ mDelete.setEnabled(false);
+ mView.setEnabled(false);
+ return;
+ }
+
+ mDelete.setEnabled(true);
+ mView.setEnabled(true);
+
+ }
+
+ //=============================================
+ // SEND REQUESTS TO THE SERVER SIDE
+ //=============================================
+ private void update() {
+ //send request and parse data
+
+ mModel.progressStart();
+ NameValuePairs response;
+ try {
+ response = mConnection.search(mDestination,
+ ScopeDef.SC_USERCERTSLIST, new NameValuePairs());
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ mModel.progressStop();
+ return;
+ }
+
+ Debug.println(response.toString());
+
+ //parse the data
+ mDataModel.removeAllRows();
+ if (response != null) {
+ String[] vals = new String[response.size()];
+ int i=0;
+ for (String entry : response.keySet()) {
+ vals[i++] = entry.trim();
+ }
+
+ int sindex = 0;
+ String snickname = "";
+ CMSAdminUtil.quickSort(vals, 0, response.size()-1);
+ for (i=0; i<vals.length; i++) {
+ Vector v = new Vector();
+ String entry = vals[i];
+ String value = response.get(entry);
+
+ // look for the comma separator
+ int lastindex = entry.lastIndexOf(",");
+ if (lastindex != -1) {
+ String nickname = entry.substring(0, lastindex);
+ int colonindex = nickname.indexOf(":");
+ v.addElement(nickname.substring(colonindex+1));
+ v.addElement(entry.substring(lastindex+1));
+ v.addElement(value);
+ v.addElement(nickname.substring(0, colonindex));
+ mDataModel.addRow(v);
+ }
+ }
+ mTable.setRowSelectionInterval(0,0);
+ }
+
+ mModel.progressStop();
+ }
+
+ private void delete() {
+ mModel.progressStart();
+ int row = mTable.getSelectedRow();
+ String nickname = (String)(mDataModel.getValueAt(row, 3))+":"+
+ (String)(mDataModel.getValueAt(row, 0));
+ String id = nickname+":SERIAL#<"+mDataModel.getValueAt(row, 1)+">"
+ +mDataModel.getValueAt(row, 2);
+
+ //send comment to server for the removal of user
+ try {
+ mConnection.delete(mDestination, ScopeDef.SC_USERCERTSLIST, id);
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ mModel.progressStop();
+ return;
+ }
+ mModel.progressStop();
+ //send comment to server and refetch the content
+ refresh();
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/ViewDialog.java b/base/console/src/com/netscape/admin/certsrv/config/ViewDialog.java
new file mode 100644
index 000000000..277b3d2be
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/ViewDialog.java
@@ -0,0 +1,189 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import javax.swing.table.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Policy Implementation Information viewer
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class ViewDialog extends JDialog
+ implements ActionListener
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private String PREFIX = "VIEWDIALOG";
+
+ private JFrame mParentFrame;
+ private ResourceBundle mResource;
+ private JTextArea mTextArea;
+ private JLabel mNameField, mClassField;
+
+ private JButton mOK;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public ViewDialog(JFrame parent) {
+ super(parent,true);
+ mParentFrame = parent;
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ setSize(400, 200);
+ setTitle(mResource.getString(PREFIX+"_TITLE"));
+ setLocationRelativeTo(parent);
+ getRootPane().setDoubleBuffered(true);
+ setDisplay();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * show the windows
+ */
+ public void showDialog(String name, String classname, String desc) {
+ //initialize and setup
+ mNameField.setText(name);
+ mClassField.setText(classname);
+ mTextArea.setText(CMSAdminUtil.wrapText(desc,50));
+ mTextArea.setCaretPosition(0);
+ this.show();
+ }
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent evt) {
+ if (evt.getSource().equals(mOK)) {
+ this.hide();
+ }
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+ private void setDisplay() {
+ getContentPane().setLayout(new BorderLayout());
+ JPanel center = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ center.setLayout(gb);
+
+ //content panel
+ JPanel content = makeContentPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.fill = gbc.BOTH;
+ gb.setConstraints(content, gbc);
+ center.add(content);
+
+ //action panel
+ JPanel action = makeActionPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints(action, gbc);
+ center.add(action);
+
+ getContentPane().add("Center",center);
+ }
+
+ private JPanel makeActionPane() {
+ mOK = CMSAdminUtil.makeJButton(mResource, PREFIX, "OK", null, this);
+ Dimension d = mOK.getMinimumSize();
+ if (d.width < CMSAdminUtil.DEFAULT_BUTTON_SIZE) {
+ d.width = CMSAdminUtil.DEFAULT_BUTTON_SIZE;
+ mOK.setMinimumSize(d);
+ }
+ JButton[] buttons = {mOK};
+ return CMSAdminUtil.makeJButtonPanel( buttons );
+ }
+
+ private JPanel makeContentPane() {
+ JPanel content = new JPanel();
+ GridBagLayout gb3 = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ content.setLayout(gb3);
+ //content.setBorder(CMSAdminUtil.makeEtchedBorder());
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label1 = CMSAdminUtil.makeJLabel(mResource, PREFIX, "NAME", null);
+ mNameField = new JLabel();
+ CMSAdminUtil.addEntryField(content, label1, mNameField, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label2 = CMSAdminUtil.makeJLabel(mResource, PREFIX, "CLASS", null);
+ mClassField = new JLabel();
+ CMSAdminUtil.addEntryField(content, label2, mClassField, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label3 = CMSAdminUtil.makeJLabel(mResource, PREFIX, "DESC", null);
+ label3.setHorizontalAlignment(JLabel.RIGHT);
+ gbc.anchor = gbc.NORTHEAST;
+ gbc. insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ gb3.setConstraints(label3, gbc);
+ content.add(label3);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mTextArea = new JTextArea("",30,10);
+ mTextArea.setFont(mClassField.getFont());
+ mTextArea.setEditable(false);
+ mTextArea.setBackground(getBackground());
+ JScrollPane scrollPanel = new JScrollPane(mTextArea,
+ JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+ JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ scrollPanel.setAlignmentX(LEFT_ALIGNMENT);
+ scrollPanel.setAlignmentY(TOP_ALIGNMENT);
+ scrollPanel.setBackground(getBackground());
+ scrollPanel.setBorder(BorderFactory.createEmptyBorder());
+ scrollPanel.setPreferredSize(new Dimension(300, 500));
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx=1.0;
+ gbc.weighty=1.0;
+ gb3.setConstraints(scrollPanel, gbc);
+ content.add(scrollPanel);
+
+ return content;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/ViewSelfTestsDialog.java b/base/console/src/com/netscape/admin/certsrv/config/ViewSelfTestsDialog.java
new file mode 100644
index 000000000..09d7892ef
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/ViewSelfTestsDialog.java
@@ -0,0 +1,172 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import javax.swing.event.*;
+import javax.swing.table.*;
+
+/**
+ * Self Tests Implementation Information viewer
+ *
+ * @author Matthew Harmsen
+ * @author Thomas Kwan
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class ViewSelfTestsDialog extends JDialog
+ implements ActionListener
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private JFrame mParentFrame;
+ private JTextArea mTextArea;
+ private JButton mOK;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public ViewSelfTestsDialog( JFrame parent, String title )
+ {
+ super( parent, true );
+ mParentFrame = parent;
+ setSize( 550, 150 );
+ setTitle( title );
+ setLocationRelativeTo( parent );
+ getRootPane().setDoubleBuffered( true );
+ setDisplay();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * show the description
+ */
+ public void showDialog( String desc )
+ {
+ //initialize and setup
+ mTextArea.setText( CMSAdminUtil.wrapText( desc, 80 ) );
+ mTextArea.setCaretPosition( 0 );
+ this.show();
+ }
+
+ /*==========================================================
+ * EVENT HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed( ActionEvent evt )
+ {
+ if( evt.getSource().equals( mOK ) ) {
+ this.hide();
+ }
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+ private void setDisplay()
+ {
+ getContentPane().setLayout( new BorderLayout() );
+ JPanel center = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ center.setLayout( gb );
+
+ //content panel
+ JPanel content = makeContentPane();
+ CMSAdminUtil.resetGBC( gbc );
+ gbc.fill = gbc.BOTH;
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints( content, gbc );
+ center.add( content );
+
+ //action panel
+ JPanel action = makeActionPane();
+ CMSAdminUtil.resetGBC( gbc );
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints( action, gbc );
+ center.add( action );
+
+ getContentPane().add( "Center", center );
+ }
+
+ private JPanel makeActionPane()
+ {
+ // add OK button
+ mOK = new JButton();
+ mOK.setText( "OK" );
+ mOK.addActionListener( this );
+ Dimension d = mOK.getMinimumSize();
+ if( d.width < CMSAdminUtil.DEFAULT_BUTTON_SIZE ) {
+ d.width = CMSAdminUtil.DEFAULT_BUTTON_SIZE;
+ mOK.setMinimumSize( d );
+ }
+ JButton[] buttons = { mOK };
+ return CMSAdminUtil.makeJButtonPanel( buttons );
+ }
+
+ private JPanel makeContentPane()
+ {
+ JPanel content = new JPanel();
+ GridBagLayout gb3 = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ content.setLayout( gb3 );
+
+ CMSAdminUtil.resetGBC( gbc );
+ mTextArea = new JTextArea( "" );
+ mTextArea.setEditable( false );
+ mTextArea.setBackground( getBackground() );
+
+ JScrollPane
+ scrollPanel = new JScrollPane( mTextArea,
+ JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+ JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
+ scrollPanel.setAlignmentX( LEFT_ALIGNMENT );
+ scrollPanel.setAlignmentY( TOP_ALIGNMENT );
+ scrollPanel.setBackground( getBackground() );
+ scrollPanel.setBorder( BorderFactory.createLoweredBevelBorder() );
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb3.setConstraints( scrollPanel, gbc );
+ content.add( scrollPanel );
+
+ return content;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/ViewTableModel.java b/base/console/src/com/netscape/admin/certsrv/config/ViewTableModel.java
new file mode 100644
index 000000000..f634a182c
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/ViewTableModel.java
@@ -0,0 +1,40 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+
+/**
+ * Table Model for viewing configuration parameters
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class ViewTableModel extends CMSTableModel {
+ private static String[] mColumns = {CONFIG, VALUE};
+
+ public ViewTableModel() {
+ init(mColumns);
+ }
+
+ public boolean isCellEditable(int row, int col) {
+ return false;
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/WBaseCertExtensionPage.java b/base/console/src/com/netscape/admin/certsrv/config/WBaseCertExtensionPage.java
new file mode 100644
index 000000000..6c92ed61e
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/WBaseCertExtensionPage.java
@@ -0,0 +1,445 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.install.InstallWizardInfo;
+
+/**
+ * Base class for the Certificate Extension wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+public class WBaseCertExtensionPage extends WizardBasePanel {
+ protected JCheckBox mMIMECheckBox, mBasicCheckBox, mExtendedKeyCheckBox;
+ protected JCheckBox mAKICheckBox, mSKICheckBox;
+ protected JCheckBox mCACheckBox, mCertPathBox, mKeyUsageBox;
+ protected JTextField mCertPathText;
+ protected JTextArea mMIMEText;
+ protected JLabel mCMCLabel;
+ protected JButton mPaste;
+ protected byte[] mDerByte;
+ protected Color mActiveColor;
+ protected JCheckBox mSSLClient, mSSLServer, mSSLMail, mObjectSigning, mTimeStamping;
+ protected JCheckBox mOCSPSigning, mOCSPNoCheck, mAIACheckBox;
+ protected static final String DEFAULT_CERT_LEN = "100";
+ protected String mPanelName;
+ protected boolean mModified=false;
+
+ public WBaseCertExtensionPage(String panelName) {
+ super(panelName);
+ }
+
+ public boolean validatePanel() {
+ if (mCertPathBox.isSelected()) {
+ String str = mCertPathText.getText().trim();
+ if (str.equals("")) {
+ setErrorMessage("BLANKLEN");
+ return false;
+ }
+
+ int len = 0;
+ try {
+ len = Integer.parseInt(str);
+ } catch (NumberFormatException e) {
+ setErrorMessage("NONINTEGER");
+ return false;
+ }
+
+ if (len < 0) {
+ setErrorMessage("INVALID");
+ return false;
+ }
+
+ }
+
+ if (mMIMECheckBox.isSelected()) {
+ String derString = mMIMEText.getText().trim();
+ if (derString.equals("")) {
+ setErrorMessage("DERBLANKFIELD");
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ if (!mModified) {
+ boolean basicConstraints = mBasicCheckBox.isSelected();
+ boolean extendedKey = mExtendedKeyCheckBox.isSelected();
+ boolean derExt = mMIMECheckBox.isSelected();
+
+ if (basicConstraints)
+ enableBasicConstraints(basicConstraints, mActiveColor);
+ else
+ enableBasicConstraints(basicConstraints, getBackground());
+
+ enableExtendedKey(extendedKey);
+
+ if (derExt)
+ enableMIMEExt(derExt, mActiveColor);
+ else
+ enableMIMEExt(derExt, getBackground());
+ }
+
+ if (info instanceof InstallWizardInfo) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ // If signed by self, no request will be generated
+ // check if a signing cert installed, make cmc note invisible
+ String type = wizardInfo.getCertType();
+ if ((type.equals(Constants.PR_KRA_TRANSPORT_CERT) &&
+ wizardInfo.isKRACertLocalCA()) ||
+ (type.equals(Constants.PR_SERVER_CERT) &&
+ wizardInfo.isSSLCertLocalCA()) ||
+ type.equals(Constants.PR_OCSP_SIGNING_CERT) ||
+ (type.equals(Constants.PR_CA_SIGNING_CERT) &&
+ wizardInfo.isCACertLocalCA()) ||
+ (type.equals(Constants.PR_SERVER_CERT) ||
+ type.equals(Constants.PR_KRA_TRANSPORT_CERT)) && (
+ (wizardInfo.isCAInstalled() &&
+ wizardInfo.isCACertInstalledDone()) ||
+ (wizardInfo.isRAInstalled() &&
+ wizardInfo.isRACertInstalledDone()) ||
+ (wizardInfo.isKRAInstalled() &&
+ wizardInfo.isKRACertInstalledDone()) ||
+ (wizardInfo.isOCSPInstalled() &&
+ wizardInfo.isOCSPCertInstalledDone()) ) ) {
+ mCMCLabel.setVisible(false);
+ CMSAdminUtil.repaintComp(mCMCLabel);
+ }
+ } else {
+ mCMCLabel.setVisible(false);
+ CMSAdminUtil.repaintComp(mCMCLabel);
+ }
+
+ return true;
+ }
+
+ protected void enableBasicConstraints(boolean enable, Color color) {
+ mCACheckBox.setEnabled(enable);
+ mCertPathBox.setEnabled(enable);
+ if (enable && !mCertPathBox.isSelected()) {
+ enableCertPath(!enable, getBackground());
+ } else {
+ enableCertPath(enable, color);
+ }
+ CMSAdminUtil.repaintComp(mCACheckBox);
+ CMSAdminUtil.repaintComp(mCertPathText);
+ }
+
+ protected void enableCertPath(boolean enable, Color color) {
+ mCertPathText.setEnabled(enable);
+ mCertPathText.setEditable(enable);
+ mCertPathText.setBackground(color);
+ CMSAdminUtil.repaintComp(mCertPathBox);
+ }
+
+ protected void enableExtendedKey(boolean enable) {
+ mSSLClient.setEnabled(enable);
+ mSSLServer.setEnabled(enable);
+ mSSLMail.setEnabled(enable);
+ mObjectSigning.setEnabled(enable);
+ mTimeStamping.setEnabled(enable);
+ mOCSPSigning.setEnabled(enable);
+
+ CMSAdminUtil.repaintComp(mSSLClient);
+ CMSAdminUtil.repaintComp(mSSLServer);
+ CMSAdminUtil.repaintComp(mSSLMail);
+ CMSAdminUtil.repaintComp(mObjectSigning);
+ CMSAdminUtil.repaintComp(mTimeStamping);
+ CMSAdminUtil.repaintComp(mOCSPSigning);
+ }
+
+ protected void enableMIMEExt(boolean enable, Color color) {
+ mMIMEText.setEnabled(enable);
+ mMIMEText.setEditable(enable);
+ mMIMEText.setBackground(color);
+ mPaste.setEnabled(enable);
+ CMSAdminUtil.repaintComp(mMIMEText);
+ CMSAdminUtil.repaintComp(mPaste);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ JTextArea desc = createTextArea(mResource.getString(
+ mPanelName+"_TEXT_HEADING_LABEL"));
+ //"CERTEXTENSIONWIZARD_TEXT_HEADING_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+
+ mBasicCheckBox = makeJCheckBox("BASIC");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0,COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ gbc.fill = gbc.NONE;
+ add(mBasicCheckBox, gbc);
+
+ mCACheckBox = makeJCheckBox("CA");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(0,4*COMPONENT_SPACE, 0,COMPONENT_SPACE);
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mCACheckBox, gbc);
+
+ JPanel panel = new JPanel();
+ GridBagLayout gb1 = new GridBagLayout();
+ panel.setLayout(gb1);
+
+ mCertPathBox = makeJCheckBox("CERTPATHLENGTH");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.insets = new Insets(0, 0, 0, COMPONENT_SPACE);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridheight = gbc.REMAINDER;
+ panel.add(mCertPathBox, gbc);
+
+ mCertPathText = makeJTextField(10);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.insets = new Insets(0,COMPONENT_SPACE, 0, COMPONENT_SPACE);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ panel.add(mCertPathText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0,4*COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE);
+ add(panel, gbc);
+
+/*
+ JTextArea dummy = createTextArea(" ", 1, 5);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.insets = new Insets(0,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(dummy, gbc);
+*/
+
+ mExtendedKeyCheckBox = makeJCheckBox("EXTENDEDKEY");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ gbc.fill = gbc.NONE;
+ add(mExtendedKeyCheckBox, gbc);
+
+ mSSLClient = makeJCheckBox("SSLCLIENT");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0,4*COMPONENT_SPACE, 0, COMPONENT_SPACE);
+ add(mSSLClient, gbc);
+
+ mSSLServer = makeJCheckBox("SSLSERVER");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0,COMPONENT_SPACE, 0, COMPONENT_SPACE);
+ add(mSSLServer, gbc);
+
+ mSSLMail = makeJCheckBox("EMAIL");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(0,COMPONENT_SPACE, 0, COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 1.0;
+ add(mSSLMail, gbc);
+
+ mObjectSigning = makeJCheckBox("OBJECTSIGNING");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0,4*COMPONENT_SPACE, 0, COMPONENT_SPACE);
+ add(mObjectSigning, gbc);
+
+ mTimeStamping = makeJCheckBox("TIMESTAMPING");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(mTimeStamping, gbc);
+
+ mOCSPSigning = makeJCheckBox("OCSPSIGNING");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(0,COMPONENT_SPACE, 0, COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 1.0;
+ add(mOCSPSigning, gbc);
+
+ mAIACheckBox = makeJCheckBox("AIA");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mAIACheckBox, gbc);
+
+ mAKICheckBox = makeJCheckBox("AKI");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mAKICheckBox, gbc);
+
+ mSKICheckBox = makeJCheckBox("SKI");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mSKICheckBox, gbc);
+
+ mOCSPNoCheck = makeJCheckBox("OCSPNOCHECK");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mOCSPNoCheck, gbc);
+
+ mCMCLabel = new JLabel(mResource.getString(
+ mPanelName + "_TEXT_CMC_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0,4*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mCMCLabel, gbc);
+
+ mKeyUsageBox = makeJCheckBox("KEYUSAGE");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mKeyUsageBox, gbc);
+ mKeyUsageBox.setSelected(true);
+
+ mMIMECheckBox = makeJCheckBox("MIME");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ gbc.fill = gbc.NONE;
+ add(mMIMECheckBox, gbc);
+
+ mMIMEText = new JTextArea("", 40, 70);
+ JScrollPane scrollPane = new JScrollPane(mMIMEText,
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
+ scrollPane.setPreferredSize(new Dimension(50, 30));
+ //scrollPane.setAlignmentX(LEFT_ALIGNMENT);
+ //scrollPane.setAlignmentY(TOP_ALIGNMENT);
+ scrollPane.setBorder(BorderFactory.createLoweredBevelBorder());
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.BOTH;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ //gbc.gridheight = gbc.REMAINDER;
+ gbc.insets = new Insets(0, 4*COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(scrollPane, gbc);
+ mActiveColor = mMIMEText.getBackground();
+
+ mPaste = makeJButton("PASTE");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ add(mPaste, gbc);
+
+ super.init();
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ Object source = e.getSource();
+ if (source.equals(mPaste)) {
+ mMIMEText.paste();
+ } else if (source.equals(mBasicCheckBox)) {
+ if (mBasicCheckBox.isSelected())
+ enableBasicConstraints(true, mActiveColor);
+ else
+ enableBasicConstraints(false, getBackground());
+ } else if (source.equals(mExtendedKeyCheckBox)) {
+ if (mExtendedKeyCheckBox.isSelected())
+ enableExtendedKey(true);
+ else
+ enableExtendedKey(false);
+ } else if (source.equals(mMIMECheckBox)) {
+ if (mMIMECheckBox.isSelected())
+ enableMIMEExt(true, mActiveColor);
+ else
+ enableMIMEExt(false, getBackground());
+ } else if (source.equals(mCertPathBox)) {
+ if (mCertPathBox.isSelected())
+ enableCertPath(true, mActiveColor);
+ else
+ enableCertPath(false, getBackground());
+ }
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/WBaseCertRequestPage.java b/base/console/src/com/netscape/admin/certsrv/config/WBaseCertRequestPage.java
new file mode 100644
index 000000000..6b9a1667b
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/WBaseCertRequestPage.java
@@ -0,0 +1,261 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Certificate wizard page
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+public class WBaseCertRequestPage extends WizardBasePanel {
+ protected JButton mCopy;
+ protected JRadioButton mEmailBtn;
+ protected JRadioButton mURLBtn;
+ protected JRadioButton mManualBtn;
+ protected JTextArea mText;
+ protected JTextField mURLText;
+ protected JTextField mEmailText, mContactEmailTxt, mNameTxt, mContactPhoneTxt;
+ protected JLabel mContactPhoneLbl, mContactEmailLbl, mNameLbl;
+ protected JTextArea mContactText;
+
+ public WBaseCertRequestPage(String panelName) {
+ super(panelName);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+/*
+ JTextArea unixDesc = createTextArea(
+ CMSAdminUtil.wrapText(mResource.getString(
+ "CERTREQUESTWIZARD_TEXT_UNIXDESC_LABEL"), 80), 3, 80);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(unixDesc, gbc);
+
+ JTextArea ntDesc = createTextArea(
+ CMSAdminUtil.wrapText(mResource.getString(
+ "CERTREQUESTWIZARD_TEXT_NTDESC_LABEL"), 80), 3, 80);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(ntDesc, gbc);
+*/
+
+ JLabel desc = makeJLabel("DESC");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+
+ mManualBtn = makeJRadioButton("MANUAL", true);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0, COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mManualBtn, gbc);
+
+ mText = new JTextArea(null, null, 0, 0);
+ //mText.setLineWrap(true);
+ //mText.setWrapStyleWord(true);
+ JScrollPane scrollPane = new JScrollPane(mText,
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
+ scrollPane.setPreferredSize(new Dimension(50, 20));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.BOTH;
+ gbc.insets = new Insets(0, 4*COMPONENT_SPACE, 0, COMPONENT_SPACE);
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(scrollPane, gbc);
+
+ mCopy = makeJButton("COPY");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mCopy, gbc);
+
+ mEmailBtn = makeJRadioButton("EMAIL", false);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ add(mEmailBtn, gbc);
+
+ mEmailText = new JTextField(30);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0, 0, COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mEmailText, gbc);
+
+ mURLBtn = makeJRadioButton("URL", false);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(mURLBtn, gbc);
+
+ mURLText = new JTextField(30);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mURLText, gbc);
+
+ ButtonGroup methodGroup = new ButtonGroup();
+ methodGroup.add(mEmailBtn);
+ methodGroup.add(mURLBtn);
+ methodGroup.add(mManualBtn);
+
+ mContactText = new JTextArea(
+ CMSAdminUtil.wrapText(mResource.getString(
+ "COPYCERTREQUESTWIZARD_TEXT_CONTACT_LABEL"), 80), 2, 80);
+ mContactText.setBackground(getBackground());
+ mContactText.setEditable(false);
+ mContactText.setCaretColor(getBackground());
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.weightx = 1.0;
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(mContactText, gbc);
+
+ JPanel panel = new JPanel();
+ GridBagLayout gb1 = new GridBagLayout();
+ panel.setLayout(gb1);
+ //panel.setBorder(new EtchedBorder());
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0, 0, 0);
+ add(panel, gbc);
+
+ mNameLbl = makeJLabel("NAME");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ panel.add(mNameLbl, gbc);
+
+ mNameTxt = new JTextField(30);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.insets = new Insets(0, COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ panel.add(mNameTxt, gbc);
+
+ mContactEmailLbl = makeJLabel("EMAILADDRESS");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ panel.add(mContactEmailLbl, gbc);
+
+ mContactEmailTxt = new JTextField(30);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.insets = new Insets(0, COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ panel.add(mContactEmailTxt, gbc);
+
+ mContactPhoneLbl = makeJLabel("PHONE");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, 4*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ panel.add(mContactPhoneLbl, gbc);
+
+ mContactPhoneTxt = new JTextField(30);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0, COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ panel.add(mContactPhoneTxt, gbc);
+
+ JLabel dummy = new JLabel(" ");
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weighty = 1.0;
+ gbc.fill = gbc.BOTH;
+ panel.add(dummy, gbc);
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+
+ public void actionPerformed(ActionEvent event) {
+ if (event.getSource().equals(mCopy)) {
+ mText.copy();
+ }
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/WBaseDNPage.java b/base/console/src/com/netscape/admin/certsrv/config/WBaseDNPage.java
new file mode 100644
index 000000000..97774727b
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/WBaseDNPage.java
@@ -0,0 +1,493 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.util.*;
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * CA signing cert for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+public class WBaseDNPage extends WizardBasePanel implements IWizardPanel {
+ protected JTextField mCNText, mOUText, mOText, mLText, mSTText, mCText;
+ protected JTextArea mSubjectDNText;
+ public static final String CN = "CN=";
+ public static final String OU = "OU=";
+ public static final String O = "O=";
+ public static final String L = "L=";
+ public static final String ST = "ST=";
+ public static final String C = "C=";
+ public static final String cn = "cn=";
+ public static final String ou = "ou=";
+ public static final String o = "o=";
+ public static final String l = "l=";
+ public static final String st = "st=";
+ public static final String c = "c=";
+ protected JRadioButton mDNComponents;
+ protected JRadioButton mDNString;
+ protected JTextField mSubjectStringText;
+ protected JLabel cnLabel;
+ protected JLabel ouLabel;
+ protected JLabel oLabel;
+ protected JLabel lLabel;
+ protected JLabel stLabel;
+ protected JLabel cLabel;
+ protected JLabel subjectDNLabel;
+ protected Color mActiveColor;
+ //protected JTextArea dnDesc;
+ protected boolean displayWarning=false;
+ protected String mPanelName;
+
+
+ public WBaseDNPage(String panelName) {
+ super(panelName);
+ mPanelName = panelName;
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ return true;
+ }
+
+ public boolean validatePanel() {
+ String str = "";
+ if (mDNComponents.isSelected()) {
+ str = mOText.getText().trim();
+ } else {
+ String dnString = mSubjectStringText.getText().trim();
+ StringTokenizer tokenizer = new StringTokenizer(dnString, ",");
+ while (tokenizer.hasMoreTokens()) {
+ String element = ((String)tokenizer.nextToken()).trim();
+ if (element.startsWith(O) || element.startsWith(o)) {
+ int index = element.indexOf("=");
+ if (index > -1) {
+ str = element.substring(index+1);
+ break;
+ }
+ }
+ }
+ }
+
+ if (str.equals("") && !displayWarning) {
+ String errorMsg =
+ mResource.getString(mPanelName+"_DIALOG_MISSINGO_MESSAGE");
+ JOptionPane.showMessageDialog(new JFrame(), errorMsg, "Warning",
+ JOptionPane.WARNING_MESSAGE,
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_WARN_ICON));
+/*
+ WarningDialog dialog = new WarningDialog(new JFrame(),
+ "_TEXT_MISSINGO_LABEL");
+*/
+ displayWarning = true;
+ return false;
+ }
+
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ return true;
+ }
+
+ public void callHelp() {
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+
+ protected void populateDN(String str) {
+ StringTokenizer tokenizer = new StringTokenizer(str, ",");
+ boolean isDNString = false;
+ while (tokenizer.hasMoreTokens()) {
+ String element = (String)tokenizer.nextToken();
+ element = element.trim();
+ int index = element.indexOf('=');
+ String val = element.substring(index+1);
+ if (element.startsWith(CN) || element.startsWith(cn)) {
+ mCNText.setText(val);
+ } else if (element.startsWith(OU) || element.startsWith(ou)) {
+ mOUText.setText(val);
+ } else if (element.startsWith(O) || element.startsWith(o)) {
+ mOText.setText(val);
+ } else if (element.startsWith(L) || element.startsWith(l)) {
+ mLText.setText(val);
+ } else if (element.startsWith(ST) || element.startsWith(st)) {
+ mSTText.setText(val);
+ } else if (element.startsWith(C) || element.startsWith(c)) {
+ mCText.setText(val);
+ } else {
+ isDNString = true;
+ }
+ }
+
+ mSubjectStringText.setText(str);
+
+ if (isDNString) {
+ mDNString.setSelected(true);
+ enableFields(false, getBackground());
+ } else {
+ mDNComponents.setSelected(true);
+ enableFields(true, mActiveColor);
+ }
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+/*
+ JLabel currentDN = makeJLabel("SUBJECTNAME");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(currentDN, gbc);
+
+ dnDesc = createTextArea(" ", 2, 80);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(dnDesc, gbc);
+*/
+
+/*
+ JTextArea desc = createTextArea(
+ CMSAdminUtil.wrapText(mResource.getString(
+ "CACERT2WIZARD_TEXT_DN_LABEL"), 80), 1, 80);
+*/
+
+ JTextArea desc = createTextArea(mResource.getString(
+ mPanelName+"_LABEL_DN_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+
+ mDNComponents = makeJRadioButton("DNCOMP", true);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mDNComponents, gbc);
+
+ cnLabel = makeJLabel("CN");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ add(cnLabel, gbc);
+
+ mCNText = new JTextField(30);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mCNText, gbc);
+
+/*
+ JTextArea dummy = createTextArea(" ", 1, 1);
+ CMSAdminUtil.addComponents(this, cnLabel, mCNText, dummy, gbc);
+*/
+ //CMSAdminUtil.addComponents(this, cnLabel, mCNText, gbc);
+
+ ouLabel = makeJLabel("OU");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE,4*COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ add(ouLabel, gbc);
+
+ mOUText = new JTextField(30);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ add(mOUText, gbc);
+
+/*
+ JTextArea dummy1 = createTextArea(" ", 1, 1);
+ CMSAdminUtil.addComponents(this, ouLabel, mOUText, dummy1, gbc);
+*/
+// CMSAdminUtil.addComponents(this, ouLabel, mOUText, gbc);
+
+ oLabel = makeJLabel("O");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ add(oLabel, gbc);
+
+ mOText = new JTextField(30);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mOText, gbc);
+
+/*
+ JTextArea dummy2 = createTextArea(" ", 1, 1);
+ CMSAdminUtil.addComponents(this, oLabel, mOText, dummy2, gbc);
+*/
+ //CMSAdminUtil.addComponents(this, oLabel, mOText, gbc);
+
+ lLabel = makeJLabel("LOCALITY");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ add(lLabel, gbc);
+
+ mLText = new JTextField(30);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mLText, gbc);
+/*
+ JTextArea dummy3 = createTextArea(" ", 1, 1);
+ CMSAdminUtil.addComponents(this, lLabel, mLText, dummy3, gbc);
+*/
+ //CMSAdminUtil.addComponents(this, lLabel, mLText, gbc);
+
+ stLabel = makeJLabel("STATE");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ add(stLabel, gbc);
+
+ mSTText = new JTextField(30);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mSTText, gbc);
+/*
+ JTextArea dummy4 = createTextArea(" ", 1, 1);
+ CMSAdminUtil.addComponents(this, stLabel, mSTText, dummy4, gbc);
+*/
+ //CMSAdminUtil.addComponents(this, stLabel, mSTText, gbc);
+
+ cLabel = makeJLabel("COUNTRY");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ add(cLabel, gbc);
+
+ mCText = new JTextField(30);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mCText, gbc);
+/*
+ JTextArea dummy5 = createTextArea(" ", 1, 1);
+ CMSAdminUtil.addComponents(this, cLabel, mCText, dummy5, gbc);
+*/
+ //CMSAdminUtil.addComponents(this, cLabel, mCText, gbc);
+
+ subjectDNLabel = makeJLabel("SELECTEDDN");
+ mSubjectDNText = new SubjectDNTextArea(3, 30);
+ mSubjectDNText.setLineWrap(true);
+ mSubjectDNText.setBackground(getBackground());
+ mSubjectDNText.setEditable(false);
+ mSubjectDNText.setCaretColor(getBackground());
+ CMSAdminUtil.resetGBC(gbc);
+ //gbc.weighty = 1.0;
+ CMSAdminUtil.addComponents(this, subjectDNLabel, mSubjectDNText, gbc);
+
+ mDNString = makeJRadioButton("DNSTRING", false);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mDNString, gbc);
+
+ ButtonGroup group = new ButtonGroup();
+ group.add(mDNString);
+ group.add(mDNComponents);
+
+ mSubjectStringText = new JTextField(256);
+/*
+ mSubjectStringText = new JTextArea(null, null, 0, 0);
+ mSubjectStringText.setBorder(BorderFactory.createLineBorder(Color.black));
+ JScrollPane scrollPane = new JScrollPane(mSubjectStringText,
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
+ scrollPane.setPreferredSize(new Dimension(50, 20));
+*/
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ //gbc.weighty = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mSubjectStringText, gbc);
+ //mSubjectStringText.setLineWrap(true);
+ mActiveColor = mCNText.getBackground();
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel d1 = new JLabel();
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(d1, gbc);
+
+
+ mCNText.getDocument().addDocumentListener((DocumentListener)mSubjectDNText);
+ mOUText.getDocument().addDocumentListener((DocumentListener)mSubjectDNText);
+ mOText.getDocument().addDocumentListener((DocumentListener)mSubjectDNText);
+ mLText.getDocument().addDocumentListener((DocumentListener)mSubjectDNText);
+ mSTText.getDocument().addDocumentListener((DocumentListener)mSubjectDNText);
+ mCText.getDocument().addDocumentListener((DocumentListener)mSubjectDNText);
+
+ super.init();
+ }
+
+ protected void enableFields(boolean enable, Color color) {
+ CMSAdminUtil.enableJTextField(mCNText, enable, color);
+ CMSAdminUtil.enableJTextField(mOUText, enable, color);
+ CMSAdminUtil.enableJTextField(mOText, enable, color);
+ CMSAdminUtil.enableJTextField(mLText, enable, color);
+ CMSAdminUtil.enableJTextField(mSTText, enable, color);
+ CMSAdminUtil.enableJTextField(mCText, enable, color);
+ cnLabel.setEnabled(enable);
+ ouLabel.setEnabled(enable);
+ oLabel.setEnabled(enable);
+ lLabel.setEnabled(enable);
+ stLabel.setEnabled(enable);
+ cLabel.setEnabled(enable);
+ subjectDNLabel.setEnabled(enable);
+ CMSAdminUtil.repaintComp(cnLabel);
+ CMSAdminUtil.repaintComp(ouLabel);
+ CMSAdminUtil.repaintComp(oLabel);
+ CMSAdminUtil.repaintComp(lLabel);
+ CMSAdminUtil.repaintComp(stLabel);
+ CMSAdminUtil.repaintComp(cLabel);
+ CMSAdminUtil.repaintComp(subjectDNLabel);
+ if (enable)
+ CMSAdminUtil.enableJTextField(mSubjectStringText, !enable,
+ getBackground());
+ else
+ CMSAdminUtil.enableJTextField(mSubjectStringText, !enable,
+ mActiveColor);
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ if (mDNComponents.isSelected()) {
+ enableFields(true, mActiveColor);
+ } else {
+ enableFields(false, getBackground());
+ }
+ }
+
+ public class SubjectDNTextArea extends JTextArea implements
+ DocumentListener {
+
+ public SubjectDNTextArea(int rows, int columns) {
+ super(rows, columns);
+ }
+
+ public void insertUpdate(DocumentEvent e) {
+ super.setText(updateStr());
+ }
+
+ public void removeUpdate(DocumentEvent e) {
+ super.setText(updateStr());
+ }
+
+ public void changedUpdate(DocumentEvent e) {
+ super.setText(updateStr());
+ }
+
+ private String updateStr() {
+ String cnStr = mCNText.getText().trim();
+ String ouStr = mOUText.getText().trim();
+ String oStr = mOText.getText().trim();
+ String lStr = mLText.getText().trim();
+ String stStr = mSTText.getText().trim();
+ String cStr = mCText.getText().trim();
+
+ String result = "";
+ result = result+appendStr(result, CN, cnStr);
+ result = result+appendStr(result, OU, ouStr);
+ result = result+appendStr(result, O, oStr);
+ result = result+appendStr(result, L, lStr);
+ result = result+appendStr(result, ST, stStr);
+ result = result+appendStr(result, C, cStr);
+
+ return result;
+ }
+
+ private String appendStr(String origStr, String prefix, String suffix) {
+ String result = "";
+ if (suffix.equals(""))
+ return result;
+
+ result = prefix + suffix;
+ if (!origStr.equals("")) {
+ result = ", "+result;
+ }
+ return result;
+ }
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/WBaseDNValidityPage.java b/base/console/src/com/netscape/admin/certsrv/config/WBaseDNValidityPage.java
new file mode 100644
index 000000000..3a5837624
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/WBaseDNValidityPage.java
@@ -0,0 +1,207 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.awt.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * CA signing cert for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+public class WBaseDNValidityPage extends WizardBasePanel {
+ public JTextField mCNText, mOUText, mOText, mLText, mSTText, mCText;
+ public JTextField mValidityText;
+ public JComboBox mUnitBox;
+ public JLabel validityLbl;
+ public JTextArea mSubjectDNText, desc1;
+ public static final String CN = "CN=";
+ public static final String OU = "OU=";
+ public static final String O = "O=";
+ public static final String L = "L=";
+ public static final String ST = "ST=";
+ public static final String C = "C=";
+
+ public WBaseDNValidityPage(String panelName) {
+ super(panelName);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ JTextArea desc = createTextArea(
+ CMSAdminUtil.wrapText(mResource.getString(
+ "CACERT2WIZARD_TEXT_DN_LABEL"), 80), 1, 80);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+
+ JLabel cnLabel = makeJLabel("CN");
+ mCNText = new JTextField(30);
+/*
+ JTextArea dummy = createTextArea(" ", 1, 1);
+ CMSAdminUtil.addComponents(this, cnLabel, mCNText, dummy, gbc);
+*/
+ CMSAdminUtil.addComponents(this, cnLabel, mCNText, gbc);
+
+ JLabel ouLabel = makeJLabel("OU");
+ mOUText = new JTextField(30);
+/*
+ JTextArea dummy1 = createTextArea(" ", 1, 1);
+ CMSAdminUtil.addComponents(this, ouLabel, mOUText, dummy1, gbc);
+*/
+ CMSAdminUtil.addComponents(this, ouLabel, mOUText, gbc);
+
+ JLabel oLabel = makeJLabel("O");
+ mOText = new JTextField(30);
+/*
+ JTextArea dummy2 = createTextArea(" ", 1, 1);
+ CMSAdminUtil.addComponents(this, oLabel, mOText, dummy2, gbc);
+*/
+ CMSAdminUtil.addComponents(this, oLabel, mOText, gbc);
+
+ JLabel lLabel = makeJLabel("LOCALITY");
+ mLText = new JTextField(30);
+/*
+ JTextArea dummy3 = createTextArea(" ", 1, 1);
+ CMSAdminUtil.addComponents(this, lLabel, mLText, dummy3, gbc);
+*/
+ CMSAdminUtil.addComponents(this, lLabel, mLText, gbc);
+
+ JLabel stLabel = makeJLabel("STATE");
+ mSTText = new JTextField(30);
+/*
+ JTextArea dummy4 = createTextArea(" ", 1, 1);
+ CMSAdminUtil.addComponents(this, stLabel, mSTText, dummy4, gbc);
+*/
+ CMSAdminUtil.addComponents(this, stLabel, mSTText, gbc);
+
+ JLabel cLabel = makeJLabel("COUNTRY");
+ mCText = new JTextField(30);
+/*
+ JTextArea dummy5 = createTextArea(" ", 1, 1);
+ CMSAdminUtil.addComponents(this, cLabel, mCText, dummy5, gbc);
+*/
+ CMSAdminUtil.addComponents(this, cLabel, mCText, gbc);
+
+ JLabel subjectDNLabel = makeJLabel("SELECTEDDN");
+ mSubjectDNText = new SubjectDNTextArea(3, 30);
+ mSubjectDNText.setLineWrap(true);
+ mSubjectDNText.setBackground(getBackground());
+ mSubjectDNText.setEditable(false);
+ mSubjectDNText.setCaretColor(getBackground());
+ CMSAdminUtil.resetGBC(gbc);
+ //gbc.weighty = 1.0;
+ CMSAdminUtil.addComponents(this, subjectDNLabel, mSubjectDNText, gbc);
+
+ desc1 = createTextArea(
+ CMSAdminUtil.wrapText(mResource.getString(
+ "CACERT2WIZARD_TEXT_VALIDITY_LABEL"), 80), 1, 80);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc1, gbc);
+
+ validityLbl = makeJLabel("VALIDITY");
+ mValidityText = new JTextField(5);
+ mUnitBox = makeJComboBox("VALIDITY");
+ gbc.weighty = 1.0;
+ CMSAdminUtil.addComponents(this, validityLbl, mValidityText, mUnitBox,
+ gbc);
+
+ mCNText.getDocument().addDocumentListener((DocumentListener)mSubjectDNText);
+ mOUText.getDocument().addDocumentListener((DocumentListener)mSubjectDNText);
+ mOText.getDocument().addDocumentListener((DocumentListener)mSubjectDNText);
+ mLText.getDocument().addDocumentListener((DocumentListener)mSubjectDNText);
+ mSTText.getDocument().addDocumentListener((DocumentListener)mSubjectDNText);
+ mCText.getDocument().addDocumentListener((DocumentListener)mSubjectDNText);
+
+ super.init();
+ }
+
+ public class SubjectDNTextArea extends JTextArea implements
+ DocumentListener {
+
+ public SubjectDNTextArea(int rows, int columns) {
+ super(rows, columns);
+ }
+
+ public void insertUpdate(DocumentEvent e) {
+ super.setText(updateStr());
+ }
+
+ public void removeUpdate(DocumentEvent e) {
+ super.setText(updateStr());
+ }
+
+ public void changedUpdate(DocumentEvent e) {
+ super.setText(updateStr());
+ }
+
+ private String updateStr() {
+ String cnStr = mCNText.getText().trim();
+ String ouStr = mOUText.getText().trim();
+ String oStr = mOText.getText().trim();
+ String lStr = mLText.getText().trim();
+ String stStr = mSTText.getText().trim();
+ String cStr = mCText.getText().trim();
+
+ String result = "";
+ result = result+appendStr(result, CN, cnStr);
+ result = result+appendStr(result, OU, ouStr);
+ result = result+appendStr(result, O, oStr);
+ result = result+appendStr(result, L, lStr);
+ result = result+appendStr(result, ST, stStr);
+ result = result+appendStr(result, C, cStr);
+
+ return result;
+ }
+
+ private String appendStr(String origStr, String prefix, String suffix) {
+ String result = "";
+ if (suffix.equals(""))
+ return result;
+
+ result = prefix + suffix;
+ if (!origStr.equals("")) {
+ result = ", "+result;
+ }
+ return result;
+ }
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/WBaseKeyPage.java b/base/console/src/com/netscape/admin/certsrv/config/WBaseKeyPage.java
new file mode 100644
index 000000000..1266099b1
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/WBaseKeyPage.java
@@ -0,0 +1,248 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.awt.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Setup CA signing cert for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+public class WBaseKeyPage extends WizardBasePanel {
+ protected JComboBox mKeyTypeBox;
+ protected JComboBox mKeyLengthBox;
+ //protected JComboBox mTokenBox;
+ //protected JPasswordField mPasswordText;
+ protected JTextField mKeyLengthText;
+
+ public WBaseKeyPage(String panelName) {
+ super(panelName);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ JTextArea desc = createTextArea(
+ CMSAdminUtil.wrapText(mResource.getString(
+ "CACERT1CUSTOMWIZARD_TEXT_HEADING_LABEL"), 80), 2, 80);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+
+/*
+ JTextArea desc1 = createTextArea(
+ CMSAdminUtil.wrapText(mResource.getString(
+ "CACERT1CUSTOMWIZARD_TEXT_TOKENHEADING_LABEL"), 80), 1, 80);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc1, gbc);
+
+ JLabel tokenLbl = makeJLabel("TOKEN");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(tokenLbl, gbc);
+
+ mTokenBox = new JComboBox();
+ mTokenBox.addItem("internal");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(COMPONENT_SPACE,0,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(mTokenBox, gbc);
+
+ JTextArea dummy = createTextArea(" ", 1, 5);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,0,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(dummy, gbc);
+*/
+
+/*
+ JTextArea desc2 = createTextArea(
+ CMSAdminUtil.wrapText(mResource.getString(
+ "CACERT1CUSTOMWIZARD_TEXT_HARDWARE_LABEL"), 80), 1, 80);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(2*COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc2, gbc);
+
+ JLabel pwdLbl = makeJLabel("PWD");
+ mPasswordText = makeJPasswordField(20);
+ //JTextArea dummy1 = createTextArea(" ", 1, 10);
+ //CMSAdminUtil.addComponents(this, pwdLbl, mPasswordText, dummy1, gbc);
+ CMSAdminUtil.addComponents(this, pwdLbl, mPasswordText, gbc);
+*/
+
+ JTextArea desc3 = createTextArea(
+ CMSAdminUtil.wrapText(mResource.getString(
+ "CACERT1CUSTOMWIZARD_TEXT_KEY_LABEL"), 80), 1, 80);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(2*COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc3, gbc);
+
+/*
+ JLabel keyTypeLbl = makeJLabel("KEYTYPE");
+ mKeyTypeBox = makeJComboBox("KEYTYPE");
+ //JTextArea dummy2 = createTextArea(" ", 1, 10);
+ //CMSAdminUtil.addComponents(this, keyTypeLbl, mKeyTypeBox, dummy2, gbc);
+ CMSAdminUtil.addComponents(this, keyTypeLbl, mKeyTypeBox, gbc);
+*/
+
+ JPanel panel = new JPanel();
+ GridBagLayout gb1 = new GridBagLayout();
+ panel.setLayout(gb1);
+
+ JLabel keyTypeLbl = makeJLabel("KEYTYPE");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ panel.add(keyTypeLbl, gbc);
+
+ mKeyTypeBox = makeJComboBox("KEYTYPE");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ gbc.fill = gbc.NONE;
+ panel.add(mKeyTypeBox, gbc);
+
+ JLabel keyLengthLbl = makeJLabel("KEYLENGTH");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ //gbc.weighty = 1.0;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE,0,COMPONENT_SPACE);
+ panel.add(keyLengthLbl, gbc);
+
+ mKeyLengthBox = makeJComboBox("KEYLENGTH");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ //gbc.weighty = 1.0;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE,0,COMPONENT_SPACE);
+ panel.add(mKeyLengthBox, gbc);
+
+ JLabel unitLbl = makeJLabel("UNITS");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ //gbc.weighty = 1.0;
+ gbc.insets = new Insets(0, 0,0,COMPONENT_SPACE);
+ panel.add(unitLbl, gbc);
+
+ JPanel panel1 = new JPanel();
+ GridBagLayout gb2 = new GridBagLayout();
+ panel1.setLayout(gb2);
+
+ JLabel keyLengthCustomLbl = makeJLabel("KEYLENGTH");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE,0,COMPONENT_SPACE);
+ panel1.add(keyLengthCustomLbl, gbc);
+
+ mKeyLengthText = makeJTextField(7);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, 0, 0);
+ panel1.add(mKeyLengthText, gbc);
+
+ JLabel unit1Lbl = makeJLabel("UNITS");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, 0, COMPONENT_SPACE);
+ panel1.add(unit1Lbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ add(panel, gbc);
+
+ JTextArea keyLengthCustomText = createTextArea(
+ CMSAdminUtil.wrapText(mResource.getString(
+ "CACERT1CUSTOMWIZARD_TEXT_CUSTOMKEY_LABEL"), 80), 1, 80);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(keyLengthCustomText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ add(panel1, gbc);
+
+ super.init();
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/WBaseManualCertRequestPage.java b/base/console/src/com/netscape/admin/certsrv/config/WBaseManualCertRequestPage.java
new file mode 100644
index 000000000..195979f9c
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/WBaseManualCertRequestPage.java
@@ -0,0 +1,508 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.util.*;
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.install.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Certificate wizard page
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+public class WBaseManualCertRequestPage extends WizardBasePanel {
+
+ public static final String SERVER_CERT = "server";
+ public static final String CLIENT_CERT = "client";
+ public static final String CA_CERT = "ca";
+ public static final String RA_CERT = "ra";
+ public static final String OCSP_CERT = "ocsp";
+ public static final String OBJECT_SIGNING_CERT = "objSignClient";
+ public static final String OTHER_CERT = "other";
+ public static final String ROUTER_CERT = "router"; // deprecated
+ public static final String CEP_CERT = "CEP-Request";
+
+ public static final String CERT_TYPE = "certType";
+ public static final String PKCS10_REQUEST = "pkcs10Request";
+ public static final String CMC_REQUEST = "cmcRequest";
+
+ protected JButton mCopy;
+ protected JTextArea mText;
+ protected String mPanelName, mDir;
+ protected JTextArea mFileName;
+ protected JTextArea mDesc;
+
+ protected JTextField mHostText, mPortText;
+ protected JLabel mHostLbl, mPortLbl;
+ protected JLabel mSSLText;
+ protected JCheckBox mSSL; // ssl or not
+ protected String mHost, mPort;
+ protected JLabel mSendNowText;
+ protected JCheckBox mSendNowBox;
+ protected Color mActiveColor;
+ public static final int MAX_PORT = 65535;
+ public static final int MIN_PORT = 1;
+ protected String mReq = null;
+ protected String mReqType = null;
+ protected String mReqFormat = null;
+
+ public WBaseManualCertRequestPage(String panelName) {
+ super(panelName);
+ mPanelName = panelName;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+
+ mReqType = wizardInfo.getCertType();
+ mReqFormat = wizardInfo.getReqFormat(mReqType);
+
+ if (mReqType.equals(Constants.PR_CA_SIGNING_CERT)){
+ mReq = (String)wizardInfo.get(ConfigConstants.CA_CERT_REQUEST);
+ }else if (mReqType.equals(Constants.PR_SERVER_CERT) ){
+ mReq = (String)wizardInfo.get(ConfigConstants.SSL_CERT_REQUEST);
+ }else if (mReqType.equals(Constants.PR_KRA_TRANSPORT_CERT)){
+ mReq = (String)wizardInfo.get(ConfigConstants.KRA_CERT_REQUEST);
+ }else if (mReqType.equals(Constants.PR_OCSP_SIGNING_CERT)){
+ mReq = (String)wizardInfo.get(ConfigConstants.OCSP_CERT_REQUEST);
+ }else if (mReqType.equals(Constants.PR_RA_SIGNING_CERT)){
+ mReq = (String)wizardInfo.get(ConfigConstants.RA_CERT_REQUEST);
+ Debug.println("no request got from ra stage");
+ }else {
+ setErrorMessage("Wrong cert request type!");
+ return false;
+ }
+
+ if (mReq == null || mReq.equals("")){
+ mReq = wizardInfo.getCertRequest();
+ }
+ if (mReqFormat.equals(ConfigConstants.PR_REQUEST_PKCS10)){
+
+ // Break the long single line:header,64 byte lines,trailer
+ // Assuming this is the only format we generate.
+ String CERT_NEW_REQUEST_HEADER = "-----BEGIN NEW CERTIFICATE REQUEST-----";
+ String CERT_NEW_REQUEST_TRAILER = "-----END NEW CERTIFICATE REQUEST-----";
+ int head = mReq.indexOf(CERT_NEW_REQUEST_HEADER);
+ int trail = mReq.indexOf(CERT_NEW_REQUEST_TRAILER);
+ String unwrapped =
+ mReq.substring(head+CERT_NEW_REQUEST_HEADER.length(),trail);
+ String str = CERT_NEW_REQUEST_HEADER + "\n";
+ int len = unwrapped.length();
+ for (int i = 0; i < len; i=i+64){
+ if (i+64 < len)
+ str = str + unwrapped.substring(i,i+64) +"\n";
+ else
+ str = str + unwrapped.substring(i,len) +"\n";
+ }
+ str = str + CERT_NEW_REQUEST_TRAILER;
+ mReq = str;
+ } else if (mReqFormat.equals(ConfigConstants.PR_REQUEST_CMC)){
+ String str = "";
+ int len = mReq.length();
+ for (int i = 0; i < len; i=i+64){
+ if (i+64 < len)
+ str = str + mReq.substring(i,i+64) +"\n";
+ else
+ str = str + mReq.substring(i,len) +"\n";
+ }
+ mReq = str;
+ }
+
+ if (mReq == null)
+ return false;
+ mText.setText(mReq);
+
+ mText.selectAll();
+ setBorder(makeTitledBorder(mPanelName));
+
+ mDir = wizardInfo.getCertRequestDir();
+ String str = mResource.getString(mPanelName+"_TEXT_FILELOC_LABEL")+mDir+".";
+ mFileName.setText(str);
+
+ if (mSendNowBox.isSelected())
+ enableFields(true, mActiveColor);
+ else
+ enableFields(false, getBackground());
+
+ String host = wizardInfo.getCMHost();
+ if (host != null && !host.equals(""))
+ mHostText.setText(host);
+ String port = wizardInfo.getCMEEPort();
+ if (port != null && !port.equals(""))
+ mPortText.setText(port);
+
+ String portType = wizardInfo.getCMEEType();
+ if (portType != null && portType.equals("http"))
+ mSSL.setSelected(false);
+
+ String desc = "";
+ if (!wizardInfo.isNewRequest()) {
+ desc = mResource.getString(mPanelName+"_TEXT_IGNOR_LABEL")+
+ "\n";
+ }
+ String certType = wizardInfo.getCertType();
+ if (mReqFormat.equals(ConfigConstants.PR_REQUEST_PKCS10)) {
+ desc = desc + mResource.getString( mPanelName+"_TEXT_DESC_LABEL");
+ } else if (mReqFormat.equals(ConfigConstants.PR_REQUEST_CMC)) {
+ desc = desc + mResource.getString(
+ mPanelName+"_TEXT_CMCDESC_LABEL");
+ }
+ mDesc.setText(desc);
+
+ return true;
+ }
+
+ public boolean validatePanel() {
+ if (!mSendNowBox.isSelected()) {
+ mHost = "";
+ mPort = "";
+ return true;
+ }
+
+ mHost = mHostText.getText().trim();
+ mPort = mPortText.getText().trim();
+ if (mHost.equals("")) {
+ setErrorMessage("BLANKHOST");
+ return false;
+ }
+ if (mPort.equals("")) {
+ setErrorMessage("BLANKPORT");
+ return false;
+ }
+
+ try {
+ int portnumber = Integer.parseInt(mPort);
+ if (portnumber < MIN_PORT || portnumber > MAX_PORT) {
+ setErrorMessage("OUTOFRANGE");
+ return false;
+ }
+ } catch (NumberFormatException e) {
+ setErrorMessage("INVALIDPORT");
+ return false;
+ }
+
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ if (!mSendNowBox.isSelected())
+ return true;
+
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (mHost != null && !mHost.equals(""))
+ wizardInfo.setCMHost(mHost);
+ if (mPort != null && !mPort.equals(""))
+ wizardInfo.setCMEEPort(mPort);
+ if (mSSL.isSelected())
+ wizardInfo.setCMEEType("https");
+ else
+ wizardInfo.setCMEEType("http");
+
+ CMSRequestCert requestCertCgi = new CMSRequestCert();
+ requestCertCgi.initialize(wizardInfo);
+ Hashtable data = new Hashtable();
+
+ String certType = null;
+ if (mReqType.equals(Constants.PR_CA_SIGNING_CERT)){
+ data.put("profileId", "caCACert");
+ }else if (mReqType.equals(Constants.PR_SERVER_CERT) ||
+ mReqType.equals(Constants.PR_KRA_TRANSPORT_CERT)){
+ data.put("profileId", "caServerCert");
+ }else if (mReqType.equals(Constants.PR_OCSP_SIGNING_CERT)){
+ data.put("profileId", "caOCSPCert");
+ }else if (mReqType.equals(Constants.PR_RA_SIGNING_CERT)){
+ data.put("profileId", "caRACert");
+ }else {
+ setErrorMessage("Wrong cert request type!");
+ return false;
+ }
+
+ if (mReqFormat.equals(ConfigConstants.PR_REQUEST_PKCS10)){
+ data.put("cert_request_type", "pkcs10");
+ data.put("cert_request", mReq);
+ } else {
+ data.put("cert_request_type", "cmc");
+ data.put("cert_request", mReq);
+ // test full response, but we don't really need it
+ // data.put("fullResponse", "true");
+ }
+
+ startProgressStatus();
+ boolean ready = requestCertCgi.requestCert(data);
+ endProgressStatus();
+
+ if (!ready) {
+ String str = requestCertCgi.getErrorMessage();
+ if (str.equals(""))
+ setErrorMessage("Server Error");
+ else
+ setErrorMessage(str);
+ return ready;
+ }
+ wizardInfo.setRequestSent(ready);
+
+ //save the stage
+ String reqID = wizardInfo.getRequestID();
+ String reqStatus = wizardInfo.getRequestStatus();
+ String reqError = wizardInfo.getRequestError();
+
+ wizardInfo.setX509RequestID(reqID);
+ wizardInfo.setX509RequestStatus(reqStatus);
+ if (reqError != null)
+ wizardInfo.setX509RequestError(reqError);
+
+ // rejected request should not be saved as requestSuccStage!!
+ if ( (reqID != null) && !reqID.equals("") &&
+ (wizardInfo.getRequestError() == null) &&
+ (reqStatus.equals(Constants.PR_REQUEST_SUCCESS)
+ || reqStatus.equals(Constants.PR_REQUEST_PENDING)
+ || reqStatus.equals(Constants.PR_REQUEST_SVC_PENDING)) ) {
+ data = new Hashtable();
+
+ ConsoleInfo consoleInfo = wizardInfo.getAdminConsoleInfo();
+ data.put(ConfigConstants.TASKID, TaskId.TASK_REQUEST_SUCCESS);
+ data.put(ConfigConstants.OPTYPE, OpDef.OP_MODIFY);
+ data.put(ConfigConstants.PR_SERVER_ROOT,
+ consoleInfo.get(ConfigConstants.PR_SERVER_ROOT));
+ data.put(ConfigConstants.PR_CERT_INSTANCE_NAME,
+ consoleInfo.get(ConfigConstants.PR_CERT_INSTANCE_NAME));
+ data.put(Constants.PR_CERTIFICATE_TYPE, mReqType);
+ data.put(mReqType+ConfigConstants.PR_REQUEST_ID, reqID);
+
+ data.put(ConfigConstants.CA_EEPORT, mPortText.getText());
+ data.put(ConfigConstants.CA_EETYPE, wizardInfo.getCMEEType());
+ data.put(ConfigConstants.CA_HOST, mHostText.getText());
+ startProgressStatus();
+ CMSConfigCert configCertCgi = new CMSConfigCert();
+ configCertCgi.initialize(wizardInfo);
+ ready = configCertCgi.configCert(data);
+ endProgressStatus();
+
+ if (!ready) {
+ String str = configCertCgi.getErrorMessage();
+ if (str.equals("")) {
+ String errorMsg = mResource.getString(
+ mPanelName+"_ERRORMSG");
+ setErrorMessage(errorMsg);
+ } else
+ setErrorMessage(str);
+ return ready;
+ }
+ }
+ return ready;
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ mDesc = createTextArea(mResource.getString(
+ mPanelName+"_TEXT_DESC_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mDesc, gbc);
+
+ mActiveColor = mDesc.getBackground();
+
+ mText = new JTextArea(null, null, 10, 10);
+ //mText.setLineWrap(true);
+ //mText.setWrapStyleWord(true);
+ mText.setEditable(false);
+ JScrollPane scrollPane = new JScrollPane(mText,
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
+ scrollPane.setPreferredSize(new Dimension(50, 50));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.BOTH;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, 0, COMPONENT_SPACE);
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.5;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(scrollPane, gbc);
+
+ mCopy = makeJButton("COPY");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mCopy, gbc);
+
+ mFileName = createTextArea("");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mFileName, gbc);
+
+ JLabel dummy = new JLabel(" ");
+ gbc.gridwidth = gbc.REMAINDER;
+ //gbc.gridheight = gbc.REMAINDER;
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weighty = 0.5;
+ gbc.fill = gbc.BOTH;
+ add(dummy, gbc);
+
+ mSendNowBox = makeJCheckBox("SENDNOW", false);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mSendNowBox, gbc);
+
+ mSendNowText = new JLabel(mResource.getString(
+ mPanelName + "_TEXT_SENDNOW_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0, 4*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mSendNowText, gbc);
+
+ mHostLbl = makeJLabel("HOST");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.fill = gbc.NONE;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(0, 4*COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ add(mHostLbl, gbc);
+
+ mHostText = makeJTextField(30);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ add(mHostText, gbc);
+ mActiveColor = mHostText.getBackground();
+
+ mPortLbl = makeJLabel("PORT");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ add(mPortLbl, gbc);
+
+ mPortText = makeJTextField(10);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ add(mPortText, gbc);
+
+ mSSLText = new JLabel(mResource.getString(
+ mPanelName+"_TEXT_SSL_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mSSLText, gbc);
+
+ mSSL = makeJCheckBox("SSL", true);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0, 4*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mSSL, gbc);
+
+ JLabel label = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(label, gbc);
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+
+ public void actionPerformed(ActionEvent event) {
+ if (event.getSource().equals(mCopy)) {
+ mText.copy();
+ }
+ if (mSendNowBox.isSelected()) {
+ enableFields(true, mActiveColor);
+ } else {
+ enableFields(false, getBackground());
+ }
+ }
+
+ protected void enableFields(boolean enabled, Color color) {
+ mSendNowText.setEnabled(enabled);
+ //mSendNowText.setEditable(enabled);
+ CMSAdminUtil.repaintComp(mSendNowText);
+ mHostLbl.setEnabled(enabled);
+ mPortLbl.setEnabled(enabled);
+ mHostText.setEnabled(enabled);
+ mHostText.setEditable(enabled);
+ mHostText.setBackground(color);
+ mPortText.setEnabled(enabled);
+ mPortText.setEditable(enabled);
+ mPortText.setBackground(color);
+ CMSAdminUtil.repaintComp(mHostLbl);
+ CMSAdminUtil.repaintComp(mHostText);
+ CMSAdminUtil.repaintComp(mPortLbl);
+ CMSAdminUtil.repaintComp(mPortText);
+ mSSLText.setEnabled(enabled);
+ //mSSLText.setEditable(enabled);
+ CMSAdminUtil.repaintComp(mSSLText);
+ mSSL.setEnabled(enabled);
+ //mSSL.setEditable(enabled);
+ //mSSL.setBackground(color);
+ CMSAdminUtil.repaintComp(mSSL);
+
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/WBaseValidityPage.java b/base/console/src/com/netscape/admin/certsrv/config/WBaseValidityPage.java
new file mode 100644
index 000000000..61d9506e6
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/WBaseValidityPage.java
@@ -0,0 +1,258 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.awt.*;
+import java.text.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * CA signing cert for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+public class WBaseValidityPage extends WizardBasePanel {
+ protected String mPanelName = "";
+ protected JTextField mBYear, mBMonth, mBDay, mBHour, mBMin, mBSec;
+ protected JTextField mEYear, mEMonth, mEDay, mEHour, mEMin, mESec;
+ protected final static String DATE_PATTERN = "dd/MM/yyyy:HH:mm:ss";
+ protected Date mBeforeDate, mAfterDate;
+ protected boolean mWarningDisplayed = false;
+
+ public WBaseValidityPage(String panelName) {
+ super(panelName);
+ mPanelName = panelName;
+ }
+
+ public boolean validatePanel() {
+ String beginYear = mBYear.getText().trim();
+ String afterYear = mEYear.getText().trim();
+ String beginMonth = mBMonth.getText().trim();
+ String afterMonth = mEMonth.getText().trim();
+ String beginDay = mBDay.getText().trim();
+ String afterDay = mEDay.getText().trim();
+ String beginHour = mBHour.getText().trim();
+ String afterHour = mEHour.getText().trim();
+ String beginMin = mBMin.getText().trim();
+ String afterMin = mEMin.getText().trim();
+ String beginSec = mBSec.getText().trim();
+ String afterSec = mESec.getText().trim();
+
+ int bYear = Integer.parseInt(beginYear);
+ int aYear = Integer.parseInt(afterYear);
+
+/*
+POSIX timestamps used in most UNIX systems are 32-bit signed integers,
+which gives you 2^31 seconds or about 68 years of useful time. The
+epoch is 1970-01-01 00:00:00, so the counter will overflow sometime in
+January 2038.
+*/
+ // if (bYear > 2032 || aYear > 2032) {
+ if (bYear > 2037 || aYear > 2037) {
+ String errorMsg = mResource.getString(mPanelName+
+ "_LABEL_MAXYEAR_LABEL");
+ JOptionPane.showMessageDialog(mParent, errorMsg, "Warning",
+ JOptionPane.WARNING_MESSAGE,
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_WARN_ICON));
+ return false;
+ }
+
+ String beginDateStr = beginDay+"/"+beginMonth+"/"+beginYear+":"
+ +beginHour+":"+beginMin+":"+beginSec;
+ String endDateStr = afterDay+"/"+afterMonth+"/"+afterYear+":"
+ +afterHour+":"+afterMin+":"+afterSec;
+
+ SimpleDateFormat format = new SimpleDateFormat(DATE_PATTERN);
+ format.setLenient(false);
+ mBeforeDate = null;
+ mAfterDate = null;
+
+ try {
+ mBeforeDate = format.parse(beginDateStr);
+ } catch (ParseException e) {
+ setErrorMessage("INVALIDBEGINDATE");
+ return false;
+ }
+
+ try {
+ mAfterDate = format.parse(endDateStr);
+ } catch (ParseException e) {
+ setErrorMessage("INVALIDENDDATE");
+ return false;
+ }
+
+ if (mAfterDate.before(mBeforeDate)) {
+ setErrorMessage("SMALLAFTERDATE");
+ return false;
+ }
+
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ return true;
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ JTextArea heading = createTextArea(mResource.getString(
+ mPanelName+"_LABEL_VALIDITY_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ add(heading, gbc);
+
+ JLabel blank = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ add(blank, gbc);
+
+ JLabel yearLbl = makeJLabel("YEAR");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ add(yearLbl, gbc);
+
+ JLabel monthLbl = makeJLabel("MONTH");
+ add(monthLbl, gbc);
+
+ JLabel dayLbl = makeJLabel("DAY");
+ add(dayLbl, gbc);
+
+ JLabel hourLbl = makeJLabel("HOUR");
+ add(hourLbl, gbc);
+
+ JLabel minLbl = makeJLabel("MIN");
+ add(minLbl, gbc);
+
+ JLabel secLbl = makeJLabel("SEC");
+ gbc.gridwidth = gbc.REMAINDER;
+ add(secLbl, gbc);
+
+ JLabel beginLbl = makeJLabel("BEGIN");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ add(beginLbl, gbc);
+
+ //DateFormat dateFormat = DataFormat.getDateTimeInstance(
+ // DateFormat.FULL,DateFormat.MEDIUM);
+
+ Calendar nowDate = Calendar.getInstance();
+
+ Calendar afterDate = (Calendar)nowDate.clone();
+ afterDate.add(Calendar.YEAR, 5);
+
+ mBYear = new JTextField(""+nowDate.get(Calendar.YEAR));
+ mBYear.setColumns(4);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ add(mBYear, gbc);
+
+ mBMonth = new JTextField(""+(nowDate.get(Calendar.MONTH)+1));
+ mBMonth.setColumns(3);
+ add(mBMonth, gbc);
+
+ mBDay = new JTextField(""+nowDate.get(Calendar.DAY_OF_MONTH));
+ mBDay.setColumns(3);
+ add(mBDay, gbc);
+
+ mBHour = new JTextField("00");
+ mBHour.setColumns(3);
+ add(mBHour, gbc);
+
+ mBMin = new JTextField("00");
+ mBMin.setColumns(3);
+ add(mBMin, gbc);
+
+ mBSec = new JTextField("00");
+ mBSec.setColumns(3);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mBSec, gbc);
+
+ JLabel expireLbl = makeJLabel("EXPIRE");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ add(expireLbl, gbc);
+
+ mEYear = new JTextField(""+afterDate.get(Calendar.YEAR));
+ mEYear.setColumns(4);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ add(mEYear, gbc);
+
+ mEMonth = new JTextField(""+(afterDate.get(Calendar.MONTH)+1));
+ mEMonth.setColumns(3);
+ add(mEMonth, gbc);
+
+ mEDay = new JTextField(""+afterDate.get(Calendar.DAY_OF_MONTH));
+ mEDay.setColumns(3);
+ add(mEDay, gbc);
+
+ mEHour = new JTextField("00");
+ mEHour.setColumns(3);
+ add(mEHour, gbc);
+
+ mEMin = new JTextField("00");
+ mEMin.setColumns(3);
+ add(mEMin, gbc);
+
+ mESec = new JTextField("00");
+ mESec.setColumns(3);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mESec, gbc);
+
+ JLabel dummy = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.weighty = 1.0;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(dummy, gbc);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/WMNNewAgent.java b/base/console/src/com/netscape/admin/certsrv/config/WMNNewAgent.java
new file mode 100644
index 000000000..425eddaaa
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/WMNNewAgent.java
@@ -0,0 +1,293 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.table.*;
+import javax.swing.text.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * New Agent names/passwords for reconfiguring the Recovery MN Scheme
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+class WMNNewAgent extends WizardBasePanel
+ implements IWizardPanel
+{
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PANELNAME = "WMNNEWAGENT";
+
+ private int mNoAgent = 0;
+ private MNSchemeWizardInfo mInfo;
+ private NewAgentModel mDataModel;
+ private JTable mTable;
+ protected JScrollPane mScrollPane;
+ private static final String HELPINDEX =
+ "configuration-kra-wizard-newagentpwd-keyscheme-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ WMNNewAgent() {
+ super(PANELNAME);
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public boolean initializePanel(WizardInfo info) {
+ //let's set the values
+ mInfo = (MNSchemeWizardInfo)info;
+ Debug.println(mInfo.toString());
+ try {
+ mNoAgent = Integer.parseInt(mInfo.getNewN());
+ } catch (Exception e) {
+ return false;
+ }
+
+ //add rows into tables
+ //zap passwords
+ mDataModel.removeAllRows();
+
+ Vector[] data = new Vector[mNoAgent];
+ for (int i=0; i<data.length; i++) {
+ data[i] = new Vector();
+ data[i].addElement(Integer.toString(i+1));
+ data[i].addElement("");
+ data[i].addElement("");
+ data[i].addElement("");
+ mDataModel.addRow(data[i]);
+ }
+ return true;
+ }
+
+ public boolean validatePanel() {
+
+ Component component = mTable.getEditorComponent();
+ if(component!= null) {
+ int col = mTable.getEditingColumn();
+ int row = mTable.getEditingRow();
+ if ((col>-1)&&(row>-1)) {
+ String str = ((JTextComponent)component).getText();
+ mTable.setValueAt(str, row, col);
+ }
+ }
+
+ if(!checkBlank()) {
+ setErrorMessage("CANNOTBEBLANK");
+ return false;
+ }
+
+ if(!checkConfirm()) {
+ setErrorMessage("PASSWORDERROR");
+ return false;
+ }
+
+ if (!checkDuplicate()) {
+ setErrorMessage("DUPLICATEERROR");
+ return false;
+ }
+
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ Debug.println("WMNNewAgent -- concludePanel() - START");
+ String val = getUIDPassword();
+ mInfo.add(Constants.PR_RECOVERY_AGENT,val);
+ try {
+ mInfo.changeScheme();
+ } catch (EAdminException e) {
+ mErrorString = e.toString();
+ return false;
+ }
+ return true;
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ //base class take care of these
+ //public String getTitle();
+ //public String getErrorMessage();
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+
+ //Set the first column's cellrender as label cell
+ protected void setLabelCellRenderer(JTable table, int index) {
+ table.getColumnModel().getColumn(index).setCellRenderer(
+ new DefaultTableCellRenderer());
+ }
+
+ //Set the first column's cellrender as label cell
+ protected void setLabelCellEditor(JTable table, int index) {
+ table.getColumnModel().getColumn(index).setCellRenderer(
+ new PasswordCellRenderer());
+ table.getColumnModel().getColumn(index).setCellEditor(
+ new DefaultCellEditor(new JPasswordField()));
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+
+ //initialize the panel
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label3 = makeJLabel("DESC");
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ add(label3,gbc);
+
+ //table
+ mDataModel = new NewAgentModel();
+ mTable = new JTable(mDataModel);
+ mScrollPane = JTable.createScrollPaneForTable(mTable);
+ //mScrollPane.setBorder(CMSAdminUtil.makeTitledBorder(mResource,PANEL_NAME,"USERS"));
+ mScrollPane.setHorizontalScrollBarPolicy(mScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mScrollPane.setVerticalScrollBarPolicy(mScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ mTable.setAutoscrolls(true);
+ mTable.sizeColumnsToFit(true);
+ mTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
+ //mTable.getSelectionModel().addListSelectionListener(this);
+ mScrollPane.setBackground(Color.white);
+ setLabelCellRenderer(mTable, 1);
+ setLabelCellEditor(mTable, 2);
+ setLabelCellEditor(mTable, 3);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ //gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.fill = gbc.BOTH;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,COMPONENT_SPACE,COMPONENT_SPACE);
+ gb.setConstraints(mScrollPane, gbc);
+ add(mScrollPane);
+
+ super.init();
+ }
+
+ private boolean checkDuplicate() {
+ Hashtable table = new Hashtable();
+ for (int i=0; i<mDataModel.getRowCount(); i++) {
+ String val1 = (String)mDataModel.getValueAt(i,1);
+ table.put(val1.trim(), "1");
+ }
+ if (table.size() != mDataModel.getRowCount()) {
+ table = null;
+ return false;
+ }
+
+ table = null;
+ return true;
+ }
+
+ private boolean checkBlank() {
+ for (int i=0; i<mDataModel.getRowCount(); i++) {
+ String val1 = (String)mDataModel.getValueAt(i,1);
+ String val2 = (String)mDataModel.getValueAt(i,2);
+ String val3 = (String)mDataModel.getValueAt(i,3);
+ if ( (val1.trim().equals(""))||(val2.trim().equals(""))||
+ (val3.trim().equals(""))) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private boolean checkConfirm() {
+ for (int i=0; i<mDataModel.getRowCount(); i++) {
+ String val2 = (String)mDataModel.getValueAt(i,2);
+ String val3 = (String)mDataModel.getValueAt(i,3);
+ if (!val2.trim().equals(val3.trim())) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private String getUIDPassword() {
+ String result = "";
+ for (int i=0; i<mDataModel.getRowCount(); i++) {
+ String val1 = (String)mDataModel.getValueAt(i,1);
+ String val2 = (String)mDataModel.getValueAt(i,2);
+ result = result+val1.trim()+"="+val2.trim();
+ if (i < (mDataModel.getRowCount()-1))
+ result = result+",";
+ }
+ return result;
+ }
+
+}
+
+class NewAgentModel extends CMSTableModel
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ public static final String COL1 = "NUMBER";
+ public static final String COL2 = "UID";
+ public static final String COL3 = "PASSWORD";
+ public static final String COL4 = "CONFIRM";
+
+
+ private static String[] mColumns = {COL1, COL2, COL3, COL4};
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public NewAgentModel() {
+ super();
+ init(mColumns);
+ }
+
+ public boolean isCellEditable(int row, int col) {
+ if(col >= 1)
+ return true;
+ return false;
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/WMNOldAgent.java b/base/console/src/com/netscape/admin/certsrv/config/WMNOldAgent.java
new file mode 100644
index 000000000..07973f6c9
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/WMNOldAgent.java
@@ -0,0 +1,214 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.table.*;
+import javax.swing.text.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Old Agent name/password for reconfiguring the Recovery MN Scheme
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+class WMNOldAgent extends WizardBasePanel
+ implements IWizardPanel
+{
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PANELNAME = "WMNOLDAGENT";
+
+ private int mNoAgent = 0;
+ private MNSchemeWizardInfo mInfo;
+ private AutoRecoveryModel mDataModel;
+ private JTable mTable;
+ protected JScrollPane mScrollPane;
+ private static final String HELPINDEX =
+ "configuration-kra-wizard-agentpwd-keyscheme-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ WMNOldAgent() {
+ super(PANELNAME);
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ public boolean initializePanel(WizardInfo info) {
+ //let's set the values
+ mInfo = (MNSchemeWizardInfo)info;
+ Debug.println(mInfo.toString());
+ try {
+ mNoAgent = Integer.parseInt(mInfo.getM());
+ } catch (Exception e) {
+ return false;
+ }
+
+ //add rows into tables
+ //zap passwords
+ mDataModel.removeAllRows();
+
+ Vector[] data = new Vector[mNoAgent];
+ for (int i=0; i<data.length; i++) {
+ data[i] = new Vector();
+ data[i].addElement(Integer.toString(i+1));
+ data[i].addElement("");
+ data[i].addElement("");
+ mDataModel.addRow(data[i]);
+ }
+
+ return true;
+ }
+
+ public boolean validatePanel() {
+
+ Component component = mTable.getEditorComponent();
+ if(component!= null) {
+ int col = mTable.getEditingColumn();
+ int row = mTable.getEditingRow();
+ if ((col>-1)&&(row>-1)) {
+ String str = ((JTextComponent)component).getText();
+ mTable.setValueAt(str, row, col);
+ }
+ }
+
+ String val = getUIDPassword();
+ if(val.equals("")) {
+ setErrorMessage("CANNOTBEBLANK");
+ return false;
+ }
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ return true;
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ String val = getUIDPassword();
+ mInfo.add(Constants.PR_OLD_RECOVERY_AGENT,val);
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ //base class take care of these
+ //public String getTitle();
+ //public String getErrorMessage();
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+
+ //Set the first column's cellrender as label cell
+ protected void setLabelCellRenderer(JTable table, int index) {
+ table.getColumnModel().getColumn(index).setCellRenderer(
+ new DefaultTableCellRenderer());
+ }
+
+ //Set the first column's cellrender as label cell
+ protected void setLabelCellEditor(JTable table, int index) {
+ table.getColumnModel().getColumn(index).setCellRenderer(
+ new PasswordCellRenderer());
+ table.getColumnModel().getColumn(index).setCellEditor(
+ new DefaultCellEditor(new JPasswordField()));
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+
+ //initialize the panel
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label3 = makeJLabel("DESC");
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ add(label3,gbc);
+
+ //table
+ mDataModel = new AutoRecoveryModel();
+ mTable = new JTable(mDataModel);
+ mScrollPane = JTable.createScrollPaneForTable(mTable);
+ //mScrollPane.setBorder(CMSAdminUtil.makeTitledBorder(mResource,PANEL_NAME,"USERS"));
+ mScrollPane.setHorizontalScrollBarPolicy(mScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mScrollPane.setVerticalScrollBarPolicy(mScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ mTable.setAutoscrolls(true);
+ mTable.sizeColumnsToFit(true);
+ mTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
+ //mTable.getSelectionModel().addListSelectionListener(this);
+ mScrollPane.setBackground(Color.white);
+ setLabelCellRenderer(mTable, 1);
+ setLabelCellEditor(mTable, 2);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ //gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.fill = gbc.BOTH;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,COMPONENT_SPACE,COMPONENT_SPACE);
+ gb.setConstraints(mScrollPane, gbc);
+ add(mScrollPane);
+
+ super.init();
+ }
+
+ private String getUIDPassword() {
+ String result = "";
+ for (int i=0; i<mDataModel.getRowCount(); i++) {
+ for (int j=1; j<mDataModel.getColumnCount(); j++) {
+ String val = (String)mDataModel.getValueAt(i, j);
+ if (val.equals(""))
+ return "";
+ else if (j == (mDataModel.getColumnCount()-1))
+ result = result+val;
+ else
+ result = result+val+"=";
+ }
+ if (i < (mDataModel.getRowCount()-1))
+ result = result+",";
+ }
+ return result;
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/WMNResultPage.java b/base/console/src/com/netscape/admin/certsrv/config/WMNResultPage.java
new file mode 100644
index 000000000..55b1d1ccf
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/WMNResultPage.java
@@ -0,0 +1,102 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.table.*;
+import javax.swing.text.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Result page for the Recovery MN Scheme
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+class WMNResultPage extends WizardBasePanel
+ implements IWizardPanel
+{
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PANELNAME = "WMNRESULTPAGE";
+
+ private static final String HELPINDEX =
+ "configuration-kra-wizard-newagentpwd-keyscheme-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ WMNResultPage() {
+ super(PANELNAME);
+ init();
+ }
+
+ public boolean isLastPage() {
+ return true;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public boolean initializePanel(WizardInfo info) {
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ return true;
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+
+ //initialize the panel
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label3 = makeJLabel("DESC");
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ add(label3,gbc);
+
+ super.init();
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/WMNSelection.java b/base/console/src/com/netscape/admin/certsrv/config/WMNSelection.java
new file mode 100644
index 000000000..db7753b1d
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/WMNSelection.java
@@ -0,0 +1,226 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * MNSelection page for reconfiguring the Recovery MN Scheme
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+class WMNSelection extends WizardBasePanel
+ implements IWizardPanel
+{
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PANELNAME = "WMNSELECTION";
+
+ private JTextField mMField, mNField;
+ private JLabel mMLabel, mNLabel;
+ private int mRequired, mAvail;
+
+ private MNSchemeWizardInfo mInfo;
+ private static final String HELPINDEX =
+ "configuration-kra-wizard-change-keyscheme-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ WMNSelection() {
+ super(PANELNAME);
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ public boolean initializePanel(WizardInfo info) {
+ //let's set the values
+ mInfo = (MNSchemeWizardInfo)info;
+ mMField.setText(mInfo.getNewM());
+ mNField.setText(mInfo.getNewN());
+ mMLabel.setText(mInfo.getM());
+ mNLabel.setText(mInfo.getN());
+ return true;
+ }
+
+ public boolean validatePanel() {
+ if ((mMField.getText().trim().equals("")) ||
+ (mNField.getText().trim().equals("")) ) {
+ setErrorMessage("CANNOTBEBLANK");
+ return false;
+ }
+
+ String str = mMField.getText().trim();
+ if (str.equals("")) {
+ setErrorMessage("CANNOTBEBLANK");
+ return false;
+ }
+
+ try {
+ mRequired = Integer.parseInt(str);
+ str = mNField.getText().trim();
+ if (str.equals("")) {
+ setErrorMessage("CANNOTBEBLANK");
+ return false;
+ }
+ mAvail = Integer.parseInt(str);
+ } catch (NumberFormatException e) {
+ setErrorMessage("NOTINTEGER");
+ return false;
+ }
+
+ if (mRequired <= 0 || mAvail <= 0) {
+ setErrorMessage("NONZERO");
+ return false;
+ }
+
+ if (mRequired > mAvail) {
+ setErrorMessage("LARGER");
+ return false;
+ }
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ return true;
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ mInfo.add(Constants.PR_RECOVERY_M, mMField.getText().trim());
+ mInfo.add(Constants.PR_RECOVERY_N, mNField.getText().trim());
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ //base class take care of these
+ //public String getTitle();
+ //public String getErrorMessage();
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+
+ //initialize the panel
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ //show icon
+ JLabel iconLabel = new JLabel(CMSAdminUtil.getImage(CMSAdminResources.IMAGE_CERTICON_LARGE));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gb.setConstraints(iconLabel,gbc);
+ add(iconLabel);
+
+ //show wizard description
+ JTextArea desc = new JTextArea(
+ CMSAdminUtil.wrapText(
+ mResource.getString("WMNSELECTION_TEXT_DESC_LABEL"),60),2,60);
+ desc.setBackground(getBackground());
+ desc.setEditable(false);
+ desc.setCaretColor(getBackground());
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.1;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+
+ //current setting
+ JPanel oldPanel = new JPanel();
+ oldPanel.setBorder(makeTitledBorder("OLDSCHEME"));
+ GridBagLayout gb1 = new GridBagLayout();
+ oldPanel.setLayout(gb1);
+
+ //m
+ JLabel label1 = makeJLabel("M");
+ mMLabel = new JLabel("");
+ CMSAdminUtil.resetGBC(gbc);
+ CMSAdminUtil.addEntryField(oldPanel, label1, mMLabel, gbc);
+
+ //n
+ JLabel label3 = makeJLabel("N");
+ mNLabel = new JLabel("");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.gridheight = gbc.REMAINDER;
+ CMSAdminUtil.addEntryField(oldPanel, label3, mNLabel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gb.setConstraints(oldPanel,gbc);
+ add(oldPanel);
+
+ //new setting
+ JPanel newPanel = new JPanel();
+ newPanel.setBorder(makeTitledBorder("NEWSCHEME"));
+ GridBagLayout gb2 = new GridBagLayout();
+ newPanel.setLayout(gb2);
+
+ //m
+ JLabel label5 = makeJLabel("M");
+ mMField = new JTextField("");
+ CMSAdminUtil.resetGBC(gbc);
+ CMSAdminUtil.addEntryField(newPanel, label5, mMField, gbc);
+
+ //n
+ JLabel label6 = makeJLabel("N");
+ mNField = new JTextField("");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.gridheight = gbc.REMAINDER;
+ CMSAdminUtil.addEntryField(newPanel, label6, mNField, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ //gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.9;
+ gb.setConstraints(newPanel,gbc);
+ add(newPanel);
+
+ super.init();
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/WMessageDigestPage.java b/base/console/src/com/netscape/admin/certsrv/config/WMessageDigestPage.java
new file mode 100644
index 000000000..ce0ced102
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/WMessageDigestPage.java
@@ -0,0 +1,240 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.text.*;
+import javax.swing.border.*;
+import javax.swing.event.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Setup the message digest information for the installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+public class WMessageDigestPage extends WizardBasePanel implements IWizardPanel {
+ protected JComboBox mRSAHashTypeBox, mDSAHashTypeBox, mECCHashTypeBox;
+ protected JComboBox mRSASignedByTypeBox, mDSASignedByTypeBox, mECCSignedByTypeBox;
+ protected String mHelpIndex;
+ protected String mCAKeyType;
+ protected JTextArea mSignedByTypeLbl;
+ private static final String HELPINDEX = "install-cert-mda-wizard-help";
+
+ public WMessageDigestPage(String panelName) {
+ super(panelName);
+ mPanelName = panelName;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ setBorder(makeTitledBorder(mPanelName));
+
+ if (mCAKeyType.equals("RSA")) {
+ mECCHashTypeBox.setVisible(false);
+ mDSAHashTypeBox.setVisible(false);
+ mRSAHashTypeBox.setVisible(true);
+ String sha1 = mResource.getString(mPanelName+"_COMBOBOX_RSAHASHTYPE_VALUE_2");
+ mRSAHashTypeBox.setSelectedItem(sha1);
+ } else if (mCAKeyType.equals("ECC")) {
+ mECCHashTypeBox.setVisible(true);
+ mDSAHashTypeBox.setVisible(false);
+ mRSAHashTypeBox.setVisible(false);
+ } else {
+ mECCHashTypeBox.setVisible(false);
+ mDSAHashTypeBox.setVisible(true);
+ mRSAHashTypeBox.setVisible(false);
+ }
+
+ mHelpIndex = HELPINDEX;
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public void enableSignedByFields(boolean enable) {
+ if (!enable) {
+ mRSASignedByTypeBox.setVisible(false);
+ mDSASignedByTypeBox.setVisible(false);
+ mECCSignedByTypeBox.setVisible(false);
+ mSignedByTypeLbl.setVisible(false);
+ return;
+ }
+
+ if (mCAKeyType.equals("RSA")) {
+ mRSASignedByTypeBox.setVisible(true);
+ mDSASignedByTypeBox.setVisible(false);
+ mECCSignedByTypeBox.setVisible(false);
+ } else if (mCAKeyType.equals("ECC")) {
+ mRSASignedByTypeBox.setVisible(false);
+ mDSASignedByTypeBox.setVisible(false);
+ mECCSignedByTypeBox.setVisible(true);
+ } else {
+ mECCSignedByTypeBox.setVisible(false);
+ mDSASignedByTypeBox.setVisible(true);
+ mRSASignedByTypeBox.setVisible(false);
+ }
+
+ mSignedByTypeLbl.setVisible(true);
+ }
+
+
+ public boolean concludePanel(WizardInfo info) {
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(mHelpIndex);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ JTextArea hashTypeLbl = createTextArea(mResource.getString(
+ mPanelName+"_TEXT_HASHTYPE_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(hashTypeLbl, gbc);
+
+ mRSAHashTypeBox = makeJComboBox("RSAHASHTYPE");
+ mRSAHashTypeBox.setVisible(true);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(0, 4*COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mRSAHashTypeBox, gbc);
+
+ mDSAHashTypeBox = makeJComboBox("DSAHASHTYPE");
+ mDSAHashTypeBox.setVisible(false);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mDSAHashTypeBox, gbc);
+
+ mECCHashTypeBox = makeJComboBox("ECCHASHTYPE");
+ mECCHashTypeBox.setVisible(false);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mECCHashTypeBox, gbc);
+
+ JLabel dummy = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0, 0,COMPONENT_SPACE, COMPONENT_SPACE);
+ add(dummy, gbc);
+
+ JLabel dummy2 = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0, 0,COMPONENT_SPACE, COMPONENT_SPACE);
+ add(dummy2, gbc);
+
+ mSignedByTypeLbl = createTextArea(mResource.getString(
+ mPanelName+"_TEXT_SIGNEDBYTYPE_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mSignedByTypeLbl, gbc);
+
+ mRSASignedByTypeBox = makeJComboBox("RSASIGNEDBYTYPE");
+ mRSASignedByTypeBox.setVisible(true);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(0, 4*COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mRSASignedByTypeBox, gbc);
+
+ mDSASignedByTypeBox = makeJComboBox("DSASIGNEDBYTYPE");
+ mDSASignedByTypeBox.setVisible(false);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mDSASignedByTypeBox, gbc);
+
+ mECCSignedByTypeBox = makeJComboBox("ECCSIGNEDBYTYPE");
+ mECCSignedByTypeBox.setVisible(false);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mECCSignedByTypeBox, gbc);
+
+ JLabel dummy1 = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.CENTER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(0, 0,COMPONENT_SPACE, COMPONENT_SPACE);
+ add(dummy1, gbc);
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/WarningDialog.java b/base/console/src/com/netscape/admin/certsrv/config/WarningDialog.java
new file mode 100644
index 000000000..bedf0b67f
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/WarningDialog.java
@@ -0,0 +1,171 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import javax.swing.table.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Certificate Information dialog
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.managecert
+ */
+public class WarningDialog extends JDialog
+ implements ActionListener {
+ private String PREFIX = "WARNINGDIALOG";
+
+ private JFrame mParent;
+ private ResourceBundle mResource;
+ private JTextArea mTextArea;
+ private JLabel mCertNameField;
+ private JButton mClose, mHelp, mTrust;
+ private AdminConnection mConn;
+ private String mCertName;
+ private String mCertDate;
+ private String mKey;
+
+ public WarningDialog(JFrame parent, String key) {
+ super(parent,true);
+ mParent = parent;
+ mKey = key;
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ setSize(500, 300);
+ setResizable(false);
+ setTitle(mResource.getString(PREFIX+"_TITLE"));
+ setLocationRelativeTo(parent);
+ getRootPane().setDoubleBuffered(true);
+ setDisplay();
+ }
+
+ public void actionPerformed(ActionEvent evt) {
+ if (evt.getSource().equals(mClose)) {
+ this.hide();
+ this.dispose();
+ }
+ }
+
+ private void setDisplay() {
+ getContentPane().setLayout(new BorderLayout());
+ JPanel center = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ center.setLayout(gb);
+
+ //content panel
+ JPanel content = makeContentPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.fill=gbc.BOTH;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE, CMSAdminUtil.COMPONENT_SPACE);
+ gb.setConstraints(content, gbc);
+ center.add(content);
+
+ //action panel
+ JPanel action = makeActionPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints(action, gbc);
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE, CMSAdminUtil.COMPONENT_SPACE);
+ center.add(action);
+
+ getContentPane().add("Center",center);
+
+ this.show();
+ }
+
+ private JPanel makeActionPane() {
+ mClose = CMSAdminUtil.makeJButton(mResource, PREFIX, "CLOSE",
+ null, this);
+
+ Dimension d = mClose.getMinimumSize();
+ if (d.width < CMSAdminUtil.DEFAULT_BUTTON_SIZE) {
+ d.width = CMSAdminUtil.DEFAULT_BUTTON_SIZE;
+ mClose.setMinimumSize(d);
+ }
+ JButton[] buttons = {mClose};
+ return CMSAdminUtil.makeJButtonPanel( buttons );
+ }
+
+ private JPanel makeContentPane() {
+ JPanel content = new JPanel();
+ GridBagLayout gb3 = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ content.setLayout(gb3);
+/*
+ content.setBorder(CMSAdminUtil.makeTitledBorder(mResource,
+ "CERTINFODIALOG", "CERT"));
+*/
+
+ CMSAdminUtil.resetGBC(gbc);
+ Icon icon = CMSAdminUtil.getImage(CMSAdminResources.IMAGE_WARN_ICON);
+ JLabel label = new JLabel(icon);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,CMSAdminUtil.COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ content.add(label, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JTextArea desc = new JTextArea(
+ CMSAdminUtil.wrapText(mResource.getString(PREFIX+mKey),65),10,65);
+ desc.setBackground(getBackground());
+ desc.setEditable(false);
+ desc.setCaretColor(getBackground());
+ JScrollPane scrollPane = new JScrollPane(desc,
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.fill= gbc.BOTH;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE, CMSAdminUtil.COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ content.add(scrollPane, gbc);
+
+ return content;
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/ComponentCellRenderer.java b/base/console/src/com/netscape/admin/certsrv/config/install/ComponentCellRenderer.java
new file mode 100644
index 000000000..f6dcff392
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/ComponentCellRenderer.java
@@ -0,0 +1,32 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.text.*;
+import javax.swing.table.*;
+
+class ComponentCellRenderer implements TableCellRenderer {
+ public Component getTableCellRendererComponent(JTable table,
+ Object value, boolean isSelected, boolean hasFocus, int row,
+ int column) {
+ return (JComponent)value;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/InstallWizard.java b/base/console/src/com/netscape/admin/certsrv/config/install/InstallWizard.java
new file mode 100644
index 000000000..557dc2739
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/InstallWizard.java
@@ -0,0 +1,202 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.util.*;
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.wizard.*;
+
+/**
+ * Wizard for Installation wizard
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+
+public class InstallWizard extends WizardWidget implements Runnable {
+
+ public InstallWizard(JFrame parent, InstallWizardInfo info,
+ IWizardDone wizDone) {
+ super(parent, wizDone);
+ setWizardInfo(info);
+ //addPage(new WIInstallCACertStatusPage());
+ addPage(new WIIntroPage(this, parent));
+ addPage(new WIMasterOrClone(this, parent));
+ addPage(new WIClonePage(this, parent));
+ addPage(new WILogonAllTokensPage(this, parent));
+ addPage(new WIInternalTokenLogonPage(this, parent));
+ addPage(new WIRecreateDBPage(this, parent));
+ addPage(new WIInternalDBPage(this, parent));
+ addPage(new WIExistingDBPage(this, parent));
+ addPage(new WICreateInternalDBPage(this, parent));
+ addPage(new WIInternalDBInfoPage(this, parent));
+ addPage(new WIReplAgreementPage(this, parent));
+ addPage(new WIAdminPage(this, parent));
+ addPage(new WIServicesPage(this, parent));
+ addPage(new WIInternalDBInfoPage(this, parent));
+/*
+ addPage(new WIRemoteCASubsystem(this, parent));
+ addPage(new WIRemoteKRASubsystem(this, parent));
+*/
+
+ // CA starting serial number
+ addPage(new WICASerialNumberPage(this,parent));
+ addPage(new WICAOCSPServicePage(this,parent));
+/*
+ addPage(new WINetworkPage(this, parent));
+*/
+
+ // CA signing certificate
+ addPage(new WIInternalDBInfoPage(this, parent));
+ addPage(new WICloneCAKeyCertPage(this, parent));
+
+ addPage(new WICACertSubmitPage(this, parent));
+ addPage(new WICAKeyPage(this, parent));
+ addPage(new WICAMessageDigestPage(this, parent));
+ addPage(new WICACertDNPage(this, parent));
+ addPage(new WICACertValidityPage(this, parent));
+ addPage(new WICACertExtensionPage(this, parent));
+ addPage(new WIGenCAKeyCertPage(this, parent));
+ addPage(new WIGenCAKeyCertReqPage(this, parent));
+ addPage(new WIManualCACertRequestPage(this, parent));
+ addPage(new WICARequestResultPage(this,parent));
+ addPage(new WIInstallCAIntroPage(this, parent));
+ addPage(new WICATokenLogonPage(this, parent));
+ addPage(new WIPasteCACertPage(this, parent));
+ addPage(new WIDisplayCACertPage(this, parent));
+ addPage(new WIInstallCACertStatusPage(this, parent));
+
+ // OCSP signing certificate
+ addPage(new WIInternalDBInfoPage(this, parent));
+ addPage(new WICloneOCSPKeyCertPage(this, parent));
+ addPage(new WIOCSPCertSubmitPage(this, parent));
+ addPage(new WIOCSPKeyPage(this, parent));
+ addPage(new WIOCSPMessageDigestPage(this, parent));
+ addPage(new WIOCSPCertDNPage(this, parent));
+ addPage(new WIGenOCSPKeyCertReqPage(this, parent));
+ addPage(new WIManualOCSPCertRequestPage(this, parent));
+ addPage(new WIOCSPRequestResultPage(this,parent));
+ addPage(new WIInstallOCSPIntroPage(this, parent));
+ addPage(new WIOCSPTokenLogonPage(this, parent));
+ addPage(new WIPasteOCSPCertPage(this, parent));
+ addPage(new WIDisplayOCSPCertPage(this, parent));
+ addPage(new WIInstallOCSPCertStatusPage(this, parent));
+
+ // RA signing certificate
+ addPage(new WIInternalDBInfoPage(this, parent));
+ addPage(new WICloneRAKeyCertPage(this, parent));
+ addPage(new WIRACertSubmitPage(this, parent));
+ addPage(new WIRAKeyPage(this, parent));
+ addPage(new WIRAMessageDigestPage(this, parent));
+ addPage(new WIRACertDNPage(this, parent));
+ addPage(new WIRACertValidityPage(this, parent));
+ addPage(new WIRACertExtensionPage(this, parent));
+ addPage(new WIGenRAKeyCertPage(this, parent));
+ addPage(new WIGenRAKeyCertReqPage(this, parent));
+ addPage(new WIManualRACertRequestPage(this, parent));
+ addPage(new WIRARequestResultPage(this,parent));
+ addPage(new WIInstallRAIntroPage(this, parent));
+ addPage(new WIRATokenLogonPage(this, parent));
+ addPage(new WIPasteRACertPage(this, parent));
+ addPage(new WIDisplayRACertPage(this, parent));
+ addPage(new WIInstallRACertStatusPage(this, parent));
+
+ // KRA transport certificate
+ addPage(new WIInternalDBInfoPage(this, parent));
+ addPage(new WIKRANumberPage(this, parent));
+ addPage(new WICloneKRAKeyCertPage(this, parent));
+ addPage(new WIKRACertSubmitPage(this, parent));
+ addPage(new WIKRAKeyPage(this, parent));
+ addPage(new WIKRAMessageDigestPage(this, parent));
+ addPage(new WIKRACertDNPage(this, parent));
+ addPage(new WIKRACertValidityPage(this, parent));
+ addPage(new WIKRACertExtensionPage(this, parent));
+ addPage(new WIGenKRAKeyCertPage(this, parent));
+ addPage(new WIGenKRAKeyCertReqPage(this, parent));
+ addPage(new WIManualKRACertRequestPage(this, parent));
+ addPage(new WIKRARequestResultPage(this,parent));
+ addPage(new WIInstallKRAIntroPage(this, parent));
+ addPage(new WIKRATokenLogonPage(this, parent));
+ addPage(new WIInternalTokenLogonPage(this, parent));
+ addPage(new WIPasteKRACertPage(this, parent));
+ addPage(new WIDisplayKRACertPage(this, parent));
+ addPage(new WIInstallKRACertStatusPage(this, parent));
+ addPage(new WIKRAStorageKeyPage(this, parent));
+
+ addPage(new WIKRAScheme1Page(this, parent));
+ addPage(new WIKRAScheme2Page(this, parent));
+
+ // SSL server certificate
+ addPage(new WIInternalDBInfoPage(this, parent));
+ addPage(new WICloneTKSKeyCertPage(this, parent));
+ addPage(new WIKRACertSubmitPage(this, parent));
+ addPage(new WIServerCertSubmitPage(this, parent));
+ addPage(new WIServerKeyPage(this, parent));
+ addPage(new WISSLMessageDigestPage(this, parent));
+ addPage(new WIServerCertDNPage(this, parent));
+ addPage(new WIServerCertValidityPage(this, parent));
+ addPage(new WIServerCertExtensionPage(this, parent));
+ addPage(new WIGenServerKeyCertPage(this, parent));
+ addPage(new WIGenSSLKeyCertReqPage(this, parent));
+ addPage(new WIManualSSLCertRequestPage(this, parent));
+ addPage(new WISSLRequestResultPage(this,parent));
+ addPage(new WIInstallSSLIntroPage(this, parent));
+ addPage(new WISSLTokenLogonPage(this, parent));
+ addPage(new WIPasteSSLCertPage(this, parent));
+ addPage(new WIDisplaySSLCertPage(this, parent));
+ addPage(new WIInstallSSLCertStatusPage(this, parent));
+
+ addPage(new WIAllCertsInstalledPage(this, parent));
+ addPage(new WISingleSignonPage(this, parent));
+ addPage(new WICertSetupStatusPage(this, parent));
+
+ show();
+ }
+
+ protected void callHelp() {
+ if (mCurrent instanceof IWizardPanel) {
+ ((IWizardPanel)mCurrent).callHelp();
+ }
+ }
+
+ protected void back_cb(WizardInfo info) {
+ if (mCurrent instanceof WIManualCertRequestPage) {
+ ((WIManualCertRequestPage)mCurrent).back_cb(info);
+ }
+ }
+
+ public void run() {
+ show();
+ }
+
+ public static void main(String[] args) {
+ JFrame.setDefaultLookAndFeelDecorated(true);
+ JFrame frame = new JFrame();
+ Cursor cursor = new Cursor(Cursor.HAND_CURSOR);
+ frame.setCursor(cursor);
+ frame.invalidate();
+ frame.validate();
+ frame.repaint(1);
+ InstallWizardInfo wizardInfo = new InstallWizardInfo();
+ InstallWizard wizard = new InstallWizard(frame, wizardInfo, null);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/InstallWizardInfo.java b/base/console/src/com/netscape/admin/certsrv/config/install/InstallWizardInfo.java
new file mode 100644
index 000000000..a88101cc4
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/InstallWizardInfo.java
@@ -0,0 +1,1724 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.console.*;
+
+/**
+ * WizardInfo for certificate setup wizard
+ * Once complete, we need to zap this object.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+public class InstallWizardInfo extends WizardInfo {
+ private static final int DB_PORT = 38900;
+ private static final String BINDDN = "cn=Directory Manager";
+ public static final String ALL_CERT_INFO = "allInfo";
+ private static final String CA_KEY_TYPE = "caKeyType";
+ private static final String CA_KEY_LEN = "caKeyLen";
+ private static final String OCSP_TOKEN_NAME = "ocspTokenName";
+ private static final String OCSP_TOKEN_PASSWD = "ocspTokenPwd";
+ private static final String CA_TOKEN_NAME = "caTokenName";
+ private static final String CA_TOKEN_PASSWD = "caTokenPwd";
+ private static final String RA_TOKEN_NAME = "raTokenName";
+ private static final String RA_TOKEN_PASSWD = "raTokenPwd";
+ private static final String KRA_TOKEN_NAME = "kraTokenName";
+ private static final String KRA_TOKEN_PASSWD = "kraTokenPwd";
+ private static final String SSL_TOKEN_NAME = "sslTokenName";
+ private static final String SSL_TOKEN_PASSWD = "sslTokenPwd";
+ private static final String MIGRATE_CA_TOKEN_NAME = "migrateCATokenName";
+ private static final String MIGRATE_SSL_TOKEN_NAME = "migrateSSLTokenName";
+ private static final String INSTALLCERT_NOW = "installCertNow";
+ private static final String CLONING = "cloning";
+ private static final String CACLONING = "cacloning";
+ private static final String RACLONING = "racloning";
+ private static final String KRACLONING = "kracloning";
+ private static final String SSLCLONING = "sslcloning";
+
+ private static final String CA_CLONING_CERT = "caSigningCert";
+ private static final String RA_CLONING_CERT = "raSigningCert";
+ private static final String KRA_CLONING_CERT = "kraTransportCert";
+ private static final String OCSP_CLONING_CERT = "ocspSigningCert";
+
+ private String mPassword = null;
+
+ private ConsoleInfo mConsoleInfo;
+
+ public InstallWizardInfo() {
+ super();
+ }
+
+ public InstallWizardInfo(ConsoleInfo consoleInfo) {
+ super();
+ mConsoleInfo = consoleInfo;
+ }
+
+ public JFrame getAdminFrame() {
+ return (JFrame)get("adminFrame");
+ }
+
+ public boolean doKeySplitting() {
+ String str = (String)get("kra.keySplitting");
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ else
+ return false;
+
+ }
+
+ public void setAdminFrame(JFrame frame) {
+ put("adminFrame", frame);
+ }
+
+ public ConsoleInfo getAdminConsoleInfo() {
+ return mConsoleInfo;
+ }
+
+ public String getStages() {
+ return (String)get(ConfigConstants.STAGES);
+ }
+
+ public String getCloneCertsList() {
+ String s = (String)get(ConfigConstants.PR_CLONE_CERTIFICATES);
+ if (s == null || s.equals(""))
+ return " ";
+ return s;
+ }
+
+ public String getCloneSubsystem() {
+
+ String s = (String)get("selected_sub");
+
+ if(s == null || s.equals(""))
+ return null;
+
+ return s;
+
+ }
+
+ public boolean isCACloningDone() {
+ String str = (String)get(ConfigConstants.STAGE_CACLONING);
+
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ else
+ return false;
+ }
+
+ public void setCACloningDone(String str) {
+ put(ConfigConstants.STAGE_CACLONING, str);
+ }
+
+ public boolean isOCSPCloningDone() {
+ String str = (String)get(ConfigConstants.STAGE_OCSPCLONING);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+
+ return false;
+ }
+
+ public void setOCSPCloningDone(String str) {
+ put(ConfigConstants.STAGE_OCSPCLONING, str);
+ }
+
+ public boolean isRACloningDone() {
+ String str = (String)get(ConfigConstants.STAGE_RACLONING);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+
+ return false;
+ }
+
+ public void setRACloningDone(String str) {
+ put(ConfigConstants.STAGE_RACLONING, str);
+ }
+
+ public boolean isKRACloningDone() {
+ String str = (String)get(ConfigConstants.STAGE_KRACLONING);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+
+ return false;
+ }
+
+ public boolean isTKSCloningDone() {
+ String str = (String)get(ConfigConstants.STAGE_TKSCLONING);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+
+ return false;
+ }
+
+ public void setUpdateDBInfoDone(String str) {
+ put(ConfigConstants.STAGE_UPDATE_DB_INFO, str);
+ }
+
+ public boolean isUpdateDBInfoDone() {
+ String str = (String)get(ConfigConstants.STAGE_UPDATE_DB_INFO);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public void setKRACloningDone(String str) {
+ put(ConfigConstants.STAGE_KRACLONING, str);
+ }
+
+ public boolean isSSLCloningDone() {
+ String str = (String)get(ConfigConstants.STAGE_SSLCLONING);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public void setSSLCloningDone(String str) {
+ put(ConfigConstants.STAGE_SSLCLONING, str);
+ }
+
+ public boolean isCloneCASubsystem() {
+ String str = (String)get(ConfigConstants.PR_CLONE_SUBSYSTEM);
+ if (str != null && str.equals(ConfigConstants.PR_CA))
+ return true;
+ return false;
+ }
+
+ public boolean isCloneRASubsystem() {
+ String str = (String)get(ConfigConstants.PR_CLONE_SUBSYSTEM);
+ if (str != null && str.equals(ConfigConstants.PR_RA))
+ return true;
+ return false;
+ }
+ public boolean isCloneKRASubsystem() {
+ String str = (String)get(ConfigConstants.PR_CLONE_SUBSYSTEM);
+ if (str != null && str.equals(ConfigConstants.PR_KRA))
+ return true;
+ return false;
+ }
+ public boolean isCloneOCSPSubsystem() {
+ String str = (String)get(ConfigConstants.PR_CLONE_SUBSYSTEM);
+ if (str != null && str.equals(ConfigConstants.PR_OCSP))
+ return true;
+ return false;
+ }
+ public boolean isCloneTKSSubsystem() {
+ String str = (String)get(ConfigConstants.PR_CLONE_SUBSYSTEM);
+ if (str != null && str.equals(ConfigConstants.PR_TKS))
+ return true;
+ return false;
+ }
+ public boolean isCloneMasterDone() {
+ String str = (String)get(ConfigConstants.STAGE_CLONEMASTER);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public void setCloneMasterDone(String str) {
+ put(ConfigConstants.STAGE_CLONEMASTER, str);
+ }
+
+ public boolean isNetworkDone() {
+ String str = (String)get(ConfigConstants.STAGE_SETUP_PORTS);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public boolean isAdministratorDone() {
+ String str = (String)get(ConfigConstants.STAGE_SETUP_ADMINISTRATOR);
+ if (str == null || str.equals("") || str.equals(ConfigConstants.FALSE))
+ return false;
+
+ return true;
+ }
+
+ public boolean isServicesDone() {
+ String str = (String)get(ConfigConstants.STAGE_SETUP_SUBSYSTEMS);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public boolean isMigrationDone() {
+ String str = (String)get(ConfigConstants.STAGE_DATA_MIGRATION);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public boolean isKRANMSchemeDone() {
+ String str = (String)get(ConfigConstants.STAGE_KRA_NM_SCHEME);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public boolean isCACertRequestBack() {
+ String str = (String)get(ConfigConstants.CA_CERT_REQUEST_BACK);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public boolean isRACertRequestBack() {
+ String str = (String)get(ConfigConstants.RA_CERT_REQUEST_BACK);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public boolean isOCSPCertRequestBack() {
+ String str = (String)get(ConfigConstants.OCSP_CERT_REQUEST_BACK);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public boolean isKRACertRequestBack() {
+ String str = (String)get(ConfigConstants.KRA_CERT_REQUEST_BACK);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public boolean isSSLCertRequestBack() {
+ String str = (String)get(ConfigConstants.SSL_CERT_REQUEST_BACK);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public boolean isSelfSignedCACertDone() {
+ String str = (String)get(ConfigConstants.STAGE_CA_SELFSIGNED_CERT);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public boolean isCACertRequestDone() {
+ String str = (String)get(ConfigConstants.STAGE_CA_CERT_REQUEST);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public boolean isCACertInstalledDone() {
+ String str = (String)get(ConfigConstants.STAGE_CA_CERT_INSTALL);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public boolean isCACertChainImportDone() {
+ String str = (String)get(ConfigConstants.STAGE_CA_CERTCHAIN_IMPORT);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+ public boolean isNumberPageDone(){
+ String str = (String)get(ConfigConstants.PR_SERIAL_REQUEST_NUMBER);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+ public void setNumberPageDone(String str) {
+ put(ConfigConstants.PR_SERIAL_REQUEST_NUMBER, str);
+ }
+ public boolean isClonePageDone(){
+ String str = (String)get(ConfigConstants.PR_CLONE_SETTING_DONE);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+ public void setClonePageDone(String str) {
+ put(ConfigConstants.PR_CLONE_SETTING_DONE, str);
+ }
+ public boolean isOCSPCertChainImportDone() {
+ String str = (String)get(ConfigConstants.STAGE_OCSP_CERTCHAIN_IMPORT);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public boolean isRALocalCertDone() {
+ String str = (String)get(ConfigConstants.STAGE_RA_LOCAL_CERT);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public boolean isRACertRequestDone() {
+ String str = (String)get(ConfigConstants.STAGE_RA_CERT_REQUEST);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public boolean isOCSPLocalCertDone() {
+ String str = (String)get(ConfigConstants.STAGE_OCSP_LOCAL_CERT);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public boolean isOCSPCertRequestDone() {
+ String str = (String)get(ConfigConstants.STAGE_OCSP_CERT_REQUEST);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public boolean isOCSPCertInstalledDone() {
+ String str = (String)get(ConfigConstants.STAGE_OCSP_CERT_INSTALL);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public boolean isRACertInstalledDone() {
+ String str = (String)get(ConfigConstants.STAGE_RA_CERT_INSTALL);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public boolean isRACertChainImportDone() {
+ String str = (String)get(ConfigConstants.STAGE_RA_CERTCHAIN_IMPORT);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public boolean isKRALocalCertDone() {
+ String str = (String)get(ConfigConstants.STAGE_KRA_LOCAL_CERT);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public boolean isKRACertRequestDone() {
+ String str = (String)get(ConfigConstants.STAGE_KRA_CERT_REQUEST);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public boolean isKRACertInstalledDone() {
+ String str = (String)get(ConfigConstants.STAGE_KRA_CERT_INSTALL);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public boolean isKRACertChainImportDone() {
+ String str = (String)get(ConfigConstants.STAGE_KRA_CERTCHAIN_IMPORT);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+ public boolean isSSLLocalCertDone() {
+ String str = (String)get(ConfigConstants.STAGE_SSL_LOCAL_CERT);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public boolean isSSLCertRequestDone() {
+ String str = (String)get(ConfigConstants.STAGE_SSL_CERT_REQUEST);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public boolean isSSLCertInstalledDone() {
+ String str = (String)get(ConfigConstants.STAGE_SSL_CERT_INSTALL);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public boolean isSSLCertChainImportDone() {
+ String str = (String)get(ConfigConstants.STAGE_SSL_CERTCHAIN_IMPORT);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+ public String getNextAvailPort() {
+ return (String)get(ConfigConstants.PR_NEXT_AVAIL_PORT);
+ }
+
+ public void setSubsystems(String str) {
+ put(ConfigConstants.PR_SUBSYSTEMS, str);
+ }
+
+ public String getSubsystems() {
+ return (String)get(ConfigConstants.PR_SUBSYSTEMS);
+ }
+
+ public void setReplicationEnabled(String str) {
+ put(ConfigConstants.PR_ENABLE_REPLICATION, str);
+ }
+
+ public boolean isReplicationEnabled() {
+ String str = (String)get(ConfigConstants.PR_ENABLE_REPLICATION);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public void setAgreementDone(String str) {
+ put(ConfigConstants.STAGE_REPLICATION_AGREEMENT, str);
+ }
+
+ public boolean isAgreementDone() {
+ String str = (String)get(ConfigConstants.STAGE_REPLICATION_AGREEMENT);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ else
+ return false;
+ }
+
+ public void setDBCreated(String str) {
+ put(ConfigConstants.PR_IS_DBCREATED, str);
+ }
+
+ public void setCloneDBCreated(String str) {
+ put(ConfigConstants.PR_IS_CLONEDDB_CREATED, str);
+ }
+
+ public boolean isDBCreated() {
+ String str = (String)get(ConfigConstants.PR_IS_DBCREATED);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public boolean isCloneDBCreated() {
+ String str = (String)get(ConfigConstants.PR_IS_CLONEDDB_CREATED);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public void setDBCreateNow(String str) {
+ put("dbCreateNow", str);
+ }
+
+ public boolean isDBCreateNow() {
+ String str = (String)get("dbCreateNow");
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public String getSingleSignOnPassword() {
+ return mPassword;
+ }
+
+ public void setSingleSignOnPassword(String password) {
+ mPassword = password;
+ }
+
+ public void setCertAdminUid(String uid) {
+ put(ConfigConstants.PR_CERT_ADMINUID, uid);
+ }
+
+ public String getCertAdminUid() {
+ return (String)get(ConfigConstants.PR_CERT_ADMINUID);
+ }
+
+ public void setCertAdminName(String name) {
+ put(ConfigConstants.PR_CERT_ADMINNAME, name);
+ }
+
+ public String getCertAdminName() {
+ return (String)get(ConfigConstants.PR_CERT_ADMINNAME);
+ }
+
+ public void setDBPort(String val) {
+ put(ConfigConstants.PR_DB_PORT, val);
+ }
+
+ public int getDBPort() {
+ String val = (String)get(ConfigConstants.PR_DB_PORT);
+ if (val != null)
+ return Integer.parseInt(val);
+ return 38900;
+ }
+
+ public void setDBName(String name) {
+ put(ConfigConstants.PR_DB_NAME, name);
+ }
+
+ public String getDBName() {
+ String dbName = (String)get(ConfigConstants.PR_DB_NAME);
+ if (dbName == null)
+ dbName = "";
+ return dbName;
+ }
+
+ public void setCloneDBName(String name) {
+ put(ConfigConstants.PR_CLONEDDB_NAME, name);
+ }
+
+ public String getCloneDBName() {
+ String dbName = (String)get(ConfigConstants.PR_CLONEDDB_NAME);
+ if (dbName == null)
+ dbName = "";
+ return dbName;
+ }
+
+ public void setDBBindDN(String val) {
+ put(ConfigConstants.PR_DB_BINDDN, val);
+ }
+
+ public String getDBBindDN() {
+ String dn = (String)get(ConfigConstants.PR_DB_BINDDN);
+ if (dn == null)
+ dn = BINDDN;
+ return dn;
+ }
+
+ public String getAdminPort() {
+ String val = (String)get(ConfigConstants.PR_RADM_PORT);
+ if (val == null)
+ val = "8200";
+ return val;
+ }
+
+ public void setAdminPort(String val) {
+ put(ConfigConstants.PR_RADM_PORT, val);
+ }
+
+ public String getEEPort() {
+ String val = (String)get(ConfigConstants.PR_EE_PORT);
+ if (val == null || val.equals(""))
+ val = "81";
+ return val;
+ }
+
+ public void setEEPort(String port) {
+ put(ConfigConstants.PR_EE_PORT, port);
+ }
+
+ public String getEESecurePort() {
+ String val = (String)get(ConfigConstants.PR_EE_SECURE_PORT);
+ if (val == null)
+ val = "8001";
+ return val;
+ }
+
+ public void setEESecurePort(String port) {
+ put(ConfigConstants.PR_EE_SECURE_PORT, port);
+ }
+
+ public String getAgentPort() {
+ String val = (String)get(ConfigConstants.PR_AGENT_PORT);
+ if (val == null)
+ val = "8100";
+ return val;
+ }
+
+ public void setAgentPort(String val) {
+ put(ConfigConstants.PR_AGENT_PORT, val);
+ }
+
+ public boolean isEEEnabled() {
+ String val = (String)get(ConfigConstants.PR_EE_PORT_ENABLE);
+ if (val != null && val.equals(Constants.TRUE))
+ return true;
+ return false;
+ }
+
+ public void setEEEnable(String enable) {
+ put(ConfigConstants.PR_EE_PORT_ENABLE, enable);
+ }
+
+ public String getCertType() {
+ return (String)get(Constants.PR_CERTIFICATE_TYPE);
+ }
+
+ public void setCertType(String str) {
+ put(Constants.PR_CERTIFICATE_TYPE, str);
+ }
+
+ public String getReqFormat(String certType) {
+ return (String)get(certType+ConfigConstants.PR_REQUEST_FORMAT);
+ }
+
+ public void setReqFormat(String certType, String str) {
+ put(certType+ConfigConstants.PR_REQUEST_FORMAT , str);
+ }
+
+ public boolean isNewRequest() {
+ String val = (String)get(getCertType()+"new");
+ if (val != null && val.equals(Constants.TRUE))
+ return true;
+ return false;
+ }
+
+ public void setNewRequest() {
+ put(getCertType()+"new", Constants.TRUE);
+ }
+
+ public boolean isCAReqResultDisplayed() {
+ String val = (String)get(ConfigConstants.CA_REQUEST_DISPLAYED);
+ if (val != null && val.equals(Constants.TRUE))
+ return true;
+ return false;
+ }
+
+ public void setCAReqResultDisplayed(String val) {
+ put(ConfigConstants.CA_REQUEST_DISPLAYED, val);
+ }
+
+ public boolean isRAReqResultDisplayed() {
+ String val = (String)get(ConfigConstants.RA_REQUEST_DISPLAYED);
+ if (val != null && val.equals(Constants.TRUE))
+ return true;
+ return false;
+ }
+
+ public void setRAReqResultDisplayed(String val) {
+ put(ConfigConstants.RA_REQUEST_DISPLAYED, val);
+ }
+
+ public boolean isOCSPReqResultDisplayed() {
+ String val = (String)get(ConfigConstants.OCSP_REQUEST_DISPLAYED);
+ if (val != null && val.equals(Constants.TRUE))
+ return true;
+ return false;
+ }
+
+ public void setOCSPReqResultDisplayed(String val) {
+ put(ConfigConstants.OCSP_REQUEST_DISPLAYED, val);
+ }
+
+ public boolean isKRAReqResultDisplayed() {
+ String val = (String)get(ConfigConstants.KRA_REQUEST_DISPLAYED);
+ if (val != null && val.equals(Constants.TRUE))
+ return true;
+ return false;
+ }
+
+ public void setKRAReqResultDisplayed(String val) {
+ put(ConfigConstants.KRA_REQUEST_DISPLAYED, val);
+ }
+
+ public boolean isSSLReqResultDisplayed() {
+ String val = (String)get(ConfigConstants.SSL_REQUEST_DISPLAYED);
+ if (val != null && val.equals(Constants.TRUE))
+ return true;
+ return false;
+ }
+
+ public void setSSLReqResultDisplayed(String val) {
+ put(ConfigConstants.SSL_REQUEST_DISPLAYED, val);
+ }
+
+ public String getCertRequest() {
+ return (String)get(Constants.PR_CERT_REQUEST);
+ }
+
+ public void setCertRequest(String certReq) {
+ put(Constants.PR_CERT_REQUEST, certReq);
+ }
+
+ public String getCAKeyLength() {
+ return (String)get(CA_KEY_LEN);
+ }
+
+ public String getCATokenName() {
+ return (String)get(CA_TOKEN_NAME);
+ }
+
+ public void setCATokenName(String tokenname) {
+ put(CA_TOKEN_NAME, tokenname);
+ }
+
+ public String getOCSPTokenName() {
+ return (String)get(OCSP_TOKEN_NAME);
+ }
+
+ public void setOCSPTokenName(String tokenname) {
+ put(OCSP_TOKEN_NAME, tokenname);
+ }
+
+ public String getRATokenName() {
+ return (String)get(RA_TOKEN_NAME);
+ }
+
+ public void setRATokenName(String tokenname) {
+ put(RA_TOKEN_NAME, tokenname);
+ }
+
+ public String getKRATokenName() {
+ return (String)get(KRA_TOKEN_NAME);
+ }
+
+ public void setKRATokenName(String tokenname) {
+ put(KRA_TOKEN_NAME, tokenname);
+ }
+
+ public String getSSLTokenName() {
+ return (String)get(SSL_TOKEN_NAME);
+ }
+
+ public void setSSLTokenName(String tokenname) {
+ put(SSL_TOKEN_NAME, tokenname);
+ }
+
+ public String getMigrateCACertTokenName() {
+ return (String)get(MIGRATE_CA_TOKEN_NAME);
+ }
+
+ public void setMigrateCACertTokenName(String tokenname) {
+ put(MIGRATE_CA_TOKEN_NAME, tokenname);
+ }
+
+ public String getMigrateSSLCertTokenName() {
+ return (String)get(MIGRATE_SSL_TOKEN_NAME);
+ }
+
+ public void setMigrateSSLCertTokenName(String tokenname) {
+ put(MIGRATE_SSL_TOKEN_NAME, tokenname);
+ }
+
+ public String getTokenName() {
+ return (String)get(ConfigConstants.PR_TOKEN_NAME);
+ }
+
+ public String getTokensList() {
+ return (String)get(ConfigConstants.PR_TOKEN_NAMES);
+ }
+
+ public String getTokensInit() {
+ return (String)get(ConfigConstants.PR_TOKEN_INITIALIZED);
+ }
+
+ public String getTokensLogin() {
+ return (String)get(ConfigConstants.PR_TOKEN_LOGGED_IN);
+ }
+
+ public void setKeyLength(String val) {
+ put(ConfigConstants.PR_KEY_LEN, val);
+ }
+
+ public String getKeyLength() {
+ String val = (String)get(ConfigConstants.PR_KEY_LEN);
+ if (val == null)
+ val = "512";
+ return val;
+ }
+
+ public String getKeyCurveName() {
+ String val = (String)get(ConfigConstants.PR_KEY_CURVENAME);
+ if (val ==null)
+ val = "nistp521";
+ return val;
+ }
+
+ public void setKeyCurveName(String val) {
+ put(ConfigConstants.PR_KEY_CURVENAME, val);
+ }
+
+ public String getKeyType() {
+ String type = (String)get(ConfigConstants.PR_KEY_TYPE);
+ // work around the historical mistake,
+ // not touching files around the places.
+ if ( type == null || type.equals("")) {
+ String certType = getCertType();
+ if (certType.equals(Constants.PR_CA_SIGNING_CERT)) {
+ type = (String)get("ca_keyType");
+ } else if (certType.equals(Constants.PR_RA_SIGNING_CERT)) {
+ type = (String)get("ra_keyType");
+ } else if (certType.equals(Constants.PR_OCSP_SIGNING_CERT)) {
+ type = (String)get("ocsp_keyType");
+ } else if (certType.equals(Constants.PR_KRA_TRANSPORT_CERT)) {
+ type = (String)get("kra_keyType");
+ } else if (certType.equals(Constants.PR_SERVER_CERT)) {
+ type = (String)get("ssl_keyType");
+ }
+ }
+ return type;
+ }
+
+ public String getSubjectName() {
+ return (String)get(ConfigConstants.PR_SUBJECT_NAME);
+ }
+
+ public void setSubjectName(String str) {
+ put(ConfigConstants.PR_SUBJECT_NAME, str);
+ }
+
+ public String getCASubjectName() {
+ return (String)get(ConfigConstants.PR_CA_SUBJECT_NAME);
+ }
+
+ public void setCASubjectName(String str) {
+ put(ConfigConstants.PR_CA_SUBJECT_NAME, str);
+ }
+
+ public String getRASubjectName() {
+ return (String)get(ConfigConstants.PR_RA_SUBJECT_NAME);
+ }
+
+ public void setRASubjectName(String str) {
+ put(ConfigConstants.PR_RA_SUBJECT_NAME, str);
+ }
+
+ public String getOCSPSubjectName() {
+ return (String)get(ConfigConstants.PR_OCSP_SUBJECT_NAME);
+ }
+
+ public void setOCSPSubjectName(String str) {
+ put(ConfigConstants.PR_OCSP_SUBJECT_NAME, str);
+ }
+
+ public String getKRASubjectName() {
+ return (String)get(ConfigConstants.PR_KRA_SUBJECT_NAME);
+ }
+
+ public void setKRASubjectName(String str) {
+ put(ConfigConstants.PR_KRA_SUBJECT_NAME, str);
+ }
+
+ public String getSSLSubjectName() {
+ return (String)get(ConfigConstants.PR_SSL_SUBJECT_NAME);
+ }
+
+ public void setSSLSubjectName(String str) {
+ put(ConfigConstants.PR_SSL_SUBJECT_NAME, str);
+ }
+
+ public NameValuePairs getAllCertInfo() {
+ return (NameValuePairs)get(ALL_CERT_INFO);
+ }
+
+ public String getBeginYear() {
+ return (String)get(Constants.PR_BEGIN_YEAR);
+ }
+
+ public String getBeginMonth() {
+ return (String)get(Constants.PR_BEGIN_MONTH);
+ }
+
+ public String getBeginDate() {
+ return (String)get(Constants.PR_BEGIN_DATE);
+ }
+
+ public String getBeginHour() {
+ return (String)get(Constants.PR_BEGIN_HOUR);
+ }
+
+ public String getBeginMin() {
+ return (String)get(Constants.PR_BEGIN_MIN);
+ }
+
+ public String getBeginSec() {
+ return (String)get(Constants.PR_BEGIN_SEC);
+ }
+
+ public String getAfterYear() {
+ return (String)get(Constants.PR_AFTER_YEAR);
+ }
+
+ public String getAfterMonth() {
+ return (String)get(Constants.PR_AFTER_MONTH);
+ }
+
+ public String getAfterDate() {
+ return (String)get(Constants.PR_AFTER_DATE);
+ }
+
+ public String getAfterHour() {
+ return (String)get(Constants.PR_AFTER_HOUR);
+ }
+
+ public String getAfterMin() {
+ return (String)get(Constants.PR_AFTER_MIN);
+ }
+
+ public String getAfterSec() {
+ return (String)get(Constants.PR_AFTER_SEC);
+ }
+
+ public boolean isSingleSignon() {
+ String val = (String)get(ConfigConstants.PR_SINGLE_SIGNON);
+ if (val != null && val.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public boolean isCACertLocalCA() {
+ String val = (String)get(ConfigConstants.PR_CACERT_LOCALCA);
+ if (val == null) {
+ return true;
+ }
+ else if (val.equals(Constants.TRUE)) {
+ return true;
+ }
+ return false;
+ }
+
+ // set true or false
+ public void setCACertLocalCA(String val) {
+ put(ConfigConstants.PR_CACERT_LOCALCA, val);
+ }
+
+ public boolean isRACertLocalCA() {
+ String val = (String)get(ConfigConstants.PR_RACERT_LOCALCA);
+ if (val == null)
+ return true;
+ else if (val.equals(Constants.TRUE))
+ return true;
+ return false;
+ }
+
+ // set true or false
+ public void setRACertLocalCA(String val) {
+ put(ConfigConstants.PR_RACERT_LOCALCA, val);
+ }
+
+ public boolean isOCSPCertLocalCA() {
+ String val = (String)get(ConfigConstants.PR_OCSPCERT_LOCALCA);
+ if (val == null)
+ return true;
+ else if (val.equals(Constants.TRUE))
+ return true;
+ return false;
+ }
+
+ // set true or false
+ public void setOCSPCertLocalCA(String val) {
+ put(ConfigConstants.PR_OCSPCERT_LOCALCA, val);
+ }
+
+ public boolean isKRACertLocalCA() {
+ String val = (String)get(ConfigConstants.PR_KRACERT_LOCALCA);
+ if (val == null)
+ return true;
+ else if (val.equals(Constants.TRUE))
+ return true;
+ return false;
+ }
+
+ // set true or false
+ public void setKRACertLocalCA(String val) {
+ put(ConfigConstants.PR_KRACERT_LOCALCA, val);
+ }
+
+ public boolean isSSLCertLocalCA() {
+ String val = (String)get(ConfigConstants.PR_SSLCERT_LOCALCA);
+ if (val == null || val.equals(""))
+ return true;
+ else if (val.equals(Constants.TRUE))
+ return true;
+ return false;
+ }
+
+ // set true or false
+ public void setSSLCertLocalCA(String val) {
+ put(ConfigConstants.PR_SSLCERT_LOCALCA, val);
+ }
+
+ public void setInstallCertNow(String val) {
+ put(INSTALLCERT_NOW, val);
+ }
+
+ public boolean isInstallCertNow() {
+ String val = (String)get(INSTALLCERT_NOW);
+ if (val == null)
+ return false;
+ else if (val.equals(Constants.TRUE))
+ return true;
+ return false;
+ }
+
+ public String getCertContent() {
+ return (String)get(Constants.PR_CERT_CONTENT);
+ }
+
+ public String getNickname() {
+ return (String)get(Constants.PR_NICKNAME);
+ }
+
+ public String getCertOrder() {
+ return (String)get(ConfigConstants.PR_CERT_CONTENT_ORDER);
+ }
+
+ public String getPKCS10() {
+ String val = (String)get(Constants.PR_PKCS10);
+ if (val != null && !val.equals(""))
+ return val;
+ return null;
+ }
+
+ public void setPKCS10(String b64E) {
+ put(Constants.PR_PKCS10, b64E);
+ }
+
+ public String getCertFilePath() {
+ String val = (String)get(Constants.PR_CERT_FILEPATH);
+ if (val != null && !val.equals(""))
+ return val;
+ return null;
+ }
+
+ public void setCertFilePath(String path) {
+ put(Constants.PR_CERT_FILEPATH, path);
+ }
+
+ public String getMachineName() {
+ return (String)get(ConfigConstants.PR_MACHINE_NAME);
+ }
+
+ public void setEnableMigration(String val) {
+ put(ConfigConstants.PR_ENABLE_MIGRATION, val);
+ }
+
+ public boolean isMigrationEnable() {
+ String val = (String)get(ConfigConstants.PR_ENABLE_MIGRATION);
+ if (val != null && val.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public void setMigrationOutputPath(String path) {
+ put(ConfigConstants.PR_OUTPUT_PATH, path);
+ }
+
+ public String getMigrationOutputPath() {
+ return (String)get(ConfigConstants.PR_OUTPUT_PATH);
+ }
+
+ public void setInternalDBPasswd(String passwd) {
+ put(ConfigConstants.PR_DB_PWD, passwd);
+ }
+
+ public String getInternalDBPasswd() {
+ return (String)get(ConfigConstants.PR_DB_PWD);
+ }
+
+ public void setMigrationPasswd(String val) {
+ put(ConfigConstants.PR_MIGRATION_PASSWORD, val);
+ }
+
+ public String getMigrationPasswd() {
+ return (String)get(ConfigConstants.PR_MIGRATION_PASSWORD);
+ }
+
+ public void setSigningKeyMigrationToken(String tokenname) {
+ put(ConfigConstants.PR_SIGNING_KEY_MIGRATION_TOKEN, tokenname);
+ }
+
+ public String getSigningKeyMigrationToken() {
+ return (String)get(ConfigConstants.PR_SIGNING_KEY_MIGRATION_TOKEN);
+ }
+
+ public void setSSLKeyMigrationToken(String tokenname) {
+ put(ConfigConstants.PR_SSL_KEY_MIGRATION_TOKEN, tokenname);
+ }
+
+ public String getSSLKeyMigrationToken() {
+ return (String)get(ConfigConstants.PR_SSL_KEY_MIGRATION_TOKEN);
+ }
+
+ public void setSigningKeyMigrationPasswd(String val) {
+ put(ConfigConstants.PR_SIGNING_KEY_MIGRATION_TOKEN_PASSWD, val);
+ }
+
+ public String getSigningKeyMigrationPasswd() {
+ return (String)get(ConfigConstants.PR_SIGNING_KEY_MIGRATION_TOKEN_PASSWD);
+ }
+
+ public void setSigningKeyMigrationSOPPasswd(String val) {
+ put(ConfigConstants.PR_SIGNING_KEY_MIGRATION_TOKEN_SOPPASSWD, val);
+ }
+
+ public String getSigningKeyMigrationSOPPasswd() {
+ return (String)get(ConfigConstants.PR_SIGNING_KEY_MIGRATION_TOKEN_SOPPASSWD);
+ }
+
+ public void setSSLKeyMigrationPasswd(String val) {
+ put(ConfigConstants.PR_SSL_KEY_MIGRATION_TOKEN_PASSWD, val);
+ }
+
+ public String getSSLKeyMigrationPasswd() {
+ return (String)get(ConfigConstants.PR_SSL_KEY_MIGRATION_TOKEN_PASSWD);
+ }
+
+ public void setSSLKeyMigrationSOPPasswd(String val) {
+ put(ConfigConstants.PR_SSL_KEY_MIGRATION_TOKEN_SOPPASSWD, val);
+ }
+
+ public String getSSLKeyMigrationSOPPasswd() {
+ return (String)get(ConfigConstants.PR_SSL_KEY_MIGRATION_TOKEN_SOPPASSWD);
+ }
+
+ public void setInstalledOCSP(String val) {
+ put(ConfigConstants.PR_OCSP, val);
+ }
+
+ public void setInstalledCA(String val) {
+ put(ConfigConstants.PR_CA, val);
+ }
+
+ public boolean isOCSPInstalled() {
+ String str = (String)get(ConfigConstants.PR_OCSP);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public boolean isCAInstalled() {
+ String str = (String)get(ConfigConstants.PR_CA);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public void setInstalledRA(String val) {
+ put(ConfigConstants.PR_RA, val);
+ }
+
+ public boolean isRAInstalled() {
+ String str = (String)get(ConfigConstants.PR_RA);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public void setInstalledKRA(String val) {
+ put(ConfigConstants.PR_KRA, val);
+ }
+
+ public void setInstalledTKS(String val) {
+ put(ConfigConstants.PR_TKS, val);
+ }
+
+ public boolean isKRAInstalled() {
+ String str = (String)get(ConfigConstants.PR_KRA);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+ public boolean isTKSInstalled() {
+ String str = (String)get(ConfigConstants.PR_TKS);
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+ public boolean isOCSPServiceAdded() {
+ String str = (String)get(ConfigConstants.PR_CA_OCSP_SERVICE);
+ if (str == null || str.equals(ConfigConstants.FALSE))
+ return false;
+ return true;
+ }
+
+ public void setOCSPService(String val) {
+ put(ConfigConstants.PR_CA_OCSP_SERVICE, val);
+ }
+
+ public void setCMHost(String host) {
+ put(ConfigConstants.CA_HOST, host);
+ }
+
+ public String getCMHost() {
+ return (String)get(ConfigConstants.CA_HOST);
+ }
+
+ public void setCMPort(String port) {
+ put(ConfigConstants.CA_PORT, port);
+ }
+
+ public String getCMPort() {
+ return (String)get(ConfigConstants.CA_PORT);
+ }
+
+ public void setCMTimeout(String timeout) {
+ put(ConfigConstants.CA_TIMEOUT, timeout);
+ }
+
+ public String getCMTimeout() {
+ return (String)get(ConfigConstants.CA_TIMEOUT);
+ }
+
+ public void setCMEEPort(String port) {
+ put(ConfigConstants.CA_EEPORT, port);
+ }
+
+ public String getCMEEPort() {
+ return (String)get(ConfigConstants.CA_EEPORT);
+ }
+
+ public void setCMEEType(String type) {
+ put(ConfigConstants.CA_EETYPE, type);
+ }
+
+ public String getCMEEType() {
+ return (String)get(ConfigConstants.CA_EETYPE);
+ }
+
+ public void setRequestStatus(String requestStatus) {
+ put(getCertType()+ConfigConstants.PR_CERT_REQUEST+"Status", requestStatus);
+ }
+
+ public String getRequestStatus() {
+ return (String)get(getCertType()+ConfigConstants.PR_CERT_REQUEST+"Status");
+ }
+
+ public void setRequestID(String requestID) {
+ put(getCertType()+ConfigConstants.PR_REQUEST_ID, requestID);
+ }
+
+ public String getRequestID() {
+ return (String)get(getCertType()+ConfigConstants.PR_REQUEST_ID);
+ }
+
+ public void setX509RequestStatus(String requestStatus) {
+ put("x509"+ConfigConstants.PR_CERT_REQUEST+"Status", requestStatus);
+ }
+
+ public String getX509RequestStatus() {
+ return (String)get("x509"+ConfigConstants.PR_CERT_REQUEST+"Status");
+ }
+
+ public void setX509RequestID(String requestID) {
+ put("x509"+getCertRequest()+ConfigConstants.PR_CERT_REQUEST, requestID);
+ }
+
+ public String getX509RequestID() {
+ return (String)get("x509"+getCertRequest()+ConfigConstants.PR_CERT_REQUEST);
+ }
+
+ public void setRequestSent(boolean sent) {
+ if (sent)
+ put(getCertRequest()+"Sent", ConfigConstants.TRUE);
+ else
+ put(getCertRequest()+"Sent", ConfigConstants.FALSE);
+ }
+
+ public boolean requestSent() {
+ String str = (String)get(getCertRequest()+"Sent");
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ return false;
+ }
+
+ public void setRequestError(String error) {
+ put(getCertRequest()+"Error", error);
+ }
+
+ public String getRequestError() {
+ return (String)get(getCertRequest()+"Error");
+ }
+
+ public void setImportError(String error) {
+ put(getCertType()+"Error", error);
+ }
+
+ public String getImportError() {
+ return (String)get(getCertType()+"Error");
+ }
+
+ public void setX509RequestError(String error) {
+ put("x509"+getCertRequest()+"Error", error);
+ }
+
+ public String getX509RequestError() {
+ return (String)get("x509"+getCertRequest()+"Error");
+ }
+
+ public void setDRMHost(String host) {
+ put(ConfigConstants.KRA_HOST, host);
+ }
+
+ public String getDRMHost() {
+ return (String)get(ConfigConstants.KRA_HOST);
+ }
+
+ public void setDRMPort(String port) {
+ put(ConfigConstants.KRA_PORT, port);
+ }
+
+ public String getDRMPort() {
+ return (String)get(ConfigConstants.KRA_PORT);
+ }
+
+ public void setDRMTimeout(String timeout) {
+ put(ConfigConstants.KRA_TIMEOUT, timeout);
+ }
+
+ public String getDRMTimeout() {
+ return (String)get(ConfigConstants.KRA_TIMEOUT);
+ }
+
+ public void enableRemoteDRM(String enable) {
+ put(ConfigConstants.REMOTE_KRA_ENABLED, enable);
+ }
+
+ public boolean isRemoteDRM() {
+ String value = (String)get(ConfigConstants.REMOTE_KRA_ENABLED);
+ if (value == null || value.equals("") || value.equals(ConfigConstants.FALSE) ||
+ !value.equals(ConfigConstants.TRUE))
+ return false;
+ return true;
+ }
+
+ public String getSingleSignon() {
+ return (String)get(ConfigConstants.PR_SINGLE_SIGNON);
+ }
+
+ public void setRequiredAgents(String val) {
+ put(ConfigConstants.PR_AGENT_M, val);
+ }
+
+ public String getRequiredAgents() {
+ return (String)get(ConfigConstants.PR_AGENT_M);
+ }
+
+ public void setTotalAgents(String val) {
+ put(ConfigConstants.PR_AGENT_N, val);
+ }
+
+ public String getTotalAgents() {
+ return (String)get(ConfigConstants.PR_AGENT_N);
+ }
+
+ public String getHashType() {
+ return (String)get(ConfigConstants.PR_HASH_TYPE);
+ }
+
+ public void setHashType(String type) {
+ put(ConfigConstants.PR_HASH_TYPE, type);
+ }
+
+ public String getSignedByType() {
+ return (String)get(ConfigConstants.PR_SIGNEDBY_TYPE);
+ }
+
+ public void setSignedByType(String type) {
+ put(ConfigConstants.PR_SIGNEDBY_TYPE, type);
+ }
+
+ public String getCAKeyType() {
+ return (String)get(ConfigConstants.PR_CA_KEYTYPE);
+ }
+
+ public boolean hasEntireCAChain() {
+ String str = (String)get(Constants.PR_CA_SIGNING_CERT+
+ "hasEntireChain");
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ else
+ return false;
+ }
+
+ public boolean hasEntireSSLChain() {
+ String str = (String)get(Constants.PR_SERVER_CERT+
+ "hasEntireChain");
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ else
+ return false;
+ }
+
+ public boolean hasEntireKRAChain() {
+ String str = (String)get(Constants.PR_KRA_TRANSPORT_CERT+
+ "hasEntireChain");
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ else
+ return false;
+ }
+
+ public boolean hasEntireOCSPChain() {
+ String str = (String)get(Constants.PR_OCSP_SIGNING_CERT+
+ "hasEntireChain");
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ else
+ return false;
+ }
+
+ public boolean hasEntireRAChain() {
+ String str = (String)get(Constants.PR_RA_SIGNING_CERT+
+ "hasEntireChain");
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ else
+ return false;
+ }
+
+ public String getOComponent() {
+ return (String)get(ConfigConstants.PR_O_COMPONENT);
+ }
+
+ public void setOComponent(String str) {
+ put(ConfigConstants.PR_O_COMPONENT, str);
+ }
+
+ public String getOUComponent() {
+ return (String)get(ConfigConstants.PR_OU_COMPONENT);
+ }
+
+ public void setOUComponent(String str) {
+ put(ConfigConstants.PR_OU_COMPONENT, str);
+ }
+
+ public String getLComponent() {
+ return (String)get(ConfigConstants.PR_L_COMPONENT);
+ }
+
+ public void setLComponent(String str) {
+ put(ConfigConstants.PR_L_COMPONENT, str);
+ }
+
+ public String getSTComponent() {
+ return (String)get(ConfigConstants.PR_ST_COMPONENT);
+ }
+
+ public void setSTComponent(String str) {
+ put(ConfigConstants.PR_ST_COMPONENT, str);
+ }
+
+ public String getCComponent() {
+ return (String)get(ConfigConstants.PR_C_COMPONENT);
+ }
+
+ public void setCComponent(String str) {
+ put(ConfigConstants.PR_C_COMPONENT, str);
+ }
+
+ public String getCAOComp() {
+ String str = (String)get(ConfigConstants.PR_CA_O_COMPONENT);
+ return str;
+ }
+
+ public void setCAOComp(String str) {
+ put(ConfigConstants.PR_CA_O_COMPONENT, str);
+ }
+
+ public String getCACComp() {
+ String str = (String)get(ConfigConstants.PR_CA_C_COMPONENT);
+ return str;
+ }
+
+ public void setCACComp(String str) {
+ put(ConfigConstants.PR_CA_C_COMPONENT, str);
+ }
+
+ public String getOCSPOComp() {
+ String str = (String)get(ConfigConstants.PR_OCSP_O_COMPONENT);
+ return str;
+ }
+
+ public void setOCSPOComp(String str) {
+ put(ConfigConstants.PR_OCSP_O_COMPONENT, str);
+ }
+
+ public String getRAOComp() {
+ String str = (String)get(ConfigConstants.PR_RA_O_COMPONENT);
+ return str;
+ }
+
+ public void setRAOComp(String str) {
+ put(ConfigConstants.PR_RA_O_COMPONENT, str);
+ }
+
+ public String getOCSPCComp() {
+ String str = (String)get(ConfigConstants.PR_OCSP_C_COMPONENT);
+ return str;
+ }
+
+ public void setOCSPCComp(String str) {
+ put(ConfigConstants.PR_OCSP_C_COMPONENT, str);
+ }
+
+ public String getRACComp() {
+ String str = (String)get(ConfigConstants.PR_RA_C_COMPONENT);
+ return str;
+ }
+
+ public void setRACComp(String str) {
+ put(ConfigConstants.PR_RA_C_COMPONENT, str);
+ }
+
+ public String getCertRequestDir() {
+ return (String)get(Constants.PR_CERT_REQUEST_DIR);
+ }
+
+ public void setCASerialNumber(String str) {
+ put(ConfigConstants.PR_CA_SERIAL_NUMBER, str);
+ }
+ public void setRequestNumber(String str) {
+ put(ConfigConstants.PR_REQUEST_NUMBER, str);
+ }
+
+ public String getCASerialNumber() {
+ return (String)get(ConfigConstants.PR_CA_SERIAL_NUMBER);
+ }
+ public String getRequestNumber() {
+ return (String)get(ConfigConstants.PR_REQUEST_NUMBER);
+ }
+
+ public void clearRequestNumber() {
+ remove(ConfigConstants.PR_REQUEST_NUMBER);
+ }
+
+ public void setCAEndSerialNumber(String str) {
+ put(ConfigConstants.PR_CA_ENDSERIAL_NUMBER, str);
+ }
+
+ public String getCAEndSerialNumber() {
+ return (String)get(ConfigConstants.PR_CA_ENDSERIAL_NUMBER);
+ }
+
+ public void clearCAEndSerialNumber() {
+ remove(ConfigConstants.PR_CA_ENDSERIAL_NUMBER);
+ }
+ public String getEndRequestNumber() {
+ return (String)get(ConfigConstants.PR_ENDREQUEST_NUMBER);
+ }
+
+ public boolean isCloning() {
+ String str = (String)get("cloning");
+ if (str != null && str.equals(ConfigConstants.TRUE))
+ return true;
+ else
+ return false;
+ }
+ public void setCloning(String str) {
+ put("cloning", str);
+ }
+ public void setCLAHost(String host) {
+ put(ConfigConstants.CLA_HOST, host);
+ }
+
+ public String getCLAHost() {
+ return (String)get(ConfigConstants.CLA_HOST);
+ }
+
+ public void setCLAPort(String port) {
+ put(ConfigConstants.CLA_PORT, port);
+ }
+
+ public String getCLAPort() {
+ return (String)get(ConfigConstants.CLA_PORT);
+ }
+
+ public void setCLAPortEE(String port) {
+ put(ConfigConstants.CLA_PORT_EE, port);
+ }
+
+ public String getCLAPortEE() {
+ return (String)get(ConfigConstants.CLA_PORT_EE);
+ }
+
+ public void setCLATimeout(String timeout) {
+ put(ConfigConstants.CLA_TIMEOUT, timeout);
+ }
+
+ public String getCLATimeout() {
+ return (String)get(ConfigConstants.CLA_TIMEOUT);
+ }
+
+ public boolean isConnectDBDone() {
+ String val = (String)get(ConfigConstants.STAGE_CONNECT_DB);
+ if (val == null || val.equals("") || val.equals(ConfigConstants.FALSE))
+ return false;
+ return true;
+ }
+
+ public void setConnectDBDone(String s) {
+ put(ConfigConstants.STAGE_CONNECT_DB, s);
+ }
+
+ public boolean isCreateDBDone() {
+ String val = (String)get(ConfigConstants.STAGE_INTERNAL_DB);
+ if (val == null || val.equals("") || val.equals(ConfigConstants.FALSE))
+ return false;
+ return true;
+ }
+
+ public void setCreateDBDone(String s) {
+ put(ConfigConstants.STAGE_INTERNAL_DB, s);
+ }
+
+ public boolean isWebServerDone() {
+ String val = (String)get(ConfigConstants.STAGE_CONFIG_WEBSERVER);
+ if (val == null || val.equals("") || val.equals(ConfigConstants.FALSE))
+ return false;
+ return true;
+ }
+
+ public void setWebServerDone(String str) {
+ put(ConfigConstants.STAGE_CONFIG_WEBSERVER, str);
+ }
+
+ public boolean isOCSPServiceDone() {
+ String val = (String)get(ConfigConstants.STAGE_OCSP_SERVICE_ADDED);
+ if (val == null || val.equals("") || val.equals(ConfigConstants.FALSE))
+ return false;
+ return true;
+ }
+
+ public boolean isCACertRequestSucc() {
+ String str = (String)get(ConfigConstants.STAGE_CA_REQ_SUCCESS);
+ if (str == null || str.equals("") || str.equals(ConfigConstants.FALSE))
+ return false;
+ return true;
+ }
+
+ public boolean isRACertRequestSucc() {
+ String str = (String)get(ConfigConstants.STAGE_RA_REQ_SUCCESS);
+ if (str == null || str.equals("") || str.equals(ConfigConstants.FALSE))
+ return false;
+ return true;
+ }
+
+ public boolean isKRACertRequestSucc() {
+ String str = (String)get(ConfigConstants.STAGE_KRA_REQ_SUCCESS);
+ if (str == null || str.equals("") || str.equals(ConfigConstants.FALSE))
+ return false;
+ return true;
+ }
+
+ public boolean isSSLCertRequestSucc() {
+ String str = (String)get(ConfigConstants.STAGE_SSL_REQ_SUCCESS);
+ if (str == null || str.equals("") || str.equals(ConfigConstants.FALSE))
+ return false;
+ return true;
+ }
+
+ public boolean isOCSPCertRequestSucc() {
+ String str = (String)get(ConfigConstants.STAGE_OCSP_REQ_SUCCESS);
+ if (str == null || str.equals("") || str.equals(ConfigConstants.FALSE))
+ return false;
+ return true;
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIAdminPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIAdminPage.java
new file mode 100644
index 000000000..467632102
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIAdminPage.java
@@ -0,0 +1,266 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.util.*;
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.console.*;
+
+/**
+ * Admin page for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIAdminPage extends WizardBasePanel implements IWizardPanel {
+ private JCheckBox mEnable;
+ private JTextField mIDText, mFullNameText, mPasswordText,
+ mPasswordAgainText;
+ private static final String PANELNAME = "ADMININSTALLWIZARD";
+ private static final String HELPINDEX =
+ "install-administrator-configuration-wizard-help";
+
+ WIAdminPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WIAdminPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isAgreementDone() &&
+ wizardInfo.isReplicationEnabled())
+ return false;
+ if (wizardInfo.isCloning() && !wizardInfo.isAgreementDone())
+ return false;
+ if (wizardInfo.isAdministratorDone())
+ return false;
+ mIDText.setText(wizardInfo.getCertAdminUid());
+ mFullNameText.setText(wizardInfo.getCertAdminName());
+
+ setBorder(makeTitledBorder(PANELNAME));
+
+ return true;
+ }
+
+ public boolean validatePanel() {
+ String password = mPasswordText.getText().trim();
+ String passwordAgain = mPasswordAgainText.getText().trim();
+ if (password.equals("") || passwordAgain.equals("")) {
+ setErrorMessage("BLANKPASSWD");
+ return false;
+ }
+
+ if (!password.equals(passwordAgain)) {
+ setErrorMessage("NOTSAMEPASSWD");
+ return false;
+ }
+
+ if (mIDText.getText().trim().equals("")) {
+ setErrorMessage("BLANKADMINID");
+ return false;
+ }
+
+ if (mFullNameText.getText().trim().equals("")) {
+ setErrorMessage("BLANKADMINNAME");
+ return false;
+ }
+
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+
+ String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_SETUP_ADMINISTRATOR;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY;
+ rawData = rawData+"&"+ConfigConstants.PR_CERT_ADMINUID+"="+mIDText.getText();
+ rawData = rawData+"&"+ConfigConstants.PR_CERT_ADMINNAME+"="+mFullNameText.getText();
+ rawData = rawData+"&"+ConfigConstants.PR_CERT_ADMINPASSWD+"="+mPasswordAgainText.getText();
+ if (mEnable.isSelected()) {
+ rawData = rawData+"&"+ConfigConstants.PR_ENABLE+"=true";
+ } else {
+ rawData = rawData+"&"+ConfigConstants.PR_ENABLE+"=false";
+ }
+ if (wizardInfo.getInternalDBPasswd() != null)
+ rawData = rawData+"&"+ConfigConstants.PR_DB_PWD+"="+wizardInfo.getInternalDBPasswd();
+ wizardInfo.setCertAdminUid(mIDText.getText().trim());
+ wizardInfo.setCertAdminName(mFullNameText.getText().trim());
+
+ startProgressStatus();
+ boolean ready = send(rawData, wizardInfo);
+ endProgressStatus();
+
+ if (!ready) {
+ String str = getErrorMessage(wizardInfo);
+ if (str.equals("")) {
+ String errorMsg = mResource.getString(
+ PANELNAME+"_ERRORMSG");
+ setErrorMessage(errorMsg);
+ } else
+ setErrorMessage(str);
+ }
+
+ return ready;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JTextArea desc = createTextArea(mResource.getString(
+ "ADMININSTALLWIZARD_TEXT_HEADING_LABEL"));
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel idLbl = makeJLabel("ADMINID");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.insets = new Insets(COMPONENT_SPACE,0,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.fill = gbc.NONE;
+ add(idLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mIDText = makeJTextField(30);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(mIDText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel nameLbl = makeJLabel("FULLNAME");
+ gbc.insets = new Insets(0, 0,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.fill = gbc.NONE;
+ gbc.anchor = gbc.NORTHEAST;
+ add(nameLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mFullNameText = makeJTextField(30);
+ gbc.insets = new Insets(0, COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mFullNameText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel passwdLbl = makeJLabel("PASSWORD");
+ gbc.insets = new Insets(0, 0,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ add(passwdLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mPasswordText = makeJPasswordField(30);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(0,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mPasswordText, gbc);
+
+/*
+ CMSAdminUtil.resetGBC(gbc);
+ JTextArea dummy2 = createTextArea(" ", 1, 5);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(dummy2, gbc);
+*/
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel passwdAgainLbl = makeJLabel("PASSWORDAGAIN");
+ gbc.insets = new Insets(0, 0,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ add(passwdAgainLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mPasswordAgainText = makeJPasswordField(30);
+ gbc.insets = new Insets(0, COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mPasswordAgainText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel passwdAgainLbl1 = makeJLabel("DUMMY");
+ gbc.insets = new Insets(0, COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.weighty = 1.0;
+ add(passwdAgainLbl1, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mEnable = makeJCheckBox("ENABLE");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(0, COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.weighty = 1.0;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mEnable, gbc);
+ mEnable.setSelected(true);
+/*
+ CMSAdminUtil.resetGBC(gbc);
+ JTextArea dummy3 = createTextArea(" ", 1, 5);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ add(dummy3, gbc);
+*/
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIAllCertsInstalledPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIAllCertsInstalledPage.java
new file mode 100644
index 000000000..b84460814
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIAllCertsInstalledPage.java
@@ -0,0 +1,269 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Introduction page for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIAllCertsInstalledPage extends WizardBasePanel implements IWizardPanel {
+ private JTextArea mLabel;
+ private static final String PANELNAME = "ALLCERTSINSTALLEDWIZARD";
+ private static final String HELPINDEX =
+ "install-allcerts-getinstalled-wizard-help";
+
+ WIAllCertsInstalledPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WIAllCertsInstalledPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return true;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+
+ if (wizardInfo.isCloning())
+ return false;
+
+ if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled()) {
+ if (caCertInstalled(wizardInfo) && kraCertInstalled(wizardInfo))
+ return false;
+ if (wizardInfo.isCloning()) {
+ if (wizardInfo.isCACloningDone() && wizardInfo.isKRACloningDone()) {
+ if (wizardInfo.isSSLCloningDone())
+ return false;
+ else if (!wizardInfo.isSSLCloningDone()) {
+ if (wizardInfo.isSSLLocalCertDone() || wizardInfo.isSSLCertInstalledDone())
+ return false;
+ }
+ }
+ }
+ }
+
+ else if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled()) {
+ if (raCertInstalled(wizardInfo) && kraCertInstalled(wizardInfo))
+ return false;
+ if (wizardInfo.isCloning()) {
+ if (wizardInfo.isRACloningDone() && wizardInfo.isKRACloningDone()) {
+ if (wizardInfo.isSSLCloningDone())
+ return false;
+ else if (!wizardInfo.isSSLCloningDone()) {
+ if (wizardInfo.isSSLLocalCertDone() || wizardInfo.isSSLCertInstalledDone())
+ return false;
+ }
+ }
+ }
+ }
+
+ else if (wizardInfo.isCAInstalled()) {
+ if (caCertInstalled(wizardInfo))
+ return false;
+ if (wizardInfo.isCloning()) {
+ if (wizardInfo.isCACloningDone()) {
+ if (wizardInfo.isSSLCloningDone())
+ return false;
+ else if (!wizardInfo.isSSLCloningDone()) {
+ if (wizardInfo.isSSLLocalCertDone() || wizardInfo.isSSLCertInstalledDone())
+ return false;
+ }
+ }
+ }
+ }
+ else if (wizardInfo.isOCSPInstalled()) {
+ if (ocspCertInstalled(wizardInfo))
+ return false;
+ }
+
+ else if (wizardInfo.isRAInstalled()) {
+ if (raCertInstalled(wizardInfo))
+ return false;
+ if (wizardInfo.isCloning()) {
+ if (wizardInfo.isRACloningDone()) {
+ if (wizardInfo.isSSLCloningDone())
+ return false;
+ else if (!wizardInfo.isSSLCloningDone()) {
+ if (wizardInfo.isSSLLocalCertDone() || wizardInfo.isSSLCertInstalledDone())
+ return false;
+ }
+ }
+ }
+ }
+
+ else if (wizardInfo.isKRAInstalled()) {
+ if (kraCertInstalled(wizardInfo))
+ return false;
+ if (wizardInfo.isCloning()) {
+ if (wizardInfo.isKRACloningDone()) {
+ if (wizardInfo.isSSLCloningDone())
+ return false;
+ else if (!wizardInfo.isSSLCloningDone()) {
+ if (wizardInfo.isSSLLocalCertDone() || wizardInfo.isSSLCertInstalledDone())
+ return false;
+ }
+ }
+ }
+ }
+ else if (wizardInfo.isTKSInstalled()) {
+ if (tksCertInstalled(wizardInfo))
+ return false;
+ }
+ setBorder(makeTitledBorder(PANELNAME));
+ mLabel.setVisible(false);
+
+ return true;
+ }
+
+ private boolean caCertInstalled(InstallWizardInfo wizardInfo) {
+ if (wizardInfo.isMigrationEnable() ||
+ ((wizardInfo.isSelfSignedCACertDone() ||
+ wizardInfo.isCACertInstalledDone()) &&
+ (wizardInfo.isSSLLocalCertDone() || wizardInfo.isSSLCertInstalledDone())))
+ return true;
+ return false;
+ }
+
+ private boolean ocspCertInstalled(InstallWizardInfo wizardInfo) {
+ if (wizardInfo.isOCSPCertInstalledDone() &&
+ wizardInfo.isSSLCertInstalledDone())
+ return true;
+ return false;
+ }
+
+ private boolean raCertInstalled(InstallWizardInfo wizardInfo) {
+ if ((wizardInfo.isRALocalCertDone() ||
+ wizardInfo.isRACertInstalledDone()) &&
+ (wizardInfo.isMigrationEnable() || wizardInfo.isSSLLocalCertDone() ||
+ wizardInfo.isSSLCertInstalledDone()))
+ return true;
+ return false;
+ }
+
+ private boolean kraCertInstalled(InstallWizardInfo wizardInfo) {
+ if ((wizardInfo.isKRALocalCertDone() ||
+ wizardInfo.isKRACertInstalledDone()) &&
+ (wizardInfo.isMigrationEnable() || wizardInfo.isSSLLocalCertDone() ||
+ wizardInfo.isSSLCertInstalledDone()))
+ return true;
+ return false;
+ }
+ private boolean tksCertInstalled(InstallWizardInfo wizardInfo) {
+ if(wizardInfo.isSSLCertInstalledDone())
+ return true;
+ return false;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+
+ String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_GET_DEFAULT_INFO;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_READ;
+ // #344791 - help server to make up the hostname
+/*
+ data.put(ConfigConstants.PR_HOST,
+ consoleInfo.get(ConfigConstants.PR_HOST));
+*/
+ startProgressStatus();
+ boolean ready = send(rawData, wizardInfo);
+ endProgressStatus();
+
+ if (!ready) {
+ String str = getErrorMessage();
+ if (str.equals("")) {
+ String errorMsg = mResource.getString(
+ PANELNAME+"_ERRORMSG");
+ setErrorMessage(errorMsg);
+ } else
+ setErrorMessage(str);
+ }
+
+ return ready;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ JTextArea desc = createTextArea(mResource.getString(
+ PANELNAME+"_TEXT_DESC_LABEL"));
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+
+ mLabel = createTextArea(mResource.getString(
+ "INTROINSTALLWIZARD_TEXT_HEADING_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ //gbc.weighty = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mLabel, gbc);
+
+ JLabel dummy = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ add(dummy, gbc);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICACert1CustomPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICACert1CustomPage.java
new file mode 100644
index 000000000..6f8c26032
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICACert1CustomPage.java
@@ -0,0 +1,72 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+
+/**
+ * Setup CA signing cert for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WICACert1CustomPage extends WBaseKeyPage implements IWizardPanel {
+ private static final String PANELNAME = "CACERT1CUSTOMWIZARD";
+ private static final String HELPINDEX =
+ "configuration-kra-wizard-change-keyscheme-help";
+
+ WICACert1CustomPage() {
+ super(PANELNAME);
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICACert1Page.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICACert1Page.java
new file mode 100644
index 000000000..c3ca75420
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICACert1Page.java
@@ -0,0 +1,218 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Setup CA signing cert for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WICACert1Page extends WizardBasePanel implements IWizardPanel {
+ private JComboBox mKeyTypeBox;
+ private JComboBox mKeyLengthBox;
+ //private JComboBox mTokenBox;
+ //private JPasswordField mPasswordText;
+
+ private static final String PANELNAME = "CACERT1WIZARD";
+ private static final String HELPINDEX =
+ "configuration-kra-wizard-change-keyscheme-help";
+
+ WICACert1Page() {
+ super(PANELNAME);
+ init();
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ return true;
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ JTextArea desc = createTextArea(
+ CMSAdminUtil.wrapText(mResource.getString(
+ "CACERT1WIZARD_TEXT_HEADING_LABEL"), 80), 2, 80);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+
+/*
+ JTextArea desc1 = createTextArea(
+ CMSAdminUtil.wrapText(mResource.getString(
+ "CACERT1WIZARD_TEXT_TOKENHEADING_LABEL"), 80), 1, 80);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc1, gbc);
+
+ JLabel tokenLbl = makeJLabel("TOKEN");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(tokenLbl, gbc);
+
+ mTokenBox = new JComboBox();
+ mTokenBox.addItem("internal");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(COMPONENT_SPACE,0,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(mTokenBox, gbc);
+
+ JTextArea dummy = createTextArea(" ", 1, 5);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,0,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(dummy, gbc);
+
+ JTextArea desc2 = createTextArea(
+ CMSAdminUtil.wrapText(mResource.getString(
+ "CACERT1WIZARD_TEXT_HARDWARE_LABEL"), 80), 1, 80);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(2*COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc2, gbc);
+
+ JLabel pwdLbl = makeJLabel("PWD");
+ mPasswordText = makeJPasswordField(20);
+ //JTextArea dummy1 = createTextArea(" ", 1, 10);
+ //CMSAdminUtil.addComponents(this, pwdLbl, mPasswordText, dummy1, gbc);
+ CMSAdminUtil.addComponents(this, pwdLbl, mPasswordText, gbc);
+*/
+
+ JTextArea desc3 = createTextArea(
+ CMSAdminUtil.wrapText(mResource.getString(
+ "CACERT1WIZARD_TEXT_KEY_LABEL"), 80), 1, 80);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(2*COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc3, gbc);
+
+ JPanel panel = new JPanel();
+ GridBagLayout gb1 = new GridBagLayout();
+ panel.setLayout(gb1);
+
+ JLabel keyTypeLbl = makeJLabel("KEYTYPE");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ panel.add(keyTypeLbl, gbc);
+
+ mKeyTypeBox = makeJComboBox("KEYTYPE");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ gbc.fill = gbc.NONE;
+ panel.add(mKeyTypeBox, gbc);
+
+ JLabel keyLengthLbl = makeJLabel("KEYLENGTH");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ //gbc.weighty = 1.0;
+ gbc.insets = new Insets(0, COMPONENT_SPACE,0,COMPONENT_SPACE);
+ gbc.gridheight = gbc.REMAINDER;
+ panel.add(keyLengthLbl, gbc);
+
+ mKeyLengthBox = makeJComboBox("KEYLENGTH");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ //gbc.weighty = 1.0;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE,0,COMPONENT_SPACE);
+ panel.add(mKeyLengthBox, gbc);
+
+ JLabel unitLbl = makeJLabel("UNITS");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ //gbc.weighty = 1.0;
+ gbc.insets = new Insets(0, 0,0,COMPONENT_SPACE);
+ panel.add(unitLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ add(panel, gbc);
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICACert2Page.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICACert2Page.java
new file mode 100644
index 000000000..79fc00b02
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICACert2Page.java
@@ -0,0 +1,72 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+
+/**
+ * CA signing cert for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WICACert2Page extends WBaseDNPage implements IWizardPanel {
+ private static final String PANELNAME = "CACERT2WIZARD";
+ private static final String HELPINDEX =
+ "configuration-kra-wizard-change-keyscheme-help";
+
+ WICACert2Page() {
+ super(PANELNAME);
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICACertDNPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICACertDNPage.java
new file mode 100644
index 000000000..531de6be5
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICACertDNPage.java
@@ -0,0 +1,97 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import com.netscape.admin.certsrv.wizard.*;
+import javax.swing.*;
+
+/**
+ * Subject DN page for CA signing certificate
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WICACertDNPage extends WICertDNPage {
+ private static final String PANELNAME = "INSTALLCACERTDNWIZARD";
+ private static final String CALOCALHELPINDEX = "install-cacertlocal-subjectdn-wizard-help";
+ private static final String CAREMOTEHELPINDEX = "install-cacertsub-subjectdn-wizard-help";
+ private static final String CAKRALOCALHELPINDEX = "install-cakracertlocal-subjectdn-wizard-help";
+ private static final String CAKRAREMOTEHELPINDEX = "install-cakracertsub-subjectdn-wizard-help";
+
+ WICACertDNPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WICACertDNPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isCACloningDone())
+ return false;
+
+ if (!wizardInfo.isCAInstalled() || wizardInfo.isMigrationEnable() ||
+ wizardInfo.isSelfSignedCACertDone() || wizardInfo.isCACertRequestDone() ||
+ wizardInfo.isCACertInstalledDone())
+ return false;
+ //dnDesc.setText(CA_DN);
+ String str = wizardInfo.getCASubjectName();
+ if (str == null || str.equals(""))
+ str = CA_CN+", "+CA_C;
+ wizardInfo.setCASubjectName(str);
+ populateDN(str);
+
+ if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled())
+ if (wizardInfo.isCACertLocalCA())
+ mHelpIndex = CAKRALOCALHELPINDEX;
+ else
+ mHelpIndex = CAKRAREMOTEHELPINDEX;
+ else if (wizardInfo.isCACertLocalCA())
+ mHelpIndex = CALOCALHELPINDEX;
+ else
+ mHelpIndex = CAREMOTEHELPINDEX;
+ return super.initializePanel(info);
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+
+ if (super.concludePanel(info)) {
+ wizardInfo.setCASubjectName(mStr);
+ return true;
+ }
+
+ return false;
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+/*
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ String str = mOText.getText().trim();
+ wizardInfo.setCAOComp(str);
+ str = mCText.getText().trim();
+ wizardInfo.setCACComp(str);
+*/
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICACertExtensionPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICACertExtensionPage.java
new file mode 100644
index 000000000..1a1a1a8b9
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICACertExtensionPage.java
@@ -0,0 +1,80 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.border.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+
+/**
+ * Certificate Extension page for CA signing Certificate.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WICACertExtensionPage extends WICertExtensionPage {
+ private static final String PANELNAME = "INSTALLCACERTEXTENSION1WIZARD";
+ private static final String CAHELPINDEX = "install-cacert-extension-wizard-help";
+ private static final String CAKRAHELPINDEX = "install-cakracert-extension-wizard-help";
+
+ WICACertExtensionPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WICACertExtensionPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isCACloningDone())
+ return false;
+
+ if (!wizardInfo.isCAInstalled() || wizardInfo.isMigrationEnable() ||
+ wizardInfo.isSelfSignedCACertDone() ||
+ wizardInfo.isCACertRequestDone() || wizardInfo.isCACertInstalledDone())
+ return false;
+
+ if (!mModified) {
+ mBasicCheckBox.setSelected(true);
+ mAKICheckBox.setSelected(true);
+ mCACheckBox.setSelected(true);
+ mSKICheckBox.setSelected(true);
+ mCertPathBox.setSelected(false);
+ mExtendedKeyCheckBox.setSelected(false);
+ mKeyUsageBox.setSelected(true);
+ }
+
+ if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = CAKRAHELPINDEX;
+ else
+ mHelpIndex = CAHELPINDEX;
+
+ return super.initializePanel(info);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICACertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICACertPage.java
new file mode 100644
index 000000000..b962c6ca1
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICACertPage.java
@@ -0,0 +1,172 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * This page allows the user to generate a CA certificate request.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WICACertPage extends WizardBasePanel implements IWizardPanel {
+ private JRadioButton mSelfBtn, mSubordinateBtn, mEmailBtn;
+ private JRadioButton mUrlBtn, mManualBtn;
+ private JTextField mEmailText;
+ private JTextField mUrlText;
+ private static final String PANELNAME = "CACERTWIZARD";
+ private static final String HELPINDEX =
+ "configuration-kra-wizard-change-keyscheme-help";
+
+ WICACertPage() {
+ super(PANELNAME);
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ JTextArea desc = createTextArea(
+ CMSAdminUtil.wrapText(mResource.getString(
+ "CACERTWIZARD_TEXT_HEADING_LABEL"), 80), 1, 80);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+
+ mSelfBtn = makeJRadioButton("SELF", true);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mSelfBtn, gbc);
+
+ mSubordinateBtn = makeJRadioButton("SUBORDINATE", false);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0,COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mSubordinateBtn, gbc);
+
+ JTextArea desc1 = createTextArea(
+ CMSAdminUtil.wrapText(mResource.getString(
+ "CACERTWIZARD_TEXT_HEADING1_LABEL"), 80), 2, 80);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc1, gbc);
+
+ mEmailBtn = makeJRadioButton("EMAIL", true);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ add(mEmailBtn, gbc);
+
+ mEmailText = makeJTextField(30);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ add(mEmailText, gbc);
+
+ mUrlBtn = makeJRadioButton("URL", false);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ add(mUrlBtn, gbc);
+
+ mUrlText = makeJTextField(30);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ gbc.fill = gbc.NONE;
+ add(mUrlText, gbc);
+
+ mManualBtn = makeJRadioButton("MANUAL", false);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mManualBtn, gbc);
+
+ JLabel dummy = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ add(dummy, gbc);
+
+ ButtonGroup CAButtonGrp = new ButtonGroup();
+ CAButtonGrp.add(mSelfBtn);
+ CAButtonGrp.add(mSubordinateBtn);
+
+ ButtonGroup MethodButtonGrp = new ButtonGroup();
+ MethodButtonGrp.add(mEmailBtn);
+ MethodButtonGrp.add(mUrlBtn);
+ MethodButtonGrp.add(mManualBtn);
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICACertSubmitPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICACertSubmitPage.java
new file mode 100644
index 000000000..efa2d8b0c
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICACertSubmitPage.java
@@ -0,0 +1,79 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+
+/**
+ * CA Certificate Submission.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WICACertSubmitPage extends WICertSubmitPage implements IWizardPanel {
+ private static final String PANELNAME = "INSTALLCACERTWIZARD";
+ private static final String CAHELPINDEX = "install-catype-wizard-help";
+ private static final String CAKRAHELPINDEX = "install-cakratype-wizard-help";
+
+ WICACertSubmitPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WICACertSubmitPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+
+ if (wizardInfo.isCloning() && wizardInfo.isCACloningDone())
+ return false;
+
+ wizardInfo.put(Constants.PR_CERTIFICATE_TYPE,
+ Constants.PR_CA_SIGNING_CERT);
+ if (!wizardInfo.isCAInstalled() || wizardInfo.isMigrationEnable() ||
+ wizardInfo.isSelfSignedCACertDone() || wizardInfo.isCACertRequestDone() ||
+ wizardInfo.isCACertInstalledDone())
+ return false;
+ if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = CAKRAHELPINDEX;
+ else
+ mHelpIndex = CAHELPINDEX;
+ return super.initializePanel(info);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (mSelfButton.isSelected())
+ wizardInfo.setCACertLocalCA(Constants.TRUE);
+ else
+ wizardInfo.setCACertLocalCA(Constants.FALSE);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICACertValidityPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICACertValidityPage.java
new file mode 100644
index 000000000..cb8fa550d
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICACertValidityPage.java
@@ -0,0 +1,75 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import javax.swing.event.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+
+/**
+ * Validity page for CA signing certificate.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WICACertValidityPage extends WICertValidityPage {
+ private static final String PANELNAME = "INSTALLCACERTVALIDWIZARD";
+ private static final String CAHELPINDEX = "install-cacert-validity-wizard-help";
+ private static final String CAKRAHELPINDEX = "install-cakracert-validity-wizard-help";
+
+ WICACertValidityPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WICACertValidityPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isCACloningDone())
+ return false;
+ if (!wizardInfo.isCAInstalled() || wizardInfo.isMigrationEnable() ||
+ wizardInfo.isSelfSignedCACertDone() || wizardInfo.isCACertRequestDone() ||
+ wizardInfo.isCACertInstalledDone())
+ return false;
+ if (super.initializePanel(info)) {
+ if (!wizardInfo.isCACertLocalCA())
+ return false;
+
+ if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = CAKRAHELPINDEX;
+ else
+ mHelpIndex = CAHELPINDEX;
+
+ return true;
+ }
+ return false;
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICAKeyPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICAKeyPage.java
new file mode 100644
index 000000000..accc866b2
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICAKeyPage.java
@@ -0,0 +1,115 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import javax.swing.event.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+
+/**
+ * Setup key information for CA signing certificate
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WICAKeyPage extends WIKeyPage implements IWizardPanel {
+ private static final String PANELNAME = "INSTALLCAKEYWIZARD";
+ private static final String CALOCALHELPINDEX =
+ "install-cakeylocal-configuration-wizard-help";
+ private static final String CAREMOTEHELPINDEX =
+ "install-cakeysub-configuration-wizard-help";
+ private static final String CAKRALOCALHELPINDEX =
+ "install-cakrakeylocal-configuration-wizard-help";
+ private static final String CAKRAREMOTEHELPINDEX =
+ "install-cakrakeysub-configuration-wizard-help";
+
+ WICAKeyPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WICAKeyPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ mWizardInfo = (InstallWizardInfo)info;
+ if (mWizardInfo.isCloning() && mWizardInfo.isCACloningDone())
+ return false;
+
+ if (!mWizardInfo.isCAInstalled() || mWizardInfo.isMigrationEnable() ||
+ mWizardInfo.isSelfSignedCACertDone() || mWizardInfo.isCACertRequestDone() ||
+ mWizardInfo.isCACertInstalledDone())
+ return false;
+
+ if (super.initializePanel(info)) {
+ String caTokenName = mWizardInfo.getCATokenName();
+ if (caTokenName == null || caTokenName.equals("")) {
+ mTokenBox.setSelectedIndex(0);
+ } else {
+ if (caTokenName.equals(Constants.PR_INTERNAL_TOKEN_NAME))
+ mTokenBox.setSelectedIndex(0);
+ else
+ mTokenBox.setSelectedItem(caTokenName);
+ }
+ }
+
+ int counts = mKeyTypeBox.getItemCount();
+ if (counts == 1)
+ mKeyTypeBox.addItem("DSA");
+
+ if (mWizardInfo.isCAInstalled() && mWizardInfo.isKRAInstalled()) {
+ if (mWizardInfo.isCACertLocalCA())
+ mHelpIndex = CAKRALOCALHELPINDEX;
+ else
+ mHelpIndex = CAKRAREMOTEHELPINDEX;
+ } else if (mWizardInfo.isCACertLocalCA())
+ mHelpIndex = CALOCALHELPINDEX;
+ else
+ mHelpIndex = CAREMOTEHELPINDEX;
+
+ enableFields();
+ mIsCAKey = true;
+ return true;
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ super.getUpdateInfo(info);
+ mWizardInfo.setCATokenName(mWizardInfo.getTokenName());
+
+ if (mPassword.isEditable()) {
+ String tokenname = mWizardInfo.getCATokenName();
+
+ // this is used for single signon. The key is the token name with
+ // the prefix "TOKEN:" and the value is the token password.
+ mWizardInfo.put("TOKEN:"+tokenname, mPassword.getText().trim());
+ }
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICAMessageDigestPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICAMessageDigestPage.java
new file mode 100644
index 000000000..e19fc6586
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICAMessageDigestPage.java
@@ -0,0 +1,80 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.text.*;
+import javax.swing.border.*;
+import javax.swing.event.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Setup the message digest information for the installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WICAMessageDigestPage extends WMessageDigestPage {
+
+ private static final String PANELNAME = "INSTALLCAMESSAGEDIGESTWIZARD";
+
+ WICAMessageDigestPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WICAMessageDigestPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isCACloningDone())
+ return false;
+
+ if (!wizardInfo.isCAInstalled() || wizardInfo.isMigrationEnable() ||
+ !wizardInfo.isCACertLocalCA() || wizardInfo.isSelfSignedCACertDone() ||
+ wizardInfo.isCACertRequestDone() || wizardInfo.isCACertInstalledDone())
+ return false;
+
+ mCAKeyType = wizardInfo.getCAKeyType();
+
+ return super.initializePanel(info);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (mDSAHashTypeBox.isVisible())
+ wizardInfo.setHashType((String)mDSAHashTypeBox.getSelectedItem());
+ else
+ wizardInfo.setHashType((String)mRSAHashTypeBox.getSelectedItem());
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICAOCSPServicePage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICAOCSPServicePage.java
new file mode 100644
index 000000000..9245b14bf
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICAOCSPServicePage.java
@@ -0,0 +1,172 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.util.*;
+import java.math.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+
+/**
+ * This panel asks for the starting serial number that the CA issues
+ *
+ * @author Michelle Zhao
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WICAOCSPServicePage extends WizardBasePanel implements IWizardPanel {
+ private JTextArea mDesc;
+
+ private boolean mEnable;
+ private JCheckBox mOCSPServiceCB;
+ private JLabel mOCSPServiceLabel;
+
+ private static final String PANELNAME = "CAOCSPSERVICEWIZARD";
+ private static final String HELPINDEX =
+ "install-ca-ocspservice-wizard-help";
+
+ WICAOCSPServicePage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WICAOCSPServicePage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ String serial;
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ setBorder(makeTitledBorder(PANELNAME));
+ // If ca's signing cert is not generated,
+ // we allow "back" to modify the panel
+ if (!wizardInfo.isCAInstalled())
+ return false;
+ if (wizardInfo.isOCSPServiceDone())
+ return false;
+ if (wizardInfo.isOCSPInstalled())
+ return false;
+
+ mDesc.setText(mResource.getString(PANELNAME+"_TEXT_HEADING_LABEL"));
+
+ return true;
+ }
+
+ public boolean validatePanel()
+ {
+ mEnable = mOCSPServiceCB.isSelected();
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+
+ String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_ADD_OCSP_SERVICE;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY;
+ if (mEnable)
+ rawData = rawData+"&"+ConfigConstants.PR_CA_OCSP_SERVICE+"="+
+ "true";
+ else
+ rawData = rawData+"&"+ConfigConstants.PR_CA_OCSP_SERVICE+"="+
+ "false";
+
+ startProgressStatus();
+
+ boolean ready = send(rawData, wizardInfo);
+ endProgressStatus();
+
+ if (!ready) {
+ String str = getErrorMessage(wizardInfo);
+ if (str.equals(""))
+ setErrorMessage("Server Error");
+ else
+ setErrorMessage(str);
+ }
+
+ return ready;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mDesc = createTextArea(mResource.getString(
+ PANELNAME+"_TEXT_HEADING_LABEL"));
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mDesc, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mOCSPServiceLabel = makeJLabel("OCSPSERVICE");
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mOCSPServiceLabel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mOCSPServiceCB = makeJCheckBox("OCSPSERVICE");
+ mOCSPServiceCB.setSelected(true);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mOCSPServiceCB, gbc);
+
+ JLabel dummy = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ add(dummy, gbc);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (mEnable)
+ wizardInfo.setOCSPService(ConfigConstants.TRUE);
+ else
+ wizardInfo.setOCSPService(ConfigConstants.FALSE);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICARequestResultPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICARequestResultPage.java
new file mode 100644
index 000000000..f40898821
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICARequestResultPage.java
@@ -0,0 +1,59 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Display the CA signing certificate request result
+ *
+ * @author Michelle Zhao
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WICARequestResultPage extends WIRequestResultPage {
+ WICARequestResultPage(JDialog parent) {
+ super(parent);
+ }
+
+ WICARequestResultPage(JDialog parent, JFrame adminFrame) {
+ super( parent, adminFrame);
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isCACloningDone())
+ return false;
+
+ if (wizardInfo.isCACertLocalCA() || !wizardInfo.isCAInstalled() ||
+ wizardInfo.isMigrationEnable() ||
+ wizardInfo.isCACertInstalledDone() ||
+ (wizardInfo.isCACertRequestSucc() && wizardInfo.isCAReqResultDisplayed()) ||
+ wizardInfo.isSelfSignedCACertDone())
+ return false;
+
+ wizardInfo.setCAReqResultDisplayed(Constants.TRUE);
+ return super.initializePanel(info);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICASerialNumberPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICASerialNumberPage.java
new file mode 100644
index 000000000..3b1653d7f
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICASerialNumberPage.java
@@ -0,0 +1,381 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.util.*;
+import java.math.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+
+/**
+ * This panel asks for the starting serial number that the CA issues
+ *
+ * @author Michelle Zhao
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WICASerialNumberPage extends WizardBasePanel implements IWizardPanel {
+ private JTextArea mDesc;
+
+ private String mSerialNumber;
+ private JTextField mSerialNumberText;
+ private JLabel mSerialNumberLabel;
+
+ private String mEndSerialNumber = null;
+ private JTextField mEndSerialNumberText;
+ private JLabel mEndSerialNumberLabel;
+
+ private String mbeginRequestNumber;
+ private JTextField mbeginRequestNumberText;
+ private JLabel mbeginRequestNumberLabel;
+
+ private String mEndRequestNumber = null;
+ private JTextField mEndRequestNumberText;
+ private JLabel mEndRequestNumberLabel;
+
+ private static final String DEFAULT_SERIAL_NUMBER = "1";
+ private static final String PANELNAME = "CASERIALNUMBERWIZARD";
+ private static final String HELPINDEX =
+ "install-ca-serialnumber-wizard-help";
+
+ WICASerialNumberPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WICASerialNumberPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ String serial;
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ setBorder(makeTitledBorder(PANELNAME));
+ // If ca's signing cert is not generated,
+ // we allow "back" to modify the panel
+
+ if (!wizardInfo.isCAInstalled() || wizardInfo.isMigrationEnable() ||
+ wizardInfo.isSelfSignedCACertDone() || wizardInfo.isCACertRequestDone()
+ ||wizardInfo.isNumberPageDone())
+ return false;
+
+ if (wizardInfo.isCloning())
+ mDesc.setText(mResource.getString(PANELNAME+"_TEXT_HEADING_LABEL")
+ + mResource.getString(PANELNAME+"_TEXT_MORE_LABEL"));
+ else
+ mDesc.setText(mResource.getString(PANELNAME+"_TEXT_HEADING_LABEL"));
+
+
+ if ((serial = wizardInfo.getCASerialNumber()) != null)
+ mSerialNumberText.setText(serial);
+ else
+ mSerialNumberText.setText(DEFAULT_SERIAL_NUMBER);
+
+ if ((serial = wizardInfo.getRequestNumber()) != null)
+ mbeginRequestNumberText.setText(serial);
+ else
+ mbeginRequestNumberText.setText(DEFAULT_SERIAL_NUMBER);
+
+ if ((serial = wizardInfo.getCAEndSerialNumber()) != null)
+ mEndSerialNumberText.setText(serial);
+
+ if ((serial = wizardInfo.getEndRequestNumber()) != null)
+ mEndRequestNumberText.setText(serial);
+
+ return true;
+ }
+
+ private String hexToDecimal(String hex, boolean isHex)
+ {
+ //String newHex = hex.substring(2);
+ BigInteger bi;
+ if(isHex)
+ bi = new BigInteger(hex, 16);
+ else
+ bi = new BigInteger(hex, 10);
+ return bi.toString();
+ }
+
+ private String DecToHex(String dec)
+ {
+ BigInteger bi;
+ bi = new BigInteger(dec, 10);
+ return bi.toString(16);
+ }
+
+ private boolean validateNumber(JTextField beginNumberField, JTextField endNumberField,String beginText, String endText,boolean isSerialNumber)
+ {
+ BigInteger num = null;
+ BigInteger endNum = null;
+ String serial = null;
+ beginText = beginNumberField.getText().trim();
+ if (beginText != null && !beginText.equals("")) {
+ try {
+ if (beginText.startsWith("0x")) {
+ serial = hexToDecimal(beginText.substring(2),true);
+ } else {
+ serial = beginText;
+ }
+ num = new BigInteger(serial);
+ if (num.compareTo(new BigInteger("0")) < 0) {
+ setErrorMessage("You must specify a positive value.");
+ return false;
+ }
+ } catch (NumberFormatException e) {
+ setErrorMessage("You must specify a numeric value.");
+ return false;
+ }
+ if(isSerialNumber)
+ mSerialNumber = DecToHex(serial); // Hex to the server
+ else
+ mbeginRequestNumber = serial;
+ } else {
+ if(isSerialNumber)
+ mSerialNumber = "";
+ else
+ mbeginRequestNumber = "";
+ }
+ endText = endNumberField.getText().trim();
+ if (endText != null && !endText.equals("")) {
+ try {
+ if (endText.startsWith("0x")) {
+ serial = hexToDecimal(endText.substring(2),true);
+ } else {
+ serial = endText;
+ }
+ endNum = new BigInteger(serial);
+ if (endNum.compareTo(new BigInteger("0")) < 0) {
+ setErrorMessage("You must specify a positive value.");
+ return false;
+ }
+ } catch (NumberFormatException e) {
+ setErrorMessage("You must specify a numeric value.");
+ return false;
+ }
+ if(isSerialNumber)
+ mEndSerialNumber = DecToHex(serial); // Hex to the Server
+ else
+ mEndRequestNumber = serial;
+ } else {
+ if(isSerialNumber)
+ mEndSerialNumber = "";
+ else
+ mEndRequestNumber = "";
+ }
+
+ if (num != null && endNum != null && num.compareTo(endNum) > 0) {
+ setErrorMessage("Ending number must be greater than starting number.");
+ return false;
+ }
+ return true;
+ }
+ public boolean validatePanel() {
+
+ if(validateNumber(mSerialNumberText,mEndSerialNumberText,mSerialNumber,mEndSerialNumber,true)==false)
+ return false;
+ if(validateNumber(mbeginRequestNumberText,mEndRequestNumberText,mbeginRequestNumber,mEndRequestNumber,false)==false)
+ return false;
+
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (mSerialNumber != null && !mSerialNumber.equals(""))
+ wizardInfo.setCASerialNumber(mSerialNumber);
+ else {
+ wizardInfo.setCASerialNumber(DEFAULT_SERIAL_NUMBER);
+ mSerialNumber = DEFAULT_SERIAL_NUMBER;
+ }
+ if (mbeginRequestNumber != null && !mbeginRequestNumber.equals(""))
+ wizardInfo.setRequestNumber(mbeginRequestNumber);
+ else {
+ wizardInfo.setRequestNumber(DEFAULT_SERIAL_NUMBER);
+ mbeginRequestNumber = DEFAULT_SERIAL_NUMBER;
+ }
+
+ String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_SET_CA_SERIAL;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY;
+ if (mSerialNumber != null && !mSerialNumber.equals(""))
+ rawData = rawData+"&"+ConfigConstants.PR_CA_SERIAL_NUMBER+"="+
+ mSerialNumber;
+ if (mEndSerialNumber != null && !mEndSerialNumber.equals(""))
+ rawData = rawData+"&"+ConfigConstants.PR_CA_ENDSERIAL_NUMBER+"="+
+ mEndSerialNumber;
+ if (mbeginRequestNumber != null && !mbeginRequestNumber.equals(""))
+ rawData = rawData+"&"+ConfigConstants.PR_REQUEST_NUMBER+"="+
+ mbeginRequestNumber;
+ if (mEndRequestNumber != null && !mEndSerialNumber.equals(""))
+ rawData = rawData+"&"+ConfigConstants.PR_ENDREQUEST_NUMBER+"="+
+ mEndRequestNumber;
+ if (wizardInfo.getInternalDBPasswd() != null)
+ rawData = rawData+"&"+ConfigConstants.PR_DB_PWD+"="+
+ wizardInfo.getInternalDBPasswd();
+
+ rawData = rawData+"&"+ConfigConstants.PR_SERIAL_REQUEST_NUMBER+"="+
+ ConfigConstants.TRUE;
+ startProgressStatus();
+
+ boolean ready = send(rawData, wizardInfo);
+ endProgressStatus();
+
+ if (!ready) {
+ String str = getErrorMessage(wizardInfo);
+ if (str.equals(""))
+ setErrorMessage("Server Error");
+ else
+ setErrorMessage(str);
+ }else {
+ wizardInfo.setNumberPageDone(ConfigConstants.TRUE);
+ }
+
+ return ready;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mDesc = createTextArea(mResource.getString(
+ PANELNAME+"_TEXT_HEADING_LABEL"));
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mDesc, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mSerialNumberLabel = makeJLabel("SERIALNUMBER");
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mSerialNumberLabel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mSerialNumberText = makeJTextField(30);
+ gbc.anchor = gbc.NORTHWEST;
+// gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mSerialNumberText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mEndSerialNumberLabel = makeJLabel("ENDSERIALNUMBER");
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mEndSerialNumberLabel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mEndSerialNumberText = makeJTextField(30);
+ gbc.anchor = gbc.NORTHWEST;
+// gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mEndSerialNumberText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mbeginRequestNumberLabel = makeJLabel("REQUESTNUMBER");
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mbeginRequestNumberLabel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mbeginRequestNumberText = makeJTextField(30);
+ gbc.anchor = gbc.NORTHWEST;
+// gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mbeginRequestNumberText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mEndRequestNumberLabel = makeJLabel("ENDREQUESTNUMBER");
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mEndRequestNumberLabel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mEndRequestNumberText = makeJTextField(30);
+ gbc.anchor = gbc.NORTHWEST;
+// gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mEndRequestNumberText, gbc);
+
+ /*
+ CMSAdminUtil.resetGBC(gbc);
+ mSerialNumberLabel = makeJLabel("PWD");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, 0, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mSerialNumberLabel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mSerialNumberText = makeJSerialNumberField(30);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mSerialNumberText, gbc);
+*/
+ JLabel dummy = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ add(dummy, gbc);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICATokenLogonPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICATokenLogonPage.java
new file mode 100644
index 000000000..f7068b3d3
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICATokenLogonPage.java
@@ -0,0 +1,76 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+
+/**
+ * This panel asks for the information of the current internal database.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WICATokenLogonPage extends WITokenLogonPage implements IWizardPanel {
+
+ private static final String HELPINDEX = "install-catoken-logon-wizard-help";
+ private static final String PANELNAME = "CATOKENLOGONWIZARD";
+
+ WICATokenLogonPage(JDialog dialog) {
+ super(PANELNAME);
+ mHelpIndex = HELPINDEX;
+ mParent = dialog;
+ }
+
+ WICATokenLogonPage(JDialog dialog, JFrame adminFrame) {
+ super(PANELNAME);
+ mHelpIndex = HELPINDEX;
+ mParent = dialog;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ String tokenname = wizardInfo.getCATokenName();
+ String pwd = (String)wizardInfo.get("TOKEN:"+tokenname);
+ if (wizardInfo.isCloning() && wizardInfo.isCACloningDone()) {
+ if (pwd != null && !pwd.equals(""))
+ return false;
+ }
+
+ if (wizardInfo.isCACertLocalCA() || !wizardInfo.isInstallCertNow()
+ || !wizardInfo.isCAInstalled() || wizardInfo.isMigrationEnable()
+ || wizardInfo.isCACertInstalledDone())
+ return false;
+ if (pwd != null)
+ return false;
+
+ mTokenName = tokenname;
+ mTokenText.setText(tokenname);
+ return super.initializePanel(info);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICertDNPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICertDNPage.java
new file mode 100644
index 000000000..cf7e623ad
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICertDNPage.java
@@ -0,0 +1,153 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import javax.swing.event.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+import com.netscape.management.client.console.*;
+import com.netscape.admin.certsrv.task.*;
+
+/**
+ * Specify Subject DN for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WICertDNPage extends WBaseDNPage {
+ protected String mSubjectName;
+ protected String mHelpIndex;
+ protected static final String CA_CN = "CN=Certificate Manager";
+ protected static final String CA_C = "C=US";
+ protected static final String RA_CN = "CN=Registration Manager";
+ protected static final String RA_C = "C=US";
+ protected static final String OCSP_CN = "CN=Online Certificate Status Manager";
+ protected static final String OCSP_C = "C=US";
+ protected static final String KRA_CN = "CN=Data Recovery Manager";
+ protected static final String KRA_C = "C=US";
+ protected static final String SERVER_C = "C=US";
+ protected String mStr;
+
+ WICertDNPage(String panelName) {
+ super(panelName);
+ mPanelName = panelName;
+ init();
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ setBorder(makeTitledBorder(mPanelName));
+/*
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ String str = wizardInfo.getSubjectName();
+
+ populateDN(str);
+*/
+
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return super.validatePanel();
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ String str1 = mSubjectDNText.getText().trim();
+ String str2 = mSubjectStringText.getText().trim();
+ String str = "";
+
+ if (mDNComponents.isSelected()) {
+ str = str1;
+ } else {
+ str = str2;
+ }
+
+ if (str.equals("")) {
+ setErrorMessage("BLANKFIELD");
+ return false;
+ //str = dnDesc.getText().trim();
+ }
+
+ mStr = CMSAdminUtil.getPureString(str);
+
+ String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_CHECK_DN;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY;
+ rawData = rawData+"&"+ConfigConstants.PR_CERTIFICATE_TYPE+"="+ wizardInfo.getCertType();
+ rawData = rawData+"&"+ConfigConstants.PR_SUBJECT_NAME+"="+mStr;
+
+ startProgressStatus();
+ boolean ready = send(rawData, wizardInfo);
+ endProgressStatus();
+
+ wizardInfo.setSubjectName(mStr);
+
+ if (!ready) {
+ String errstr = getErrorMessage();
+ if (errstr.equals("")) {
+ String errorMsg = mResource.getString(
+ mPanelName+"_ERRORMSG");
+ setErrorMessage(errorMsg);
+ } else
+ setErrorMessage(errstr);
+ }
+
+/*
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ AdminConnection connection = wizardInfo.getAdminConnection();
+ NameValuePairs nvps = new NameValuePairs();
+
+ nvps.add(Constants.PR_SUBJECT_NAME, str);
+ wizardInfo.addEntry(Constants.PR_SUBJECT_NAME, str);
+
+ try {
+ connection.validate(DestDef.DEST_SERVER_ADMIN,
+ ScopeDef.SC_SUBJECT_NAME, nvps);
+ } catch (EAdminException e) {
+ //showErrorDialog(e.toString());
+ setErrorMessage(e.toString());
+ return false;
+ }
+
+ nvps.add(Constants.PR_TOKEN_NAME, wizardInfo.getTokenName());
+ if (wizardInfo.isNewKey()) {
+ nvps.add(Constants.PR_KEY_LENGTH, wizardInfo.getKeyLength());
+ nvps.add(Constants.PR_KEY_TYPE, wizardInfo.getKeyType());
+ }
+
+ wizardInfo.addEntry(wizardInfo.ALL_INFO, nvps);
+*/
+
+ return ready;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(mHelpIndex);
+ }
+
+ protected void init() {
+ super.init();
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICertExtensionPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICertExtensionPage.java
new file mode 100644
index 000000000..8c989685a
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICertExtensionPage.java
@@ -0,0 +1,168 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+
+/**
+ * Certificate Extension for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WICertExtensionPage extends WBaseCertExtensionPage implements
+ IWizardPanel {
+ protected String mHelpIndex;
+
+ WICertExtensionPage(String panelName) {
+ super(panelName);
+ mPanelName = panelName;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ setBorder(makeTitledBorder(mPanelName));
+ return super.initializePanel(info);
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+
+ boolean ready = false;
+
+ String rawData = "";
+ if (mMIMECheckBox.isSelected()) {
+ //Check the extension if it is valid
+ rawData = ConfigConstants.TASKID+"="+TaskId.TASK_CHECK_EXTENSION;
+ rawData = rawData+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY;
+ rawData = rawData+ConfigConstants.PR_CERTIFICATE_EXTENSION+"="+
+ mMIMEText.getText().trim();
+
+ startProgressStatus();
+ ready = send(rawData, wizardInfo);
+ endProgressStatus();
+ if (!ready) {
+ String str = getErrorMessage();
+ if (str.equals("")) {
+ String errorMsg = mResource.getString(
+ mPanelName+"_ERRORMSG");
+ setErrorMessage(errorMsg);
+ } else
+ setErrorMessage(str);
+ }
+ } else
+ ready = true;
+
+ if (ready) {
+ NameValuePairs nvps = new NameValuePairs();
+
+ nvps.put(Constants.PR_CERTIFICATE_TYPE, wizardInfo.getCertType());
+ nvps.put(Constants.PR_SUBJECT_NAME, wizardInfo.getSubjectName());
+ nvps.put(Constants.PR_TOKEN_NAME, wizardInfo.getTokenName());
+ nvps.put(Constants.PR_KEY_LENGTH, wizardInfo.getKeyLength());
+ nvps.put(Constants.PR_KEY_TYPE, wizardInfo.getKeyType());
+ nvps.put(Constants.PR_KEY_CURVENAME, wizardInfo.getKeyCurveName());
+ addValidityPeriod(wizardInfo, nvps);
+
+ if (mBasicCheckBox.isSelected())
+ addBasicConstraints(nvps);
+
+ if (mExtendedKeyCheckBox.isSelected())
+ addExtendedKey(nvps);
+
+ if (mAKICheckBox.isSelected())
+ nvps.put(Constants.PR_AKI, Constants.TRUE);
+
+ if (mSKICheckBox.isSelected())
+ nvps.put(Constants.PR_SKI, Constants.TRUE);
+
+ if (mKeyUsageBox.isSelected())
+ nvps.put(Constants.PR_KEY_USAGE, Constants.TRUE);
+
+ if (mMIMECheckBox.isSelected())
+ nvps.put(Constants.PR_DER_EXTENSION, mMIMEText.getText().trim());
+
+ wizardInfo.put(wizardInfo.ALL_CERT_INFO, nvps);
+ }
+
+ mModified = true;
+ return ready;
+ }
+
+ private void addValidityPeriod(InstallWizardInfo wizardInfo,
+ NameValuePairs nvps) {
+ nvps.put(Constants.PR_BEGIN_YEAR, wizardInfo.getBeginYear());
+ nvps.put(Constants.PR_BEGIN_MONTH, wizardInfo.getBeginMonth());
+ nvps.put(Constants.PR_BEGIN_DATE, wizardInfo.getBeginDate());
+ nvps.put(Constants.PR_BEGIN_HOUR, wizardInfo.getBeginHour());
+ nvps.put(Constants.PR_BEGIN_MIN, wizardInfo.getBeginMin());
+ nvps.put(Constants.PR_BEGIN_SEC, wizardInfo.getBeginSec());
+ nvps.put(Constants.PR_AFTER_YEAR, wizardInfo.getAfterYear());
+ nvps.put(Constants.PR_AFTER_MONTH, wizardInfo.getAfterMonth());
+ nvps.put(Constants.PR_AFTER_DATE, wizardInfo.getAfterDate());
+ nvps.put(Constants.PR_AFTER_HOUR, wizardInfo.getAfterHour());
+ nvps.put(Constants.PR_AFTER_MIN, wizardInfo.getAfterMin());
+ nvps.put(Constants.PR_AFTER_SEC, wizardInfo.getAfterSec());
+ }
+
+ private void addBasicConstraints(NameValuePairs nvps) {
+ if (mCACheckBox.isSelected())
+ nvps.put(Constants.PR_IS_CA, Constants.TRUE);
+
+ if (mCertPathBox.isSelected()) {
+ String certLen = mCertPathText.getText().trim();
+ if (!certLen.equals(""))
+ nvps.put(Constants.PR_CERT_LEN, certLen);
+ } else {
+ // negative number means infinity
+ nvps.put(Constants.PR_CERT_LEN, "-1");
+ }
+ }
+
+ private void addExtendedKey(NameValuePairs nvps) {
+ if (mSSLClient.isSelected())
+ nvps.put(Constants.PR_SSL_CLIENT_BIT, Constants.TRUE);
+ if (mSSLServer.isSelected())
+ nvps.put(Constants.PR_SSL_SERVER_BIT, Constants.TRUE);
+ if (mSSLMail.isSelected())
+ nvps.put(Constants.PR_SSL_MAIL_BIT, Constants.TRUE);
+ if (mObjectSigning.isSelected())
+ nvps.put(Constants.PR_OBJECT_SIGNING_BIT, Constants.TRUE);
+ if (mTimeStamping.isSelected())
+ nvps.put(Constants.PR_TIMESTAMPING_BIT, Constants.TRUE);
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(mHelpIndex);
+ }
+
+ protected void init() {
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICertRequestPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICertRequestPage.java
new file mode 100644
index 000000000..d4926e1e9
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICertRequestPage.java
@@ -0,0 +1,73 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+
+/**
+ * Introduction page for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WICertRequestPage extends WBaseCertRequestPage implements IWizardPanel {
+ private JButton mCopy;
+ private JTextArea mText;
+ private static final String PANELNAME = "CERTREQUESTWIZARD";
+ private static final String HELPINDEX =
+ "configuration-kra-wizard-change-keyscheme-help";
+
+ WICertRequestPage() {
+ super(PANELNAME);
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICertSetupStatusPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICertSetupStatusPage.java
new file mode 100644
index 000000000..ff9ca97a6
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICertSetupStatusPage.java
@@ -0,0 +1,144 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.util.Hashtable;
+import java.net.URL;
+import java.io.InputStream;
+import java.io.ByteArrayInputStream;
+import java.awt.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.wizard.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import javax.swing.event.*;
+import com.netscape.management.client.console.ConsoleInfo;
+import com.netscape.management.client.util.*;
+import com.netscape.management.client.comm.*;
+import com.netscape.management.client.*;
+
+/**
+ * Status page for the configuration of the certificate server.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WICertSetupStatusPage extends WizardBasePanel implements IWizardPanel {
+ private JTextArea desc;
+ private static final String PANELNAME = "INSTALLCONFIGSTATUSWIZARD";
+ private static final String HELPINDEX = "install-certsetup-status-wizard-help";
+
+ WICertSetupStatusPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WICertSetupStatusPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return true;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ String str = "";
+ if (wizardInfo.isCAInstalled()) {
+
+ String str1 = "";
+ // display status
+ str = mResource.getString(
+ "INSTALLCONFIGSTATUSWIZARD_CATEXT_DESC_LABEL");
+ if (wizardInfo.isKRAInstalled())
+ str1 = mResource.getString(
+ "INSTALLCONFIGSTATUSWIZARD_CAKRATEXT_DESC_LABEL");
+ String link = "https://"+wizardInfo.getMachineName()+":"+
+ wizardInfo.getAdminPort() + "/ca/adminEnroll.html";
+ desc.setText(str+"\n"+link+"\n\n"+str1);
+ } else if (wizardInfo.isOCSPInstalled()) {
+ desc.setText(mResource.getString(
+ "INSTALLCONFIGSTATUSWIZARD_OCSPTEXT_DESC_LABEL"));
+ } else if (wizardInfo.isRAInstalled()) {
+ if (wizardInfo.isKRAInstalled())
+ desc.setText(mResource.getString(
+ "INSTALLCONFIGSTATUSWIZARD_RAKRATEXT_DESC_LABEL"));
+ else
+ desc.setText(mResource.getString(
+ "INSTALLCONFIGSTATUSWIZARD_RATEXT_DESC_LABEL"));
+ } else if (wizardInfo.isKRAInstalled()) {
+ desc.setText(mResource.getString(
+ "INSTALLCONFIGSTATUSWIZARD_KRATEXT_DESC_LABEL"));
+ }
+ else if (wizardInfo.isTKSInstalled()) {
+ desc.setText(mResource.getString(
+ "INSTALLCONFIGSTATUSWIZARD_TKSTEXT_DESC_LABEL"));
+ }
+ setBorder(makeTitledBorder(PANELNAME));
+
+ CMSAdmin admin = (CMSAdmin)wizardInfo.get("CMSAdmin");
+ IPage viewInstance = (IPage)wizardInfo.get("viewInstance");
+ if (viewInstance != null)
+ admin.updateMenu(viewInstance);
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+/*
+ desc = new JTextArea("", 4, 80);
+ desc.setBackground(getBackground());
+ desc.setEditable(false);
+ desc.setCaretColor(getBackground());
+*/
+ desc = createTextArea("");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ add(desc, gbc);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICertSubmitPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICertSubmitPage.java
new file mode 100644
index 000000000..18beac219
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICertSubmitPage.java
@@ -0,0 +1,144 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+
+/**
+ * Introduction page for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WICertSubmitPage extends WizardBasePanel implements IWizardPanel {
+ protected JRadioButton mSelfButton;
+ protected JRadioButton mSubordinateButton;
+ protected JTextArea mLabel;
+ protected String mHelpIndex;
+ private String mPanelName;
+ protected InstallWizardInfo mWizardInfo;
+
+ WICertSubmitPage(String panelName) {
+ super(panelName);
+ mPanelName = panelName;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ setBorder(makeTitledBorder(mPanelName));
+ mWizardInfo = (InstallWizardInfo)info;
+ if (!mWizardInfo.getCertType().equals(Constants.PR_CA_SIGNING_CERT)) {
+ if (mWizardInfo.isCACertRequestDone() &&
+ !mWizardInfo.isCACertInstalledDone()) {
+ mSubordinateButton.setSelected(true);
+ mSelfButton.setSelected(false);
+ }
+ }
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(mHelpIndex);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mLabel = createTextArea(mResource.getString(
+ mPanelName+"_TEXT_HEADING_LABEL"));
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mLabel, gbc);
+
+ mSelfButton = makeJRadioButton("SELF", true);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mSelfButton, gbc);
+
+ mSubordinateButton = makeJRadioButton("SUB", false);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mSubordinateButton, gbc);
+
+ ButtonGroup buttonGroup = new ButtonGroup();
+ buttonGroup.add(mSelfButton);
+ buttonGroup.add(mSubordinateButton);
+
+ JLabel dummy = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ add(dummy, gbc);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ if (!mWizardInfo.getCertType().equals(Constants.PR_CA_SIGNING_CERT)) {
+ if (e.getSource().equals(mSelfButton)) {
+ if (mWizardInfo.isCACertRequestDone() &&
+ !mWizardInfo.isCACertInstalledDone()) {
+ String errorMsg = mResource.getString(mPanelName+"_LABEL_INCOMPLETE_LABEL");
+ JOptionPane.showMessageDialog(mParent, errorMsg, "Warning",
+ JOptionPane.WARNING_MESSAGE,
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_WARN_ICON));
+ mSelfButton.setSelected(false);
+ mSubordinateButton.setSelected(true);
+ }
+ }
+ }
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICertValidityPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICertValidityPage.java
new file mode 100644
index 000000000..8f2acd493
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICertValidityPage.java
@@ -0,0 +1,141 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.util.*;
+import java.text.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import javax.swing.event.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+
+/**
+ * Validity page for installation wizard
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WICertValidityPage extends WBaseValidityPage implements IWizardPanel {
+ private String mPanelName;
+ protected String mHelpIndex;
+
+ WICertValidityPage(String panelName) {
+ super(panelName);
+ mPanelName = panelName;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ setBorder(makeTitledBorder(mPanelName));
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(mHelpIndex);
+ }
+
+ protected void init() {
+ super.init();
+ }
+
+ public boolean validatePanel() {
+ boolean status = super.validatePanel();
+ Date currTime = new Date();
+
+ if (status) {
+ if (currTime.before(mBeforeDate)) {
+ if (!mWarningDisplayed) {
+ setErrorMessage("INVALIDCERT");
+ mWarningDisplayed = true;
+ return false;
+ }
+ }
+ }
+
+ return status;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (!wizardInfo.getCertType().equals(Constants.PR_CA_SIGNING_CERT)) {
+ String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_VALIDITY_PERIOD;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY;
+ rawData = rawData+"&"+ConfigConstants.PR_NOTAFTER+"="+mAfterDate.getTime();
+ startProgressStatus();
+ boolean ready = send(rawData, wizardInfo);
+ endProgressStatus();
+
+ if (!ready) {
+ String str = getErrorMessage(wizardInfo);
+ if (str.equals("")) {
+ String errorMsg = mResource.getString(
+ mPanelName+"_ERRORMSG");
+ setErrorMessage(errorMsg);
+ } else if (str.equals("beyondCAValidity")) {
+ String errormsg = mResource.getString(mPanelName+"_BEYONDCAVALIDITY");
+ int status = JOptionPane.showConfirmDialog(mAdminFrame, errormsg, "Information",
+ JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE,
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_INFO_ICON));
+ if (status == JOptionPane.OK_OPTION) {
+ rawData = rawData+"&"+ConfigConstants.OVERRIDE_VALIDITY+"="+ConfigConstants.TRUE;
+ ready = send(rawData, wizardInfo);
+ return true;
+ } else {
+ setErrorMessage(mResource.getString(mPanelName+"_ERROR1"));
+ return false;
+ }
+ } else
+ setErrorMessage(str);
+ return ready;
+ }
+ }
+
+ return super.concludePanel(info);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ wizardInfo.addEntry(Constants.PR_BEGIN_YEAR, mBYear.getText().trim());
+ int beforeMonth = Integer.parseInt(mBMonth.getText().trim());
+ wizardInfo.addEntry(Constants.PR_BEGIN_MONTH, ""+(beforeMonth-1));
+ wizardInfo.addEntry(Constants.PR_BEGIN_DATE, mBDay.getText().trim());
+ wizardInfo.addEntry(Constants.PR_BEGIN_HOUR, mBHour.getText().trim());
+ wizardInfo.addEntry(Constants.PR_BEGIN_MIN, mBMin.getText().trim());
+ wizardInfo.addEntry(Constants.PR_BEGIN_SEC, mBSec.getText().trim());
+ wizardInfo.addEntry(Constants.PR_AFTER_YEAR, mEYear.getText().trim());
+ int afterMonth = Integer.parseInt(mEMonth.getText().trim());
+ wizardInfo.addEntry(Constants.PR_AFTER_MONTH, ""+(afterMonth-1));
+ wizardInfo.addEntry(Constants.PR_AFTER_DATE, mEDay.getText().trim());
+ wizardInfo.addEntry(Constants.PR_AFTER_HOUR, mEHour.getText().trim());
+ wizardInfo.addEntry(Constants.PR_AFTER_MIN, mEMin.getText().trim());
+ wizardInfo.addEntry(Constants.PR_AFTER_SEC, mESec.getText().trim());
+ //wizardInfo.addEntry(Constants.PR_VALIDITY_PERIOD, ""+period);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICloneCAKeyCertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICloneCAKeyCertPage.java
new file mode 100644
index 000000000..d5722df32
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICloneCAKeyCertPage.java
@@ -0,0 +1,292 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+
+/**
+ * Introduction page for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WICloneCAKeyCertPage extends WizardBasePanel implements IWizardPanel {
+ private String mCANicknameStr, mSSLNicknameStr, mOCSPNicknameStr;
+ private String mCATokenname, mOCSPTokenname, mSSLTokenname;
+ protected InstallWizardInfo mWizardInfo;
+ protected JComboBox mCANicknameBox, mOCSPNicknameBox, mSSLNicknameBox;
+ private static final String PANELNAME = "CLONECAKEYCERTWIZARD";
+ private static final String CAHELPINDEX =
+ "install-cacertclone-wizard-help";
+
+
+ WICloneCAKeyCertPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ mCANicknameStr = "caSigningCert";
+ mSSLNicknameStr = "Server-Cert";
+ mOCSPNicknameStr = "ocspSigningCert";
+ init();
+ }
+
+ WICloneCAKeyCertPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ mCANicknameStr = "caSigningCert";
+ mSSLNicknameStr = "Server-Cert";
+ mOCSPNicknameStr = "ocspSigningCert";
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ mWizardInfo = wizardInfo;
+ if (!wizardInfo.isCloning())
+ return false;
+ if (!wizardInfo.isCloneCASubsystem())
+ return false;
+ if (wizardInfo.isCACloningDone())
+ return false;
+ if (!wizardInfo.isCAInstalled() || wizardInfo.isMigrationEnable()
+ || wizardInfo.isSelfSignedCACertDone()
+ || wizardInfo.isCACertRequestDone())
+ return false;
+
+ setBorder(makeTitledBorder(PANELNAME));
+ if (mCANicknameBox.getItemCount() > 0) {
+ mCANicknameBox.removeAllItems();
+ }
+
+ if (mOCSPNicknameBox.getItemCount() > 0) {
+ mOCSPNicknameBox.removeAllItems();
+ }
+
+ if (mSSLNicknameBox.getItemCount() > 0) {
+ mSSLNicknameBox.removeAllItems();
+ }
+ String certsList = mWizardInfo.getCloneCertsList();
+ StringTokenizer t1 = new StringTokenizer(certsList, ";");
+ while (t1.hasMoreTokens()) {
+ String s1 = (String)t1.nextToken();
+ if (s1.indexOf(mCANicknameStr) >= 0)
+ mCANicknameBox.addItem(s1);
+ }
+
+ StringTokenizer t2 = new StringTokenizer(certsList, ";");
+ while (t2.hasMoreTokens()) {
+ String s1 = (String)t2.nextToken();
+ if (s1.indexOf(mSSLNicknameStr) >= 0)
+ mSSLNicknameBox.addItem(s1);
+ }
+
+ StringTokenizer t3 = new StringTokenizer(certsList, ";");
+ while (t3.hasMoreTokens()) {
+ String s1 = (String)t3.nextToken();
+ if (s1.indexOf(mOCSPNicknameStr) >= 0)
+ mOCSPNicknameBox.addItem(s1);
+ }
+
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ String canickname = (String)mCANicknameBox.getSelectedItem();
+ mCATokenname = Constants.PR_INTERNAL_TOKEN_NAME;
+ int index = canickname.indexOf(":");
+ if (index > -1) {
+ mCATokenname = canickname.substring(0, index);
+ }
+ mWizardInfo.put(ConfigConstants.PR_CLONE_CA_TOKEN_NAME, mCATokenname);
+
+ String ocspnickname = (String)mOCSPNicknameBox.getSelectedItem();
+ mOCSPTokenname = Constants.PR_INTERNAL_TOKEN_NAME;
+ index = ocspnickname.indexOf(":");
+ if (index > -1) {
+ mOCSPTokenname = ocspnickname.substring(0, index);
+ }
+ mWizardInfo.put(ConfigConstants.PR_CLONE_OCSP_TOKEN_NAME, mOCSPTokenname);
+
+ String sslnickname = (String)mSSLNicknameBox.getSelectedItem();
+ mSSLTokenname = Constants.PR_INTERNAL_TOKEN_NAME;
+ index = sslnickname.indexOf(":");
+ if (index > -1) {
+ mSSLTokenname = sslnickname.substring(0, index);
+ }
+ mWizardInfo.put(ConfigConstants.PR_CLONE_SSL_TOKEN_NAME, mSSLTokenname);
+
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_CLONING;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY;
+ rawData = rawData+"&"+ConfigConstants.PR_SUBSYSTEM+"="+ConfigConstants.PR_CA;
+ rawData = rawData+"&"+ConfigConstants.PR_CLONE_CA_TOKEN_NAME+"="+
+ mCATokenname;
+ rawData = rawData+"&"+ConfigConstants.PR_CLONE_CA_NICKNAME+"="+
+ mCANicknameBox.getSelectedItem();
+ rawData = rawData+"&"+ConfigConstants.PR_CLONE_OCSP_TOKEN_NAME+"="+
+ mOCSPTokenname;
+ rawData = rawData+"&"+ConfigConstants.PR_CLONE_OCSP_NICKNAME+"="+
+ mOCSPNicknameBox.getSelectedItem();
+ rawData = rawData+"&"+ConfigConstants.PR_CLONE_SSL_TOKEN_NAME+"="+
+ mSSLTokenname;
+ rawData = rawData+"&"+ConfigConstants.PR_CLONE_SSL_NICKNAME+"="+
+ mSSLNicknameBox.getSelectedItem();
+
+ startProgressStatus();
+ boolean ready = send(rawData, wizardInfo);
+ endProgressStatus();
+
+ if (!ready) {
+ String errstr = getErrorMessage(wizardInfo);
+ if (errstr.equals("")) {
+ String errorMsg = mResource.getString(
+ PANELNAME+"_ERRORMSG");
+ setErrorMessage(errorMsg);
+ } else
+ setErrorMessage(errstr);
+ }
+ return ready;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(CAHELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JTextArea heading = createTextArea(mResource.getString(
+ PANELNAME+"_TEXT_HEADING_LABEL"));
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(heading, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel caNicknameLbl = makeJLabel("CANICKNAME");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(caNicknameLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mCANicknameBox = new JComboBox();
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.weightx = 0.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mCANicknameBox, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JTextArea heading1 = createTextArea(mResource.getString(
+ PANELNAME+"_TEXT_HEADING1_LABEL"));
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(heading1, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel ocspNicknameLbl = makeJLabel("OCSPNICKNAME");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(ocspNicknameLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mOCSPNicknameBox = new JComboBox();
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.weightx = 0.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mOCSPNicknameBox, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JTextArea heading2 = createTextArea(mResource.getString(
+ PANELNAME+"_TEXT_HEADING2_LABEL"));
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(heading2, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel sslNicknameLbl = makeJLabel("SSLNICKNAME");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(sslNicknameLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mSSLNicknameBox = new JComboBox();
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.weightx = 0.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mSSLNicknameBox, gbc);
+
+ JLabel dummy = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ add(dummy, gbc);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ mWizardInfo.setCATokenName(mCATokenname);
+ mWizardInfo.setOCSPTokenName(mOCSPTokenname);
+ mWizardInfo.setSSLTokenName(mSSLTokenname);
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICloneKRAKeyCertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICloneKRAKeyCertPage.java
new file mode 100644
index 000000000..bea79b2e0
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICloneKRAKeyCertPage.java
@@ -0,0 +1,292 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+
+/**
+ * Introduction page for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WICloneKRAKeyCertPage extends WizardBasePanel implements IWizardPanel {
+ private String mKRANicknameStr, mStorageNicknameStr, mSSLNicknameStr;
+ private String mKRATokenname, mStorageTokenname, mSSLTokenname;
+ protected InstallWizardInfo mWizardInfo;
+ protected JComboBox mKRANicknameBox, mStorageNicknameBox, mSSLNicknameBox;
+ private static final String PANELNAME = "CLONEKRAKEYCERTWIZARD";
+ private static final String KRAHELPINDEX =
+ "install-kracertclone-wizard-help";
+
+
+ WICloneKRAKeyCertPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ mKRANicknameStr = "kraTransportCert";
+ mSSLNicknameStr = "Server-Cert";
+ mStorageNicknameStr = "kraStorageCert";
+ init();
+ }
+
+ WICloneKRAKeyCertPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ mKRANicknameStr = "kraTransportCert";
+ mSSLNicknameStr = "Server-Cert";
+ mStorageNicknameStr = "kraStorageCert";
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ mWizardInfo = wizardInfo;
+ if (!wizardInfo.isCloning())
+ return false;
+ if (!wizardInfo.isCloneKRASubsystem())
+ return false;
+ if (wizardInfo.isKRACloningDone())
+ return false;
+
+ if (!wizardInfo.isKRAInstalled() ||
+ wizardInfo.isKRACertRequestDone()) {
+ return false;
+ }
+
+ setBorder(makeTitledBorder(PANELNAME));
+ if (mKRANicknameBox.getItemCount() > 0) {
+ mKRANicknameBox.removeAllItems();
+ }
+
+ if (mStorageNicknameBox.getItemCount() > 0) {
+ mStorageNicknameBox.removeAllItems();
+ }
+
+ if (mSSLNicknameBox.getItemCount() > 0) {
+ mSSLNicknameBox.removeAllItems();
+ }
+ String certsList = mWizardInfo.getCloneCertsList();
+ StringTokenizer t1 = new StringTokenizer(certsList, ";");
+ while (t1.hasMoreTokens()) {
+ String s1 = (String)t1.nextToken();
+ if (s1.indexOf(mStorageNicknameStr) >= 0)
+ mStorageNicknameBox.addItem(s1);
+ }
+
+ StringTokenizer t2 = new StringTokenizer(certsList, ";");
+ while (t2.hasMoreTokens()) {
+ String s1 = (String)t2.nextToken();
+ if (s1.indexOf(mSSLNicknameStr) >= 0)
+ mSSLNicknameBox.addItem(s1);
+ }
+
+ StringTokenizer t3 = new StringTokenizer(certsList, ";");
+ while (t3.hasMoreTokens()) {
+ String s1 = (String)t3.nextToken();
+ if (s1.indexOf(mKRANicknameStr) >= 0)
+ mKRANicknameBox.addItem(s1);
+ }
+
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ String kranickname = (String)mKRANicknameBox.getSelectedItem();
+ mKRATokenname = Constants.PR_INTERNAL_TOKEN_NAME;
+ int index = kranickname.indexOf(":");
+ if (index > -1) {
+ mKRATokenname = kranickname.substring(0, index);
+ }
+ mWizardInfo.put(ConfigConstants.PR_CLONE_KRA_TOKEN_NAME, mKRATokenname);
+
+ String storagenickname = (String)mStorageNicknameBox.getSelectedItem();
+ mStorageTokenname = Constants.PR_INTERNAL_TOKEN_NAME;
+ index = storagenickname.indexOf(":");
+ if (index > -1) {
+ mStorageTokenname = storagenickname.substring(0, index);
+ }
+ mWizardInfo.put(ConfigConstants.PR_CLONE_STORAGE_TOKEN_NAME, mStorageTokenname);
+
+ String sslnickname = (String)mSSLNicknameBox.getSelectedItem();
+ mSSLTokenname = Constants.PR_INTERNAL_TOKEN_NAME;
+ index = sslnickname.indexOf(":");
+ if (index > -1) {
+ mSSLTokenname = sslnickname.substring(0, index);
+ }
+ mWizardInfo.put(ConfigConstants.PR_CLONE_SSL_TOKEN_NAME, mSSLTokenname);
+
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_CLONING;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY;
+ rawData = rawData+"&"+ConfigConstants.PR_SUBSYSTEM+"="+ConfigConstants.PR_KRA;
+ rawData = rawData+"&"+ConfigConstants.PR_CLONE_KRA_TOKEN_NAME+"="+
+ mKRATokenname;
+ rawData = rawData+"&"+ConfigConstants.PR_CLONE_KRA_NICKNAME+"="+
+ mKRANicknameBox.getSelectedItem();
+ rawData = rawData+"&"+ConfigConstants.PR_CLONE_STORAGE_TOKEN_NAME+"="+
+ mStorageTokenname;
+ rawData = rawData+"&"+ConfigConstants.PR_CLONE_STORAGE_NICKNAME+"="+
+ mStorageNicknameBox.getSelectedItem();
+ rawData = rawData+"&"+ConfigConstants.PR_CLONE_SSL_TOKEN_NAME+"="+
+ mSSLTokenname;
+ rawData = rawData+"&"+ConfigConstants.PR_CLONE_SSL_NICKNAME+"="+
+ mSSLNicknameBox.getSelectedItem();
+
+ startProgressStatus();
+ boolean ready = send(rawData, wizardInfo);
+ endProgressStatus();
+
+ if (!ready) {
+ String errstr = getErrorMessage();
+ if (errstr.equals("")) {
+ String errorMsg = mResource.getString(
+ PANELNAME+"_ERRORMSG");
+ setErrorMessage(errorMsg);
+ } else
+ setErrorMessage(errstr);
+ }
+ return ready;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(KRAHELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JTextArea heading = createTextArea(mResource.getString(
+ PANELNAME+"_TEXT_HEADING_LABEL"));
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(heading, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel kraNicknameLbl = makeJLabel("KRANICKNAME");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(kraNicknameLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mKRANicknameBox = new JComboBox();
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.weightx = 0.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mKRANicknameBox, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JTextArea heading1 = createTextArea(mResource.getString(
+ PANELNAME+"_TEXT_HEADING1_LABEL"));
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(heading1, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel storageNicknameLbl = makeJLabel("STORAGENICKNAME");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(storageNicknameLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mStorageNicknameBox = new JComboBox();
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.weightx = 0.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mStorageNicknameBox, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JTextArea heading2 = createTextArea(mResource.getString(
+ PANELNAME+"_TEXT_HEADING2_LABEL"));
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(heading2, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel sslNicknameLbl = makeJLabel("SSLNICKNAME");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(sslNicknameLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mSSLNicknameBox = new JComboBox();
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.weightx = 0.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mSSLNicknameBox, gbc);
+
+ JLabel dummy = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ add(dummy, gbc);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ mWizardInfo.setKRATokenName(mKRATokenname);
+ mWizardInfo.setSSLTokenName(mSSLTokenname);
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICloneMasterPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICloneMasterPage.java
new file mode 100644
index 000000000..c8498f306
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICloneMasterPage.java
@@ -0,0 +1,409 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+import com.netscape.management.client.util.*;
+import javax.swing.*;
+import java.awt.*;
+import java.util.*;
+import java.awt.event.*;
+
+/**
+ * Clone CA getting Clone Master connector info.
+ *
+ * @author Christina Fu
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+
+class WICloneMasterPage extends WizardBasePanel implements IWizardPanel {
+ protected JTextField mHostText, mPortText, mPortEEText, mTimeoutText;
+ protected JLabel mHostLbl, mPortLbl, mPortEELbl, mTimeoutLbl, mTimeunitLbl;
+ protected JRadioButton mYes, mNo;
+ protected String mHost, mPort, mPortEE, mTimeout;
+ protected JTextArea mHeading;
+ protected Color mActiveColor;
+ public static final int MAX_PORT = 65535;
+ public static final int MIN_PORT = 1;
+ private static final String PANELNAME = "CLONEMASTERWIZARD";
+ private static final String HELPINDEX1 = "install-ca-clone-master-wizard-help";
+
+ private InstallWizardInfo mWizardInfo;
+
+ WICloneMasterPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WICloneMasterPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ mWizardInfo = wizardInfo;
+ Debug.println("WICloneMasterPage: initializing");
+
+ if (wizardInfo.isCloneMasterDone())
+ return false;
+
+ if (wizardInfo.isCloning()) {
+ Debug.println("WICloneMasterPage: is cloning");
+ setBorder(makeTitledBorder(PANELNAME));
+ if (mYes.isSelected())
+ enableFields(true, mActiveColor);
+ else
+ enableFields(false, getBackground());
+ return true;
+ }
+ return false;
+ }
+
+ public boolean validatePanel() {
+ if (mNo.isSelected()) {
+ mHost = "";
+ mPort = "";
+ mPortEE = "";
+ mTimeout = "";
+ return true;
+ }
+
+ mHost = mHostText.getText().trim();
+ mPort = mPortText.getText().trim();
+ mPortEE = mPortEEText.getText().trim();
+ mTimeout = mTimeoutText.getText().trim();
+ if (mHost.equals("")) {
+ setErrorMessage("BLANKHOST");
+ return false;
+ }
+ if (mPort.equals("")) {
+ setErrorMessage("BLANKPORT");
+ return false;
+ }
+ if (mPortEE.equals("")) {
+ setErrorMessage("BLANKPORT");
+ return false;
+ }
+ if (mTimeout.equals("")) {
+ setErrorMessage("BLANKTIMEOUT");
+ return false;
+ }
+
+ try {
+ int portnumber = Integer.parseInt(mPort);
+ if (portnumber < MIN_PORT || portnumber > MAX_PORT) {
+ setErrorMessage("OUTOFRANGE");
+ return false;
+ }
+ int portnumberEE = Integer.parseInt(mPortEE);
+ if (portnumberEE < MIN_PORT || portnumberEE > MAX_PORT) {
+ setErrorMessage("OUTOFRANGE");
+ return false;
+ }
+ } catch (NumberFormatException e) {
+ setErrorMessage("INVALIDPORT");
+ return false;
+ }
+
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ Debug.println("WICloneMasterPage: in concludePanel");
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ wizardInfo.setCLAHost(mHost);
+ wizardInfo.setCLAPort(mPort);
+ wizardInfo.setCLAPortEE(mPortEE);
+ wizardInfo.setCLATimeout(mTimeout);
+ ConsoleInfo consoleInfo = wizardInfo.getAdminConsoleInfo();
+ CMSConfigCert configCertCgi = new CMSConfigCert();
+ configCertCgi.initialize(wizardInfo);
+ Hashtable data = new Hashtable();
+ data.put(ConfigConstants.TASKID,TaskId.TASK_CLONE_MASTER);
+ data.put(ConfigConstants.OPTYPE, OpDef.OP_MODIFY);
+ data.put(ConfigConstants.PR_CERT_INSTANCE_NAME,
+ consoleInfo.get(ConfigConstants.PR_CERT_INSTANCE_NAME));
+ data.put(ConfigConstants.PR_DB_BINDDN, wizardInfo.getDBBindDN());
+ data.put(ConfigConstants.PR_DB_PWD, wizardInfo.getInternalDBPasswd());
+ data.put(ConfigConstants.PR_CLONING_INSTANCE,
+ wizardInfo.get(ConfigConstants.PR_CLONING_INSTANCE));
+
+ if (wizardInfo.isCAInstalled())
+ data.put(ConfigConstants.PR_CA, ConfigConstants.TRUE);
+ else
+ data.put(ConfigConstants.PR_CA, ConfigConstants.FALSE);
+
+ if (wizardInfo.isRAInstalled())
+ data.put(ConfigConstants.PR_RA, ConfigConstants.TRUE);
+ else
+ data.put(ConfigConstants.PR_RA, ConfigConstants.FALSE);
+
+ if (wizardInfo.isKRAInstalled())
+ data.put(ConfigConstants.PR_KRA, ConfigConstants.TRUE);
+ else
+ data.put(ConfigConstants.PR_KRA, ConfigConstants.FALSE);
+
+ String services = "";
+ if (wizardInfo.isCAInstalled()) {
+ if (!services.equals(""))
+ services = services+":";
+ services=services+ConfigConstants.PR_CA;
+ } else {
+ data.put(ConfigConstants.CA_HOST, wizardInfo.getCMHost());
+ data.put(ConfigConstants.CA_PORT, wizardInfo.getCMPort());
+ data.put(ConfigConstants.CA_TIMEOUT, wizardInfo.getCMTimeout());
+ }
+
+ if (wizardInfo.isRAInstalled()) {
+ if (!services.equals(""))
+ services = services+":";
+ services=services+ConfigConstants.PR_RA;
+ }
+ if (wizardInfo.isKRAInstalled()) {
+ if (!services.equals(""))
+ services = services+":";
+ services=services+ConfigConstants.PR_KRA;
+ } else {
+ // connect to the clone master (CLA)
+ Debug.println("WICloneMasterPage: Cloning page");
+ if (mYes.isSelected()) {
+ Debug.println("WICloneMasterPage: Cloning page yes selected");
+ data.put(ConfigConstants.CLA_HOST, wizardInfo.getCLAHost());
+ data.put(ConfigConstants.CLA_PORT, wizardInfo.getCLAPort());
+ data.put(ConfigConstants.CLA_PORT_EE, wizardInfo.getCLAPortEE());
+ data.put(ConfigConstants.CLA_TIMEOUT,
+ wizardInfo.getCLATimeout());
+ data.put(ConfigConstants.CLONE_CA, ConfigConstants.TRUE);
+ } else {
+ Debug.println("WICloneMasterPage: Cloning page yes NOT selected");
+ // admin will have to manually add if not through wizard
+ }
+ }
+
+ data.put(ConfigConstants.PR_SUBSYSTEMS, services);
+ wizardInfo.setSubsystems(services);
+ startProgressStatus();
+ CMSMessageBox dlg = new CMSMessageBox(mAdminFrame, "CGITASK", "CONFIGDB");
+ boolean ready = configCertCgi.configCert(data);
+ dlg.setVisible(false);
+
+ endProgressStatus();
+
+ if (!ready) {
+ String str = configCertCgi.getErrorMessage();
+ if (str.equals(""))
+ setErrorMessage("Server Error");
+ else
+ setErrorMessage(str);
+ }
+
+ return ready;
+ }
+
+ public void callHelp() {
+ if (mWizardInfo.isCAInstalled()) {
+ CMSAdminUtil.help(HELPINDEX1);
+ }
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ JTextArea heading = createTextArea(mResource.getString(
+ "CLONEMASTERWIZARD_TEXT_ISCLONECA_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(heading, gbc);
+
+ mNo = makeJRadioButton("NO", false);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mNo, gbc);
+
+ mYes = makeJRadioButton("YES", true);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mYes, gbc);
+
+ ButtonGroup btnGroup = new ButtonGroup();
+ btnGroup.add(mNo);
+ btnGroup.add(mYes);
+
+ mHeading = createTextArea(mResource.getString(
+ "CLONEMASTERWIZARD_TEXT_HEADING_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0,4*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mHeading, gbc);
+
+ mHostLbl = makeJLabel("HOST");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.fill = gbc.NONE;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0, 0,
+ COMPONENT_SPACE);
+ add(mHostLbl, gbc);
+
+ mHostText = makeJTextField(30);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ add(mHostText, gbc);
+ mActiveColor = mHostText.getBackground();
+
+ mPortLbl = makeJLabel("PORT");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ add(mPortLbl, gbc);
+
+ mPortText = makeJTextField(10);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mPortText, gbc);
+
+ mPortEELbl = makeJLabel("PORTEE");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ add(mPortEELbl, gbc);
+
+ mPortEEText = makeJTextField(10);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mPortEEText, gbc);
+
+ mTimeoutLbl = makeJLabel("TIMEOUT");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0, 0,
+ COMPONENT_SPACE);
+ add(mTimeoutLbl, gbc);
+
+ mTimeoutText = makeJTextField("30", 10);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mTimeoutText, gbc);
+
+ /*mTimeunitLbl = makeJLabel("TIMEUNIT");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0, 0,
+ COMPONENT_SPACE);
+ add(mTimeunitLbl, gbc);
+ */
+
+ JLabel label = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(label, gbc);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ if (mYes.isSelected()) {
+ enableFields(true, mActiveColor);
+ } else {
+ enableFields(false, getBackground());
+ }
+ }
+
+ private void enableFields(boolean enabled, Color color) {
+ mHeading.setEnabled(enabled);
+ mHostLbl.setEnabled(enabled);
+ mPortLbl.setEnabled(enabled);
+ mPortEELbl.setEnabled(enabled);
+ mTimeoutLbl.setEnabled(enabled);
+ mHostText.setEnabled(enabled);
+ mHostText.setEditable(enabled);
+ mHostText.setBackground(color);
+ mPortText.setEnabled(enabled);
+ mPortText.setEditable(enabled);
+ mPortText.setBackground(color);
+ mPortEEText.setEnabled(enabled);
+ mPortEEText.setEditable(enabled);
+ mPortEEText.setBackground(color);
+ mTimeoutText.setEnabled(enabled);
+ mTimeoutText.setEditable(enabled);
+ mTimeoutText.setBackground(color);
+ CMSAdminUtil.repaintComp(mHeading);
+ CMSAdminUtil.repaintComp(mHostLbl);
+ CMSAdminUtil.repaintComp(mHostText);
+ CMSAdminUtil.repaintComp(mPortLbl);
+ CMSAdminUtil.repaintComp(mPortText);
+ CMSAdminUtil.repaintComp(mPortEELbl);
+ CMSAdminUtil.repaintComp(mPortEEText);
+ CMSAdminUtil.repaintComp(mTimeoutLbl);
+ CMSAdminUtil.repaintComp(mTimeoutText);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICloneOCSPKeyCertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICloneOCSPKeyCertPage.java
new file mode 100644
index 000000000..9061b5f7a
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICloneOCSPKeyCertPage.java
@@ -0,0 +1,237 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+
+/**
+ * Introduction page for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WICloneOCSPKeyCertPage extends WizardBasePanel implements IWizardPanel {
+ private String mOCSPNicknameStr, mSSLNicknameStr;
+ private String mOCSPTokenname, mSSLTokenname;
+ protected InstallWizardInfo mWizardInfo;
+ protected JComboBox mOCSPNicknameBox, mSSLNicknameBox;
+ private static final String PANELNAME = "CLONEOCSPKEYCERTWIZARD";
+ private static final String OCSPHELPINDEX =
+ "install-ocspcertclone-wizard-help";
+
+
+ WICloneOCSPKeyCertPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ mSSLNicknameStr = "Server-Cert";
+ mOCSPNicknameStr = "ocspSigningCert";
+ init();
+ }
+
+ WICloneOCSPKeyCertPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ mSSLNicknameStr = "Server-Cert";
+ mOCSPNicknameStr = "ocspSigningCert";
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ mWizardInfo = wizardInfo;
+ if (!wizardInfo.isCloning())
+ return false;
+ if (!wizardInfo.isCloneOCSPSubsystem())
+ return false;
+ if (wizardInfo.isOCSPCloningDone())
+ return false;
+
+ setBorder(makeTitledBorder(PANELNAME));
+
+ if (mOCSPNicknameBox.getItemCount() > 0) {
+ mOCSPNicknameBox.removeAllItems();
+ }
+
+ if (mSSLNicknameBox.getItemCount() > 0) {
+ mSSLNicknameBox.removeAllItems();
+ }
+ String certsList = mWizardInfo.getCloneCertsList();
+ StringTokenizer t2 = new StringTokenizer(certsList, ";");
+ while (t2.hasMoreTokens()) {
+ String s1 = (String)t2.nextToken();
+ if (s1.indexOf(mSSLNicknameStr) >= 0)
+ mSSLNicknameBox.addItem(s1);
+ }
+
+ StringTokenizer t3 = new StringTokenizer(certsList, ";");
+ while (t3.hasMoreTokens()) {
+ String s1 = (String)t3.nextToken();
+ if (s1.indexOf(mOCSPNicknameStr) >= 0)
+ mOCSPNicknameBox.addItem(s1);
+ }
+
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ String ocspnickname = (String)mOCSPNicknameBox.getSelectedItem();
+ mOCSPTokenname = Constants.PR_INTERNAL_TOKEN_NAME;
+ int index = ocspnickname.indexOf(":");
+ if (index > -1) {
+ mOCSPTokenname = ocspnickname.substring(0, index);
+ }
+ mWizardInfo.put(ConfigConstants.PR_CLONE_OCSP_TOKEN_NAME, mOCSPTokenname);
+
+ String sslnickname = (String)mSSLNicknameBox.getSelectedItem();
+ mSSLTokenname = Constants.PR_INTERNAL_TOKEN_NAME;
+ index = sslnickname.indexOf(":");
+ if (index > -1) {
+ mSSLTokenname = sslnickname.substring(0, index);
+ }
+ mWizardInfo.put(ConfigConstants.PR_CLONE_SSL_TOKEN_NAME, mSSLTokenname);
+
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_CLONING;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY;
+ rawData = rawData+"&"+ConfigConstants.PR_SUBSYSTEM+"="+
+ ConfigConstants.PR_OCSP;
+ rawData = rawData+"&"+ConfigConstants.PR_CLONE_OCSP_TOKEN_NAME+"="+
+ mOCSPTokenname;
+ rawData = rawData+"&"+ConfigConstants.PR_CLONE_OCSP_NICKNAME+"="+
+ mOCSPNicknameBox.getSelectedItem();
+ rawData = rawData+"&"+ConfigConstants.PR_CLONE_SSL_TOKEN_NAME+"="+
+ mSSLTokenname;
+ rawData = rawData+"&"+ConfigConstants.PR_CLONE_SSL_NICKNAME+"="+
+ mSSLNicknameBox.getSelectedItem();
+
+ startProgressStatus();
+ boolean ready = send(rawData, wizardInfo);
+ endProgressStatus();
+
+ if (!ready) {
+ String errstr = getErrorMessage();
+ if (errstr.equals("")) {
+ String errorMsg = mResource.getString(
+ PANELNAME+"_ERRORMSG");
+ setErrorMessage(errorMsg);
+ } else
+ setErrorMessage(errstr);
+ }
+ return ready;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(OCSPHELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JTextArea heading1 = createTextArea(mResource.getString(
+ PANELNAME+"_TEXT_HEADING1_LABEL"));
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(heading1, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel ocspNicknameLbl = makeJLabel("OCSPNICKNAME");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(ocspNicknameLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mOCSPNicknameBox = new JComboBox();
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.weightx = 0.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mOCSPNicknameBox, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JTextArea heading2 = createTextArea(mResource.getString(
+ PANELNAME+"_TEXT_HEADING2_LABEL"));
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(heading2, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel sslNicknameLbl = makeJLabel("SSLNICKNAME");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(sslNicknameLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mSSLNicknameBox = new JComboBox();
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.weightx = 0.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mSSLNicknameBox, gbc);
+
+ JLabel dummy = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ add(dummy, gbc);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ mWizardInfo.setOCSPTokenName(mOCSPTokenname);
+ mWizardInfo.setSSLTokenName(mSSLTokenname);
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIClonePage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIClonePage.java
new file mode 100644
index 000000000..cdfa23199
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIClonePage.java
@@ -0,0 +1,142 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Introduction page for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIClonePage extends WizardBasePanel implements IWizardPanel {
+
+ private static final String PANELNAME = "CLONEINSTALLWIZARD";
+ private static final String HELPINDEX =
+ "install-general-intro-wizard-help";
+
+ WIClonePage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WIClonePage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ setBorder(makeTitledBorder(PANELNAME));
+
+ if //(wizardInfo.isKRACertLocalCA() || !wizardInfo.isInstallCertNow() ||
+ (!wizardInfo.isCloning()||wizardInfo.isClonePageDone())
+ return false;
+
+ mAdminFrame = wizardInfo.getAdminFrame();
+
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ cleanUpWizardInfo(wizardInfo);
+ startProgressStatus();
+ Debug.println("WIClonePage:concludePanel() 1");
+
+ String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_MASTER_OR_CLONE;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_READ;
+ rawData = rawData+"&"+ConfigConstants.PR_CLONE_SETTING_DONE+"="+
+ ConfigConstants.TRUE;
+ boolean ready = send(rawData, wizardInfo);
+
+ Debug.println("WIClonePage:concludePanel() 2");
+
+ endProgressStatus();
+
+ if (!ready) {
+ String str = getErrorMessage(wizardInfo);
+ if (str == null)
+ setErrorMessage("Server Error");
+ else
+ setErrorMessage(str);
+ }else{
+ wizardInfo.setClonePageDone(ConfigConstants.TRUE);
+ }
+
+ return ready;
+ }
+
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ JTextArea desc = createTextArea(mResource.getString(
+ "CLONEINSTALLWIZARD_TEXT_DESC_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+
+
+
+ JLabel dummy = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ add(dummy, gbc);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICloneRAKeyCertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICloneRAKeyCertPage.java
new file mode 100644
index 000000000..7194ee3cc
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICloneRAKeyCertPage.java
@@ -0,0 +1,242 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+
+/**
+ * Introduction page for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WICloneRAKeyCertPage extends WizardBasePanel implements IWizardPanel {
+ private String mRANicknameStr, mSSLNicknameStr;
+ private String mRATokenname, mSSLTokenname;
+ protected InstallWizardInfo mWizardInfo;
+ protected JComboBox mRANicknameBox, mSSLNicknameBox;
+ private static final String PANELNAME = "CLONERAKEYCERTWIZARD";
+ private static final String CAHELPINDEX =
+ "install-racertclone-wizard-help";
+
+
+ WICloneRAKeyCertPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ mRANicknameStr = "raSigningCert";
+ mSSLNicknameStr = "Server-Cert";
+ init();
+ }
+
+ WICloneRAKeyCertPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ mRANicknameStr = "raSigningCert";
+ mSSLNicknameStr = "Server-Cert";
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ mWizardInfo = wizardInfo;
+ if (!wizardInfo.isCloning())
+ return false;
+ if (!wizardInfo.isCloneRASubsystem())
+ return false;
+ if (wizardInfo.isRACloningDone())
+ return false;
+ if (!wizardInfo.isRAInstalled() ||
+ wizardInfo.isRACertRequestDone())
+ return false;
+
+ setBorder(makeTitledBorder(PANELNAME));
+ if (mRANicknameBox.getItemCount() > 0) {
+ mRANicknameBox.removeAllItems();
+ }
+
+ if (mSSLNicknameBox.getItemCount() > 0) {
+ mSSLNicknameBox.removeAllItems();
+ }
+ String certsList = mWizardInfo.getCloneCertsList();
+ StringTokenizer t1 = new StringTokenizer(certsList, ";");
+ while (t1.hasMoreTokens()) {
+ String s1 = (String)t1.nextToken();
+ if (s1.indexOf(mRANicknameStr) >= 0)
+ mRANicknameBox.addItem(s1);
+ }
+
+ StringTokenizer t2 = new StringTokenizer(certsList, ";");
+ while (t2.hasMoreTokens()) {
+ String s1 = (String)t2.nextToken();
+ if (s1.indexOf(mSSLNicknameStr) >= 0)
+ mSSLNicknameBox.addItem(s1);
+ }
+
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ String ranickname = (String)mRANicknameBox.getSelectedItem();
+ mRATokenname = Constants.PR_INTERNAL_TOKEN_NAME;
+ int index = ranickname.indexOf(":");
+ if (index > -1) {
+ mRATokenname = ranickname.substring(0, index);
+ }
+ mWizardInfo.put(ConfigConstants.PR_CLONE_RA_TOKEN_NAME, mRATokenname);
+
+ String sslnickname = (String)mSSLNicknameBox.getSelectedItem();
+ mSSLTokenname = Constants.PR_INTERNAL_TOKEN_NAME;
+ index = sslnickname.indexOf(":");
+ if (index > -1) {
+ mSSLTokenname = sslnickname.substring(0, index);
+ }
+ mWizardInfo.put(ConfigConstants.PR_CLONE_SSL_TOKEN_NAME, mSSLTokenname);
+
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ ConsoleInfo consoleInfo = wizardInfo.getAdminConsoleInfo();
+ CMSConfigCert configCertCgi = new CMSConfigCert();
+ configCertCgi.initialize(wizardInfo);
+ Hashtable data = new Hashtable();
+ data.put(ConfigConstants.TASKID,TaskId.TASK_CLONING);
+ data.put(ConfigConstants.OPTYPE, OpDef.OP_MODIFY);
+ data.put(ConfigConstants.PR_SUBSYSTEM, ConfigConstants.PR_RA);
+ data.put(ConfigConstants.PR_CERT_INSTANCE_NAME,
+ consoleInfo.get(ConfigConstants.PR_CERT_INSTANCE_NAME));
+ data.put(ConfigConstants.PR_CLONE_RA_TOKEN_NAME, mRATokenname);
+ data.put(ConfigConstants.PR_CLONE_RA_NICKNAME,
+ mRANicknameBox.getSelectedItem());
+ data.put(ConfigConstants.PR_CLONE_SSL_TOKEN_NAME, mSSLTokenname);
+ data.put(ConfigConstants.PR_CLONE_SSL_NICKNAME,
+ mSSLNicknameBox.getSelectedItem());
+
+ startProgressStatus();
+ boolean ready = configCertCgi.configCert(data);
+ endProgressStatus();
+
+ if (!ready) {
+ String errstr = configCertCgi.getErrorMessage();
+ if (errstr.equals("")) {
+ String errorMsg = mResource.getString(
+ PANELNAME+"_ERRORMSG");
+ setErrorMessage(errorMsg);
+ } else
+ setErrorMessage(errstr);
+ }
+ return ready;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(CAHELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JTextArea heading = createTextArea(mResource.getString(
+ PANELNAME+"_TEXT_HEADING_LABEL"));
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(heading, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel raNicknameLbl = makeJLabel("RANICKNAME");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(raNicknameLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mRANicknameBox = new JComboBox();
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.weightx = 0.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mRANicknameBox, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JTextArea heading1 = createTextArea(mResource.getString(
+ PANELNAME+"_TEXT_HEADING1_LABEL"));
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(heading1, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel sslNicknameLbl = makeJLabel("SSLNICKNAME");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(sslNicknameLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mSSLNicknameBox = new JComboBox();
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.weightx = 0.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mSSLNicknameBox, gbc);
+
+ JLabel dummy = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ add(dummy, gbc);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ mWizardInfo.setRATokenName(mRATokenname);
+ mWizardInfo.setSSLTokenName(mSSLTokenname);
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICloneTKSKeyCertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICloneTKSKeyCertPage.java
new file mode 100644
index 000000000..baeaaec8d
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICloneTKSKeyCertPage.java
@@ -0,0 +1,182 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+
+/**
+ * Introduction page for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WICloneTKSKeyCertPage extends WizardBasePanel implements IWizardPanel {
+ private String mSSLNicknameStr, mSSLTokenname;
+ protected InstallWizardInfo mWizardInfo;
+ protected JComboBox mSSLNicknameBox;
+ private static final String PANELNAME = "CLONETKSKEYCERTWIZARD";
+ private static final String TKSHELPINDEX =
+ "install-tkscertclone-wizard-help";
+
+
+ WICloneTKSKeyCertPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ mSSLNicknameStr = "Server-Cert";
+ init();
+ }
+
+ WICloneTKSKeyCertPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ mSSLNicknameStr = "Server-Cert";
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ mWizardInfo = wizardInfo;
+ if (!wizardInfo.isCloning())
+ return false;
+ if (!wizardInfo.isCloneTKSSubsystem())
+ return false;
+ if (wizardInfo.isTKSCloningDone())
+ return false;
+
+ setBorder(makeTitledBorder(PANELNAME));
+
+ if (mSSLNicknameBox.getItemCount() > 0) {
+ mSSLNicknameBox.removeAllItems();
+ }
+ String certsList = mWizardInfo.getCloneCertsList();
+ StringTokenizer t = new StringTokenizer(certsList, ";");
+ while (t.hasMoreTokens()) {
+ String s1 = (String)t.nextToken();
+ if (s1.indexOf(mSSLNicknameStr) >= 0)
+ mSSLNicknameBox.addItem(s1);
+ }
+
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ String sslnickname = (String)mSSLNicknameBox.getSelectedItem();
+ mSSLTokenname = Constants.PR_INTERNAL_TOKEN_NAME;
+ int index = sslnickname.indexOf(":");
+ if (index > -1) {
+ mSSLTokenname = sslnickname.substring(0, index);
+ }
+ mWizardInfo.put(ConfigConstants.PR_CLONE_SSL_TOKEN_NAME, mSSLTokenname);
+
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_CLONING;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY;
+ rawData = rawData+"&"+ConfigConstants.PR_SUBSYSTEM+"="+ConfigConstants.PR_TKS;
+ rawData = rawData+"&"+ConfigConstants.PR_CLONE_SSL_TOKEN_NAME+"="+
+ mSSLTokenname;
+ rawData = rawData+"&"+ConfigConstants.PR_CLONE_SSL_NICKNAME+"="+
+ mSSLNicknameBox.getSelectedItem();
+
+ startProgressStatus();
+ boolean ready = send(rawData, wizardInfo);
+ endProgressStatus();
+
+ if (!ready) {
+ String errstr = getErrorMessage();
+ if (errstr.equals("")) {
+ String errorMsg = mResource.getString(
+ PANELNAME+"_ERRORMSG");
+ setErrorMessage(errorMsg);
+ } else
+ setErrorMessage(errstr);
+ }
+ return ready;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(TKSHELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JTextArea heading = createTextArea(mResource.getString(
+ PANELNAME+"_TEXT_HEADING_LABEL"));
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(heading, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel sslNicknameLbl = makeJLabel("SSLNICKNAME");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(sslNicknameLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mSSLNicknameBox = new JComboBox();
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.weightx = 0.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mSSLNicknameBox, gbc);
+
+ JLabel dummy = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ add(dummy, gbc);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ mWizardInfo.setSSLTokenName(mSSLTokenname);
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIConfigWebServerPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIConfigWebServerPage.java
new file mode 100644
index 000000000..ad9e8b4d6
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIConfigWebServerPage.java
@@ -0,0 +1,182 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Web Server Configuration.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIConfigWebServerPage extends WizardBasePanel implements IWizardPanel {
+ private Color mActiveColor;
+ private JTextField mServerRootText;
+ private JTextField mUserIDText;
+
+ private static final String PANELNAME = "WEBSERVERCONFIGWIZARD";
+ private static final String HELPINDEX =
+ "install-webserver-configuration-wizard-help";
+
+ WIConfigWebServerPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WIConfigWebServerPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isWebServerDone())
+ return false;
+ setBorder(makeTitledBorder(PANELNAME));
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ ConsoleInfo consoleInfo = wizardInfo.getAdminConsoleInfo();
+ CMSConfigCert configCertCgi = new CMSConfigCert();
+ configCertCgi.initialize(wizardInfo);
+ Hashtable data = new Hashtable();
+
+ data.put(ConfigConstants.TASKID,TaskId.TASK_CONFIG_WEB_SERVER);
+ data.put(ConfigConstants.OPTYPE, OpDef.OP_MODIFY);
+ data.put(ConfigConstants.PR_CERT_INSTANCE_NAME,
+ consoleInfo.get(ConfigConstants.PR_CERT_INSTANCE_NAME));
+
+ data.put(ConfigConstants.PR_WEB_SERVERROOT,
+ mServerRootText.getText().trim());
+ data.put(ConfigConstants.PR_USER_ID,
+ mUserIDText.getText().trim());
+
+ startProgressStatus();
+ CMSMessageBox dlg = new CMSMessageBox(mAdminFrame, "CGITASK", "CREATEWEBSERVER");
+
+ boolean ready = configCertCgi.configCert(data);
+ dlg.setVisible(false);
+
+ endProgressStatus();
+
+ if (!ready) {
+ String str = configCertCgi.getErrorMessage();
+ if (str.equals("")) {
+ String errorMsg = mResource.getString(
+ PANELNAME+"_ERRORMSG");
+ setErrorMessage(errorMsg);
+ } else
+ setErrorMessage(str);
+ }
+
+ return ready;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JTextArea desc = createTextArea(mResource.getString(
+ PANELNAME+"_TEXT_HEADING_LABEL"));
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel serverRootLbl = makeJLabel("SERVERROOT");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(serverRootLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mServerRootText = makeJTextField(30);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ //gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mServerRootText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel userIDLbl = makeJLabel("USERID");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(userIDLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mUserIDText = makeJTextField(30);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ //gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mUserIDText, gbc);
+
+ JLabel dummy = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ add(dummy, gbc);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ wizardInfo.setWebServerDone(ConfigConstants.TRUE);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICreateInternalDBPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICreateInternalDBPage.java
new file mode 100644
index 000000000..4aee62e27
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICreateInternalDBPage.java
@@ -0,0 +1,581 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Introduction page for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WICreateInternalDBPage extends WizardBasePanel implements IWizardPanel {
+ private Color mActiveColor;
+ private JTextField mPortText, mBindAsText, mInstanceIDText;
+ private JTextField mRemoteHostText, mRemotePortText, mRemoteBaseDNText;
+ private JTextField mRemoteBindAsText,mRemotePasswordText, mRemoteDatabaseText;
+ private JPasswordField mPasswordText, mPasswordAgainText;
+ private JLabel mBindAsLabel, mPasswordLabel, mPasswordAgainLabel;
+ private JComboBox mVersionBox;
+ private JCheckBox mEnable, mSchema;
+ private JRadioButton mLocal, mRemote;
+ private static final String PANELNAME = "CREATEINTERNALDBWIZARD";
+ private static final String HELPINDEX =
+ "install-internaldb-configuration-wizard-help";
+ private static final String EMPTYSTR = " ";
+
+ WICreateInternalDBPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WICreateInternalDBPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mEnable)) {
+ enableLocalDB(mEnable.isSelected());
+ enableRemoteDB(mEnable.isSelected());
+ mLocal.setEnabled(mEnable.isSelected());
+ mRemote.setEnabled(mEnable.isSelected());
+ } else if (e.getSource().equals(mLocal)) {
+ enableLocalDB(mEnable.isSelected());
+ enableRemoteDB(mEnable.isSelected());
+ } else if (e.getSource().equals(mRemote)) {
+ enableLocalDB(mEnable.isSelected());
+ enableRemoteDB(mEnable.isSelected());
+ }
+ }
+
+ private void enableLocalDB(boolean e)
+ {
+ Color c;
+ if (e) {
+ if (mLocal.isSelected())
+ c = mActiveColor;
+ else
+ c = getBackground();
+ } else {
+ c = getBackground();
+ }
+ mPortText.setEditable(e);
+ mPortText.setEnabled(e);
+ mPortText.setBackground(c);
+ mBindAsText.setEditable(e);
+ mBindAsText.setEnabled(e);
+ mBindAsText.setBackground(c);
+ mInstanceIDText.setEditable(e);
+ mInstanceIDText.setEnabled(e);
+ mInstanceIDText.setBackground(c);
+ mPasswordText.setEditable(e);
+ mPasswordText.setEnabled(e);
+ mPasswordText.setBackground(c);
+ mPasswordAgainText.setEditable(e);
+ mPasswordAgainText.setEnabled(e);
+ mPasswordAgainText.setBackground(c);
+ }
+
+ private void enableRemoteDB(boolean e) {
+ Color c;
+ if (e) {
+ if (mRemote.isSelected())
+ c = mActiveColor;
+ else
+ c = getBackground();
+ } else {
+ c = getBackground();
+ }
+ mRemoteHostText.setEditable(e);
+ mRemoteHostText.setEnabled(e);
+ mRemoteHostText.setBackground(c);
+ mRemotePortText.setEditable(e);
+ mRemotePortText.setEnabled(e);
+ mRemotePortText.setBackground(c);
+ mRemoteBaseDNText.setEditable(e);
+ mRemoteBaseDNText.setEnabled(e);
+ mRemoteBaseDNText.setBackground(c);
+ mRemoteBindAsText.setEditable(e);
+ mRemoteBindAsText.setEnabled(e);
+ mRemoteBindAsText.setBackground(c);
+ mRemotePasswordText.setEditable(e);
+ mRemotePasswordText.setEnabled(e);
+ mRemotePasswordText.setBackground(c);
+ mRemoteDatabaseText.setEditable(e);
+ mRemoteDatabaseText.setEnabled(e);
+ mRemoteDatabaseText.setBackground(c);
+ mSchema.setEnabled(e);
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+
+ if (wizardInfo.isCloning() && wizardInfo.isUpdateDBInfoDone())
+ return false;
+ if (wizardInfo.isCloning() && !wizardInfo.isCreateDBDone()) {
+ setBorder(makeTitledBorder(PANELNAME));
+ mEnable.setSelected(true);
+ mInstanceIDText.setText(wizardInfo.getCloneDBName());
+ mPortText.setText(""+wizardInfo.getNextAvailPort());
+ mBindAsText.setText(wizardInfo.getDBBindDN());
+ mPasswordText.setText("");
+ mPasswordAgainText.setText("");
+ mRemoteBaseDNText.setText("o=netscapeCertificateServer");
+ mRemoteDatabaseText.setText("userRoot");
+ mRemoteBindAsText.setText("cn=directory manager");
+ enableLocalDB(mEnable.isSelected());
+ enableRemoteDB(mEnable.isSelected());
+ mLocal.setEnabled(mEnable.isSelected());
+ mRemote.setEnabled(mEnable.isSelected());
+ return true;
+ }
+
+ return false;
+ }
+
+ public boolean validatePanel() {
+ if (!mEnable.isSelected())
+ return true;
+ if (mLocal.isSelected()) {
+ String passwd = mPasswordText.getText().trim();
+ String passwdAgain = mPasswordAgainText.getText().trim();
+ String instanceId = mInstanceIDText.getText().trim();
+ String bindAs = mBindAsText.getText().trim();
+ String port = mPortText.getText().trim();
+
+ if (instanceId.equals("") || bindAs.equals("") ||
+ port.equals("")) {
+ setErrorMessage("BLANKFIELD");
+ return false;
+ }
+
+ if (passwd.equals("") || passwdAgain.equals("")) {
+ setErrorMessage("BLANKPASSWD");
+ return false;
+ }
+ if (!passwd.equals(passwdAgain)) {
+ setErrorMessage("NOTSAMEPASSWD");
+ return false;
+ }
+
+ try {
+ Integer num = new Integer(mPortText.getText().trim());
+ } catch (NumberFormatException e) {
+ setErrorMessage("NUMBERFORMAT");
+ return false;
+ }
+ } else {
+ String host = mRemoteHostText.getText().trim();
+ String port = mRemotePortText.getText().trim();
+ String baseDN = mRemoteBaseDNText.getText().trim();
+ String bindAs = mRemoteBindAsText.getText().trim();
+ String passwd = mRemotePasswordText.getText().trim();
+ String dbname = mRemoteDatabaseText.getText().trim();
+ if (host.equals("") || port.equals("") || bindAs.equals("") ||
+ baseDN.equals("") || dbname.equals("")) {
+ setErrorMessage("BLANKFIELD");
+ return false;
+ }
+ if (passwd.equals("")) {
+ setErrorMessage("BLANKPASSWD");
+ return false;
+ }
+ try {
+ Integer num = new Integer(port);
+ } catch (NumberFormatException e) {
+ setErrorMessage("NUMBERFORMAT");
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ String rawData = "";
+ if (!mEnable.isSelected()) {
+ rawData = rawData+ConfigConstants.TASKID+"="+TaskId.TASK_UPDATE_DB_INFO;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY;
+ boolean ready = send(rawData, wizardInfo);
+ if (!ready) {
+ String str = getErrorMessage(wizardInfo);
+ if (str.equals("")) {
+ String errorMsg = mResource.getString(
+ PANELNAME+"_ERRORMSG");
+ setErrorMessage(errorMsg);
+ } else
+ setErrorMessage(str);
+ }
+
+ return ready;
+ }
+
+ if (mRemote.isSelected()) {
+ rawData = ConfigConstants.TASKID+"="+TaskId.TASK_ADD_DBSCHEMA_INDEXES;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY;
+ rawData = rawData+"&"+ConfigConstants.PR_HOST+"="+mRemoteHostText.getText().trim();
+ rawData = rawData+"&"+ConfigConstants.PR_DB_PORT+"="+mRemotePortText.getText().trim();
+ rawData = rawData+"&"+ConfigConstants.PR_DB_BINDDN+"="+mRemoteBindAsText.getText().trim();
+ rawData = rawData+"&"+ConfigConstants.PR_DB_PWD+"="+mRemotePasswordText.getText().trim();
+ rawData = rawData+"&"+ConfigConstants.PR_DB_NAME+"="+mRemoteBaseDNText.getText().trim();
+ rawData = rawData+"&"+ConfigConstants.PR_LDAP_DB_NAME+"="+mRemoteDatabaseText.getText().trim();
+ rawData = rawData+"&"+ConfigConstants.PR_DB_SCHEMA+"="+mSchema.isSelected();
+ rawData = rawData+"&"+ConfigConstants.PR_DB_MODE+"=remote";
+ } else {
+ rawData = ConfigConstants.TASKID+"="+TaskId.TASK_CREATE_INTERNALDB;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY;
+ rawData = rawData+"&"+ConfigConstants.PR_IS_CLONEDDB_CREATED+"=true";
+ rawData = rawData+"&"+ConfigConstants.PR_DB_MODE+"=local";
+ rawData = rawData+"&"+ConfigConstants.PR_DB_PORT+"="+mPortText.getText();
+ rawData = rawData+"&"+ConfigConstants.PR_DB_BINDDN+"="+mBindAsText.getText();
+ rawData = rawData+"&"+ConfigConstants.PR_DB_NAME+"="+mInstanceIDText.getText();
+ rawData = rawData+"&"+ConfigConstants.PR_DB_PWD+"="+mPasswordText.getText();
+ wizardInfo.setInternalDBPasswd(mPasswordText.getText().trim());
+ wizardInfo.setDBBindDN(mBindAsText.getText().trim());
+ wizardInfo.setDBName(mInstanceIDText.getText().trim());
+ }
+
+ startProgressStatus();
+ //CMSMessageBox dlg = new CMSMessageBox(mAdminFrame, "CGITASK", "CREATEDB");
+
+ boolean ready = send(rawData, wizardInfo);
+
+ if (ready) {
+ rawData = ConfigConstants.TASKID+"="+TaskId.TASK_TOKEN_INFO;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_READ;
+ ready = send(rawData, wizardInfo);
+ }
+ //dlg.setVisible(false);
+
+ endProgressStatus();
+
+ if (!ready) {
+ String str = getErrorMessage(wizardInfo);
+ if (str.equals("")) {
+ String errorMsg = mResource.getString(
+ PANELNAME+"_ERRORMSG");
+ setErrorMessage(errorMsg);
+ } else
+ setErrorMessage(str);
+ }
+
+ return ready;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JTextArea desc = createTextArea(mResource.getString(
+ PANELNAME+"_TEXT_HEADING_LABEL"));
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mEnable = makeJCheckBox("ENABLE");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mEnable, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mLocal = makeJRadioButton("LOCAL", true);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, 2*COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ add(mLocal, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel instanceIDLbl = makeJLabel("INSTANCEID");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(instanceIDLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mInstanceIDText = makeJTextField(30);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ //gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mInstanceIDText, gbc);
+ mActiveColor = mInstanceIDText.getBackground();
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel portNumber = makeJLabel("PORT");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, 0,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(portNumber, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mPortText = makeJTextField(10);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(mPortText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mBindAsLabel = makeJLabel("ADMIN");
+ //gbc.anchor = gbc.NORTHWEST;
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, 2*COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mBindAsLabel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mBindAsText = makeJTextField(30);
+ gbc.anchor = gbc.NORTHWEST;
+ //gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mBindAsText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mPasswordLabel = makeJLabel("PWD");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, 0, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mPasswordLabel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mPasswordText = makeJPasswordField(30);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mPasswordText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mPasswordAgainLabel = makeJLabel("PWDAGAIN");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, 0, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mPasswordAgainLabel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mPasswordAgainText = makeJPasswordField(30);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mPasswordAgainText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mRemote = makeJRadioButton("REMOTE", false);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, 2*COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ add(mRemote, gbc);
+
+ ButtonGroup buttonGroup = new ButtonGroup();
+ buttonGroup.add(mLocal);
+ buttonGroup.add(mRemote);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel hostLbl = makeJLabel("HOST");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(hostLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mRemoteHostText = makeJTextField(30);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ //gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mRemoteHostText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel portNumber1 = makeJLabel("PORT");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, 0,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(portNumber1, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mRemotePortText = makeJTextField(10);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(mRemotePortText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel baseDNLbl = makeJLabel("BASEDN");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, 0,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(baseDNLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mRemoteBaseDNText = makeJTextField(30);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(mRemoteBaseDNText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel bindAsLabel = makeJLabel("ADMIN");
+ //gbc.anchor = gbc.NORTHWEST;
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, 2*COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(bindAsLabel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mRemoteBindAsText = makeJTextField(30);
+ gbc.anchor = gbc.NORTHWEST;
+ //gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mRemoteBindAsText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel passwordLabel = makeJLabel("PWD");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, 0, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(passwordLabel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mRemotePasswordText = makeJPasswordField(30);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mRemotePasswordText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel databaseLabel = makeJLabel("DNAME");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, 3*COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(databaseLabel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mRemoteDatabaseText = makeJTextField(30);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mRemoteDatabaseText, gbc);
+
+ JLabel dummy1 = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, 0, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(dummy1, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mSchema = makeJCheckBox("SCHEMA", true);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mSchema, gbc);
+
+ JLabel dummy = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ add(dummy, gbc);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ wizardInfo.setDBCreated(ConfigConstants.TRUE);
+ wizardInfo.setDBCreateNow(ConfigConstants.FALSE);
+ wizardInfo.setCreateDBDone(ConfigConstants.TRUE);
+
+ if (mEnable.isSelected())
+ wizardInfo.setCloneDBCreated("true");
+ else {
+ wizardInfo.setUpdateDBInfoDone(ConfigConstants.TRUE);
+ wizardInfo.setCloneDBCreated("false");
+ }
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIDBEnrollPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIDBEnrollPage.java
new file mode 100644
index 000000000..d63a07129
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIDBEnrollPage.java
@@ -0,0 +1,211 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Introduction page for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIDBEnrollPage extends WizardBasePanel implements IWizardPanel {
+ private JCheckBox mEnable;
+ private JTextField mHostNameText, mPortText, mBaseDNText;
+ private JComboBox mVersionBox;
+
+ private static final String PANELNAME = "DBENROLLWIZARD";
+ private static final String HELPINDEX =
+ "configuration-kra-wizard-change-keyscheme-help";
+
+ WIDBEnrollPage() {
+ super(PANELNAME);
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JTextArea desc = createTextArea(
+ CMSAdminUtil.wrapText(mResource.getString(
+ "DBENROLLWIZARD_TEXT_HEADING_LABEL"), 80), 1, 80);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mEnable = makeJCheckBox("ENABLE");
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mEnable, gbc);
+
+ JPanel panel = new JPanel();
+ panel.setBorder(CMSAdminUtil.makeTitledBorder(mResource,
+ PANELNAME, "DESTINATION"));
+ GridBagLayout gb1 = new GridBagLayout();
+ panel.setLayout(gb1);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ gbc.weighty = 1.0;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(panel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel hostName = makeJLabel("HOST");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ panel.add(hostName, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mHostNameText = makeJTextField(30);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ panel.add(mHostNameText, gbc);
+
+/*
+ CMSAdminUtil.resetGBC(gbc);
+ JTextArea dummy = createTextArea(" ", 2, 5);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ add(dummy, gbc);
+*/
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel portNumber = makeJLabel("PORT");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ panel.add(portNumber, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mPortText = makeJTextField(10);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ panel.add(mPortText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel versionLbl = makeJLabel("VERSION");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ panel.add(versionLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mVersionBox = makeJComboBox("VERSION");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ panel.add(mVersionBox, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel dummy = new JLabel(" ");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ panel.add(dummy, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel baseDNLbl = makeJLabel("BASEDN");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ panel.add(baseDNLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mBaseDNText = makeJTextField(20);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ panel.add(mBaseDNText, gbc);
+
+/*
+ CMSAdminUtil.resetGBC(gbc);
+ JTextArea dummy1 = createTextArea(" ", 2, 30);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(dummy1, gbc);
+*/
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIDisplayCACertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIDisplayCACertPage.java
new file mode 100644
index 000000000..442fa2b29
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIDisplayCACertPage.java
@@ -0,0 +1,75 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import com.netscape.admin.certsrv.wizard.*;
+import javax.swing.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * The panel displays the certificate which will be installed in the token.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIDisplayCACertPage extends WIDisplayCertPage {
+ private static final String PANELNAME = "INSTALLDISPLAYCACERTWIZARD";
+ private static final String CAHELPINDEX = "install-cacert-display-wizard-help";
+ private static final String CAKRAHELPINDEX = "install-cakracert-display-wizard-help";
+
+ WIDisplayCACertPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIDisplayCACertPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isCACloningDone())
+ return false;
+
+ if (wizardInfo.isCACertLocalCA() || !wizardInfo.isInstallCertNow() ||
+ !wizardInfo.isCAInstalled() || wizardInfo.isMigrationEnable() ||
+ wizardInfo.isCACertInstalledDone())
+ return false;
+
+ if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = CAKRAHELPINDEX;
+ else
+ mHelpIndex = CAHELPINDEX;
+ return super.initializePanel(info);
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ if (super.concludePanel(info)) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ wizardInfo.put(ConfigConstants.STAGE_CA_CERT_REQUEST,
+ ConfigConstants.TRUE);
+ return true;
+ }
+
+ return false;
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIDisplayCertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIDisplayCertPage.java
new file mode 100644
index 000000000..30e0bac13
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIDisplayCertPage.java
@@ -0,0 +1,205 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.management.client.util.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+
+/**
+ * This page is to install the certificate in the internal token. It
+ * displays the certificate information.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIDisplayCertPage extends WizardBasePanel implements IWizardPanel {
+ private JTextArea mTextArea;
+ private JTextField mCertNameField;
+ protected String mPanelName;
+ protected String mHelpIndex;
+
+ WIDisplayCertPage(String panelName) {
+ super(panelName);
+ mPanelName = panelName;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ setBorder(makeTitledBorder(mPanelName));
+ String content = wizardInfo.getCertContent();
+ String certOrder = wizardInfo.getCertOrder();
+ String str = reformat(content, certOrder);
+ mTextArea.setText(str);
+ mCertNameField.setEditable(false);
+ mCertNameField.setBackground(getBackground());
+ String tokenName = null;
+ String certType = wizardInfo.getCertType();
+ if (certType != null) {
+ if (certType.equalsIgnoreCase(Constants.PR_CA_SIGNING_CERT)) {
+ tokenName = wizardInfo.getCATokenName();
+ } else if (certType.equalsIgnoreCase(Constants.PR_RA_SIGNING_CERT)) {
+ tokenName = wizardInfo.getRATokenName();
+ } else if (certType.equalsIgnoreCase(Constants.PR_OCSP_SIGNING_CERT)) {
+ tokenName = wizardInfo.getOCSPTokenName();
+ } else if (certType.equalsIgnoreCase(Constants.PR_KRA_TRANSPORT_CERT)) {
+ tokenName = wizardInfo.getKRATokenName();
+ } else if (certType.equalsIgnoreCase(Constants.PR_SERVER_CERT)) {
+ tokenName = wizardInfo.getSSLTokenName();
+ } else {
+ Debug.println("WIDisplayCertPage: unrecognized certType: "+
+ certType);
+ }
+ }
+ if ((tokenName != null) &&
+ !(tokenName.equalsIgnoreCase(Constants.PR_INTERNAL_TOKEN_NAME))) {
+ Debug.println("tokenName="+tokenName);
+ mCertNameField.setText(tokenName+":"+wizardInfo.getNickname());
+ } else {
+ Debug.println("tokenName=null");
+ mCertNameField.setText(wizardInfo.getNickname());
+ }
+ return true;
+ }
+
+ private String reformat(String content, String certOrder) {
+ StringBuffer buffer = new StringBuffer(content);
+ StringTokenizer tokenizer = new StringTokenizer(certOrder, ":");
+ int len = 0;
+ while (tokenizer.hasMoreTokens()) {
+ String str = (String)tokenizer.nextToken();
+ int index = len+Integer.parseInt(str);
+ if (index >= buffer.length())
+ break;
+ buffer.insert(index, "\n");
+ len = index+1;
+ }
+ return buffer.toString();
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_INSTALL_CERT;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY;
+ String val = wizardInfo.getPKCS10();
+ if (val == null) {
+ rawData = rawData+"&"+Constants.PR_CERT_FILEPATH+"="+
+ wizardInfo.getCertFilePath();
+ } else {
+ rawData = rawData+"&"+Constants.PR_PKCS10+"="+
+ wizardInfo.getPKCS10();
+ }
+ rawData = rawData+"&"+Constants.PR_CERTIFICATE_TYPE+"="+wizardInfo.getCertType();
+ rawData = rawData+"&"+Constants.PR_NICKNAME+"="+wizardInfo.getNickname();
+ if (wizardInfo.getInternalDBPasswd() != null)
+ rawData = rawData+"&"+ConfigConstants.PR_DB_PWD+"="+wizardInfo.getInternalDBPasswd();
+
+ startProgressStatus();
+ boolean ready = send(rawData, wizardInfo);
+ endProgressStatus();
+
+ if (!ready) {
+ String str = getErrorMessage();
+ if (str.equals("")) {
+ String errorMsg = mResource.getString(
+ mPanelName+"_ERRORMSG");
+ setErrorMessage(errorMsg);
+ } else
+ setErrorMessage(str);
+ }
+
+ return ready;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(mHelpIndex);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label1 = makeJLabel("NAME");
+ gbc.fill = gbc.NONE;
+ gbc.anchor = gbc.WEST;
+ gbc.insets = new Insets(COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE);
+ add(label1, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mCertNameField = new JTextField(30);
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.anchor = gbc.WEST;
+ gbc.weightx=1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ add(mCertNameField, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel certLbl = makeJLabel("CONTENT");
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.anchor = gbc.WEST;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ add(certLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mTextArea = new JTextArea("",100,90);
+ mTextArea.setEditable(false);
+ mTextArea.setBackground(getBackground());
+ JScrollPane scrollPanel = new JScrollPane(mTextArea,
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
+ scrollPanel.setAlignmentX(LEFT_ALIGNMENT);
+ scrollPanel.setAlignmentY(TOP_ALIGNMENT);
+ scrollPanel.setBorder(BorderFactory.createLoweredBevelBorder());
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx=1.0;
+ gbc.weighty=1.0;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(scrollPanel, gbc);
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIDisplayKRACertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIDisplayKRACertPage.java
new file mode 100644
index 000000000..cae06e6cf
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIDisplayKRACertPage.java
@@ -0,0 +1,77 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import com.netscape.admin.certsrv.wizard.*;
+import javax.swing.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * The panel displays the certificate which will be installed in the token.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIDisplayKRACertPage extends WIDisplayCertPage {
+ private static final String PANELNAME = "INSTALLDISPLAYKRACERTWIZARD";
+ private static final String KRAHELPINDEX = "install-kracert-display-wizard-help";
+ private static final String CAKRAHELPINDEX = "install-cakra-kracert-display-wizard-help";
+ private static final String RAKRAHELPINDEX = "install-rakra-kracert-display-wizard-help";
+
+ WIDisplayKRACertPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIDisplayKRACertPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isKRACloningDone())
+ return false;
+ if (wizardInfo.isKRACertLocalCA() || !wizardInfo.isInstallCertNow() ||
+ !wizardInfo.isKRAInstalled() || wizardInfo.isKRACertInstalledDone())
+ return false;
+
+ if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = CAKRAHELPINDEX;
+ else if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = RAKRAHELPINDEX;
+ else
+ mHelpIndex = KRAHELPINDEX;
+
+ return super.initializePanel(info);
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ if (super.concludePanel(info)) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ wizardInfo.put(ConfigConstants.STAGE_KRA_CERT_REQUEST,
+ ConfigConstants.TRUE);
+ return true;
+ }
+
+ return false;
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIDisplayOCSPCertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIDisplayOCSPCertPage.java
new file mode 100644
index 000000000..e9db0e436
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIDisplayOCSPCertPage.java
@@ -0,0 +1,71 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import com.netscape.admin.certsrv.wizard.*;
+import javax.swing.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * The panel displays the certificate which will be installed in the token.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIDisplayOCSPCertPage extends WIDisplayCertPage {
+ private static final String PANELNAME = "INSTALLDISPLAYOCSPCERTWIZARD";
+ private static final String OCSPHELPINDEX = "install-ocspcert-display-wizard-help";
+
+ WIDisplayOCSPCertPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIDisplayOCSPCertPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isOCSPCloningDone())
+ return false;
+
+ if (wizardInfo.isOCSPCertLocalCA() || !wizardInfo.isInstallCertNow() ||
+ !wizardInfo.isOCSPInstalled() || wizardInfo.isOCSPCertInstalledDone())
+ return false;
+
+ mHelpIndex = OCSPHELPINDEX;
+ return super.initializePanel(info);
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ if (super.concludePanel(info)) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ wizardInfo.put(ConfigConstants.STAGE_OCSP_CERT_REQUEST,
+ ConfigConstants.TRUE);
+ return true;
+ }
+
+ return false;
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIDisplayRACertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIDisplayRACertPage.java
new file mode 100644
index 000000000..891e68038
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIDisplayRACertPage.java
@@ -0,0 +1,73 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import com.netscape.admin.certsrv.wizard.*;
+import javax.swing.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * The panel displays the certificate which will be installed in the token.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIDisplayRACertPage extends WIDisplayCertPage {
+ private static final String PANELNAME = "INSTALLDISPLAYRACERTWIZARD";
+ private static final String RAHELPINDEX = "install-racert-display-wizard-help";
+ private static final String RAKRAHELPINDEX = "install-rakracert-display-wizard-help";
+
+ WIDisplayRACertPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIDisplayRACertPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isRACloningDone())
+ return false;
+ if (wizardInfo.isRACertLocalCA() || !wizardInfo.isInstallCertNow() ||
+ !wizardInfo.isRAInstalled() || wizardInfo.isRACertInstalledDone())
+ return false;
+
+ if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = RAKRAHELPINDEX;
+ else
+ mHelpIndex = RAHELPINDEX;
+ return super.initializePanel(info);
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ if (super.concludePanel(info)) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ wizardInfo.put(ConfigConstants.STAGE_RA_CERT_REQUEST,
+ ConfigConstants.TRUE);
+ return true;
+ }
+
+ return false;
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIDisplaySSLCertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIDisplaySSLCertPage.java
new file mode 100644
index 000000000..3a791b4ed
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIDisplaySSLCertPage.java
@@ -0,0 +1,70 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import com.netscape.admin.certsrv.wizard.*;
+import javax.swing.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * The panel displays the certificate which will be installed in the token.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIDisplaySSLCertPage extends WIDisplayCertPage {
+ private static final String PANELNAME = "INSTALLDISPLAYSSLCERTWIZARD";
+ private static final String HELPINDEX = "install-sslcert-display-wizard-help";
+
+ WIDisplaySSLCertPage(JDialog parent) {
+ super(PANELNAME);
+ mHelpIndex = HELPINDEX;
+ mParent = parent;
+ }
+
+ WIDisplaySSLCertPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mHelpIndex = HELPINDEX;
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning())
+ return false;
+ if (wizardInfo.isSSLCertLocalCA() || !wizardInfo.isInstallCertNow() ||
+ wizardInfo.isMigrationEnable() || wizardInfo.isSSLCertInstalledDone())
+ return false;
+
+ return super.initializePanel(info);
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ if (super.concludePanel(info)) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ wizardInfo.put(ConfigConstants.STAGE_SSL_CERT_REQUEST,
+ ConfigConstants.TRUE);
+ return true;
+ }
+
+ return false;
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIExistingDBPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIExistingDBPage.java
new file mode 100644
index 000000000..93bbde830
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIExistingDBPage.java
@@ -0,0 +1,282 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * This panel is for cloning. It lets the user to enter the configuration
+ * information for the master database.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIExistingDBPage extends WizardBasePanel implements IWizardPanel {
+ private JTextField mRMPortText, mRMBindAsText, mRMHostText;
+ private JTextField mRMBaseDNText;
+ private JPasswordField mRMPasswordText;
+
+ private static final String PANELNAME = "EXISTINGDBWIZARD";
+ private static final String HELPINDEX =
+ "install-internaldb-configuration-wizard-help";
+ private static final String EMPTYSTR = " ";
+
+ WIExistingDBPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WIExistingDBPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+
+ if (wizardInfo.isCloning() && !wizardInfo.isConnectDBDone()) {
+ setBorder(makeTitledBorder(PANELNAME));
+ mRMBindAsText.setText(wizardInfo.getDBBindDN());
+ return true;
+ }
+
+ return false;
+ }
+
+ public boolean validatePanel() {
+ String rmhostname = mRMHostText.getText().trim();
+ String rmport = mRMPortText.getText().trim();
+ String rmbindDN = mRMBindAsText.getText().trim();
+ String rmpasswd = mRMPasswordText.getText().trim();
+
+ if (rmhostname.equals("")) {
+ setErrorMessage("EMPTYHOST");
+ return false;
+ }
+
+ if (rmport.equals("")) {
+ setErrorMessage("EMPTYPORT");
+ return false;
+ }
+
+ if (rmbindDN.equals("")) {
+ setErrorMessage("EMPTYBINDDN");
+ return false;
+ }
+
+ if (rmpasswd.equals("")) {
+ setErrorMessage("EMPTYPASSWD");
+ return false;
+ }
+
+ try {
+ Integer num = new Integer(rmport);
+ } catch (NumberFormatException e) {
+ setErrorMessage("NUMBERFORMAT");
+ return false;
+ }
+
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ cleanUpWizardInfo(wizardInfo);
+
+ String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_CREATE_INTERNALDB;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY;
+ rawData = rawData+"&"+ConfigConstants.PR_DB_MODE+"=remote";
+ rawData = rawData+"&"+ConfigConstants.PR_HOST+"="+mRMHostText.getText();
+ rawData = rawData+"&"+ConfigConstants.PR_DB_PORT+"="+mRMPortText.getText();
+ rawData = rawData+"&"+ConfigConstants.PR_DB_BINDDN+"="+mRMBindAsText.getText();
+ rawData = rawData+"&"+ConfigConstants.PR_DB_PWD+"="+mRMPasswordText.getText();
+ rawData = rawData+"&"+ConfigConstants.PR_DB_NAME+"="+mRMBaseDNText.getText();
+ wizardInfo.setInternalDBPasswd(mRMPasswordText.getText().trim());
+ wizardInfo.setDBBindDN(mRMBindAsText.getText().trim());
+
+ startProgressStatus();
+ //CMSMessageBox dlg = new CMSMessageBox(mAdminFrame, "CGITASK", "CONNECTDB");
+
+ boolean ready = send(rawData, wizardInfo);
+
+ if (ready) {
+ rawData = ConfigConstants.TASKID+"="+TaskId.TASK_TOKEN_INFO;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_READ;
+ ready = send(rawData, wizardInfo);
+ }
+ //dlg.setVisible(false);
+
+ endProgressStatus();
+
+ if (!ready) {
+ String str = getErrorMessage(wizardInfo);
+ if (str.equals("")) {
+ String errorMsg = mResource.getString(
+ PANELNAME+"_ERRORMSG");
+ setErrorMessage(errorMsg);
+ } else
+ setErrorMessage(str);
+ }
+
+ return ready;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JTextArea desc = createTextArea(mResource.getString(
+ PANELNAME+"_TEXT_HEADING_LABEL"));
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel instanceIDLbl = makeJLabel("REMOTEHOST");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(instanceIDLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mRMHostText = makeJTextField(30);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ //gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mRMHostText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel portNumber = makeJLabel("REMOTEPORT");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, 0,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(portNumber, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mRMPortText = makeJTextField(10);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(mRMPortText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel mRMBindAsLabel = makeJLabel("REMOTEADMIN");
+ //gbc.anchor = gbc.NORTHWEST;
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mRMBindAsLabel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mRMBindAsText = makeJTextField(30);
+ gbc.anchor = gbc.NORTHWEST;
+ //gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mRMBindAsText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel mRMPasswordLabel = makeJLabel("REMOTEPWD");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, 0, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mRMPasswordLabel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mRMPasswordText = makeJPasswordField(30);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mRMPasswordText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel mRMBaseDNLabel = makeJLabel("REMOTEBASEDN");
+ //gbc.anchor = gbc.NORTHWEST;
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mRMBaseDNLabel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mRMBaseDNText = makeJTextField(30);
+ gbc.anchor = gbc.NORTHWEST;
+ //gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mRMBaseDNText, gbc);
+
+ JLabel dummy = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ add(dummy, gbc);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ wizardInfo.setDBCreated(ConfigConstants.TRUE);
+ wizardInfo.setDBCreateNow(ConfigConstants.FALSE);
+ wizardInfo.setConnectDBDone(ConfigConstants.TRUE);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIGenCAKeyCertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenCAKeyCertPage.java
new file mode 100644
index 000000000..2bbb2f570
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenCAKeyCertPage.java
@@ -0,0 +1,68 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Generate the CA signing certificate
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.keycert
+ */
+class WIGenCAKeyCertPage extends WIGenKeyCertPage {
+ private static final String PANELNAME = "INSTALLGENCAWIZARD";
+ private static final String CAHELPINDEX = "install-cacert-creation-wizard-help";
+ private static final String CAKRAHELPINDEX = "install-cakracert-creation-wizard-help";
+
+ WIGenCAKeyCertPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIGenCAKeyCertPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isCACloningDone())
+ return false;
+
+ if (!wizardInfo.isCACertLocalCA() || !wizardInfo.isCAInstalled() ||
+ wizardInfo.isMigrationEnable() || wizardInfo.isSelfSignedCACertDone() ||
+ wizardInfo.isCACertRequestDone() || wizardInfo.isCACertInstalledDone())
+ return false;
+
+ if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = CAKRAHELPINDEX;
+ else
+ mHelpIndex = CAHELPINDEX;
+
+ return super.initializePanel(info);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIGenCAKeyCertReqPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenCAKeyCertReqPage.java
new file mode 100644
index 000000000..c1f3c11ea
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenCAKeyCertReqPage.java
@@ -0,0 +1,80 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Generate the CA signing certificate request
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIGenCAKeyCertReqPage extends WIGenKeyCertReqPage {
+ private static final String PANELNAME = "INSTALLGENCACERTREQWIZARD";
+ private static final String CAHELPINDEX = "install-cacert-request-wizard-help";
+ private static final String CAKRAHELPINDEX = "install-cakracert-request-wizard-help";
+
+ WIGenCAKeyCertReqPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIGenCAKeyCertReqPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isCACloningDone())
+ return false;
+
+ if (wizardInfo.isCACertLocalCA() || !wizardInfo.isCAInstalled() ||
+ wizardInfo.isMigrationEnable() || wizardInfo.isSelfSignedCACertDone()
+ || (wizardInfo.isCACertRequestDone() &&
+ !wizardInfo.isCACertRequestBack()) ||
+ wizardInfo.isCACertInstalledDone())
+ return false;
+
+ if (wizardInfo.isCACertRequestBack()) {
+ wizardInfo.put(ConfigConstants.STAGE_CA_CERT_REQUEST,
+ ConfigConstants.FALSE);
+ wizardInfo.put(ConfigConstants.CA_CERT_REQUEST_BACK,
+ ConfigConstants.FALSE);
+ }
+
+ if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = CAKRAHELPINDEX;
+ else
+ mHelpIndex = CAHELPINDEX;
+
+ mTokenName = wizardInfo.getCATokenName();
+ wizardInfo.setCertType(Constants.PR_CA_SIGNING_CERT);
+ wizardInfo.setNewRequest();
+ return super.initializePanel(info);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIGenKRAKeyCertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenKRAKeyCertPage.java
new file mode 100644
index 000000000..98ef24812
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenKRAKeyCertPage.java
@@ -0,0 +1,70 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Generate the KRA transport certificate
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.keycert
+ */
+class WIGenKRAKeyCertPage extends WIGenKeyCertPage {
+ private static final String PANELNAME = "INSTALLGENKRAWIZARD";
+ private static final String KRAHELPINDEX = "install-kracert-creation-wizard-help";
+ private static final String RAKRAHELPINDEX = "install-rakracert-creation-wizard-help";
+ private static final String CAKRAHELPINDEX = "install-cakra-kracert-creation-wizard-help";
+
+ WIGenKRAKeyCertPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIGenKRAKeyCertPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isKRACloningDone())
+ return false;
+ if (!wizardInfo.isKRACertLocalCA() || !wizardInfo.isKRAInstalled() ||
+ wizardInfo.isKRALocalCertDone() || wizardInfo.isKRACertRequestDone() ||
+ wizardInfo.isKRACertInstalledDone())
+ return false;
+
+ if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = CAKRAHELPINDEX;
+ else if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = RAKRAHELPINDEX;
+ else
+ mHelpIndex = KRAHELPINDEX;
+
+ return super.initializePanel(info);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIGenKRAKeyCertReqPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenKRAKeyCertReqPage.java
new file mode 100644
index 000000000..f6e5df9fe
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenKRAKeyCertReqPage.java
@@ -0,0 +1,82 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Generate the KRA signing certificate request
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIGenKRAKeyCertReqPage extends WIGenKeyCertReqPage {
+ private static final String PANELNAME = "INSTALLGENKRACERTREQWIZARD";
+ private static final String KRAHELPINDEX = "install-kracert-request-wizard-help";
+ private static final String CAKRAHELPINDEX = "install-cakra-kracert-request-wizard-help";
+ private static final String RAKRAHELPINDEX = "install-rakra-kracert-request-wizard-help";
+
+ WIGenKRAKeyCertReqPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIGenKRAKeyCertReqPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isKRACloningDone())
+ return false;
+ if (wizardInfo.isKRACertLocalCA() || !wizardInfo.isKRAInstalled() ||
+ (wizardInfo.isKRACertRequestDone() &&
+ !wizardInfo.isKRACertRequestBack()) ||
+ wizardInfo.isKRALocalCertDone() ||
+ wizardInfo.isKRACertInstalledDone())
+ return false;
+
+ if (wizardInfo.isCACertRequestBack()) {
+ wizardInfo.put(ConfigConstants.STAGE_KRA_CERT_REQUEST,
+ ConfigConstants.FALSE);
+ wizardInfo.put(ConfigConstants.KRA_CERT_REQUEST_BACK,
+ ConfigConstants.FALSE);
+ }
+
+ if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = CAKRAHELPINDEX;
+ else if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = RAKRAHELPINDEX;
+ else
+ mHelpIndex = KRAHELPINDEX;
+
+ mTokenName = wizardInfo.getKRATokenName();
+ wizardInfo.setCertType(Constants.PR_KRA_TRANSPORT_CERT);
+ wizardInfo.setNewRequest();
+ return super.initializePanel(info);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIGenKeyCertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenKeyCertPage.java
new file mode 100644
index 000000000..8272d44df
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenKeyCertPage.java
@@ -0,0 +1,143 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Generate the certificate
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.keycert
+ */
+class WIGenKeyCertPage extends WizardBasePanel implements IWizardPanel {
+ private JTextArea desc;
+ private String mPanelName;
+ protected String mHelpIndex;
+
+ WIGenKeyCertPage(String panelName) {
+ super(panelName);
+ mPanelName = panelName;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ setBorder(makeTitledBorder(mPanelName));
+
+ String str = mResource.getString(mPanelName+"_TEXT_NEWKEY_LABEL");
+ desc.setText(str);
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ NameValuePairs nvps = wizardInfo.getAllCertInfo();
+ String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_CREATE_CERT;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY;
+ rawData = rawData+"&"+ConfigConstants.PR_HASH_TYPE+"="+wizardInfo.getHashType();
+ if (wizardInfo.getCertType().equals(Constants.PR_CA_SIGNING_CERT)) {
+ String OComp = wizardInfo.getCAOComp();
+ if (OComp != null && !OComp.equals("")) {
+ rawData = rawData+"&"+ConfigConstants.PR_CA_O_COMPONENT+"="+
+ wizardInfo.getCAOComp();
+ }
+ String CComp = wizardInfo.getCACComp();
+ if (CComp != null && !CComp.equals(""))
+ rawData = rawData+"&"+ConfigConstants.PR_CA_C_COMPONENT+"="+
+ wizardInfo.getCACComp();
+ }
+
+ // testing, please remove after finish testing
+ if (wizardInfo.getInternalDBPasswd() != null)
+ rawData = rawData+"&"+ConfigConstants.PR_DB_PWD+"="+wizardInfo.getInternalDBPasswd();
+
+ if (nvps != null) {
+ for (String name : nvps.keySet()) {
+ String value = nvps.get(name);
+ rawData = rawData+"&"+name+"="+value;
+ }
+ }
+
+ startProgressStatus();
+
+ //CMSMessageBox dlg = new CMSMessageBox(mAdminFrame, "CGITASK", "CREATECERT");
+
+ boolean ready = send(rawData, wizardInfo);
+
+ //dlg.setVisible(false);
+
+ endProgressStatus();
+
+ if (!ready) {
+ String str = getErrorMessage();
+ if (str.equals("")) {
+ String errorMsg = mResource.getString(
+ mPanelName+"_ERRORMSG");
+ setErrorMessage(errorMsg);
+ } else
+ setErrorMessage(str);
+ }
+
+ return ready;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(mHelpIndex);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+/*
+ desc = new JTextArea(2, 80);
+ desc.setBackground(getBackground());
+ desc.setEditable(false);
+ desc.setCaretColor(getBackground());
+*/
+ desc = createTextArea("");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIGenKeyCertReqPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenKeyCertReqPage.java
new file mode 100644
index 000000000..b5c0378c3
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenKeyCertReqPage.java
@@ -0,0 +1,291 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Generate the certificate request
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIGenKeyCertReqPage extends WizardBasePanel implements IWizardPanel {
+ private JTextArea desc;
+ private String mPanelName;
+ private static final String CERTREQ_BEGIN_HEADING =
+ "-----BEGIN NEW CERTIFICATE REQUEST-----";
+ private static final String CERTREQ_END_HEADING =
+ "-----END NEW CERTIFICATE REQUEST-----";
+ private static final int LINE_COUNT = 76;
+ protected String mHelpIndex;
+ protected String mTokenName;
+
+ protected JRadioButton mPKCS10;
+ protected JRadioButton mCMC;
+ protected String mSigningCert = null;
+
+ WIGenKeyCertReqPage(String panelName) {
+ super(panelName);
+ mPanelName = panelName;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ setBorder(makeTitledBorder(mPanelName));
+
+ String str = mResource.getString(mPanelName+"_TEXT_NEWKEY_LABEL");
+ desc.setText(str);
+ // check subject key identifier to enable cmc or not
+ NameValuePairs nvps =
+ (NameValuePairs)wizardInfo.get(wizardInfo.ALL_CERT_INFO);
+ if (nvps != null) {
+ str = (String)nvps.get(Constants.PR_SKI);
+ if (str != null && str.equals(ConfigConstants.TRUE)) {
+ mCMC.setEnabled(true);
+ mCMC.setVisible(true);
+ mPKCS10.setVisible(true);
+ } else if (str == null || str.equals(ConfigConstants.FALSE)){
+ mCMC.setEnabled(false);
+ mCMC.setVisible(false);
+ mPKCS10.setVisible(false);
+ }
+ CMSAdminUtil.repaintComp(mCMC);
+ CMSAdminUtil.repaintComp(mPKCS10);
+ }
+ // check if a signing cert installed
+ String type = wizardInfo.getCertType();
+ if (!mCMC.isEnabled() &&
+ (type.equals(Constants.PR_SERVER_CERT) ||
+ type.equals(Constants.PR_KRA_TRANSPORT_CERT)) ) {
+ if (wizardInfo.isCAInstalled() &&
+ wizardInfo.isCACertInstalledDone()) {
+ mSigningCert = Constants.PR_CA_SIGNING_CERT;
+ mCMC.setEnabled(true);
+ mCMC.setVisible(true);
+ CMSAdminUtil.repaintComp(mCMC);
+ mPKCS10.setVisible(true);
+ CMSAdminUtil.repaintComp(mPKCS10);
+ } else if (wizardInfo.isRAInstalled() &&
+ wizardInfo.isRACertInstalledDone()) {
+ mSigningCert = Constants.PR_RA_SIGNING_CERT;
+ mCMC.setEnabled(true);
+ mCMC.setVisible(true);
+ CMSAdminUtil.repaintComp(mCMC);
+ mPKCS10.setVisible(true);
+ CMSAdminUtil.repaintComp(mPKCS10);
+ } else if (wizardInfo.isKRAInstalled() &&
+ wizardInfo.isKRACertInstalledDone()) {
+ mSigningCert = Constants.PR_KRA_TRANSPORT_CERT;
+ mCMC.setEnabled(true);
+ mCMC.setVisible(true);
+ CMSAdminUtil.repaintComp(mCMC);
+ mPKCS10.setVisible(true);
+ CMSAdminUtil.repaintComp(mPKCS10);
+ } else if (wizardInfo.isOCSPInstalled() &&
+ wizardInfo.isOCSPCertInstalledDone()) {
+ mSigningCert = Constants.PR_OCSP_SIGNING_CERT;
+ mCMC.setEnabled(true);
+ mCMC.setVisible(true);
+ CMSAdminUtil.repaintComp(mCMC);
+ mPKCS10.setVisible(true);
+ CMSAdminUtil.repaintComp(mPKCS10);
+ }
+ }
+
+ if (type.equals(Constants.PR_OCSP_SIGNING_CERT)) {
+ mCMC.setEnabled(false);
+ mCMC.setVisible(false);
+ CMSAdminUtil.repaintComp(mCMC);
+ mPKCS10.setVisible(false);
+ CMSAdminUtil.repaintComp(mPKCS10);
+ }
+
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_CERT_REQUEST;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY;
+
+ if (wizardInfo.getSubjectName() == null) {
+ setErrorMessage("Subject Name is not available. Please redo all the request generation procedure. ");
+ return false;
+ }
+ rawData = rawData+"&"+Constants.PR_SUBJECT_NAME+"="+wizardInfo.getSubjectName();
+ if (mTokenName == null) {
+ setErrorMessage("Token Name is not available. Please redo all the request generation procedure. ");
+ return false;
+ }
+ rawData = rawData+"&"+Constants.PR_TOKEN_NAME+"="+mTokenName;
+ if (wizardInfo.getKeyLength() == null) {
+ setErrorMessage("Key Length is not available. Please redo all the request generation procedure. ");
+ return false;
+ }
+ rawData = rawData+"&"+Constants.PR_KEY_LENGTH+"="+wizardInfo.getKeyLength();
+ if (wizardInfo.getKeyType() == null) {
+ setErrorMessage("Key Type is not available. Please redo all the request generation procedure. ");
+ return false;
+ }
+ rawData = rawData+"&"+Constants.PR_KEY_TYPE+"="+wizardInfo.getKeyType();
+ if (wizardInfo.getCertType() == null) {
+ setErrorMessage("CertType is not available. Please redo all the request generation procedure. ");
+ return false;
+ }
+ rawData = rawData+"&"+Constants.PR_CERTIFICATE_TYPE+"="+wizardInfo.getCertType();
+
+ NameValuePairs nvps = wizardInfo.getAllCertInfo();//extensions
+ if (nvps != null) {
+ for (String name : nvps.keySet()) {
+ String value = nvps.get(name);
+ if (name != null && value != null)
+ rawData = rawData+"&"+name+"="+value;
+ }
+ }
+
+ if (mSigningCert != null) {
+ rawData = rawData+"&"+"signing_cert="+mSigningCert;
+ }
+
+ if (mPKCS10.isSelected()) {
+ rawData = rawData+"&"+wizardInfo.getCertType()+ConfigConstants.PR_REQUEST_FORMAT+
+ "="+ConfigConstants.PR_REQUEST_PKCS10;
+ } else if (mCMC.isSelected()) {
+ rawData = rawData+"&"+wizardInfo.getCertType()+ConfigConstants.PR_REQUEST_FORMAT+"="+ConfigConstants.PR_REQUEST_CMC;
+ }
+
+ startProgressStatus();
+ //CMSMessageBox dlg = new CMSMessageBox(mAdminFrame, "CGITASK", "CREATEREQ");
+ boolean ready = send(rawData, wizardInfo);
+ if (ready) {
+ String pkcs = wizardInfo.getCertRequest();
+ wizardInfo.setCertRequest(reformat(pkcs));
+ }
+ //dlg.setVisible(false);
+ endProgressStatus();
+
+ if (!ready) {
+ String str = getErrorMessage();
+ if (str.equals("")) {
+ String errorMsg = mResource.getString(
+ mPanelName+"_ERRORMSG");
+ setErrorMessage(errorMsg);
+ } else
+ setErrorMessage(str);
+ }
+
+ return ready;
+ }
+
+ private String reformat(String pkcs) {
+ int beginIndex = CERTREQ_BEGIN_HEADING.length();
+ int endIndex = CERTREQ_END_HEADING.length();
+ int totalLen = pkcs.length();
+ String content = pkcs.substring(beginIndex, totalLen-endIndex);
+ String result = CERTREQ_BEGIN_HEADING+"\n";
+ int index = 0;
+ while (content.length() >= LINE_COUNT) {
+ result = result+content.substring(0, LINE_COUNT)+"\n";
+ content = content.substring(LINE_COUNT);
+ }
+ if (content.length() > 0) {
+ result = result+content+"\n"+CERTREQ_END_HEADING;
+ } else {
+ result = result+CERTREQ_END_HEADING;
+ }
+
+ return result;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(mHelpIndex);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+/*
+ desc = new JTextArea(2, 80);
+ desc.setBackground(getBackground());
+ desc.setEditable(false);
+ desc.setCaretColor(getBackground());
+*/
+ desc = createTextArea("");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ //gbc.weighty = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+
+ mPKCS10 = makeJRadioButton("PKCS10", true);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mPKCS10, gbc);
+
+ mCMC = makeJRadioButton("CMC", false);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mCMC, gbc);
+
+ ButtonGroup group = new ButtonGroup();
+ group.add(mCMC);
+ group.add(mPKCS10);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel d1 = new JLabel(" ");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(d1, gbc);
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIGenOCSPKeyCertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenOCSPKeyCertPage.java
new file mode 100644
index 000000000..2e2fbdbed
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenOCSPKeyCertPage.java
@@ -0,0 +1,62 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Generate the OCSP signing certificate
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.keycert
+ */
+class WIGenOCSPKeyCertPage extends WIGenKeyCertPage {
+ private static final String PANELNAME = "INSTALLGENOCSPWIZARD";
+ private static final String OCSPHELPINDEX = "install-ocspcert-creation-wizard-help";
+
+ WIGenOCSPKeyCertPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIGenOCSPKeyCertPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+
+Debug.println("+++++++++++++++++++++++++++++=WIGenOCSPKeyCertPage ");
+ if (!wizardInfo.isOCSPInstalled())
+ return false;
+
+ mHelpIndex = OCSPHELPINDEX;
+
+ return super.initializePanel(info);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIGenOCSPKeyCertReqPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenOCSPKeyCertReqPage.java
new file mode 100644
index 000000000..7c27f673d
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenOCSPKeyCertReqPage.java
@@ -0,0 +1,77 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Generate the OCSP signing certificate request
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIGenOCSPKeyCertReqPage extends WIGenKeyCertReqPage {
+ private static final String PANELNAME = "INSTALLGENOCSPCERTREQWIZARD";
+ private static final String OCSPHELPINDEX = "install-ocspcert-request-wizard-help";
+
+ WIGenOCSPKeyCertReqPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIGenOCSPKeyCertReqPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isOCSPCloningDone())
+ return false;
+
+ if (wizardInfo.isOCSPCertLocalCA() || !wizardInfo.isOCSPInstalled() ||
+ (wizardInfo.isOCSPCertRequestDone() &&
+ !wizardInfo.isOCSPCertRequestBack()) ||
+ wizardInfo.isOCSPLocalCertDone() ||
+ wizardInfo.isOCSPCertInstalledDone())
+ return false;
+
+ if (wizardInfo.isOCSPCertRequestBack()) {
+ wizardInfo.put(ConfigConstants.STAGE_OCSP_CERT_REQUEST,
+ ConfigConstants.FALSE);
+ wizardInfo.put(ConfigConstants.OCSP_CERT_REQUEST_BACK,
+ ConfigConstants.FALSE);
+ }
+
+ mHelpIndex = OCSPHELPINDEX;
+
+ mTokenName = wizardInfo.getOCSPTokenName();
+ wizardInfo.setCertType(Constants.PR_OCSP_SIGNING_CERT);
+ wizardInfo.setNewRequest();
+ return super.initializePanel(info);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIGenRAKeyCertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenRAKeyCertPage.java
new file mode 100644
index 000000000..05859e54c
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenRAKeyCertPage.java
@@ -0,0 +1,67 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Generate the RA signing certificate
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.keycert
+ */
+class WIGenRAKeyCertPage extends WIGenKeyCertPage {
+ private static final String PANELNAME = "INSTALLGENRAWIZARD";
+ private static final String RAHELPINDEX = "install-racert-creation-wizard-help";
+ private static final String RAKRAHELPINDEX = "install-rakracert-creation-wizard-help";
+
+ WIGenRAKeyCertPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIGenRAKeyCertPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isRACloningDone())
+ return false;
+ if (!wizardInfo.isRACertLocalCA() || !wizardInfo.isRAInstalled() ||
+ wizardInfo.isRALocalCertDone() || wizardInfo.isRACertRequestDone() ||
+ wizardInfo.isRACertInstalledDone())
+ return false;
+
+ if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = RAKRAHELPINDEX;
+ else
+ mHelpIndex = RAHELPINDEX;
+
+ return super.initializePanel(info);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIGenRAKeyCertReqPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenRAKeyCertReqPage.java
new file mode 100644
index 000000000..89aa21f14
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenRAKeyCertReqPage.java
@@ -0,0 +1,79 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Generate the RA signing certificate request
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIGenRAKeyCertReqPage extends WIGenKeyCertReqPage {
+ private static final String PANELNAME = "INSTALLGENRACERTREQWIZARD";
+ private static final String RAHELPINDEX = "install-racert-request-wizard-help";
+ private static final String RAKRAHELPINDEX = "install-rakracert-request-wizard-help";
+
+ WIGenRAKeyCertReqPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIGenRAKeyCertReqPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isRACloningDone())
+ return false;
+ if (wizardInfo.isRACertLocalCA() || !wizardInfo.isRAInstalled() ||
+ (wizardInfo.isRACertRequestDone() &&
+ !wizardInfo.isRACertRequestBack()) ||
+ wizardInfo.isRALocalCertDone() ||
+ wizardInfo.isRACertInstalledDone())
+ return false;
+
+ if (wizardInfo.isRACertRequestBack()) {
+ wizardInfo.put(ConfigConstants.STAGE_RA_CERT_REQUEST,
+ ConfigConstants.FALSE);
+ wizardInfo.put(ConfigConstants.RA_CERT_REQUEST_BACK,
+ ConfigConstants.FALSE);
+ }
+
+ if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = RAKRAHELPINDEX;
+ else
+ mHelpIndex = RAHELPINDEX;
+
+ mTokenName = wizardInfo.getRATokenName();
+ wizardInfo.setCertType(Constants.PR_RA_SIGNING_CERT);
+ wizardInfo.setNewRequest();
+ return super.initializePanel(info);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIGenSSLKeyCertReqPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenSSLKeyCertReqPage.java
new file mode 100644
index 000000000..58a85f790
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenSSLKeyCertReqPage.java
@@ -0,0 +1,76 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Generate the SSL server certificate request
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIGenSSLKeyCertReqPage extends WIGenKeyCertReqPage {
+ private static final String PANELNAME = "INSTALLGENSSLCERTREQWIZARD";
+ private static final String HELPINDEX = "install-sslcert-request-wizard-help";
+
+ WIGenSSLKeyCertReqPage(JDialog parent) {
+ super(PANELNAME);
+ mHelpIndex = HELPINDEX;
+ mParent = parent;
+ }
+
+ WIGenSSLKeyCertReqPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mHelpIndex = HELPINDEX;
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning())
+ return false;
+ if (wizardInfo.isSSLCertLocalCA() || wizardInfo.isMigrationEnable() ||
+ (wizardInfo.isSSLCertRequestDone() &&
+ !wizardInfo.isSSLCertRequestBack()) ||
+ wizardInfo.isSSLLocalCertDone() ||
+ wizardInfo.isSSLCertInstalledDone())
+ return false;
+
+
+ if (wizardInfo.isSSLCertRequestBack()) {
+ wizardInfo.put(ConfigConstants.STAGE_SSL_CERT_REQUEST,
+ ConfigConstants.FALSE);
+ wizardInfo.put(ConfigConstants.SSL_CERT_REQUEST_BACK,
+ ConfigConstants.FALSE);
+ }
+
+ mTokenName = wizardInfo.getSSLTokenName();
+ wizardInfo.setCertType(Constants.PR_SERVER_CERT);
+ wizardInfo.setNewRequest();
+ return super.initializePanel(info);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIGenServerKeyCertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenServerKeyCertPage.java
new file mode 100644
index 000000000..e93c378f6
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenServerKeyCertPage.java
@@ -0,0 +1,62 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Generate the SSL server certificate
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.keycert
+ */
+class WIGenServerKeyCertPage extends WIGenKeyCertPage {
+ private static final String PANELNAME = "INSTALLGENSSLWIZARD";
+ private static final String HELPINDEX = "install-sslcert-creation-wizard-help";
+
+ WIGenServerKeyCertPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIGenServerKeyCertPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning())
+ return false;
+ if (!wizardInfo.isSSLCertLocalCA() || wizardInfo.isMigrationEnable() ||
+ wizardInfo.isSSLLocalCertDone() || wizardInfo.isSSLCertRequestDone() ||
+ wizardInfo.isSSLCertInstalledDone())
+ return false;
+
+ mHelpIndex = HELPINDEX;
+ return super.initializePanel(info);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallCACertStatusPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallCACertStatusPage.java
new file mode 100644
index 000000000..d26b79ab0
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallCACertStatusPage.java
@@ -0,0 +1,70 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import javax.swing.*;
+
+/**
+ * The panel asks the user to paste the certificate.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIInstallCACertStatusPage extends WIInstallCertStatusPage {
+ private static final String PANELNAME = "INSTALLCACERTSTATUSWIZARD";
+ private static final String CAHELPINDEX = "install-cacert-status-wizard-help";
+ private static final String CAKRAHELPINDEX = "install-cakracert-status-wizard-help";
+
+ WIInstallCACertStatusPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIInstallCACertStatusPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isCACloningDone())
+ return false;
+ if (wizardInfo.isCACertLocalCA() || !wizardInfo.isCACertInstalledDone() ||
+ !wizardInfo.isCAInstalled() || wizardInfo.isMigrationEnable() ||
+ wizardInfo.isCACertChainImportDone())
+ return false;
+
+ if (wizardInfo.hasEntireCAChain())
+ return false;
+
+ wizardInfo.setCertType(Constants.PR_CA_SIGNING_CERT);
+
+ if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = CAKRAHELPINDEX;
+ else
+ mHelpIndex = CAHELPINDEX;
+
+ return super.initializePanel(info);
+ }
+}
+
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallCAIntroPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallCAIntroPage.java
new file mode 100644
index 000000000..033897c79
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallCAIntroPage.java
@@ -0,0 +1,62 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import com.netscape.admin.certsrv.wizard.*;
+import javax.swing.*;
+
+/**
+ * The panel asks if the user wants to install the CA certificate now.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIInstallCAIntroPage extends WIInstallIntroPage {
+ private static final String PANELNAME = "INSTALLCAINTROWIZARD";
+ private static final String CAHELPINDEX = "install-cacert-installintro-wizard-help";
+ private static final String CAKRAHELPINDEX = "install-cakracert-installintro-wizard-help";
+
+ WIInstallCAIntroPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIInstallCAIntroPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isCACloningDone())
+ return false;
+
+ if (wizardInfo.isCACertLocalCA() || !wizardInfo.isCAInstalled() ||
+ wizardInfo.isMigrationEnable() || wizardInfo.isCACertInstalledDone())
+ return false;
+
+ if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = CAKRAHELPINDEX;
+ else
+ mHelpIndex = CAHELPINDEX;
+
+ return super.initializePanel(info);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallCert1Page.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallCert1Page.java
new file mode 100644
index 000000000..240134536
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallCert1Page.java
@@ -0,0 +1,157 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * This page is to install the certificate in the internal token. The user can
+ * import the cert from the file or paste the Base 64 encoded blob in the
+ * text area.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIInstallCert1Page extends WizardBasePanel implements IWizardPanel {
+ private JRadioButton mFileBtn;
+ private JRadioButton mBase64Btn;
+ private JTextField mFileText;
+ private JTextArea mBase64Text;
+ private JButton mPaste;
+ private static final String PANELNAME = "INSTALLCERT1WIZARD";
+ private static final String HELPINDEX =
+ "configuration-kra-wizard-change-keyscheme-help";
+
+ WIInstallCert1Page() {
+ super(PANELNAME);
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ mFileBtn = makeJRadioButton("FILE", true);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mFileBtn, gbc);
+
+ mFileText = makeJTextField(50);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, 0);
+ add(mFileText, gbc);
+
+ mBase64Btn = makeJRadioButton("BASE64", false);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mBase64Btn, gbc);
+
+ JTextArea desc = createTextArea(
+ CMSAdminUtil.wrapText(mResource.getString(
+ "INSTALLCERT1WIZARD_TEXT_DESC_LABEL"), 80), 2, 80);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+
+ mPaste = makeJButton("PASTE");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mPaste, gbc);
+
+ mBase64Text = new JTextArea(null, null, 0, 0);
+ mBase64Text.setLineWrap(true);
+ mBase64Text.setWrapStyleWord(true);
+ JScrollPane scrollPane = new JScrollPane(mBase64Text,
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
+ scrollPane.setPreferredSize(new Dimension(50, 20));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(scrollPane, gbc);
+
+ JLabel dummy = new JLabel(" ");
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weighty = 1.0;
+ gbc.fill = gbc.BOTH;
+ add(dummy, gbc);
+
+ ButtonGroup buttonGrp = new ButtonGroup();
+ buttonGrp.add(mFileBtn);
+ buttonGrp.add(mBase64Btn);
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallCert2Page.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallCert2Page.java
new file mode 100644
index 000000000..fc9eaacb0
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallCert2Page.java
@@ -0,0 +1,140 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * This page is to install the certificate in the internal token. It
+ * displays the certificate information.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIInstallCert2Page extends WizardBasePanel implements IWizardPanel {
+ private JButton mAdd;
+ private static final String PANELNAME = "INSTALLCERT2WIZARD";
+ private static final String HELPINDEX =
+ "configuration-kra-wizard-change-keyscheme-help";
+
+ WIInstallCert2Page() {
+ super(PANELNAME);
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ JLabel subjectDNLbl = makeJLabel("SUBJECTDN");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ add(subjectDNLbl, gbc);
+
+ JLabel issuerLbl = makeJLabel("ISSUE");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ add(issuerLbl, gbc);
+
+ JTextArea subjectText = new JTextArea(null, null, 0, 0);
+ JScrollPane subjectScrollPane = new JScrollPane(subjectText,
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
+ //subjectScrollPane.setPreferredSize(new Dimension(50, 30));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, 0 );
+ gbc.weighty = 1.0;
+ gbc.weightx = 1.0;
+ gbc.fill = gbc.BOTH;
+ add(subjectScrollPane, gbc);
+
+ JTextArea issueText = new JTextArea(null, null, 0, 0);
+ JScrollPane issueScrollPane = new JScrollPane(issueText,
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
+ //issueScrollPane.setPreferredSize(new Dimension(50, 30));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weighty = 1.0;
+ gbc.weightx = 1.0;
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(issueScrollPane, gbc);
+
+ JTextArea infoText = new JTextArea(null, null, 0, 0);
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ infoText.setPreferredSize(new Dimension(50, 20));
+ gbc.fill = gbc.BOTH;
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ add(infoText, gbc);
+
+ mAdd = makeJButton("ADD");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mAdd, gbc);
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallCertStatusPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallCertStatusPage.java
new file mode 100644
index 000000000..860e5b60e
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallCertStatusPage.java
@@ -0,0 +1,248 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import java.io.*;
+import javax.swing.*;
+import javax.swing.text.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+
+/**
+ * Status page of certificate installation.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIInstallCertStatusPage extends WizardBasePanel implements IWizardPanel {
+ private Color mActiveColor;
+ private JTextArea desc;
+ private JRadioButton mFileBtn;
+ private JRadioButton mBase64Btn;
+ private String mPanelName;
+ protected JTextArea mBase64Text;
+ private JTextField mFileText;
+ protected JButton mPaste;
+ protected String mHelpIndex;
+ protected String mCertChain;
+ protected String mCertFilePath;
+
+ WIInstallCertStatusPage(String panelName) {
+ super(panelName);
+ mPanelName = panelName;
+ init();
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ setBorder(makeTitledBorder(mPanelName));
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ String str = mResource.getString(mPanelName+"_TEXT_DESC_LABEL");
+ desc.setText(str);
+ return true;
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean validatePanel() {
+ if (mFileBtn.isSelected()) {
+ mCertFilePath = mFileText.getText().trim();
+ if (mCertFilePath.equals("")) {
+ setErrorMessage("EMPTYFILEFIELD");
+ return false;
+ }
+ } else if (mBase64Btn.isSelected()) {
+ mCertChain = mBase64Text.getText().trim();
+ if (mCertChain.equals("")) {
+ setErrorMessage("B64EEMPTY");
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_IMPORT_CERT_CHAIN;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_READ;
+ if (mFileBtn.isSelected()) {
+ rawData = rawData+"&"+Constants.PR_CERT_FILEPATH+"="+mCertFilePath;
+ } else if (mBase64Btn.isSelected()) {
+ rawData = rawData+"&"+ConfigConstants.PR_CERT_CHAIN+"="+mCertChain;
+ }
+
+ rawData = rawData+"&"+Constants.PR_CERTIFICATE_TYPE+"="+wizardInfo.getCertType();
+
+ startProgressStatus();
+ boolean ready = send(rawData, wizardInfo);
+ endProgressStatus();
+ if (!ready) {
+ String str = getErrorMessage();
+ if (str.equals("")) {
+ String errorMsg = mResource.getString(
+ mPanelName+"_ERRORMSG");
+ setErrorMessage(errorMsg);
+ } else if (str.equals("incompleteCertChain")) {
+ String errormsg = mResource.getString(mPanelName+"_INCOMPLETECERTCHAIN");
+ int status = JOptionPane.showConfirmDialog(mAdminFrame, errormsg, "Information",
+ JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE,
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_INFO_ICON));
+ if (status == JOptionPane.OK_OPTION) {
+ rawData = rawData+"&"+ConfigConstants.NOT_IMPORT_CHAIN+"="+
+ ConfigConstants.TRUE;
+ ready = send(rawData, wizardInfo);
+ return true;
+ } else {
+ setErrorMessage(mResource.getString(mPanelName+"_ERROR1"));
+ return false;
+ }
+ } else
+ setErrorMessage(str);
+ }
+ return ready;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(mHelpIndex);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ desc = createTextArea("");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ //gbc.weighty = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+
+ mFileBtn = makeJRadioButton("FILE", true);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mFileBtn, gbc);
+
+ mFileText = makeJTextField(50);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, 4*COMPONENT_SPACE, COMPONENT_SPACE, 0);
+ add(mFileText, gbc);
+ mActiveColor = mFileText.getBackground();
+
+ mBase64Btn = makeJRadioButton("BASE64", false);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mBase64Btn, gbc);
+
+ ButtonGroup btngroup = new ButtonGroup();
+ btngroup.add(mFileBtn);
+ btngroup.add(mBase64Btn);
+
+ JTextArea desc1 = createTextArea(mResource.getString(
+ mPanelName+"_TEXT_DESC1_LABEL"));
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,4*COMPONENT_SPACE,0,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc1, gbc);
+
+ mBase64Text = new JTextArea(null, null, 0, 0);
+ JScrollPane scrollPane = new JScrollPane(mBase64Text,
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
+ scrollPane.setPreferredSize(new Dimension(50, 20));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(scrollPane, gbc);
+
+ mPaste = makeJButton("PASTE");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mPaste, gbc);
+
+ JLabel dummy = new JLabel(" ");
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weighty = 1.0;
+ gbc.fill = gbc.BOTH;
+ add(dummy, gbc);
+
+ enableFields(mFileText, true, mActiveColor);
+ enableFields(mBase64Text, false, getBackground());
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mPaste)) {
+ mBase64Text.paste();
+ } else if (e.getSource().equals(mFileBtn)) {
+ enableFields(mFileText, true, mActiveColor);
+ enableFields(mBase64Text, false, getBackground());
+ } else if (e.getSource().equals(mBase64Btn)) {
+ enableFields(mFileText, false, getBackground());
+ enableFields(mBase64Text, true, mActiveColor);
+ }
+ }
+
+ private void enableFields(JTextComponent comp1, boolean enable, Color color) {
+ comp1.setEnabled(enable);
+ comp1.setEditable(enable);
+ comp1.setBackground(color);
+ CMSAdminUtil.repaintComp(comp1);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallIntroPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallIntroPage.java
new file mode 100644
index 000000000..29ddd0a46
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallIntroPage.java
@@ -0,0 +1,133 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import javax.swing.event.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+
+/**
+ * Setup Single Signon for the installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIInstallIntroPage extends WizardBasePanel implements IWizardPanel {
+ protected JRadioButton mYes;
+ protected JRadioButton mNo;
+ protected String mPanelName;
+ protected String mHelpIndex;
+
+ WIInstallIntroPage(String panelName) {
+ super(panelName);
+ mPanelName = panelName;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ setBorder(makeTitledBorder(mPanelName));
+
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(mHelpIndex);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ JTextArea heading = createTextArea(mResource.getString(
+ mPanelName+"_TEXT_HEADING_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(heading, gbc);
+
+ mNo = makeJRadioButton("NO", false);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mNo, gbc);
+
+ mYes = makeJRadioButton("YES", true);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(0,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mYes, gbc);
+
+ JLabel dummy = new JLabel("");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(dummy, gbc);
+
+ ButtonGroup buttonGrp = new ButtonGroup();
+ buttonGrp.add(mYes);
+ buttonGrp.add(mNo);
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (mNo.isSelected())
+ wizardInfo.setInstallCertNow(Constants.FALSE);
+ else
+ wizardInfo.setInstallCertNow(Constants.TRUE);
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallKRACertStatusPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallKRACertStatusPage.java
new file mode 100644
index 000000000..d33601151
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallKRACertStatusPage.java
@@ -0,0 +1,72 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import javax.swing.*;
+
+/**
+ * The panel asks the user to paste the certificate.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIInstallKRACertStatusPage extends WIInstallCertStatusPage {
+ private static final String PANELNAME = "INSTALLKRACERTSTATUSWIZARD";
+ private static final String KRAHELPINDEX = "install-kracert-status-wizard-help";
+ private static final String CAKRAHELPINDEX = "install-cakra-kracert-status-wizard-help";
+ private static final String RAKRAHELPINDEX = "install-rakra-kracert-status-wizard-help";
+
+ WIInstallKRACertStatusPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIInstallKRACertStatusPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isKRACloningDone())
+ return false;
+ if (wizardInfo.isKRACertLocalCA() || !wizardInfo.isKRACertInstalledDone() ||
+ !wizardInfo.isKRAInstalled() || wizardInfo.isKRACertChainImportDone())
+ return false;
+
+ if (wizardInfo.hasEntireKRAChain())
+ return false;
+
+ wizardInfo.setCertType(Constants.PR_KRA_TRANSPORT_CERT);
+
+ if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = CAKRAHELPINDEX;
+ else if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = RAKRAHELPINDEX;
+ else
+ mHelpIndex = KRAHELPINDEX;
+
+ return super.initializePanel(info);
+ }
+}
+
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallKRAIntroPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallKRAIntroPage.java
new file mode 100644
index 000000000..cba792c1c
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallKRAIntroPage.java
@@ -0,0 +1,65 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import com.netscape.admin.certsrv.wizard.*;
+import javax.swing.*;
+
+/**
+ * The panel asks if the user wants to install the KR certificate now.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIInstallKRAIntroPage extends WIInstallIntroPage {
+ private static final String PANELNAME = "INSTALLKRAINTROWIZARD";
+ private static final String KRAHELPINDEX = "install-kracert-installintro-wizard-help";
+ private static final String RAKRAHELPINDEX = "install-rakra-kracert-installintro-wizard-help";
+ private static final String CAKRAHELPINDEX = "install-cakra-kracert-installintro-wizard-help";
+
+
+ WIInstallKRAIntroPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIInstallKRAIntroPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isKRACloningDone())
+ return false;
+ if (wizardInfo.isKRACertLocalCA() || !wizardInfo.isKRAInstalled() ||
+ wizardInfo.isKRACertInstalledDone())
+ return false;
+
+ if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = CAKRAHELPINDEX;
+ else if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = RAKRAHELPINDEX;
+ else
+ mHelpIndex = KRAHELPINDEX;
+
+ return super.initializePanel(info);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallOCSPCertStatusPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallOCSPCertStatusPage.java
new file mode 100644
index 000000000..c98b7b045
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallOCSPCertStatusPage.java
@@ -0,0 +1,67 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import javax.swing.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * The panel asks the user to paste the certificate.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIInstallOCSPCertStatusPage extends WIInstallCertStatusPage {
+ private static final String PANELNAME = "INSTALLOCSPCERTSTATUSWIZARD";
+ private static final String OCSPHELPINDEX = "install-ocspcert-status-wizard-help";
+
+ WIInstallOCSPCertStatusPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIInstallOCSPCertStatusPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isOCSPCloningDone())
+ return false;
+
+ if (wizardInfo.isOCSPCertLocalCA() || !wizardInfo.isOCSPCertInstalledDone() ||
+ !wizardInfo.isOCSPInstalled() || wizardInfo.isOCSPCertChainImportDone())
+ return false;
+
+ if (wizardInfo.hasEntireOCSPChain())
+ return false;
+
+ wizardInfo.setCertType(Constants.PR_OCSP_SIGNING_CERT);
+
+ mHelpIndex = OCSPHELPINDEX;
+
+ return super.initializePanel(info);
+ }
+}
+
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallOCSPIntroPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallOCSPIntroPage.java
new file mode 100644
index 000000000..96c843e57
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallOCSPIntroPage.java
@@ -0,0 +1,60 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import com.netscape.admin.certsrv.wizard.*;
+import javax.swing.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * The panel asks if the user wants to install the RA certificate now.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIInstallOCSPIntroPage extends WIInstallIntroPage {
+
+ private static final String PANELNAME = "INSTALLOCSPINTROWIZARD";
+ private static final String OCSPHELPINDEX = "install-ocspcert-installintro-wizard-help";
+
+ WIInstallOCSPIntroPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIInstallOCSPIntroPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+
+ if (wizardInfo.isCloning() && wizardInfo.isOCSPCloningDone())
+ return false;
+ if (wizardInfo.isOCSPCertLocalCA() || !wizardInfo.isOCSPInstalled() ||
+ wizardInfo.isOCSPCertInstalledDone())
+ return false;
+
+ mHelpIndex = OCSPHELPINDEX;
+
+ return super.initializePanel(info);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallRACertStatusPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallRACertStatusPage.java
new file mode 100644
index 000000000..326f5067a
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallRACertStatusPage.java
@@ -0,0 +1,69 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import javax.swing.*;
+
+/**
+ * The panel asks the user to paste the certificate.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIInstallRACertStatusPage extends WIInstallCertStatusPage {
+ private static final String PANELNAME = "INSTALLRACERTSTATUSWIZARD";
+ private static final String RAHELPINDEX = "install-racert-status-wizard-help";
+ private static final String RAKRAHELPINDEX = "install-rakracert-status-wizard-help";
+
+ WIInstallRACertStatusPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIInstallRACertStatusPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isRACloningDone())
+ return false;
+ if (wizardInfo.isRACertLocalCA() || !wizardInfo.isRACertInstalledDone() ||
+ !wizardInfo.isRAInstalled() || wizardInfo.isRACertChainImportDone())
+ return false;
+
+ if (wizardInfo.hasEntireRAChain())
+ return false;
+
+ wizardInfo.setCertType(Constants.PR_RA_SIGNING_CERT);
+
+ if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = RAKRAHELPINDEX;
+ else
+ mHelpIndex = RAHELPINDEX;
+
+ return super.initializePanel(info);
+ }
+}
+
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallRAIntroPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallRAIntroPage.java
new file mode 100644
index 000000000..d3d48492c
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallRAIntroPage.java
@@ -0,0 +1,61 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import com.netscape.admin.certsrv.wizard.*;
+import javax.swing.*;
+
+/**
+ * The panel asks if the user wants to install the RA certificate now.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIInstallRAIntroPage extends WIInstallIntroPage {
+ private static final String PANELNAME = "INSTALLRAINTROWIZARD";
+ private static final String RAHELPINDEX = "install-racert-installintro-wizard-help";
+ private static final String RAKRAHELPINDEX = "install-rakracert-installintro-wizard-help";
+
+ WIInstallRAIntroPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIInstallRAIntroPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isRACloningDone())
+ return false;
+ if (wizardInfo.isRACertLocalCA() || !wizardInfo.isRAInstalled() ||
+ wizardInfo.isRACertInstalledDone())
+ return false;
+
+ if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = RAKRAHELPINDEX;
+ else
+ mHelpIndex = RAHELPINDEX;
+
+ return super.initializePanel(info);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallSSLCertStatusPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallSSLCertStatusPage.java
new file mode 100644
index 000000000..27ca1755f
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallSSLCertStatusPage.java
@@ -0,0 +1,65 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import javax.swing.*;
+
+/**
+ * The panel asks the user to paste the certificate.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIInstallSSLCertStatusPage extends WIInstallCertStatusPage {
+ private static final String PANELNAME = "INSTALLSSLCERTSTATUSWIZARD";
+ private static final String HELPINDEX = "install-sslcert-status-wizard-help";
+
+ WIInstallSSLCertStatusPage(JDialog parent) {
+ super(PANELNAME);
+ mHelpIndex = HELPINDEX;
+ mParent = parent;
+ }
+
+ WIInstallSSLCertStatusPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mHelpIndex = HELPINDEX;
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning())
+ return false;
+ if (wizardInfo.isSSLCertLocalCA() || !wizardInfo.isSSLCertInstalledDone() ||
+ wizardInfo.isMigrationEnable() || wizardInfo.isSSLCertChainImportDone())
+ return false;
+
+ if (wizardInfo.hasEntireSSLChain())
+ return false;
+
+ wizardInfo.setCertType(Constants.PR_SERVER_CERT);
+
+ return super.initializePanel(info);
+ }
+}
+
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallSSLIntroPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallSSLIntroPage.java
new file mode 100644
index 000000000..7115f96bf
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallSSLIntroPage.java
@@ -0,0 +1,58 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import com.netscape.admin.certsrv.wizard.*;
+import javax.swing.*;
+
+/**
+ * The panel asks if the user wants to install the SSL certificate now.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIInstallSSLIntroPage extends WIInstallIntroPage {
+ private static final String PANELNAME = "INSTALLSSLINTROWIZARD";
+ private static final String HELPINDEX = "install-sslcert-installintro-wizard-help";
+
+ WIInstallSSLIntroPage(JDialog parent) {
+ super(PANELNAME);
+ mHelpIndex = HELPINDEX;
+ mParent = parent;
+ }
+
+ WIInstallSSLIntroPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mHelpIndex = HELPINDEX;
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning())
+ return false;
+
+ if (wizardInfo.isSSLCertLocalCA() || wizardInfo.isMigrationEnable() ||
+ wizardInfo.isSSLCertInstalledDone())
+ return false;
+
+ return super.initializePanel(info);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIInternalDBInfoPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIInternalDBInfoPage.java
new file mode 100644
index 000000000..5338e820d
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIInternalDBInfoPage.java
@@ -0,0 +1,173 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+
+/**
+ * This panel asks for the information of the current internal database.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIInternalDBInfoPage extends WizardBasePanel implements IWizardPanel {
+ private JTextField mBindAsText;
+ private JPasswordField mPasswordText;
+ private JLabel mBindAsLabel, mPasswordLabel;
+
+ private static final String PANELNAME = "INTERNALDBINFOWIZARD";
+ private static final String HELPINDEX =
+ "install-internaldb-logon-wizard-help";
+
+ WIInternalDBInfoPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WIInternalDBInfoPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.getInternalDBPasswd() != null)
+ return false;
+ setBorder(makeTitledBorder(PANELNAME));
+ mBindAsText.setText(wizardInfo.getDBBindDN());
+ return true;
+ }
+
+ public boolean validatePanel() {
+ String passwd = mPasswordText.getText();
+ if (passwd.equals("")) {
+ setErrorMessage("BLANKPASSWD");
+ return false;
+ }
+
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ wizardInfo.setDBBindDN(mBindAsText.getText().trim());
+ wizardInfo.setInternalDBPasswd(mPasswordText.getText().trim());
+
+ String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_VALIDATE_DSPASSWD;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY;
+ rawData = rawData+"&"+ConfigConstants.PR_DB_PWD+"="+wizardInfo.getInternalDBPasswd();
+ rawData = rawData+"&"+ConfigConstants.PR_DB_BINDDN+"="+wizardInfo.getDBBindDN();
+
+ startProgressStatus();
+
+ boolean ready = send(rawData, wizardInfo);
+ endProgressStatus();
+
+ if (!ready) {
+ String str = getErrorMessage(wizardInfo);
+ if (str.equals(""))
+ setErrorMessage("Server Error");
+ else
+ setErrorMessage(str);
+ }
+
+ return ready;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JTextArea desc = createTextArea(mResource.getString(
+ PANELNAME+"_TEXT_HEADING_LABEL"));
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mBindAsLabel = makeJLabel("ADMIN");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mBindAsLabel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mBindAsText = makeJTextField(30);
+ gbc.anchor = gbc.NORTHWEST;
+ //gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mBindAsText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mPasswordLabel = makeJLabel("PWD");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, 0, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mPasswordLabel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mPasswordText = makeJPasswordField(30);
+ gbc.anchor = gbc.NORTHWEST;
+ // gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mPasswordText, gbc);
+
+ JLabel dummy = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ add(dummy, gbc);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIInternalDBPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIInternalDBPage.java
new file mode 100644
index 000000000..936d252d8
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIInternalDBPage.java
@@ -0,0 +1,313 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Introduction page for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIInternalDBPage extends WizardBasePanel implements IWizardPanel {
+ private Color mActiveColor;
+
+ private JCheckBox mSchema;
+ private JTextField mRMPortText, mRMBindAsText, mRMBaseText;
+ private JTextField mRMHostText,mRMDBNameAsText;
+ private JPasswordField mRMPasswordText;
+ private JLabel mRMHostLabel, mRMDBNameAsLabel;
+ private JLabel mRMBaseLabel, mRMBindAsLabel, mRMPasswordLabel;
+
+ private static final String PANELNAME = "INTERNALDBWIZARD";
+ private static final String HELPINDEX =
+ "install-internaldb-configuration-wizard-help";
+ private static final String EMPTYSTR = " ";
+
+ WIInternalDBPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WIInternalDBPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mSchema)) {
+ if (mSchema.isSelected()) {
+ mRMDBNameAsText.setEnabled(true);
+ mRMDBNameAsText.setBackground(mActiveColor);
+ } else {
+ mRMDBNameAsText.setEnabled(false);
+ mRMDBNameAsText.setBackground(getBackground());
+ }
+ } else {
+ super.actionPerformed(e);
+ }
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+
+ if (wizardInfo.isCloning())
+ return false;
+ if (wizardInfo.isDBCreateNow()) {
+ setBorder(makeTitledBorder(PANELNAME));
+ mRMBaseText.setText("o="+wizardInfo.getDBName()+", o=netscapeCertificateServer");
+ mRMBindAsText.setText(wizardInfo.getDBBindDN());
+ return true;
+ }
+
+ return false;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ cleanUpWizardInfo(wizardInfo);
+
+ String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_CREATE_INTERNALDB;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY;
+ rawData = rawData+"&"+ConfigConstants.PR_CMS_SEED+"="+
+ (new Long(WizardBasePanel.mSeed).toString());
+ // remote database
+ rawData = rawData+"&"+ConfigConstants.PR_HOST+"="
+ +mRMHostText.getText();
+ rawData = rawData+"&"+ConfigConstants.PR_LDAP_DB_NAME+"="
+ +mRMDBNameAsText.getText();
+ rawData = rawData+"&"+ConfigConstants.PR_DB_PORT+"="+mRMPortText.getText();
+ rawData = rawData+"&"+ConfigConstants.PR_DB_BINDDN+"="+mRMBindAsText.getText();
+ rawData = rawData+"&"+ConfigConstants.PR_DB_NAME+"="+mRMBaseText.getText();
+ rawData = rawData+"&"+ConfigConstants.PR_DB_PWD+"="+mRMPasswordText.getText();
+ if (mSchema.isSelected()) {
+ rawData = rawData+"&"+ConfigConstants.PR_DB_SCHEMA+"="+"true";
+ } else {
+ rawData = rawData+"&"+ConfigConstants.PR_DB_SCHEMA+"="+"false";
+ }
+ wizardInfo.setInternalDBPasswd(mRMPasswordText.getText().trim());
+ wizardInfo.setDBBindDN(mRMBindAsText.getText().trim());
+ wizardInfo.setDBName(mRMBaseText.getText().trim());
+
+ startProgressStatus();
+ //CMSMessageBox dlg = new CMSMessageBox(mAdminFrame, "CGITASK", "CREATEDB");
+
+ boolean ready = send(rawData, wizardInfo);
+
+ if (ready) {
+ rawData = ConfigConstants.TASKID+"="+TaskId.TASK_TOKEN_INFO;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_READ;
+ ready = send(rawData, wizardInfo);
+ }
+ //dlg.setVisible(false);
+
+ endProgressStatus();
+
+ if (!ready) {
+ String str = getErrorMessage(wizardInfo);
+ if (str.equals("")) {
+ String errorMsg = mResource.getString(
+ PANELNAME+"_ERRORMSG");
+ setErrorMessage(errorMsg);
+ } else
+ setErrorMessage(str);
+ }
+
+ return ready;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JTextArea desc = createTextArea(mResource.getString(
+ "INTERNALDBWIZARD_TEXT_HEADING_LABEL"));
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel instanceIDLbl = makeJLabel("REMOTEHOST");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(instanceIDLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mRMHostText = makeJTextField(30);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ //gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mRMHostText, gbc);
+
+ mActiveColor = mRMHostText.getBackground();
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel portNumber = makeJLabel("REMOTEPORT");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, 0,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(portNumber, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mRMPortText = makeJTextField(10);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(mRMPortText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mRMBaseLabel = makeJLabel("REMOTEDN");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mRMBaseLabel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mRMBaseText = makeJTextField(30);
+ gbc.anchor = gbc.NORTHWEST;
+ //gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mRMBaseText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mRMBindAsLabel = makeJLabel("REMOTEADMIN");
+ //gbc.anchor = gbc.NORTHWEST;
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mRMBindAsLabel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mRMBindAsText = makeJTextField(30);
+ gbc.anchor = gbc.NORTHWEST;
+ //gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mRMBindAsText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mRMPasswordLabel = makeJLabel("REMOTEPWD");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, 0, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mRMPasswordLabel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mRMPasswordText = makeJPasswordField(30);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mRMPasswordText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mRMDBNameAsLabel = makeJLabel("DATABASE");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mRMDBNameAsLabel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mRMDBNameAsText = makeJTextField(30);
+ gbc.anchor = gbc.NORTHWEST;
+ //gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mRMDBNameAsText, gbc);
+
+ JLabel dummy1 = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, 0, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(dummy1, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mSchema = makeJCheckBox("SCHEMA", true);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mSchema, gbc);
+
+ JLabel dummy = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ add(dummy, gbc);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ wizardInfo.setDBCreated(ConfigConstants.TRUE);
+ wizardInfo.setDBCreateNow(ConfigConstants.FALSE);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIInternalTokenLogonPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIInternalTokenLogonPage.java
new file mode 100644
index 000000000..3bc9bd2f3
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIInternalTokenLogonPage.java
@@ -0,0 +1,67 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+
+/**
+ * This panel asks for the information of the current internal database.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIInternalTokenLogonPage extends WITokenLogonPage implements IWizardPanel {
+
+ private static final String HELPINDEX = "install-internaltoken-logon-wizard-help";
+ private static final String PANELNAME = "INTERNALTOKENLOGONWIZARD";
+
+ WIInternalTokenLogonPage(JDialog dialog) {
+ super(PANELNAME);
+ mHelpIndex = HELPINDEX;
+ mParent = dialog;
+ }
+
+ WIInternalTokenLogonPage(JDialog dialog, JFrame adminFrame) {
+ super(PANELNAME);
+ mHelpIndex = HELPINDEX;
+ mParent = dialog;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ String pwd =
+ (String)wizardInfo.get("TOKEN:"+Constants.PR_INTERNAL_TOKEN_NAME);
+ if (pwd != null)
+ return false;
+
+ mTokenName = "Internal";
+ mTokenText.setText(Constants.PR_INTERNAL_TOKEN_NAME);
+ return super.initializePanel(info);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIIntroMigrationPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIIntroMigrationPage.java
new file mode 100644
index 000000000..616911252
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIIntroMigrationPage.java
@@ -0,0 +1,162 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+
+/**
+ * Data Migration.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIIntroMigrationPage extends WizardBasePanel implements IWizardPanel {
+ private JRadioButton mYes;
+ private JRadioButton mNo;
+ private static final String PANELNAME = "INTROMIGRATIONWIZARD";
+ private String mHelpIndex;
+ private static final String CAHELPINDEX =
+ "install-ca-migration-enable-wizard-help";
+ private static final String CAKRAHELPINDEX =
+ "install-cakra-migration-enable-wizard-help";
+
+ WIIntroMigrationPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WIIntroMigrationPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (!wizardInfo.isCAInstalled() || wizardInfo.isMigrationDone())
+ return false;
+ if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = CAKRAHELPINDEX;
+ else
+ mHelpIndex = CAHELPINDEX;
+ setBorder(makeTitledBorder(PANELNAME));
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ Hashtable data = new Hashtable();
+
+ boolean ready = false;
+ if (mYes.isSelected()) {
+ wizardInfo.setEnableMigration(ConfigConstants.TRUE);
+ data.put(ConfigConstants.TASKID, TaskId.TASK_TOKEN_INFO);
+ data.put(ConfigConstants.OPTYPE, OpDef.OP_READ);
+ } else {
+ wizardInfo.setEnableMigration(ConfigConstants.FALSE);
+ // do the data migration
+ data.put(ConfigConstants.TASKID, TaskId.TASK_MIGRATION);
+ data.put(ConfigConstants.OPTYPE, OpDef.OP_MODIFY);
+ data.put(ConfigConstants.PR_ENABLE_MIGRATION,
+ ConfigConstants.FALSE);
+ }
+
+ startProgressStatus();
+
+ endProgressStatus();
+
+ if (!ready) {
+ String str = getErrorMessage(wizardInfo);
+ if (str.equals("")) {
+ String errorMsg = mResource.getString(
+ PANELNAME+"_ERRORMSG");
+ setErrorMessage(errorMsg);
+ } else
+ setErrorMessage(str);
+ }
+
+ return ready;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(mHelpIndex);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ JTextArea label = createTextArea(mResource.getString(
+ PANELNAME+"_LABEL_DESC_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(label, gbc);
+
+ mYes = makeJRadioButton("YES", false);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mYes, gbc);
+
+ mNo = makeJRadioButton("NO", true);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(0,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.weighty = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ add(mNo, gbc);
+
+ ButtonGroup group = new ButtonGroup();
+ group.add(mYes);
+ group.add(mNo);
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIIntroPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIIntroPage.java
new file mode 100644
index 000000000..208a92cb8
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIIntroPage.java
@@ -0,0 +1,217 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Introduction page for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIIntroPage extends WizardBasePanel implements IWizardPanel {
+ private JRadioButton mDbButton;
+ private JRadioButton mNetworkButton;
+ private JRadioButton mAdminButton;
+ private JRadioButton mSubsystemButton;
+ private JRadioButton mMigrationButton;
+ private JTextArea mLabel;
+ private static final String PANELNAME = "INTROINSTALLWIZARD";
+ private static final String HELPINDEX =
+ "install-general-intro-wizard-help";
+
+ WIIntroPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WIIntroPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ setBorder(makeTitledBorder(PANELNAME));
+ mAdminFrame = wizardInfo.getAdminFrame();
+ mLabel.setVisible(false);
+ mDbButton.setVisible(false);
+ mNetworkButton.setVisible(false);
+ mAdminButton.setVisible(false);
+ mSubsystemButton.setVisible(false);
+ mMigrationButton.setVisible(false);
+ String stages = wizardInfo.getStages();
+
+ if (stages != null && !stages.equals("")) {
+ StringTokenizer tokenizer = new StringTokenizer(stages, ":");
+ mLabel.setVisible(true);
+ while (tokenizer.hasMoreTokens()) {
+ String str = (String)tokenizer.nextToken();
+ if (str.equals(ConfigConstants.STAGE_INTERNAL_DB)) {
+ mDbButton.setVisible(true);
+ } else if (str.equals(ConfigConstants.STAGE_SETUP_PORTS)) {
+ mNetworkButton.setVisible(true);
+ } else if (str.equals(ConfigConstants.STAGE_SETUP_ADMINISTRATOR)) {
+ mAdminButton.setVisible(true);
+ }
+ }
+ }
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ cleanUpWizardInfo(wizardInfo);
+
+ startProgressStatus();
+ String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_GET_DEFAULT_INFO;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+ OpDef.OP_READ;
+ boolean ready = send(rawData, wizardInfo);
+ if (ready) {
+ rawData = ConfigConstants.TASKID+"="+TaskId.TASK_TOKEN_INFO;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_READ;
+ rawData = rawData+"&"+ConfigConstants.PR_CMS_SEED+"="+
+ (new Long(WizardBasePanel.mSeed).toString());
+
+ ready = send(rawData, wizardInfo);
+ }
+
+ endProgressStatus();
+
+ if (!ready) {
+ String str = getErrorMessage(wizardInfo);
+ if (str == null)
+ setErrorMessage("Server Error");
+ else
+ setErrorMessage(str);
+ }
+
+ return ready;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ JTextArea desc = createTextArea(mResource.getString(
+ "INTROINSTALLWIZARD_TEXT_DESC_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+
+ mLabel = createTextArea(
+ CMSAdminUtil.wrapText(mResource.getString(
+ "INTROINSTALLWIZARD_TEXT_HEADING_LABEL"), 80), 2, 80);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mLabel, gbc);
+
+ mDbButton = makeJRadioButton("CREATEDB");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mDbButton, gbc);
+
+ mNetworkButton = makeJRadioButton("NETWORK");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mNetworkButton, gbc);
+
+ mAdminButton = makeJRadioButton("ADMIN");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mAdminButton, gbc);
+
+ mSubsystemButton = makeJRadioButton("SUBSYSTEMS");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mSubsystemButton, gbc);
+
+ mMigrationButton = makeJRadioButton("MIGRATION");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mMigrationButton, gbc);
+
+ JLabel dummy = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ add(dummy, gbc);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIIntroSingleSignonPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIIntroSingleSignonPage.java
new file mode 100644
index 000000000..659dd6969
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIIntroSingleSignonPage.java
@@ -0,0 +1,162 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.io.*;
+import java.net.*;
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import javax.swing.event.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+import com.netscape.management.client.comm.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Setup Single Signon for the installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIIntroSingleSignonPage extends WizardBasePanel implements IWizardPanel {
+ private JRadioButton mYes;
+ private JRadioButton mNo;
+ private static final String HELPINDEX =
+ "install-single-signon-enable-wizard-help";
+ private static final String PANELNAME = "INSTALLINTROSINGLESIGNON";
+
+ WIIntroSingleSignonPage() {
+ super(PANELNAME);
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ setBorder(makeTitledBorder(PANELNAME));
+
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ if (mNo.isSelected()) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ Hashtable data = new Hashtable();
+ ConsoleInfo consoleInfo = wizardInfo.getAdminConsoleInfo();
+ CMSConfigCert configCertCgi = new CMSConfigCert();
+ configCertCgi.initialize(wizardInfo);
+ data.put(ConfigConstants.TASKID, TaskId.TASK_MISCELLANEOUS);
+ data.put(ConfigConstants.OPTYPE, OpDef.OP_MODIFY);
+ data.put(ConfigConstants.PR_CERT_INSTANCE_NAME,
+ consoleInfo.get(ConfigConstants.PR_CERT_INSTANCE_NAME));
+ data.put(ConfigConstants.PR_ADMIN_PASSWD,
+ (String)consoleInfo.get(ConfigConstants.PR_ADMIN_PASSWD));
+
+ boolean ready = configCertCgi.configCert(data);
+ return ready;
+ }
+
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+/*
+ JTextArea heading = createTextArea(
+ CMSAdminUtil.wrapText(mResource.getString(
+ PANELNAME+"_TEXT_HEADING_LABEL"), 80), 1, 80);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(heading, gbc);
+*/
+ JLabel heading = makeJLabel("HEADING");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(heading, gbc);
+
+ mNo = makeJRadioButton("NO", true);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mNo, gbc);
+
+ mYes = makeJRadioButton("YES", false);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(0,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mYes, gbc);
+
+ JLabel dummy = new JLabel("");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(dummy, gbc);
+
+ ButtonGroup buttonGrp = new ButtonGroup();
+ buttonGrp.add(mYes);
+ buttonGrp.add(mNo);
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (mNo.isSelected())
+ wizardInfo.put(ConfigConstants.PR_SINGLE_SIGNON, ConfigConstants.FALSE);
+ else
+ wizardInfo.put(ConfigConstants.PR_SINGLE_SIGNON, ConfigConstants.TRUE);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIKRACertDNPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRACertDNPage.java
new file mode 100644
index 000000000..2dca713b5
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRACertDNPage.java
@@ -0,0 +1,105 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import com.netscape.admin.certsrv.wizard.*;
+import javax.swing.*;
+
+/**
+ * Subject DN page for KRA transport certificate
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIKRACertDNPage extends WICertDNPage {
+ private static final String PANELNAME = "INSTALLKRACERTDNWIZARD";
+ private static final String CAKRALOCALHELPINDEX = "install-cakra-kracertlocal-subjectdn-wizard-help";
+ private static final String CAKRAREMOTEHELPINDEX = "install-cakra-kracertsub-subjectdn-wizard-help";
+ private static final String RAKRAHELPINDEX = "install-rakra-kracertsub-subjectdn-wizard-help";
+ private static final String KRAHELPINDEX = "install-kracertsub-subjectdn-wizard-help";
+
+ WIKRACertDNPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIKRACertDNPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isKRACloningDone())
+ return false;
+ if (!wizardInfo.isKRAInstalled() || wizardInfo.isKRALocalCertDone() ||
+ wizardInfo.isKRACertRequestDone() || wizardInfo.isKRACertInstalledDone())
+ return false;
+// dnDesc.setText(KRA_DN);
+ String str = wizardInfo.getKRASubjectName();
+ String OComp = null;
+ String CComp = null;
+ if (wizardInfo.isCAInstalled()) {
+ // get O component
+ OComp = wizardInfo.getCAOComp();
+ CComp = wizardInfo.getCACComp();
+ }
+
+ if (str == null || str.equals("")) {
+ if (OComp != null && !OComp.equals("")) {
+ if (CComp == null || CComp.equals(""))
+ str = KRA_CN+", O="+OComp;
+ else
+ str = KRA_CN+", O="+OComp+", C="+CComp;
+ } else {
+ if (CComp == null || CComp.equals(""))
+ str = KRA_CN;
+ else
+ str = KRA_CN+", C="+CComp;
+ }
+ }
+ wizardInfo.setKRASubjectName(str);
+ populateDN(str);
+
+ if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled())
+ if (wizardInfo.isKRACertLocalCA())
+ mHelpIndex = CAKRALOCALHELPINDEX;
+ else
+ mHelpIndex = CAKRAREMOTEHELPINDEX;
+ else if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = RAKRAHELPINDEX;
+ else
+ mHelpIndex = KRAHELPINDEX;
+
+ return super.initializePanel(info);
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+
+ if (super.concludePanel(info)) {
+ wizardInfo.setKRASubjectName(mStr);
+ return true;
+ }
+
+ return false;
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIKRACertExtensionPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRACertExtensionPage.java
new file mode 100644
index 000000000..2b1f0dc99
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRACertExtensionPage.java
@@ -0,0 +1,75 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.border.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+
+/**
+ * Certificate Extension page for KRA transport certificate.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIKRACertExtensionPage extends WICertExtensionPage {
+ private static final String PANELNAME = "INSTALLKRACERTEXTENSION1WIZARD";
+ private static final String KRAHELPINDEX = "install-kracert-extension-wizard-help";
+ private static final String CAKRAHELPINDEX = "install-cakra-kracert-extension-wizard-help";
+ private static final String RAKRAHELPINDEX = "install-rakracert-extension-wizard-help";
+
+ WIKRACertExtensionPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIKRACertExtensionPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isKRACloningDone())
+ return false;
+ if (!wizardInfo.isKRAInstalled() ||
+ wizardInfo.isKRALocalCertDone() || wizardInfo.isKRACertRequestDone() ||
+ wizardInfo.isKRACertInstalledDone())
+ return false;
+
+ if (!mModified)
+ mAKICheckBox.setSelected(true);
+
+ if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = CAKRAHELPINDEX;
+ else if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = RAKRAHELPINDEX;
+ else
+ mHelpIndex = KRAHELPINDEX;
+
+ return super.initializePanel(info);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIKRACertSubmitPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRACertSubmitPage.java
new file mode 100644
index 000000000..992bd7f14
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRACertSubmitPage.java
@@ -0,0 +1,80 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+
+/**
+ * KRA Certificate Submission.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIKRACertSubmitPage extends WICertSubmitPage implements IWizardPanel {
+ private static final String PANELNAME = "INSTALLKRACERTWIZARD";
+ private static final String KRAHELPINDEX = "install-kratype-wizard-help";
+ private static final String CAKRAHELPINDEX = "install-cakratype-wizard-help";
+ private static final String RAKRAHELPINDEX = "install-rakratype-wizard-help";
+
+ WIKRACertSubmitPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isKRACloningDone())
+ return false;
+ wizardInfo.put(Constants.PR_CERTIFICATE_TYPE,
+ Constants.PR_KRA_TRANSPORT_CERT);
+ if (!wizardInfo.isKRAInstalled() ||
+ wizardInfo.isKRACertRequestDone() || wizardInfo.isKRACertInstalledDone() ||
+ !wizardInfo.isCAInstalled()) {
+ wizardInfo.setKRACertLocalCA(Constants.FALSE);
+ return false;
+ }
+
+ if (wizardInfo.isKRALocalCertDone())
+ return false;
+
+ if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = KRAHELPINDEX;
+ else if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = RAKRAHELPINDEX;
+
+ return super.initializePanel(info);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (mSelfButton.isSelected())
+ wizardInfo.setKRACertLocalCA(Constants.TRUE);
+ else
+ wizardInfo.setKRACertLocalCA(Constants.FALSE);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIKRACertValidityPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRACertValidityPage.java
new file mode 100644
index 000000000..feaa29983
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRACertValidityPage.java
@@ -0,0 +1,77 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import javax.swing.event.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+
+/**
+ * Validity page for KRA transport certificate.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIKRACertValidityPage extends WICertValidityPage {
+ private static final String PANELNAME = "INSTALLKRACERTVALIDWIZARD";
+ private static final String KRAHELPINDEX = "install-kracert-validity-wizard-help";
+ private static final String RAKRAHELPINDEX = "install-rakracert-validity-wizard-help";
+ private static final String CAKRAHELPINDEX = "install-cakra-kracert-validity-wizard-help";
+
+ WIKRACertValidityPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIKRACertValidityPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isKRACloningDone())
+ return false;
+ if (!wizardInfo.isKRAInstalled() || wizardInfo.isKRALocalCertDone() ||
+ wizardInfo.isKRACertRequestDone() || wizardInfo.isKRACertInstalledDone())
+ return false;
+ if (super.initializePanel(info)) {
+ if (!wizardInfo.isKRACertLocalCA())
+ return false;
+
+ if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = CAKRAHELPINDEX;
+ else if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = RAKRAHELPINDEX;
+ else
+ mHelpIndex = KRAHELPINDEX;
+
+ return true;
+ }
+ return false;
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIKRAKeyPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRAKeyPage.java
new file mode 100644
index 000000000..00b12d43c
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRAKeyPage.java
@@ -0,0 +1,100 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import javax.swing.event.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+
+/**
+ * Setup key information for KRA transport certificate
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIKRAKeyPage extends WIKeyPage implements IWizardPanel {
+ private static final String PANELNAME = "INSTALLKRAKEYWIZARD";
+ private static final String KRAHELPINDEX =
+ "install-krakeysub-configuration-wizard-help";
+ private static final String CAKRALOCALHELPINDEX =
+ "install-cakra-krakeylocal-configuration-wizard-help";
+ private static final String CAKRAREMOTEHELPINDEX =
+ "install-cakra-krakeysub-configuration-wizard-help";
+ private static final String RAKRAHELPINDEX =
+ "install-rakra-krakeysub-configuration-wizard-help";
+
+ WIKRAKeyPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIKRAKeyPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ mWizardInfo = (InstallWizardInfo)info;
+ if (mWizardInfo.isCloning() && mWizardInfo.isKRACloningDone())
+ return false;
+ if (!mWizardInfo.isKRAInstalled() || mWizardInfo.isKRALocalCertDone() ||
+ mWizardInfo.isKRACertRequestDone() || mWizardInfo.isKRACertInstalledDone())
+ return false;
+ if (super.initializePanel(info)) {
+ String kraTokenName = mWizardInfo.getKRATokenName();
+ if (kraTokenName == null || kraTokenName.equals("")) {
+ mTokenBox.setSelectedIndex(0);
+ } else {
+ if (kraTokenName.equals(Constants.PR_INTERNAL_TOKEN_NAME))
+ mTokenBox.setSelectedIndex(0);
+ else
+ mTokenBox.setSelectedItem(kraTokenName);
+ }
+ }
+
+ if (mWizardInfo.isCAInstalled() && mWizardInfo.isKRAInstalled()) {
+ if (mWizardInfo.isKRACertLocalCA())
+ mHelpIndex = CAKRALOCALHELPINDEX;
+ else
+ mHelpIndex = CAKRAREMOTEHELPINDEX;
+ } else if (mWizardInfo.isRAInstalled() && mWizardInfo.isKRAInstalled())
+ mHelpIndex = RAKRAHELPINDEX;
+ else
+ mHelpIndex = KRAHELPINDEX;
+
+ enableFields();
+ mIsCAKey = false;
+ return true;
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ super.getUpdateInfo(info);
+ mWizardInfo.setKRATokenName(mWizardInfo.getTokenName());
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIKRAMessageDigestPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRAMessageDigestPage.java
new file mode 100644
index 000000000..38941ec7b
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRAMessageDigestPage.java
@@ -0,0 +1,79 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.text.*;
+import javax.swing.border.*;
+import javax.swing.event.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Setup the message digest information for the installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIKRAMessageDigestPage extends WMessageDigestPage {
+
+ private static final String PANELNAME = "INSTALLKRAMESSAGEDIGESTWIZARD";
+
+ WIKRAMessageDigestPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIKRAMessageDigestPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isKRACloningDone())
+ return false;
+ if (!wizardInfo.isKRAInstalled() || !wizardInfo.isKRACertLocalCA() ||
+ wizardInfo.isKRALocalCertDone() || wizardInfo.isKRACertRequestDone() ||
+ wizardInfo.isKRACertInstalledDone())
+ return false;
+
+ mCAKeyType = wizardInfo.getCAKeyType();
+
+ return super.initializePanel(info);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (mDSAHashTypeBox.isVisible())
+ wizardInfo.setHashType((String)mDSAHashTypeBox.getSelectedItem());
+ else
+ wizardInfo.setHashType((String)mRSAHashTypeBox.getSelectedItem());
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIKRANumberPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRANumberPage.java
new file mode 100644
index 000000000..000b3eb9f
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRANumberPage.java
@@ -0,0 +1,378 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.util.*;
+import java.math.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+
+/**
+ * This panel asks for the starting serial number that the CA issues
+ *
+ * @author Michelle Zhao
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIKRANumberPage extends WizardBasePanel implements IWizardPanel {
+ private JTextArea mDesc;
+
+ private String mSerialNumber;
+ private JTextField mSerialNumberText;
+ private JLabel mSerialNumberLabel;
+
+ private String mEndSerialNumber = null;
+ private JTextField mEndSerialNumberText;
+ private JLabel mEndSerialNumberLabel;
+
+ private String mbeginRequestNumber;
+ private JTextField mbeginRequestNumberText;
+ private JLabel mbeginRequestNumberLabel;
+
+ private String mEndRequestNumber = null;
+ private JTextField mEndRequestNumberText;
+ private JLabel mEndRequestNumberLabel;
+
+ private static final String DEFAULT_SERIAL_NUMBER = "1";
+ private static final String PANELNAME = "KRAREQUESTNUMBERWIZARD";
+ private static final String HELPINDEX =
+ "install-ca-serialnumber-wizard-help";
+
+ WIKRANumberPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WIKRANumberPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ String serial;
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ setBorder(makeTitledBorder(PANELNAME));
+ if (//wizardInfo.isKRACertLocalCA() || !wizardInfo.isInstallCertNow() ||
+ !wizardInfo.isKRAInstalled() || wizardInfo.isKRACertInstalledDone()||
+ wizardInfo.isNumberPageDone())
+ return false;
+
+ if (wizardInfo.isCloning())
+ mDesc.setText(mResource.getString(PANELNAME+"_TEXT_HEADING_LABEL")
+ + mResource.getString(PANELNAME+"_TEXT_MORE_LABEL"));
+ else
+ mDesc.setText(mResource.getString(PANELNAME+"_TEXT_HEADING_LABEL"));
+
+
+ if ((serial = wizardInfo.getCASerialNumber()) != null)
+ mSerialNumberText.setText(serial);
+ else
+ mSerialNumberText.setText(DEFAULT_SERIAL_NUMBER);
+
+ if ((serial = wizardInfo.getRequestNumber()) != null)
+ mbeginRequestNumberText.setText(serial);
+ else
+ mbeginRequestNumberText.setText(DEFAULT_SERIAL_NUMBER);
+
+ if ((serial = wizardInfo.getCAEndSerialNumber()) != null)
+ mEndSerialNumberText.setText(serial);
+
+ if ((serial = wizardInfo.getEndRequestNumber()) != null)
+ mEndRequestNumberText.setText(serial);
+ return true;
+ }
+
+ private String hexToDecimal(String hex, boolean isHex)
+ {
+ //String newHex = hex.substring(2);
+ BigInteger bi;
+ if(isHex)
+ bi = new BigInteger(hex, 16);
+ else
+ bi = new BigInteger(hex, 10);
+ return bi.toString();
+ }
+
+ private String DecToHex(String dec)
+ {
+ BigInteger bi;
+ bi = new BigInteger(dec, 10);
+ return bi.toString(16);
+ }
+
+ private boolean validateNumber(JTextField beginNumberField, JTextField endNumberField,String beginText, String endText,boolean isSerialNumber)
+ {
+ BigInteger num = null;
+ BigInteger endNum = null;
+ String serial = null;
+ beginText = beginNumberField.getText().trim();
+ if (beginText != null && !beginText.equals("")) {
+ try {
+ if (beginText.startsWith("0x")) {
+ serial = hexToDecimal(beginText.substring(2),true);
+ } else {
+ serial = beginText;
+ }
+ num = new BigInteger(serial);
+ if (num.compareTo(new BigInteger("0")) < 0) {
+ setErrorMessage("You must specify a positive value.");
+ return false;
+ }
+ } catch (NumberFormatException e) {
+ setErrorMessage("You must specify a numeric value.");
+ return false;
+ }
+ if(isSerialNumber)
+ mSerialNumber = DecToHex(serial);
+ else
+ mbeginRequestNumber = serial;
+ } else {
+ if(isSerialNumber)
+ mSerialNumber = "";
+ else
+ mbeginRequestNumber = "";
+ }
+
+ endText = endNumberField.getText().trim();
+ if (endText != null && !endText.equals("")) {
+ try {
+ if (endText.startsWith("0x")) {
+ serial = hexToDecimal(endText.substring(2),true);
+ } else {
+ serial = endText;
+ }
+ endNum = new BigInteger(serial);
+ if (endNum.compareTo(new BigInteger("0")) < 0) {
+ setErrorMessage("You must specify a positive value.");
+ return false;
+ }
+ } catch (NumberFormatException e) {
+ setErrorMessage("You must specify a numeric value.");
+ return false;
+ }
+ if(isSerialNumber)
+ mEndSerialNumber = DecToHex(serial);
+ else
+ mEndRequestNumber = serial;
+ } else {
+ if(isSerialNumber)
+ mEndSerialNumber = "";
+ else
+ mEndRequestNumber = "";
+ }
+
+ if (num != null && endNum != null && num.compareTo(endNum) > 0) {
+ setErrorMessage("Ending number must be greater than starting number.");
+ return false;
+ }
+ return true;
+ }
+
+ public boolean validatePanel() {
+ if(validateNumber(mSerialNumberText,mEndSerialNumberText,mSerialNumber,mEndSerialNumber,true)==false)
+ return false;
+ if(validateNumber(mbeginRequestNumberText,mEndRequestNumberText,mbeginRequestNumber,mEndRequestNumber,false)==false)
+ return false;
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (mSerialNumber != null && !mSerialNumber.equals(""))
+ wizardInfo.setCASerialNumber(mSerialNumber);
+ else {
+ wizardInfo.setCASerialNumber(DEFAULT_SERIAL_NUMBER);
+ mSerialNumber = DEFAULT_SERIAL_NUMBER;
+ }
+ if (mbeginRequestNumber != null && !mbeginRequestNumber.equals(""))
+ wizardInfo.setRequestNumber(mbeginRequestNumber);
+ else {
+ wizardInfo.setRequestNumber(DEFAULT_SERIAL_NUMBER);
+ mbeginRequestNumber = DEFAULT_SERIAL_NUMBER;
+ }
+
+ String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_SET_KRA_NUMBER;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY;
+ if (mSerialNumber != null && !mSerialNumber.equals(""))
+ rawData = rawData+"&"+ConfigConstants.PR_CA_SERIAL_NUMBER+"="+
+ mSerialNumber;
+ if (mEndSerialNumber != null && !mEndSerialNumber.equals(""))
+ rawData = rawData+"&"+ConfigConstants.PR_CA_ENDSERIAL_NUMBER+"="+
+ mEndSerialNumber;
+ if (mbeginRequestNumber != null && !mbeginRequestNumber.equals(""))
+ rawData = rawData+"&"+ConfigConstants.PR_REQUEST_NUMBER+"="+
+ mbeginRequestNumber;
+ if (mEndRequestNumber != null && !mEndSerialNumber.equals(""))
+ rawData = rawData+"&"+ConfigConstants.PR_ENDREQUEST_NUMBER+"="+
+ mEndRequestNumber;
+ if (wizardInfo.getInternalDBPasswd() != null)
+ rawData = rawData+"&"+ConfigConstants.PR_DB_PWD+"="+
+ wizardInfo.getInternalDBPasswd();
+ rawData = rawData+"&"+ConfigConstants.PR_SERIAL_REQUEST_NUMBER+"="+
+ ConfigConstants.TRUE;
+
+ startProgressStatus();
+
+ boolean ready = send(rawData, wizardInfo);
+ endProgressStatus();
+
+ if (!ready) {
+ String str = getErrorMessage();
+ if (str.equals(""))
+ setErrorMessage("Server Error");
+ else
+ setErrorMessage(str);
+ }else {
+ wizardInfo.setNumberPageDone(ConfigConstants.TRUE);
+ }
+
+ return ready;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mDesc = createTextArea(mResource.getString(
+ PANELNAME+"_TEXT_HEADING_LABEL"));
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mDesc, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mSerialNumberLabel = makeJLabel("SERIALNUMBER");
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mSerialNumberLabel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mSerialNumberText = makeJTextField(30);
+ gbc.anchor = gbc.NORTHWEST;
+// gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mSerialNumberText, gbc);
+
+
+ CMSAdminUtil.resetGBC(gbc);
+ mEndSerialNumberLabel = makeJLabel("ENDSERIALNUMBER");
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mEndSerialNumberLabel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mEndSerialNumberText = makeJTextField(30);
+ gbc.anchor = gbc.NORTHWEST;
+// gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mEndSerialNumberText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mbeginRequestNumberLabel = makeJLabel("REQUESTNUMBER");
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mbeginRequestNumberLabel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mbeginRequestNumberText = makeJTextField(30);
+ gbc.anchor = gbc.NORTHWEST;
+// gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mbeginRequestNumberText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mEndRequestNumberLabel = makeJLabel("ENDREQUESTNUMBER");
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mEndRequestNumberLabel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mEndRequestNumberText = makeJTextField(30);
+ gbc.anchor = gbc.NORTHWEST;
+// gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mEndRequestNumberText, gbc);
+
+ /*
+ CMSAdminUtil.resetGBC(gbc);
+ mSerialNumberLabel = makeJLabel("PWD");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, 0, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mSerialNumberLabel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mSerialNumberText = makeJSerialNumberField(30);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mSerialNumberText, gbc);
+*/
+ JLabel dummy = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ add(dummy, gbc);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIKRARequestResultPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRARequestResultPage.java
new file mode 100644
index 000000000..1580b7101
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRARequestResultPage.java
@@ -0,0 +1,58 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Display the KRA transport certificate request result
+ *
+ * @author Michelle Zhao
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIKRARequestResultPage extends WIRequestResultPage {
+
+ WIKRARequestResultPage(JDialog parent) {
+ super(parent);
+ }
+
+ WIKRARequestResultPage(JDialog parent, JFrame adminFrame) {
+ super( parent, adminFrame);
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isKRACloningDone())
+ return false;
+ if (wizardInfo.isKRACertLocalCA() || !wizardInfo.isKRAInstalled() ||
+ wizardInfo.isKRALocalCertDone() ||
+ (wizardInfo.isKRACertRequestSucc() && wizardInfo.isKRAReqResultDisplayed()) ||
+ wizardInfo.isKRACertInstalledDone())
+ return false;
+
+ wizardInfo.setKRAReqResultDisplayed(Constants.TRUE);
+ return super.initializePanel(info);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIKRAScheme1Page.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRAScheme1Page.java
new file mode 100644
index 000000000..d6171e651
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRAScheme1Page.java
@@ -0,0 +1,188 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * KRA Key recovery for installation wizard: specify number of required and
+ * available agents
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIKRAScheme1Page extends WizardBasePanel implements IWizardPanel {
+ private JTextField mRequiredText;
+ private JTextField mAvailText;
+ private String mHelpIndex;
+ private static final String PANELNAME = "KRASCHEME1WIZARD";
+ private static final String KRAHELPINDEX =
+ "install-kra-mnscheme-wizard-help";
+ private static final String CAKRAHELPINDEX =
+ "install-cakra-mnscheme-wizard-help";
+ private static final String RAKRAHELPINDEX =
+ "install-rakra-mnscheme-wizard-help";
+ private int mRequired, mAvail;
+
+ WIKRAScheme1Page(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WIKRAScheme1Page(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (!wizardInfo.doKeySplitting())
+ return false;
+ if (wizardInfo.isCloning())
+ return false;
+ if (!wizardInfo.isKRAInstalled() || wizardInfo.isKRANMSchemeDone())
+ return false;
+ setBorder(makeTitledBorder(PANELNAME));
+ mRequiredText.setText(wizardInfo.getRequiredAgents());
+ mAvailText.setText(wizardInfo.getTotalAgents());
+
+ if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = CAKRAHELPINDEX;
+ else if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = RAKRAHELPINDEX;
+ else
+ mHelpIndex = KRAHELPINDEX;
+ return true;
+ }
+
+ public boolean validatePanel() {
+ String str = mRequiredText.getText().trim();
+ if (str.equals("")) {
+ setErrorMessage("CANNOTBEBLANK");
+ return false;
+ }
+
+ try {
+ mRequired = Integer.parseInt(str);
+ str = mAvailText.getText().trim();
+ if (str.equals("")) {
+ setErrorMessage("CANNOTBEBLANK");
+ return false;
+ }
+ mAvail = Integer.parseInt(str);
+ } catch (NumberFormatException e) {
+ setErrorMessage("NOTINTEGER");
+ return false;
+ }
+
+ if (mRequired <= 0 || mAvail <= 0) {
+ setErrorMessage("NONZERO");
+ return false;
+ }
+
+ if (mRequired > mAvail) {
+ setErrorMessage("LARGER");
+ return false;
+ }
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(mHelpIndex);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel requiredLbl = makeJLabel("REQUIRED");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.fill = gbc.NONE;
+ add(requiredLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mRequiredText = makeJTextField(5);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.fill = gbc.NONE;
+ add(mRequiredText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JTextArea dummy = createTextArea(" ", 1, 15);
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(dummy, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel availLbl = makeJLabel("AVAILABLE");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.insets = new Insets(0,COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ gbc.weighty = 1.0;
+ gbc.fill = gbc.NONE;
+ add(availLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mAvailText = makeJTextField(5);
+ gbc.insets = new Insets(0,COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weighty = 1.0;
+ gbc.fill = gbc.NONE;
+ add(mAvailText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JTextArea dummy1 = createTextArea(" ", 1, 15);
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(0,COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(dummy1, gbc);
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ wizardInfo.setRequiredAgents(mRequiredText.getText().trim());
+ wizardInfo.setTotalAgents(mAvailText.getText());
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIKRAScheme2Page.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRAScheme2Page.java
new file mode 100644
index 000000000..f8c9c9f8e
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRAScheme2Page.java
@@ -0,0 +1,309 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.util.*;
+import java.awt.*;
+import javax.swing.*;
+import javax.swing.text.*;
+import javax.swing.table.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.console.*;
+
+/**
+ * KRA Key recovery for installation wizard: specify the uid and password
+ * for all the available agents
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIKRAScheme2Page extends WizardBasePanel implements IWizardPanel {
+ private JTable mTable;
+ private NewAgentModel mDataModel;
+ private String mHelpIndex;
+ private static final String PANELNAME = "KRASCHEME2WIZARD";
+ private static final String KRAHELPINDEX =
+ "install-kra-scheme-usrpwds-wizard-help";
+ private static final String CAKRAHELPINDEX =
+ "install-cakra-scheme-usrpwds-wizard-help";
+ private static final String RAKRAHELPINDEX =
+ "install-rakra-scheme-usrpwds-wizard-help";
+
+ WIKRAScheme2Page(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WIKRAScheme2Page(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (!wizardInfo.doKeySplitting())
+ return false;
+ if (wizardInfo.isCloning())
+ return false;
+ if (!wizardInfo.isKRAInstalled() || wizardInfo.isKRANMSchemeDone())
+ return false;
+
+ String val = wizardInfo.getTotalAgents();
+ int M = Integer.parseInt(val);
+ mDataModel.removeAllRows();
+
+ Vector[] data = new Vector[M];
+ for (int i=0; i<data.length; i++) {
+ data[i] = new Vector();
+ data[i].addElement(Integer.toString(i+1));
+ // initialize userid
+ data[i].addElement("agent"+(i+1));
+ data[i].addElement("");
+ data[i].addElement("");
+ mDataModel.addRow(data[i]);
+ }
+
+ setBorder(makeTitledBorder(PANELNAME));
+
+ if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = CAKRAHELPINDEX;
+ else if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = RAKRAHELPINDEX;
+ else
+ mHelpIndex = KRAHELPINDEX;
+
+ return true;
+ }
+
+ public boolean validatePanel() {
+
+ Component component = mTable.getEditorComponent();
+ if(component!= null) {
+ int col = mTable.getEditingColumn();
+ int row = mTable.getEditingRow();
+ if ((col>-1)&&(row>-1)) {
+ String str = ((JTextComponent)component).getText();
+ mTable.setValueAt(str, row, col);
+ }
+ }
+
+ if(!checkBlank()) {
+ setErrorMessage("CANNOTBEBLANK");
+ return false;
+ }
+
+ if(!checkConfirm()) {
+ setErrorMessage("PASSWORDERROR");
+ return false;
+ }
+
+ if (!checkDuplicate()) {
+ setErrorMessage("DUPLICATEERROR");
+ return false;
+ }
+
+ return true;
+ }
+
+ private boolean checkBlank() {
+ for (int i=0; i<mDataModel.getRowCount(); i++) {
+ String val1 = (String)mDataModel.getValueAt(i,1);
+ String val2 = (String)mDataModel.getValueAt(i,2);
+ String val3 = (String)mDataModel.getValueAt(i,3);
+ if ( (val1.trim().equals(""))||(val2.trim().equals(""))||
+ (val3.trim().equals(""))) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private boolean checkDuplicate() {
+ Hashtable table = new Hashtable();
+ for (int i=0; i<mDataModel.getRowCount(); i++) {
+ String val1 = (String)mDataModel.getValueAt(i,1);
+ table.put(val1.trim(), "1");
+ }
+ if (table.size() != mDataModel.getRowCount()) {
+ table = null;
+ return false;
+ }
+
+ table = null;
+ return true;
+ }
+
+ private boolean checkConfirm() {
+ for (int i=0; i<mDataModel.getRowCount(); i++) {
+ String val2 = (String)mDataModel.getValueAt(i,2);
+ String val3 = (String)mDataModel.getValueAt(i,3);
+ if (!val2.trim().equals(val3.trim())) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private String getUIDPassword() {
+ String result = "";
+ for (int i=0; i<mDataModel.getRowCount(); i++) {
+ String val1 = (String)mDataModel.getValueAt(i,1);
+ String val2 = (String)mDataModel.getValueAt(i,2);
+ result = result+val1.trim()+"="+val2.trim();
+ if (i < (mDataModel.getRowCount()-1))
+ result = result+",";
+ }
+ return result;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+
+ String rawData = "";
+ int total = Integer.parseInt(wizardInfo.getTotalAgents());
+ for (int i=0; i<total; i++) {
+ String val1 = (String)mDataModel.getValueAt(i,1);
+ String val2 = (String)mDataModel.getValueAt(i,2);
+ rawData = rawData+ConfigConstants.PR_AGENT_UID+i+"="+val1;
+ rawData = rawData+"&"+ConfigConstants.PR_AGENT_PWD+i+"="+val2;
+ }
+
+ rawData = rawData+"&"+ConfigConstants.TASKID+"="+TaskId.TASK_AGENTS;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY;
+ rawData = rawData+"&"+ConfigConstants.PR_AGENT_N+"="+
+ wizardInfo.getTotalAgents();
+ rawData = rawData+"&"+ConfigConstants.PR_AGENT_M+"="+
+ wizardInfo.getRequiredAgents();
+ startProgressStatus();
+ boolean ready = send(rawData, wizardInfo);
+ endProgressStatus();
+
+ if (!ready) {
+ String str = getErrorMessage();
+ if (str.equals("")) {
+ String errorMsg = mResource.getString(
+ PANELNAME+"_ERRORMSG");
+ setErrorMessage(errorMsg);
+ } else
+ setErrorMessage(str);
+ }
+
+ return ready;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(mHelpIndex);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JTextArea headingLbl = createTextArea(mResource.getString(
+ PANELNAME+"_LABEL_HEADING_LABEL"));
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(headingLbl, gbc);
+
+ mDataModel = new NewAgentModel();
+ mTable = new JTable(mDataModel);
+ JScrollPane scrollPane = JTable.createScrollPaneForTable(mTable);
+ scrollPane.setHorizontalScrollBarPolicy(scrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ scrollPane.setVerticalScrollBarPolicy(scrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ mTable.setAutoscrolls(true);
+ mTable.sizeColumnsToFit(true);
+ mTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
+ scrollPane.setBackground(Color.white);
+ setLabelCellRenderer(mTable, 1);
+ setLabelCellEditor(mTable, 2);
+ setLabelCellEditor(mTable, 3);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.BOTH;
+ gbc.weighty = 1.0;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ gb.setConstraints(scrollPane, gbc);
+ add(scrollPane);
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+
+ //Set the first column's cellrender as label cell
+ protected void setLabelCellRenderer(JTable table, int index) {
+ table.getColumnModel().getColumn(index).setCellRenderer(
+ new DefaultTableCellRenderer());
+ }
+
+ //Set the first column's cellrender as label cell
+ protected void setLabelCellEditor(JTable table, int index) {
+ table.getColumnModel().getColumn(index).setCellRenderer(
+ new PasswordCellRenderer());
+ table.getColumnModel().getColumn(index).setCellEditor(
+ new DefaultCellEditor(new JPasswordField()));
+ }
+}
+
+class NewAgentModel extends CMSTableModel
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ public static final String COL1 = "NUMBER";
+ public static final String COL2 = "UID";
+ public static final String COL3 = "PASSWORD";
+ public static final String COL4 = "CONFIRM";
+
+
+ private static String[] mColumns = {COL1, COL2, COL3, COL4};
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public NewAgentModel() {
+ super();
+ init(mColumns);
+ }
+
+ public boolean isCellEditable(int row, int col) {
+ if(col >= 1)
+ return true;
+ return false;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIKRAStorageKeyPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRAStorageKeyPage.java
new file mode 100644
index 000000000..6cce19d95
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRAStorageKeyPage.java
@@ -0,0 +1,356 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.util.*;
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.console.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+
+/**
+ * Install KRA storage key.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIKRAStorageKeyPage extends WizardBasePanel implements IWizardPanel {
+ private String mHelpIndex;
+ private static final String PANELNAME = "INSTALLKRASTORAGEKEYWIZARD";
+ private static final String KRAHELPINDEX =
+ "install-kra-storagekey-wizard-help";
+ private static final String CAKRAHELPINDEX =
+ "install-cakra-storagekey-wizard-help";
+ private static final String RAKRAHELPINDEX =
+ "install-rakra-storagekey-wizard-help";
+
+ protected JComboBox mKeyTypeBox, mKeyLengthBox, mDSAKeyLengthBox, mTokenBox;
+ protected JPasswordField mPassword, mPasswordAgain, mSOPPassword;
+ protected JLabel keyTypeLbl, keyLengthCustomText, keyLengthLbl, unitLbl,
+ keyLengthCustomLbl, unit1Lbl, mTokenLbl;
+ protected JLabel mPasswdLbl, mPasswdAgainLbl, mSOPLbl;
+ protected JCheckBox mHardwareSplit;
+ protected String[] mTokenInitialized;
+ protected String[] mTokenLogin;
+ private Color mActiveColor;
+
+ WIKRAStorageKeyPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WIKRAStorageKeyPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning())
+ return false;
+ if (!wizardInfo.isKRAInstalled() || wizardInfo.isKRANMSchemeDone())
+ return false;
+ setBorder(makeTitledBorder(PANELNAME));
+
+ if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = CAKRAHELPINDEX;
+ else if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = RAKRAHELPINDEX;
+ else
+ mHelpIndex = KRAHELPINDEX;
+
+ wizardInfo = (InstallWizardInfo)info;
+ setBorder(makeTitledBorder(mPanelName));
+ if (mTokenBox.getItemCount() > 0) {
+ mTokenBox.removeAllItems();
+ }
+
+ String tokenList = wizardInfo.getTokensList();
+ StringTokenizer tokenizer = new StringTokenizer(tokenList, ":");
+ int count = tokenizer.countTokens();
+ while (tokenizer.hasMoreTokens()) {
+ mTokenBox.addItem((String)tokenizer.nextToken());
+ }
+
+ String initializedList = wizardInfo.getTokensInit();
+ tokenizer = new StringTokenizer(initializedList, ":");
+ int i=0;
+ mTokenInitialized = new String[count];
+ while (tokenizer.hasMoreElements()) {
+ mTokenInitialized[i] = (String)tokenizer.nextToken();
+ i++;
+ }
+
+ String loginList = wizardInfo.getTokensLogin();
+ tokenizer = new StringTokenizer(loginList, ":");
+ i=0;
+ mTokenLogin = new String[count];
+ while (tokenizer.hasMoreElements()) {
+ mTokenLogin[i] = (String)tokenizer.nextToken();
+ i++;
+ }
+
+ //mTokenBox.setSelectedIndex(0);
+ mTokenBox.addItemListener(this);
+
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ int index = mTokenBox.getSelectedIndex();
+ if (index > 0) {
+ mPassword.setEnabled(true);
+ mPassword.setBackground(mActiveColor);
+ } else {
+ // Internal Token
+ mPassword.setEnabled(false);
+ mPassword.setBackground(getBackground());
+ }
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ ConsoleInfo consoleInfo = wizardInfo.getAdminConsoleInfo();
+ CMSConfigCert configCertCgi = new CMSConfigCert();
+ configCertCgi.initialize(wizardInfo);
+ Hashtable data = new Hashtable();
+
+ String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_STORAGE_KEY;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY;
+ wizardInfo.setKeyLength((String)mKeyLengthBox.getSelectedItem());
+ rawData = rawData+"&"+ConfigConstants.PR_KEY_LEN+"="+wizardInfo.getKeyLength();
+ rawData = rawData+"&"+ConfigConstants.PR_TOKEN_NAME+"="+(String)mTokenBox.getSelectedItem();
+ rawData = rawData+"&"+ConfigConstants.PR_TOKEN_PASSWD+"="+
+ (String)mPassword.getText().trim();
+ startProgressStatus();
+ boolean ready = send(rawData, wizardInfo);
+ endProgressStatus();
+
+ if (!ready) {
+ String str = getErrorMessage();
+ if (str.equals(""))
+ setErrorMessage("Server Error");
+ else
+ setErrorMessage(str);
+ }
+
+ return ready;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(mHelpIndex);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ JPanel panel = new JPanel();
+ GridBagLayout gb1 = new GridBagLayout();
+ panel.setLayout(gb1);
+
+ JPanel panel2 = new JPanel();
+ GridBagLayout gb3 = new GridBagLayout();
+ panel2.setLayout(gb3);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ add(panel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ add(panel2, gbc);
+
+ JTextArea selectTokenLbl = createTextArea(mResource.getString(
+ mPanelName+"_LABEL_SELECTTOKEN_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, 0, COMPONENT_SPACE,0);
+ panel.add(selectTokenLbl, gbc);
+
+ JLabel tokenLbl = makeJLabel("TOKEN");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.CENTER;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0, 0,
+ COMPONENT_SPACE);
+ gbc.fill = gbc.NONE;
+ panel.add(tokenLbl, gbc);
+
+ mTokenBox = new JComboBox();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ //gbc.weightx = 1.0;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ panel.add(mTokenBox, gbc);
+ mTokenBox.addActionListener(this);
+
+ JTextArea dummy2 = createTextArea(" ", 1, 5);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ panel.add(dummy2, gbc);
+
+ mTokenLbl = new JLabel("");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ panel2.add(mTokenLbl, gbc);
+
+ mPasswdLbl = makeJLabel("PASSWD");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0, 0,
+ COMPONENT_SPACE);
+ panel2.add(mPasswdLbl, gbc);
+
+ mPassword = new JPasswordField();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ panel2.add(mPassword, gbc);
+ mActiveColor = mPassword.getBackground();
+
+/**
+ mPasswdAgainLbl = makeJLabel("PASSWDAGAIN");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0, 0,
+ COMPONENT_SPACE);
+ panel2.add(mPasswdAgainLbl, gbc);
+
+ mPasswordAgain = new JPasswordField();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ panel2.add(mPasswordAgain, gbc);
+
+ mSOPLbl = makeJLabel("SOP");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ panel2.add(mSOPLbl, gbc);
+
+ mSOPPassword = new JPasswordField();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ panel2.add(mSOPPassword, gbc);
+ **/
+
+ CMSAdminUtil.resetGBC(gbc);
+ JTextArea label = createTextArea(mResource.getString(
+ PANELNAME+"_LABEL_HEADING_LABEL"));
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ gbc.weightx = 1.0;
+ add(label, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel keyLengthLbl = makeJLabel("KEYLENGTH");
+ gbc.anchor = gbc.WEST;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ gbc.fill = gbc.NONE;
+ add(keyLengthLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mKeyLengthBox = makeJComboBox("KEYLENGTH");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mKeyLengthBox, gbc);
+
+/**
+ CMSAdminUtil.resetGBC(gbc);
+ mHardwareSplit = makeJCheckBox("HARDWARE_SPLIT");
+ gbc.anchor = gbc.NORTHWEST;
+ //gbc.weightx = 0.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE,
+ DIFFERENT_COMPONENT_SPACE - COMPONENT_SPACE,0,COMPONENT_SPACE);
+ add(mHardwareSplit, gbc);
+ mHardwareSplit.setEnabled(false);
+ mHardwareSplit.setSelected(false);
+ **/
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel dummy = new JLabel(" ");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ add(dummy, gbc);
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIKRATokenLogonPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRATokenLogonPage.java
new file mode 100644
index 000000000..82857a154
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRATokenLogonPage.java
@@ -0,0 +1,74 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+
+/**
+ * This panel asks for the information of the current internal database.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIKRATokenLogonPage extends WITokenLogonPage implements IWizardPanel {
+
+ private static final String HELPINDEX = "install-kratoken-logon-wizard-help";
+ private static final String PANELNAME = "KRATOKENLOGONWIZARD";
+
+ WIKRATokenLogonPage(JDialog dialog) {
+ super(PANELNAME);
+ mHelpIndex = HELPINDEX;
+ mParent = dialog;
+ }
+
+ WIKRATokenLogonPage(JDialog dialog, JFrame adminFrame) {
+ super(PANELNAME);
+ mHelpIndex = HELPINDEX;
+ mParent = dialog;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ String tokenname = wizardInfo.getKRATokenName();
+ String pwd = (String)wizardInfo.get("TOKEN:"+tokenname);
+ if (wizardInfo.isCloning() && wizardInfo.isKRACloningDone()) {
+ if (pwd != null && !pwd.equals(""))
+ return false;
+ }
+ if (wizardInfo.isKRACertLocalCA() || !wizardInfo.isInstallCertNow() ||
+ !wizardInfo.isKRAInstalled() || wizardInfo.isKRACertInstalledDone())
+ return false;
+ if (pwd != null)
+ return false;
+
+ mTokenText.setText(tokenname);
+ mTokenName = tokenname;
+ return super.initializePanel(info);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIKeyPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIKeyPage.java
new file mode 100644
index 000000000..d67d0e339
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIKeyPage.java
@@ -0,0 +1,641 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.text.*;
+import javax.swing.border.*;
+import javax.swing.event.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Setup key information for certificate setup wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIKeyPage extends WizardBasePanel implements IWizardPanel, ItemListener {
+ protected Color mActiveColor;
+ protected JComboBox mKeyTypeBox, mKeyLengthBox, mDSAKeyLengthBox, mTokenBox;
+ protected JTextField mKeyLengthText;
+ protected JPasswordField mPassword, mPasswordAgain, mSOPPassword;
+ protected JLabel keyTypeLbl, keyLengthCustomText, keyLengthLbl, unitLbl,
+ keyLengthCustomLbl, unit1Lbl, mTokenLbl;
+ protected JTextArea keyHeading;
+ protected JLabel mPasswdLbl, mPasswdAgainLbl, mSOPLbl;
+ private String mPanelName;
+ protected String[] mTokenInitialized;
+ protected String[] mTokenLogin;
+ protected InstallWizardInfo mWizardInfo;
+ protected String mHelpIndex;
+ protected boolean mIsCAKey;
+
+ WIKeyPage(String panelName) {
+ super(panelName);
+ mPanelName = panelName;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ mWizardInfo = (InstallWizardInfo)info;
+ setBorder(makeTitledBorder(mPanelName));
+ if (mTokenBox.getItemCount() > 0) {
+ mTokenBox.removeAllItems();
+ }
+
+ String tokenList = mWizardInfo.getTokensList();
+ StringTokenizer tokenizer = new StringTokenizer(tokenList, ":");
+ int count = tokenizer.countTokens();
+ while (tokenizer.hasMoreTokens()) {
+ mTokenBox.addItem((String)tokenizer.nextToken());
+ }
+
+ String initializedList = mWizardInfo.getTokensInit();
+ tokenizer = new StringTokenizer(initializedList, ":");
+ int i=0;
+ mTokenInitialized = new String[count];
+ while (tokenizer.hasMoreElements()) {
+ mTokenInitialized[i] = (String)tokenizer.nextToken();
+ i++;
+ }
+
+ String loginList = mWizardInfo.getTokensLogin();
+ tokenizer = new StringTokenizer(loginList, ":");
+ i=0;
+ mTokenLogin = new String[count];
+ while (tokenizer.hasMoreElements()) {
+ mTokenLogin[i] = (String)tokenizer.nextToken();
+ i++;
+ }
+
+ //mTokenBox.setSelectedIndex(0);
+ mTokenBox.addItemListener(this);
+
+ String type = (String)mKeyTypeBox.getSelectedItem();
+ if (type.equals("RSA")) {
+ mDSAKeyLengthBox.setVisible(false);
+ mKeyLengthBox.setVisible(true);
+ } else {
+ mKeyLengthBox.setVisible(false);
+ mDSAKeyLengthBox.setVisible(true);
+ }
+
+ enableKeyLengthFields();
+ return true;
+ }
+
+ public boolean validatePanel() {
+ int index = mTokenBox.getSelectedIndex();
+
+ if (mKeyLengthText.isEnabled()) {
+ String str = mKeyLengthText.getText().trim();
+ if (str.equals("")) {
+ setErrorMessage("BLANKLEN");
+ return false;
+ } else {
+ try {
+ int num = Integer.parseInt(str);
+ if (num <= 0) {
+ setErrorMessage("INVALIDKEYLEN");
+ return false;
+ }else if (mKeyTypeBox.isVisible()) {
+ String type = (String)mKeyTypeBox.getSelectedItem();
+ if (type.equals("RSA")) {
+ float fraction = (float)num / (float)8.0;
+ int wholeNumber = (int)fraction;
+ if((fraction - wholeNumber)!=0) {
+ setErrorMessage("RSAINVALID");
+ return false;
+ }
+ }else {
+ float fraction = (float)num / (float)64.0;
+ int wholeNumber = (int)fraction;
+ if(num < 512 || num > 1024 || (fraction - wholeNumber)!=0){
+ setErrorMessage("DSAINVALID");
+ return false;
+ }
+ }
+ }
+ } catch (NumberFormatException e) {
+ setErrorMessage("NONINTEGER");
+ return false;
+ }
+ }
+ }
+
+ if (index > 0)
+ return validateHardwareToken(index);
+ else
+ return validateInternalToken(index);
+ }
+
+ private boolean validateHardwareToken(int index) {
+ String passwd = mPassword.getText();
+ String passwdAgain = mPasswordAgain.getText();
+ String sopPasswd = mSOPPassword.getText();
+ if (mTokenLogin[index].equals(ConfigConstants.TRUE)) {
+ return true;
+ }
+
+ if (mTokenInitialized[index].equals(ConfigConstants.TRUE)) {
+ if (passwd.equals("")) {
+ setErrorMessage("BLANKPASSWD");
+ return false;
+ }
+ return true;
+ }
+
+ if (passwd.equals("") || passwdAgain.equals("") || sopPasswd.equals("")) {
+ setErrorMessage("BLANKPASSWD");
+ return false;
+ }
+ if (!passwd.equals(passwdAgain)) {
+ setErrorMessage("NOTSAMEPASSWD");
+ return false;
+ }
+ return true;
+ }
+
+ private boolean validateInternalToken(int index) {
+ String passwd = mPassword.getText();
+ String passwdAgain = mPasswordAgain.getText();
+ if (mTokenLogin[index].equals(ConfigConstants.TRUE)) {
+ return true;
+ }
+
+ if (mTokenInitialized[index].equals(ConfigConstants.TRUE)) {
+ if (passwd.equals("")) {
+ setErrorMessage("BLANKPASSWD");
+ return false;
+ }
+ return true;
+ }
+
+ if (passwd.equals("") || passwdAgain.equals("")) {
+ setErrorMessage("BLANKPASSWD");
+ return false;
+ }
+ if (!passwd.equals(passwdAgain)) {
+ setErrorMessage("NOTSAMEPASSWD");
+ return false;
+ }
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ mWizardInfo = (InstallWizardInfo)info;
+
+ String customLen = "";
+ if (mKeyLengthText.isEnabled())
+ customLen = mKeyLengthText.getText();
+
+ if (customLen != null && (!customLen.trim().equals(""))) {
+ mWizardInfo.put(ConfigConstants.PR_KEY_LEN, customLen);
+ } else {
+ if (mKeyLengthBox.isVisible()) {
+ mWizardInfo.put(ConfigConstants.PR_KEY_LEN,
+ mKeyLengthBox.getSelectedItem());
+ } else if (mDSAKeyLengthBox.isVisible()) {
+ mWizardInfo.put(ConfigConstants.PR_KEY_LEN,
+ mDSAKeyLengthBox.getSelectedItem());
+ }
+ }
+
+ if (mIsCAKey) {
+ mWizardInfo.put(ConfigConstants.PR_CA_KEYTYPE, mKeyTypeBox.getSelectedItem());
+ mWizardInfo.put(ConfigConstants.PR_CA_KEYTYPE, mKeyTypeBox.getSelectedItem());
+ }
+
+ mWizardInfo.put(ConfigConstants.PR_KEY_TYPE, mKeyTypeBox.getSelectedItem());
+
+ String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_INIT_TOKEN;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY;
+ rawData = rawData+"&"+ConfigConstants.PR_TOKEN_NAME+"="+(String)mTokenBox.getSelectedItem();
+ rawData = rawData+"&"+ConfigConstants.PR_TOKEN_PASSWD+"="+mPassword.getText().trim();
+ String sop = mSOPPassword.getText().trim();
+ if (sop != null) {
+ rawData = rawData+"&"+ConfigConstants.PR_TOKEN_SOP+"="+sop;
+ }
+ rawData = rawData+"&"+ConfigConstants.PR_KEY_LEN+"="+mWizardInfo.getKeyLength();
+ rawData = rawData+"&"+ConfigConstants.PR_KEY_TYPE+"="+mWizardInfo.getKeyType();
+ rawData = rawData+"&"+ConfigConstants.PR_CERTIFICATE_TYPE+"="+mWizardInfo.getCertType();
+
+ startProgressStatus();
+// CMSMessageBox dlg = new CMSMessageBox(mAdminFrame, "CGITASK", "INITTOKEN");
+
+ boolean ready = send(rawData, mWizardInfo);
+
+ if (ready) {
+ rawData = rawData+"&"+ConfigConstants.TASKID+"="+TaskId.TASK_TOKEN_INFO;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_READ;
+ ready = send(rawData, mWizardInfo);
+ }
+
+ if (ready) {
+ rawData = rawData+"&"+ConfigConstants.TASKID+"="+TaskId.TASK_CHECK_KEYLENGTH;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY;
+ ready = send(rawData, mWizardInfo);
+ }
+
+ //dlg.setVisible(false);
+
+ endProgressStatus();
+
+ if (!ready) {
+ String str = getErrorMessage();
+ if (str.equals("")) {
+ String errorMsg = mResource.getString(
+ mPanelName+"_ERRORMSG");
+ setErrorMessage(errorMsg);
+ } else
+ setErrorMessage(str);
+ }
+
+ return ready;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(mHelpIndex);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ JPanel panel = new JPanel();
+ GridBagLayout gb1 = new GridBagLayout();
+ panel.setLayout(gb1);
+
+ JPanel panel2 = new JPanel();
+ GridBagLayout gb3 = new GridBagLayout();
+ panel2.setLayout(gb3);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ add(panel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ add(panel2, gbc);
+
+ JTextArea selectTokenLbl = createTextArea(mResource.getString(
+ mPanelName+"_LABEL_SELECTTOKEN_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, 0, COMPONENT_SPACE,0);
+ panel.add(selectTokenLbl, gbc);
+
+ JLabel tokenLbl = makeJLabel("TOKEN");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.CENTER;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0, 0,
+ COMPONENT_SPACE);
+ gbc.fill = gbc.NONE;
+ panel.add(tokenLbl, gbc);
+
+ mTokenBox = new JComboBox();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ //gbc.weightx = 1.0;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ panel.add(mTokenBox, gbc);
+
+ JTextArea dummy2 = createTextArea(" ", 1, 5);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ panel.add(dummy2, gbc);
+
+ mTokenLbl = new JLabel("");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ panel2.add(mTokenLbl, gbc);
+
+ mPasswdLbl = makeJLabel("PASSWD");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0, 0,
+ COMPONENT_SPACE);
+ panel2.add(mPasswdLbl, gbc);
+
+ mPassword = new JPasswordField();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ panel2.add(mPassword, gbc);
+
+ mPasswdAgainLbl = makeJLabel("PASSWDAGAIN");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0, 0,
+ COMPONENT_SPACE);
+ panel2.add(mPasswdAgainLbl, gbc);
+
+ mPasswordAgain = new JPasswordField();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ panel2.add(mPasswordAgain, gbc);
+
+ mSOPLbl = makeJLabel("SOP");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ panel2.add(mSOPLbl, gbc);
+
+ mSOPPassword = new JPasswordField();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ panel2.add(mSOPPassword, gbc);
+
+ keyHeading = createTextArea(mResource.getString(
+ mPanelName+"_LABEL_KEY_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ add(keyHeading, gbc);
+
+ keyTypeLbl = makeJLabel("KEYTYPE");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, 0, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(keyTypeLbl, gbc);
+
+ mKeyTypeBox = makeJComboBox("KEYTYPE");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ gbc.fill = gbc.NONE;
+ add(mKeyTypeBox, gbc);
+
+ keyLengthLbl = makeJLabel("KEYLENGTH");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(keyLengthLbl, gbc);
+
+ mDSAKeyLengthBox = makeJComboBox("DSAKEYLENGTH");
+ mDSAKeyLengthBox.setVisible(false);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mDSAKeyLengthBox, gbc);
+
+ mKeyLengthBox = makeJComboBox("KEYLENGTH");
+ mKeyLengthBox.setVisible(true);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mKeyLengthBox, gbc);
+
+ unitLbl = makeJLabel("UNITS");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.CENTER;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, 0,COMPONENT_SPACE, COMPONENT_SPACE);
+ add(unitLbl, gbc);
+
+ JPanel panel1 = new JPanel();
+ GridBagLayout gb2 = new GridBagLayout();
+ panel1.setLayout(gb2);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, 0, 0, 0);
+ add(panel1, gbc);
+
+ keyLengthCustomText = makeJLabel("CUSTOMKEY");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ panel1.add(keyLengthCustomText, gbc);
+
+/*
+ keyLengthCustomLbl = makeJLabel("KEYLENGTH");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.CENTER;
+ gbc.fill = gbc.NONE;
+ //gbc.gridheight = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE,0,COMPONENT_SPACE);
+ add(keyLengthCustomLbl, gbc);
+*/
+
+ mKeyLengthText = makeJTextField(7);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ //gbc.gridheight = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE,
+ COMPONENT_SPACE, 0);
+ panel1.add(mKeyLengthText, gbc);
+ mActiveColor = mKeyLengthText.getBackground();
+
+ unit1Lbl = makeJLabel("UNITS");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ //gbc.gridheight = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE);
+ panel1.add(unit1Lbl, gbc);
+
+ JLabel dummy1 = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ add(dummy1, gbc);
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ mWizardInfo = (InstallWizardInfo)info;
+ String name = (String)mTokenBox.getSelectedItem();
+ if (name.equalsIgnoreCase(Constants.PR_INTERNAL_TOKEN))
+ name = Constants.PR_INTERNAL_TOKEN_NAME;
+ mWizardInfo.put(ConfigConstants.PR_TOKEN_NAME, name);
+ if (mPassword.isEditable()) {
+ // this is used for single signon. The key is the token name with
+ // the prefix "TOKEN:" and the value is the token password.
+ mWizardInfo.put("TOKEN:"+name, mPassword.getText().trim());
+ }
+
+ mTokenBox.removeItemListener(this);
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ }
+
+ public void itemStateChanged(ItemEvent e){
+ //super.itemStateChanged(e);
+ if (e.getSource().equals(mTokenBox)) {
+ JComboBox c = (JComboBox)(e.getSource());
+ if (c.getItemCount() > 0)
+ enableFields();
+ } else if (e.getSource().equals(mKeyLengthBox) ||
+ e.getSource().equals(mDSAKeyLengthBox)) {
+ enableKeyLengthFields();
+ } else if (e.getSource().equals(mKeyTypeBox)) {
+ String type = (String)mKeyTypeBox.getSelectedItem();
+ if (type.equals("RSA")) {
+ mDSAKeyLengthBox.setVisible(false);
+ mKeyLengthBox.setVisible(true);
+ } else {
+ mDSAKeyLengthBox.setVisible(true);
+ mKeyLengthBox.setVisible(false);
+ }
+ enableKeyLengthFields();
+ CMSAdminUtil.repaintComp(this);
+ }
+ }
+
+ protected void enableKeyLengthFields() {
+ String value = "";
+ if (mKeyLengthBox.isVisible())
+ value = (String)mKeyLengthBox.getSelectedItem();
+ else
+ value = (String)mDSAKeyLengthBox.getSelectedItem();
+
+ if (value.equals("Custom")) {
+ enableFields(keyLengthCustomText, mKeyLengthText, true, mActiveColor);
+ enableFields(unit1Lbl, null, true, mActiveColor);
+ } else {
+ enableFields(keyLengthCustomText, mKeyLengthText, false,
+ getBackground());
+ enableFields(unit1Lbl, null, false, getBackground());
+ }
+ }
+
+ protected void enableFields(JComponent comp1, JTextComponent comp2, boolean enable,
+ Color color) {
+ if (comp1 != null) {
+ comp1.setEnabled(enable);
+ CMSAdminUtil.repaintComp(comp1);
+ }
+ if (comp2 != null) {
+ comp2.setEnabled(enable);
+ comp2.setBackground(color);
+ comp2.setEditable(enable);
+ CMSAdminUtil.repaintComp(comp2);
+ }
+ }
+
+
+ protected void enableFields() {
+ int index = mTokenBox.getSelectedIndex();
+
+ if (mTokenLogin[index].equals(ConfigConstants.TRUE)) {
+ mTokenLbl.setText("");
+ enableFields(mTokenLbl, null, false, null);
+ enableFields(mSOPLbl, mSOPPassword, false, getBackground());
+ enableFields(mPasswdLbl, mPassword, false, getBackground());
+ enableFields(mPasswdAgainLbl, mPasswordAgain, false, getBackground());
+ } else {
+ if (mTokenInitialized[index].equals(ConfigConstants.TRUE)) {
+ String str = mResource.getString(mPanelName+"_LABEL_LOGIN_LABEL");
+ mTokenLbl.setText(str);
+ enableFields(mTokenLbl, null, true, null);
+ enableFields(mPasswdAgainLbl, mPasswordAgain, false, getBackground());
+ enableFields(mPasswdLbl, mPassword, true, mActiveColor);
+ enableFields(mSOPLbl, mSOPPassword, false, getBackground());
+/*
+ if (index == 0) {
+ enableFields(mSOPLbl, mSOPPassword, false, getBackground());
+ } else {
+ enableFields(mSOPLbl, mSOPPassword, true, mActiveColor);
+ }
+*/
+ } else {
+ String str = mResource.getString(mPanelName+"_LABEL_INITIALIZE_LABEL");
+ mTokenLbl.setText(str);
+ enableFields(mTokenLbl, null, true, null);
+ enableFields(mTokenLbl, null, true, null);
+ enableFields(mPasswdAgainLbl, mPasswordAgain, true, mActiveColor);
+ enableFields(mPasswdLbl, mPassword, true, mActiveColor);
+ if (index == 0) {
+ enableFields(mSOPLbl, mSOPPassword, false, getBackground());
+ } else {
+ enableFields(mSOPLbl, mSOPPassword, true, mActiveColor);
+ }
+ }
+ }
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WILDAPPublishingPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WILDAPPublishingPage.java
new file mode 100644
index 000000000..5cb6b3db3
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WILDAPPublishingPage.java
@@ -0,0 +1,279 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Introduction page for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WILDAPPublishingPage extends WizardBasePanel implements IWizardPanel {
+ private JTextField mHostNameText, mPortText, mBindAsText;
+ private JCheckBox mSecurePort, mEnable;
+ private JLabel mBindAsLabel, mCertLabel;
+ private JComboBox mAuthBox, mCertBox, mVersionBox;
+
+ private static final String PANELNAME = "LDAPPUBLISHINGWIZARD";
+ private static final String HELPINDEX =
+ "configuration-kra-wizard-change-keyscheme-help";
+ private static final String EMPTYSTR = " ";
+ private static final String DELIMITER = ",";
+ private final static String[] AUTHTYPE = {Constants.PR_BASIC_AUTH,
+ Constants.PR_SSL_AUTH};
+
+ WILDAPPublishingPage() {
+ super(PANELNAME);
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JTextArea desc = createTextArea(
+ CMSAdminUtil.wrapText(mResource.getString(
+ "INTERNALDBWIZARD_TEXT_HEADING_LABEL"), 80), 2, 80);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+
+ mEnable = makeJCheckBox("ENABLE");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mEnable, gbc);
+
+ JPanel panel = new JPanel();
+ panel.setBorder(CMSAdminUtil.makeTitledBorder(mResource,
+ PANELNAME, "DESTINATION"));
+ GridBagLayout gb1 = new GridBagLayout();
+ panel.setLayout(gb1);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ gbc.weighty = 1.0;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(panel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel hostName = makeJLabel("HOST");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ panel.add(hostName, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mHostNameText = makeJTextField(30);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ panel.add(mHostNameText, gbc);
+
+/*
+ CMSAdminUtil.resetGBC(gbc);
+ JTextArea dummy = createTextArea(" ", 2, 5);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ add(dummy, gbc);
+*/
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel portNumber = makeJLabel("PORT");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ panel.add(portNumber, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mPortText = makeJTextField(10);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ panel.add(mPortText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mSecurePort = makeJCheckBox("SECUREPORT");
+ gbc.anchor = gbc.NORTHWEST;
+ //gbc.weightx = 0.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE,
+ DIFFERENT_COMPONENT_SPACE - COMPONENT_SPACE,0,COMPONENT_SPACE);
+ panel.add(mSecurePort, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel versionLbl = makeJLabel("VERSION");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ panel.add(versionLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mVersionBox = makeJComboBox("VERSION");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ panel.add(mVersionBox, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel dummy = new JLabel(" ");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ panel.add(dummy, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mBindAsLabel = makeJLabel("BINDAS");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ panel.add(mBindAsLabel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mBindAsText = makeJTextField(30);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ panel.add(mBindAsText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mCertLabel = makeJLabel("CERTLIST");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ panel.add(mCertLabel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mCertBox = new JComboBox();
+ mCertBox.addItem("internal");
+ gbc.fill = gbc.NONE;
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ panel.add(mCertBox, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel dummy1 = new JLabel(" ");
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ panel.add(dummy1, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel authLbl = makeJLabel("AUTHTYPE");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.gridheight = gbc.REMAINDER;
+ //gbc.weighty = 1.0;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ panel.add(authLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mAuthBox = makeJComboBox("AUTHTYPE");
+ //gbc.weighty = 1.0;
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ panel.add(mAuthBox, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel dummy2 = new JLabel(" ");
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ //gbc.weighty = 1.0;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ panel.add(dummy2, gbc);
+
+/*
+ CMSAdminUtil.resetGBC(gbc);
+ JTextArea dummy1 = createTextArea(" ", 2, 30);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(dummy1, gbc);
+*/
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WILoggingPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WILoggingPage.java
new file mode 100644
index 000000000..a28a4795d
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WILoggingPage.java
@@ -0,0 +1,202 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Introduction page for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WILoggingPage extends WizardBasePanel implements IWizardPanel {
+ private JCheckBox mEnableSysLog;
+ private JCheckBox mEnableErrorLog;
+ private JCheckBox mEnableAuditLog;
+ private JComboBox mlogFQC, mLogLevel;
+ private JTextField mlogMaxSizText, mlogBufSizText;
+ private static final String PANELNAME = "LOGGINGWIZARD";
+ private static final String HELPINDEX =
+ "configuration-kra-wizard-change-keyscheme-help";
+ private static final String EMPTYSTR = " ";
+
+ protected final static int YEAR = 31536000;
+ protected final static int MONTH = 2592000;
+ protected final static int WEEK = 604800;
+ protected final static int DAY = 86400;
+ protected final static int HOUR = 3600;
+
+ WILoggingPage() {
+ super(PANELNAME);
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mEnableSysLog = makeJCheckBox("SYSLOG");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ add(mEnableSysLog, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mEnableErrorLog = makeJCheckBox("ERRORLOG");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ add(mEnableErrorLog, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mEnableAuditLog = makeJCheckBox("AUDITLOG");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mEnableAuditLog, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel logFQC = makeJLabel("LOGFQC");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ add(logFQC, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mlogFQC = makeJComboBox("LOGFQC");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 0.0;
+ add(mlogFQC, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JTextArea dummy1 = new JTextArea(EMPTYSTR, 1, 20);
+ dummy1.setBackground(getBackground());
+ dummy1.setEditable(false);
+ dummy1.setCaretColor(getBackground());
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(dummy1, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel logMaxSiz = makeJLabel("LOGMAXSIZ");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ add(logMaxSiz, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mlogMaxSizText = makeJTextField(10);
+ gbc.anchor = gbc.NORTHWEST;
+ add(mlogMaxSizText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel maxLabel = makeJLabel("SIZEUNIT");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(maxLabel, gbc);
+ //mActiveColor = mlogMaxSizText.getBackground();
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel logBufSiz = makeJLabel("LOGBUFSIZ");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ add(logBufSiz, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mlogBufSizText = makeJTextField(10);
+ gbc.anchor = gbc.NORTHWEST;
+ add(mlogBufSizText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel bufferLabel = makeJLabel("SIZEUNIT");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(bufferLabel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel logLevel = makeJLabel("LOGLEVEL");
+ gbc.fill = gbc.NONE;
+ gbc.anchor = gbc.NORTHEAST;
+ add(logLevel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mLogLevel = makeJComboBox("LOGLEVEL");
+ gbc.anchor = gbc.NORTHWEST;
+ add(mLogLevel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel dummy4 = new JLabel(EMPTYSTR);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ add(dummy4, gbc);
+
+/*
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel dummy = new JLabel(" ");
+ JLabel dummy5 = new JLabel(" ");
+ gbc.weighty = 0.1;
+ CMSAdminUtil.addEntryField(this, dummy, dummy5, gbc);
+*/
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WILogonAllTokensPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WILogonAllTokensPage.java
new file mode 100644
index 000000000..9a8060b30
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WILogonAllTokensPage.java
@@ -0,0 +1,264 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.text.*;
+import javax.swing.table.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.config.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+
+/**
+ * This panel asks for the information of the current internal database.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WILogonAllTokensPage extends WizardBasePanel implements IWizardPanel {
+ private ProfileDataTable mTable;
+ private static final String EMPTYSTR = " ";
+ private static final String PANELNAME = "LOGONALLTOKENSWIZARD";
+ private static final String HELPINDEX = "install-internaldb-configuration-wizard-help";
+
+ WILogonAllTokensPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WILogonAllTokensPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ setBorder(makeTitledBorder(PANELNAME));
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+
+ String tokenList = wizardInfo.getTokensList();
+ String tokenLoggedIn = wizardInfo.getTokensLogin();
+ String tokenInits = wizardInfo.getTokensInit();
+ StringTokenizer tokenizer = new StringTokenizer(tokenList, ":");
+ StringTokenizer tokenizerLoggedIn = new StringTokenizer(tokenLoggedIn, ":");
+ StringTokenizer tokenizerInits = new StringTokenizer(tokenInits, ":");
+ String loggedIn = "";
+ String inits = "";
+
+ boolean logon = false;
+ Vector defcolNames = new Vector();
+ defcolNames.addElement("Token Name");
+ defcolNames.addElement("Password");
+ Vector defdata = new Vector();
+
+ while (tokenizer.hasMoreElements()) {
+ String token = (String)tokenizer.nextElement();
+ loggedIn = (String)tokenizerLoggedIn.nextElement();
+ inits = (String)tokenizerInits.nextElement();
+
+ // if (loggedIn.equals("false")) {
+ // always logon to the token.
+ if (inits.equals("true")) {
+ Vector v = new Vector();
+ v.addElement(new JLabel(token));
+ v.addElement(new JPasswordField());
+ defdata.addElement(v);
+ logon = true;
+ }
+ //}
+ }
+
+ ProfilePolicyEditDataModel defmodel = new ProfilePolicyEditDataModel();
+ defmodel.setInfo(defdata, defcolNames);
+ mTable.setModel(defmodel);
+
+ return logon;
+ }
+
+ public boolean validatePanel() {
+ for (int i=0; i<mTable.getRowCount(); i++) {
+ JComponent comp = (JComponent)mTable.getValueAt(i,1);
+ if (comp instanceof JPasswordField) {
+ String val2 = ((JPasswordField)comp).getText().trim();
+ if (val2.trim().equals("")) {
+ setErrorMessage("CANNOTBEBLANK");
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ cleanUpWizardInfo(wizardInfo);
+ String tokenNames = "";
+ String pwds = "";
+
+ String val1 = "";
+ String val2 = "";
+ for (int i=0; i<mTable.getRowCount(); i++) {
+ JComponent comp = (JComponent)mTable.getValueAt(i,0);
+ if (comp instanceof JLabel) {
+ val1 = ((JLabel)comp).getText().trim();
+ }
+ JComponent comp1 = (JComponent)mTable.getValueAt(i,1);
+ if (comp1 instanceof JPasswordField) {
+ val2 = ((JPasswordField)comp1).getText().trim();
+ }
+ wizardInfo.put("TOKEN:"+val1, val2);
+ if (i == 0) {
+ tokenNames = val1;
+ pwds = val2;
+ } else {
+ tokenNames = tokenNames+":"+val1;
+ pwds = pwds+":"+val2;
+ }
+ }
+
+ startProgressStatus();
+ String rawData = ConfigConstants.PR_TOKEN_LOGONLIST+"="+tokenNames;
+ rawData = rawData+"&"+ConfigConstants.PR_TOKEN_LOGON_PWDS+"="+pwds;
+ rawData = rawData+"&"+ConfigConstants.TASKID+"="+TaskId.TASK_LOGON_ALL_TOKENS;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY;
+ rawData = rawData+"&"+ConfigConstants.PR_CMS_SEED+"="+
+ (new Long(WizardBasePanel.mSeed).toString());
+
+ boolean ready = send(rawData, wizardInfo);
+
+ if (!ready) {
+ String str = getErrorMessage(wizardInfo);
+ if (str == null) {
+ String errorMsg = mResource.getString(
+ PANELNAME+"_ERRORMSG");
+ setErrorMessage(errorMsg);
+ } else
+ setErrorMessage(str);
+ } else {
+ rawData = ConfigConstants.TASKID+"="+TaskId.TASK_TOKEN_INFO;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_READ;
+ ready = send(rawData, wizardInfo);
+ }
+
+ if (!ready) {
+ String str = getErrorMessage(wizardInfo);
+ if (str == null)
+ setErrorMessage("Server Error");
+ else
+ setErrorMessage(str);
+ }
+
+ endProgressStatus();
+
+ return ready;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JTextArea desc = createTextArea(mResource.getString(
+ PANELNAME+"_TEXT_HEADING_LABEL"));
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+
+ Vector colNames = new Vector();
+ colNames.addElement("Token Name");
+ colNames.addElement("Password");
+ Vector data = new Vector();
+ Vector row = new Vector();
+ row.addElement("x");
+ row.addElement("x");
+ data.addElement(row);
+ ProfilePolicyEditDataModel dataModel = new ProfilePolicyEditDataModel();
+ dataModel.setInfo(data, colNames);
+ mTable = new ProfileDataTable(dataModel);
+ JScrollPane scrollPane = JTable.createScrollPaneForTable(mTable);
+ scrollPane.setHorizontalScrollBarPolicy(
+ scrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ scrollPane.setVerticalScrollBarPolicy(
+ scrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ mTable.setAutoscrolls(true);
+ mTable.sizeColumnsToFit(true);
+ mTable.getSelectionModel().setSelectionMode(
+ ListSelectionModel.SINGLE_INTERVAL_SELECTION);
+ scrollPane.setBackground(Color.white);
+ mTable.setDefaultRenderer(JComponent.class, new ComponentCellRenderer());
+ mTable.setDefaultEditor(JComponent.class,
+ new ProfileComponentCellEditor());
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.BOTH;
+ gbc.weighty = 1.0;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ gb.setConstraints(scrollPane, gbc);
+ add(scrollPane, gbc);
+
+ JLabel dummy = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ add(dummy, gbc);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+
+ private void setLabelCellRenderer(JTable table, int index) {
+ table.getColumnModel().getColumn(index).setCellRenderer(
+ new DefaultTableCellRenderer());
+ }
+
+ private void setLabelCellEditor(JTable table, int index) {
+ table.getColumnModel().getColumn(index).setCellRenderer(
+ new PasswordCellRenderer());
+ table.getColumnModel().getColumn(index).setCellEditor(
+ new DefaultCellEditor(new JPasswordField()));
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIManualCACertRequestPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIManualCACertRequestPage.java
new file mode 100644
index 000000000..cb1e092de
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIManualCACertRequestPage.java
@@ -0,0 +1,86 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.console.*;
+
+/**
+ * Generate the CA signing certificate request
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIManualCACertRequestPage extends WIManualCertRequestPage {
+ private static final String PANELNAME = "INSTALLMANUALCACERTREQUESTWIZARD";
+ private static final String CAHELPINDEX = "install-cacertrequest-manual-wizard-help";
+ private static final String CAKRAHELPINDEX = "install-cakracertrequest-manual-wizard-help";
+
+ WIManualCACertRequestPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIManualCACertRequestPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isCACloningDone())
+ return false;
+
+ if (wizardInfo.isCACertLocalCA() || !wizardInfo.isCAInstalled() ||
+ wizardInfo.isMigrationEnable() ||
+ wizardInfo.isCACertInstalledDone() ||
+ wizardInfo.isCACertRequestSucc() ||
+ wizardInfo.isSelfSignedCACertDone())
+ return false;
+
+ if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = CAKRAHELPINDEX;
+ else
+ mHelpIndex = CAHELPINDEX;
+
+/*
+ mDesc.setText(mResource.getString(
+ mPanelName+"_TEXT_DESC_LABEL"));
+*/
+
+ return super.initializePanel(info);
+ }
+
+ public void back_cb(WizardInfo info) {
+ super.back_cb(info);
+ info.put(ConfigConstants.CA_CERT_REQUEST_BACK,ConfigConstants.TRUE);
+ info.put(ConfigConstants.CA_CERT_REQUEST_BACK,ConfigConstants.TRUE);
+ }
+
+}
+
+
+
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIManualCertRequestPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIManualCertRequestPage.java
new file mode 100644
index 000000000..37adddb98
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIManualCertRequestPage.java
@@ -0,0 +1,178 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.io.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+import com.netscape.management.client.console.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Manual certificate request page for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIManualCertRequestPage extends WBaseManualCertRequestPage implements IWizardPanel {
+// private static final String PANELNAME = "INSTALLMANUALCERTREQUESTWIZARD";
+ String mHelpIndex;
+
+ WIManualCertRequestPage(String panelName) {
+ super(panelName);
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ return super.initializePanel(info);
+ }
+
+ public boolean validatePanel() {
+ return super.validatePanel();
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ if (!mSendNowBox.isSelected())
+ return true;
+
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (mHost != null && !mHost.equals(""))
+ wizardInfo.setCMHost(mHost);
+ if (mPort != null && !mPort.equals(""))
+ wizardInfo.setCMEEPort(mPort);
+ if (mSSL.isSelected())
+ wizardInfo.setCMEEType("https");
+ else
+ wizardInfo.setCMEEType("http");
+ String certType = null;
+ String rawData = "";
+ if (mReqType.equals(Constants.PR_CA_SIGNING_CERT)){
+ rawData = "profileId=caCACert";
+ }else if (mReqType.equals(Constants.PR_SERVER_CERT) ||
+ mReqType.equals(Constants.PR_KRA_TRANSPORT_CERT)){
+ rawData = "profileId=caServerCert";
+ }else if (mReqType.equals(Constants.PR_OCSP_SIGNING_CERT)){
+ rawData = "profileId=caOCSPCert";
+ }else if (mReqType.equals(Constants.PR_RA_SIGNING_CERT)){
+ rawData = "profileId=caRACert";
+ }else {
+ setErrorMessage("Wrong cert request type!");
+ return false;
+ }
+
+ if (mReqFormat.equals(ConfigConstants.PR_REQUEST_PKCS10)){
+ rawData = rawData+"&cert_request_type=pkcs10";
+ rawData = rawData+"&cert_request="+mReq;
+ } else {
+ rawData = rawData+"&cert_request_type=cmc";
+ rawData = rawData+"&cert_request="+mReq;
+ // test full response, but we don't really need it
+ // data.put("fullResponse", "true");
+ }
+
+ startProgressStatus();
+ boolean ready = send(mHost, Integer.parseInt(mPort),
+ "/ca/ee/ca/profileSubmit", rawData, wizardInfo);
+ endProgressStatus();
+
+ if (!ready) {
+ String str = getErrorMessage();
+ if (str.equals(""))
+ setErrorMessage("Server Error");
+ else
+ setErrorMessage(str);
+ return ready;
+ }
+
+ wizardInfo.setRequestSent(ready);
+
+ //save the stage
+ String reqID = wizardInfo.getRequestID();
+ String reqStatus = wizardInfo.getRequestStatus();
+ String reqError = wizardInfo.getRequestError();
+
+ wizardInfo.setX509RequestID(reqID);
+ wizardInfo.setX509RequestStatus(reqStatus);
+ if (reqError != null)
+ wizardInfo.setX509RequestError(reqError);
+
+ // rejected request should not be saved as requestSuccStage!!
+ if ( (reqID != null) && !reqID.equals("") &&
+ (wizardInfo.getRequestError() == null) &&
+ (reqStatus.equals(Constants.PR_REQUEST_SUCCESS)
+ || reqStatus.equals(Constants.PR_REQUEST_PENDING)
+ || reqStatus.equals(Constants.PR_REQUEST_SVC_PENDING)) ) {
+ rawData = ConfigConstants.TASKID+"="+TaskId.TASK_REQUEST_SUCCESS;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY;
+ rawData = rawData+"&"+Constants.PR_CERTIFICATE_TYPE+"="+mReqType;
+ rawData = rawData+"&"+mReqType+ConfigConstants.PR_REQUEST_ID+"="+
+ reqID;
+ rawData = rawData+"&"+ConfigConstants.CA_EEPORT+"="+
+ mPortText.getText();
+ rawData = rawData+"&"+ConfigConstants.CA_EETYPE+"="+
+ wizardInfo.getCMEEType();
+ rawData = rawData+"&"+ConfigConstants.CA_HOST+"="+
+ mHostText.getText();
+
+ startProgressStatus();
+ ready = send(rawData, wizardInfo);
+ endProgressStatus();
+
+ if (!ready) {
+ String str = getErrorMessage();
+ if (str.equals("")) {
+ String errorMsg = mResource.getString(
+ mPanelName+"_ERRORMSG");
+ setErrorMessage(errorMsg);
+ } else
+ setErrorMessage(str);
+ return ready;
+ }
+ }
+ return ready;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(mHelpIndex);
+ }
+
+ protected void back_cb(WizardInfo info) {
+ // clear up the status
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ wizardInfo.remove(wizardInfo.getCertType()+ConfigConstants.PR_CERT_REQUEST+"Status");
+ wizardInfo.remove(wizardInfo.getCertRequest()+"Error");
+ wizardInfo.remove(wizardInfo.getCertType()+ConfigConstants.PR_REQUEST_ID);
+ }
+
+ protected void init() {
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIManualKRACertRequestPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIManualKRACertRequestPage.java
new file mode 100644
index 000000000..c1355b3d5
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIManualKRACertRequestPage.java
@@ -0,0 +1,77 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Generate the CA signing certificate request
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIManualKRACertRequestPage extends WIManualCertRequestPage {
+ private static final String PANELNAME = "INSTALLMANUALKRACERTREQUESTWIZARD";
+ private static final String KRAHELPINDEX = "install-kracertrequest-manual-wizard-help";
+ private static final String RAKRAHELPINDEX = "install-rakra-kracertrequest-manual-wizard-help";
+ private static final String CAKRAHELPINDEX = "install-cakra-kracertrequest-manual-wizard-help";
+
+ WIManualKRACertRequestPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIManualKRACertRequestPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isKRACloningDone())
+ return false;
+ if (wizardInfo.isKRACertLocalCA() || !wizardInfo.isKRAInstalled() ||
+ wizardInfo.isKRALocalCertDone() ||
+ wizardInfo.isKRACertInstalledDone() ||
+ wizardInfo.isKRACertRequestSucc())
+ return false;
+
+ if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = CAKRAHELPINDEX;
+ else if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = RAKRAHELPINDEX;
+ else
+ mHelpIndex = KRAHELPINDEX;
+
+ return super.initializePanel(info);
+ }
+
+ public void back_cb(WizardInfo info) {
+ super.back_cb(info);
+ info.put(ConfigConstants.KRA_CERT_REQUEST_BACK,ConfigConstants.TRUE);
+ info.put(ConfigConstants.KRA_REQUEST_DISPLAYED,ConfigConstants.FALSE);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIManualOCSPCertRequestPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIManualOCSPCertRequestPage.java
new file mode 100644
index 000000000..268c6c395
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIManualOCSPCertRequestPage.java
@@ -0,0 +1,72 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Generate the OCSP signing certificate request
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIManualOCSPCertRequestPage extends WIManualCertRequestPage {
+ private static final String PANELNAME = "INSTALLMANUALOCSPCERTREQUESTWIZARD";
+ private static final String OCSPHELPINDEX = "install-ocspcertrequest-manual-wizard-help";
+
+ WIManualOCSPCertRequestPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIManualOCSPCertRequestPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+
+ if (wizardInfo.isCloning() && wizardInfo.isOCSPCloningDone())
+ return false;
+ if (wizardInfo.isOCSPCertLocalCA() || !wizardInfo.isOCSPInstalled() ||
+ wizardInfo.isOCSPLocalCertDone() ||
+ wizardInfo.isOCSPCertInstalledDone() ||
+ wizardInfo.isOCSPCertRequestSucc() )
+ return false;
+
+ mHelpIndex = OCSPHELPINDEX;
+
+ return super.initializePanel(info);
+ }
+
+ public void back_cb(WizardInfo info) {
+ super.back_cb(info);
+ info.put(ConfigConstants.OCSP_CERT_REQUEST_BACK,ConfigConstants.TRUE);
+ info.put(ConfigConstants.OCSP_REQUEST_DISPLAYED,ConfigConstants.FALSE);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIManualRACertRequestPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIManualRACertRequestPage.java
new file mode 100644
index 000000000..7439ed7b5
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIManualRACertRequestPage.java
@@ -0,0 +1,74 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Generate the CA signing certificate request
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIManualRACertRequestPage extends WIManualCertRequestPage {
+ private static final String PANELNAME = "INSTALLMANUALRACERTREQUESTWIZARD";
+ private static final String RAHELPINDEX = "install-racertrequest-manual-wizard-help";
+ private static final String RAKRAHELPINDEX = "install-rakracertrequest-manual-wizard-help";
+
+ WIManualRACertRequestPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIManualRACertRequestPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isRACloningDone())
+ return false;
+ if (wizardInfo.isRACertLocalCA() || !wizardInfo.isRAInstalled() ||
+ wizardInfo.isRALocalCertDone() ||
+ wizardInfo.isRACertInstalledDone() ||
+ wizardInfo.isRACertRequestSucc() )
+ return false;
+
+ if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = RAKRAHELPINDEX;
+ else
+ mHelpIndex = RAHELPINDEX;
+
+ return super.initializePanel(info);
+ }
+
+ public void back_cb(WizardInfo info) {
+ super.back_cb(info);
+ info.put(ConfigConstants.RA_CERT_REQUEST_BACK,ConfigConstants.TRUE);
+ info.put(ConfigConstants.RA_REQUEST_DISPLAYED,ConfigConstants.FALSE);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIManualSSLCertRequestPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIManualSSLCertRequestPage.java
new file mode 100644
index 000000000..f96ea5208
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIManualSSLCertRequestPage.java
@@ -0,0 +1,69 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Generate the CA signing certificate request
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIManualSSLCertRequestPage extends WIManualCertRequestPage {
+ private static final String PANELNAME = "INSTALLMANUALSSLCERTREQUESTWIZARD";
+ private static final String HELPINDEX = "install-sslcertrequest-manual-wizard-help";
+
+ WIManualSSLCertRequestPage(JDialog parent) {
+ super(PANELNAME);
+ mHelpIndex = HELPINDEX;
+ mParent = parent;
+ }
+
+ WIManualSSLCertRequestPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mHelpIndex = HELPINDEX;
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning())
+ return false;
+ if (wizardInfo.isSSLCertLocalCA() || wizardInfo.isMigrationEnable() ||
+ wizardInfo.isSSLLocalCertDone() ||
+ wizardInfo.isSSLCertInstalledDone() ||
+ wizardInfo.isSSLCertRequestSucc())
+ return false;
+ return super.initializePanel(info);
+ }
+
+ public void back_cb(WizardInfo info) {
+ super.back_cb(info);
+ info.put(ConfigConstants.SSL_CERT_REQUEST_BACK,ConfigConstants.TRUE);
+ info.put(ConfigConstants.SSL_REQUEST_DISPLAYED,ConfigConstants.FALSE);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIMasterOrClone.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIMasterOrClone.java
new file mode 100644
index 000000000..96c764381
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIMasterOrClone.java
@@ -0,0 +1,172 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Introduction page for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIMasterOrClone extends WizardBasePanel implements IWizardPanel {
+ protected JRadioButton mYes;
+ protected JRadioButton mNo;
+ protected JTextArea mLabel;
+ private static final String PANELNAME = "MASTERORCLONE";
+ private static final String HELPINDEX =
+ "install-internaldb-createdbagain-help";
+
+ WIMasterOrClone(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WIMasterOrClone(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ setBorder(makeTitledBorder(PANELNAME));
+ if(wizardInfo.isCloning()) {
+ mYes.setSelected(true);
+ mNo.setSelected(false);
+ }else{
+ mYes.setSelected(false);
+ mNo.setSelected(true);
+ }
+ if(wizardInfo.isClonePageDone())
+ return false;
+ else
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ cleanUpWizardInfo(wizardInfo);
+ startProgressStatus();
+ Debug.println("WIMasterOrClone:concludePanel() 1");
+ String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_MASTER_OR_CLONE;
+ rawData = rawData+"&"+ ConfigConstants.OPTYPE+"="+OpDef.OP_READ;
+ if (mYes.isSelected()) {
+ rawData = rawData+"&"+"cloning="+ConfigConstants.TRUE;
+ } else {
+ rawData = rawData+"&"+"cloning="+ConfigConstants.FALSE;
+ rawData = rawData+"&"+ConfigConstants.PR_CLONE_SETTING_DONE+"="+ConfigConstants.TRUE;
+ }
+ rawData = rawData+"&"+ConfigConstants.PR_CMS_SEED+"="+(new Long(WizardBasePanel.mSeed).toString());
+ Debug.println("WIMasterOrClone:concludePanel() 2");
+ boolean ready = send(rawData, wizardInfo);
+ endProgressStatus();
+
+ if (!ready) {
+ String str = getErrorMessage(wizardInfo);
+ if (str == null)
+ setErrorMessage("Server Error");
+ else
+ setErrorMessage(str);
+ }else if (!mYes.isSelected()){
+ wizardInfo.setClonePageDone(ConfigConstants.TRUE);
+ }
+
+ return ready;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mLabel = createTextArea(mResource.getString(
+ PANELNAME+"_TEXT_HEADING_LABEL"));
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mLabel, gbc);
+
+
+ mYes = makeJRadioButton("YES", false);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mYes, gbc);
+
+ mNo = makeJRadioButton("NO", false);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mNo, gbc);
+
+ ButtonGroup buttonGroup = new ButtonGroup();
+ buttonGroup.add(mYes);
+ buttonGroup.add(mNo);
+
+ JLabel dummy = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ add(dummy, gbc);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (mYes.isSelected()) {
+ wizardInfo.setCloning(ConfigConstants.TRUE);
+ } else {
+ wizardInfo.setCloning(ConfigConstants.FALSE);
+ }
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIMigrationPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIMigrationPage.java
new file mode 100644
index 000000000..ab9bcebb9
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIMigrationPage.java
@@ -0,0 +1,715 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.text.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+
+/**
+ * Migration page for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIMigrationPage extends WizardBasePanel implements IWizardPanel, ItemListener {
+ private JLabel mTransportLbl, mDBLbl;
+ private JPasswordField mTransportPassword, mDBPassword;
+ private JLabel mCAPasswdLbl, mCAPasswdAgainLbl, mCASOPLbl;
+ private JPasswordField mCAPassword, mCAPasswordAgain, mCASOPPassword;
+ private JLabel mSSLPasswdLbl, mSSLPasswdAgainLbl, mSSLSOPLbl;
+ private JPasswordField mSSLPassword, mSSLPasswordAgain, mSSLSOPPassword;
+ private JLabel mPathLbl, mCATokenHeading, mSSLTokenHeading;
+ private JLabel mCATokenLbl, mSSLTokenLbl;
+ private JTextField mPathText;
+ private JComboBox mCATokenBox, mSSLTokenBox;
+ private String[] mTokenInitialized;
+ private String[] mTokenLogin;
+ private Color mActiveColor;
+ private JLabel mLogonInitCATokenLbl, mLogonInitSSLTokenLbl;
+ private String mHelpIndex;
+ private InstallWizardInfo mWizardInfo;
+ private static final String PANELNAME = "MIGRATIONWIZARD";
+ private static final String CAHELPINDEX =
+ "install-ca-migration-configuration-wizard-help";
+ private static final String CAKRAHELPINDEX =
+ "install-cakra-migration-configuration-wizard-help";
+
+ WIMigrationPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WIMigrationPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ mWizardInfo = (InstallWizardInfo)info;
+ if (!mWizardInfo.isMigrationEnable() || !mWizardInfo.isCAInstalled() ||
+ mWizardInfo.isMigrationDone())
+ return false;
+ setBorder(makeTitledBorder(PANELNAME));
+ initializeTokenBox(mCATokenBox);
+
+ if (mSSLTokenBox.getItemCount() > 0)
+ mSSLTokenBox.removeAllItems();
+ for (int i=0; i<mCATokenBox.getItemCount(); i++) {
+ String str = (String)mCATokenBox.getItemAt(i);
+ mSSLTokenBox.addItem(str);
+ }
+ int index = mCATokenBox.getSelectedIndex();
+ mWizardInfo.setMigrateCACertTokenName((String)mCATokenBox.getSelectedItem());
+ enableFields(index, mLogonInitCATokenLbl, mCAPasswdLbl, mCAPassword,
+ mCAPasswdAgainLbl, mCAPasswordAgain, mCASOPLbl, mCASOPPassword);
+
+ index = mSSLTokenBox.getSelectedIndex();
+ mWizardInfo.setMigrateSSLCertTokenName((String)mSSLTokenBox.getSelectedItem());
+ enableFields(index, mLogonInitSSLTokenLbl, mSSLPasswdLbl, mSSLPassword,
+ mSSLPasswdAgainLbl, mSSLPasswordAgain, mSSLSOPLbl, mSSLSOPPassword);
+
+ mCATokenBox.addItemListener(this);
+ mSSLTokenBox.addItemListener(this);
+ enablePasswordFields();
+
+ if (mWizardInfo.isCAInstalled() && mWizardInfo.isKRAInstalled())
+ mHelpIndex = CAKRAHELPINDEX;
+ else
+ mHelpIndex = CAHELPINDEX;
+
+ return true;
+ }
+
+ private void initializeTokenBox(JComboBox tokenBox) {
+ if (tokenBox.getItemCount() > 0)
+ tokenBox.removeAllItems();
+
+ String tokenList = mWizardInfo.getTokensList();
+ StringTokenizer tokenizer = new StringTokenizer(tokenList, ":");
+ int count = tokenizer.countTokens();
+ while (tokenizer.hasMoreTokens()) {
+ tokenBox.addItem((String)tokenizer.nextToken());
+ }
+
+ String initializedList = mWizardInfo.getTokensInit();
+ tokenizer = new StringTokenizer(initializedList, ":");
+ int i=0;
+ mTokenInitialized = new String[count];
+ while (tokenizer.hasMoreElements()) {
+ mTokenInitialized[i] = (String)tokenizer.nextToken();
+ i++;
+ }
+
+ String loginList = mWizardInfo.getTokensLogin();
+ tokenizer = new StringTokenizer(loginList, ":");
+ i=0;
+ mTokenLogin = new String[count];
+ while (tokenizer.hasMoreElements()) {
+ mTokenLogin[i] = (String)tokenizer.nextToken();
+ i++;
+ }
+ }
+
+ public boolean validatePanel() {
+ int caindex = mCATokenBox.getSelectedIndex();
+ boolean status = false;
+
+ if (caindex > 0) {
+ status = validateHardwareToken(caindex, mCAPassword, mCAPasswordAgain,
+ mCASOPPassword);
+ } else {
+ status = validateInternalToken(caindex, mCAPassword, mCAPasswordAgain);
+ }
+
+ if (!status)
+ return false;
+
+ int sslindex = mSSLTokenBox.getSelectedIndex();
+ if (sslindex != caindex) {
+ if (sslindex > 0) {
+ status = validateHardwareToken(sslindex, mSSLPassword, mSSLPasswordAgain,
+ mSSLSOPPassword);
+ } else {
+ status = validateInternalToken(sslindex, mSSLPassword, mSSLPasswordAgain);
+ }
+ }
+
+ return status;
+ }
+
+ private boolean validateHardwareToken(int index, JPasswordField passwdField,
+ JPasswordField passwdAgainField, JPasswordField sopPasswdField) {
+ String caPasswd = mCAPassword.getText().trim();
+ String caPasswdAgain = mCAPasswordAgain.getText().trim();
+ String sslPasswd = mSSLPassword.getText().trim();
+ String sslPasswdAgain = mSSLPasswordAgain.getText().trim();
+ String sopPasswd = sopPasswdField.getText();
+ if (mTokenLogin[index].equals(ConfigConstants.TRUE)) {
+ return true;
+ }
+
+ if (mTokenInitialized[index].equals(ConfigConstants.TRUE)) {
+ if (caPasswd.equals("")) {
+ //if (caPasswd.equals("") || sopPasswd.equals("")) {
+ setErrorMessage("BLANKPASSWD");
+ return false;
+ }
+ return true;
+ }
+
+ if (caPasswd.equals("") || caPasswdAgain.equals("") || sopPasswd.equals("")) {
+ setErrorMessage("BLANKPASSWD");
+ return false;
+ }
+ if (!caPasswd.equals(caPasswdAgain)) {
+ setErrorMessage("NOTSAMEPASSWD");
+ return false;
+ }
+ return true;
+ }
+
+ private boolean validateInternalToken(int index, JPasswordField passwdField,
+ JPasswordField passwdAgainField) {
+ String passwd = passwdField.getText();
+ String passwdAgain = passwdAgainField.getText();
+ if (mTokenLogin[index].equals(ConfigConstants.TRUE)) {
+ return true;
+ }
+
+ if (mTokenInitialized[index].equals(ConfigConstants.TRUE)) {
+ if (passwd.equals("")) {
+ setErrorMessage("BLANKPASSWD");
+ return false;
+ }
+ return true;
+ }
+
+ if (passwd.equals("") || passwdAgain.equals("")) {
+ setErrorMessage("BLANKPASSWD");
+ return false;
+ }
+ if (!passwd.equals(passwdAgain)) {
+ setErrorMessage("NOTSAMEPASSWD");
+ return false;
+ }
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ Hashtable data = new Hashtable();
+ String caTokenName = "";
+ String sslTokenName = "";
+ if (mCATokenBox.getSelectedIndex() == 0) {
+ caTokenName = Constants.PR_INTERNAL_TOKEN_NAME;
+ } else {
+ caTokenName = (String)mCATokenBox.getSelectedItem();
+ }
+ if (mSSLTokenBox.getSelectedIndex() == 0) {
+ sslTokenName = Constants.PR_INTERNAL_TOKEN_NAME;
+ } else {
+ sslTokenName = (String)mSSLTokenBox.getSelectedItem();
+ }
+
+ mWizardInfo.setCATokenName(caTokenName);
+ mWizardInfo.setSSLTokenName(sslTokenName);
+ mWizardInfo.setMigrationOutputPath(mPathText.getText().trim());
+ //mWizardInfo.setInternalDBPasswd(mDBPassword.getText().trim());
+ mWizardInfo.setMigrationPasswd(mTransportPassword.getText().trim());
+ mWizardInfo.setSigningKeyMigrationToken(caTokenName);
+ mWizardInfo.setSigningKeyMigrationPasswd(mCAPassword.getText().trim());
+ if (mCATokenBox.getSelectedIndex() > 0) {
+ mWizardInfo.setSigningKeyMigrationSOPPasswd(mCASOPPassword.getText().trim());
+ data.put(ConfigConstants.PR_SIGNING_KEY_MIGRATION_TOKEN_SOPPASSWD,
+ mWizardInfo.getSigningKeyMigrationSOPPasswd());
+ }
+ mWizardInfo.setSSLKeyMigrationToken(sslTokenName);
+
+ if (caTokenName.equals(sslTokenName))
+ mWizardInfo.setSSLKeyMigrationPasswd(mCAPassword.getText().trim());
+ else
+ mWizardInfo.setSSLKeyMigrationPasswd(mSSLPassword.getText().trim());
+
+ if (mSSLTokenBox.getSelectedIndex() > 0) {
+ mWizardInfo.setSSLKeyMigrationSOPPasswd(mSSLSOPPassword.getText().trim());
+ data.put(ConfigConstants.PR_SSL_KEY_MIGRATION_TOKEN_SOPPASSWD,
+ mWizardInfo.getSSLKeyMigrationSOPPasswd());
+ }
+ ConsoleInfo consoleInfo = mWizardInfo.getAdminConsoleInfo();
+ CMSConfigCert configCertCgi = new CMSConfigCert();
+ configCertCgi.initialize(mWizardInfo);
+ data.put(ConfigConstants.PR_CERT_INSTANCE_NAME,
+ consoleInfo.get(ConfigConstants.PR_CERT_INSTANCE_NAME));
+
+ data.put(ConfigConstants.TASKID, TaskId.TASK_MIGRATION);
+ data.put(ConfigConstants.OPTYPE, OpDef.OP_MODIFY);
+ if (mWizardInfo.isMigrationEnable())
+ data.put(ConfigConstants.PR_ENABLE_MIGRATION, ConfigConstants.TRUE);
+ else
+ data.put(ConfigConstants.PR_ENABLE_MIGRATION, ConfigConstants.FALSE);
+ data.put(ConfigConstants.PR_OUTPUT_PATH,
+ mWizardInfo.getMigrationOutputPath());
+ if (mWizardInfo.getInternalDBPasswd() != null)
+ data.put(ConfigConstants.PR_DB_PWD,
+ mWizardInfo.getInternalDBPasswd());
+ data.put(ConfigConstants.PR_MIGRATION_PASSWORD,
+ mWizardInfo.getMigrationPasswd());
+ data.put(ConfigConstants.PR_SIGNING_KEY_MIGRATION_TOKEN,
+ mWizardInfo.getSigningKeyMigrationToken());
+ data.put(ConfigConstants.PR_SIGNING_KEY_MIGRATION_TOKEN_PASSWD,
+ mWizardInfo.getSigningKeyMigrationPasswd());
+ data.put(ConfigConstants.PR_SSL_KEY_MIGRATION_TOKEN,
+ mWizardInfo.getSSLKeyMigrationToken());
+ data.put(ConfigConstants.PR_SSL_KEY_MIGRATION_TOKEN_PASSWD,
+ mWizardInfo.getSSLKeyMigrationPasswd());
+
+ startProgressStatus();
+ boolean ready = configCertCgi.configCert(data);
+ endProgressStatus();
+
+ mWizardInfo.put("TOKEN:"+caTokenName, mCAPassword.getText().trim());
+ mWizardInfo.put("TOKEN:"+sslTokenName,
+ mSSLPassword.getText().trim());
+
+ if (!ready) {
+ String str = configCertCgi.getErrorMessage();
+ if (str.equals("")) {
+ String errorMsg = mResource.getString(
+ PANELNAME+"_ERRORMSG");
+ setErrorMessage(errorMsg);
+ } else
+ setErrorMessage(str);
+ }
+
+ return ready;
+ }
+
+ public void itemStateChanged(ItemEvent e) {
+ super.itemStateChanged(e);
+ int index = 0;
+ if (e.getSource().equals(mCATokenBox)) {
+ index = mCATokenBox.getSelectedIndex();
+ mWizardInfo.setMigrateCACertTokenName((String)mCATokenBox.getSelectedItem());
+ enableFields(index, mLogonInitCATokenLbl, mCAPasswdLbl, mCAPassword,
+ mCAPasswdAgainLbl, mCAPasswordAgain, mCASOPLbl, mCASOPPassword);
+ enablePasswordFields();
+ } else if (e.getSource().equals(mSSLTokenBox)) {
+ index = mSSLTokenBox.getSelectedIndex();
+ mWizardInfo.setMigrateSSLCertTokenName((String)mSSLTokenBox.getSelectedItem());
+ enableFields(index, mLogonInitSSLTokenLbl, mSSLPasswdLbl, mSSLPassword,
+ mSSLPasswdAgainLbl, mSSLPasswordAgain, mSSLSOPLbl, mSSLSOPPassword);
+ enablePasswordFields();
+ }
+ }
+
+ private void enableFields(int index, JLabel logonInitLbl, JLabel passwdLbl,
+ JPasswordField passwd, JLabel passwdAgainLbl, JPasswordField passwdAgain,
+ JLabel sopLbl, JPasswordField sopPasswd) {
+ if (mTokenLogin[index].equals(ConfigConstants.TRUE)) {
+ logonInitLbl.setText("");
+ enableFields(logonInitLbl, null, false, null);
+ enableFields(sopLbl, sopPasswd, false, getBackground());
+ enableFields(passwdLbl, passwd, false, getBackground());
+ enableFields(passwdAgainLbl, passwdAgain, false, getBackground());
+ } else {
+ if (mTokenInitialized[index].equals(ConfigConstants.TRUE)) {
+ String str = mResource.getString(PANELNAME+"_LABEL_LOGIN_LABEL");
+ logonInitLbl.setText(str);
+ enableFields(logonInitLbl, null, true, null);
+ enableFields(passwdAgainLbl, passwdAgain, false, getBackground());
+ enableFields(passwdLbl, passwd, true, mActiveColor);
+ enableFields(sopLbl, sopPasswd, false, getBackground());
+ } else {
+ String str = mResource.getString(PANELNAME+"_LABEL_INITIALIZE_LABEL")
+;
+ logonInitLbl.setText(str);
+ enableFields(logonInitLbl, null, true, null);
+ enableFields(logonInitLbl, null, true, null);
+ enableFields(passwdAgainLbl, passwdAgain, true, mActiveColor);
+ enableFields(passwdLbl, passwd, true, mActiveColor);
+ if (index == 0) {
+ enableFields(sopLbl, sopPasswd, false, getBackground());
+ } else {
+ enableFields(sopLbl, sopPasswd, true, mActiveColor);
+ }
+ }
+ }
+ }
+
+ protected void enableFields(JComponent comp1, JTextComponent comp2,
+ boolean enable, Color color) {
+ if (comp1 != null) {
+ comp1.setEnabled(enable);
+ CMSAdminUtil.repaintComp(comp1);
+ }
+ if (comp2 != null) {
+ comp2.setEnabled(enable);
+ comp2.setBackground(color);
+ comp2.setEditable(enable);
+ CMSAdminUtil.repaintComp(comp2);
+ }
+ }
+
+ protected void enablePasswordFields() {
+ String caTokenStr = (String)mCATokenBox.getSelectedItem();
+ String sslTokenStr = (String)mSSLTokenBox.getSelectedItem();
+ if (caTokenStr.equals(sslTokenStr)) {
+ enableFields(mSSLPasswdLbl, mSSLPassword, false, getBackground());
+ enableFields(mSSLPasswdAgainLbl, mSSLPasswordAgain, false, getBackground());
+ } else {
+ enableFields(mSSLPasswdLbl, mSSLPassword, true, mActiveColor);
+ enableFields(mSSLPasswdAgainLbl, mSSLPasswordAgain, true, mActiveColor);
+ }
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(mHelpIndex);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+/*
+ JTextArea desc = createTextArea(
+ CMSAdminUtil.wrapText(mResource.getString(
+ "MIGRATIONWIZARD_TEXT_DESC_LABEL"), 80), 1, 80);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+*/
+
+ CMSAdminUtil.resetGBC(gbc);
+ mPathLbl = makeJLabel("PATH");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(mPathLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mPathText = makeJTextField(30);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mPathText, gbc);
+
+ mTransportLbl = makeJLabel("TRANSPORTPASSWORD");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(mTransportLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mTransportPassword = makeJPasswordField(20);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mTransportPassword, gbc);
+ mActiveColor = mTransportPassword.getBackground();
+
+/*
+ mDBLbl = makeJLabel("DBPASSWORD");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mDBLbl, gbc);
+
+ mDBPassword = makeJPasswordField(20);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mDBPassword, gbc);
+*/
+
+ JPanel panel1 = new JPanel();
+ GridBagLayout gb1 = new GridBagLayout();
+ panel1.setLayout(gb1);
+
+ mCATokenHeading = makeJLabel("SELECTCATOKEN");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ panel1.add(mCATokenHeading, gbc);
+
+ mCATokenLbl = makeJLabel("TOKEN");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0, 0,
+ COMPONENT_SPACE);
+ gbc.fill = gbc.NONE;
+ panel1.add(mCATokenLbl, gbc);
+
+ mCATokenBox = new JComboBox();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ //gbc.weightx = 1.0;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ panel1.add(mCATokenBox, gbc);
+
+ JTextArea dummy1 = createTextArea(" ", 1, 5);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ panel1.add(dummy1, gbc);
+
+ JPanel panel1a = new JPanel();
+ GridBagLayout gb1a = new GridBagLayout();
+ panel1a.setLayout(gb1a);
+
+ mLogonInitCATokenLbl = new JLabel("Initialize the selected token:");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, 0, 0, COMPONENT_SPACE);
+ panel1a.add(mLogonInitCATokenLbl, gbc);
+
+ mCAPasswdLbl = makeJLabel("PASSWD");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0, 0,
+ COMPONENT_SPACE);
+ panel1a.add(mCAPasswdLbl, gbc);
+
+ mCAPassword = new JPasswordField();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ panel1a.add(mCAPassword, gbc);
+
+ mCAPasswdAgainLbl = makeJLabel("PASSWDAGAIN");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0, 0,
+ COMPONENT_SPACE);
+ panel1a.add(mCAPasswdAgainLbl, gbc);
+
+ mCAPasswordAgain = new JPasswordField();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ panel1a.add(mCAPasswordAgain, gbc);
+
+ mCASOPLbl = makeJLabel("SOP");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ panel1a.add(mCASOPLbl, gbc);
+
+ mCASOPPassword = new JPasswordField();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ panel1a.add(mCASOPPassword, gbc);
+
+ JPanel panel2 = new JPanel();
+ GridBagLayout gb2 = new GridBagLayout();
+ panel2.setLayout(gb2);
+
+ mSSLTokenHeading = makeJLabel("SELECTSSLTOKEN");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, 0, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ panel2.add(mSSLTokenHeading, gbc);
+
+ mSSLTokenLbl = makeJLabel("TOKEN");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0, 0,
+ COMPONENT_SPACE);
+ gbc.fill = gbc.NONE;
+ panel2.add(mSSLTokenLbl, gbc);
+
+ mSSLTokenBox = new JComboBox();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ //gbc.weightx = 1.0;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ panel2.add(mSSLTokenBox, gbc);
+
+ JTextArea dummy1a = createTextArea(" ", 1, 5);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ panel2.add(dummy1a, gbc);
+
+ JPanel panel2a = new JPanel();
+ GridBagLayout gb2a = new GridBagLayout();
+ panel2a.setLayout(gb2a);
+
+ mLogonInitSSLTokenLbl = new JLabel("Initialize the SSL token");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, 0, 0, COMPONENT_SPACE);
+ panel2a.add(mLogonInitSSLTokenLbl, gbc);
+
+ mSSLPasswdLbl = makeJLabel("PASSWD");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0, 0,
+ COMPONENT_SPACE);
+ panel2a.add(mSSLPasswdLbl, gbc);
+
+ mSSLPassword = new JPasswordField();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ panel2a.add(mSSLPassword, gbc);
+
+ mSSLPasswdAgainLbl = makeJLabel("PASSWDAGAIN");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0, 0,
+ COMPONENT_SPACE);
+ panel2a.add(mSSLPasswdAgainLbl, gbc);
+
+ mSSLPasswordAgain = new JPasswordField();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ panel2a.add(mSSLPasswordAgain, gbc);
+
+ mSSLSOPLbl = makeJLabel("SOP");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ panel2a.add(mSSLSOPLbl, gbc);
+
+ mSSLSOPPassword = new JPasswordField();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ panel2a.add(mSSLSOPPassword, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ gbc.weightx = 1.0;
+ add(panel1, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ gbc.weightx = 1.0;
+ add(panel1a, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ gbc.weightx = 1.0;
+ add(panel2, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ gbc.weightx = 1.0;
+ add(panel2a, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel dumLbl = new JLabel("");
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ add(dumLbl, gbc);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WINetworkPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WINetworkPage.java
new file mode 100644
index 000000000..823980d56
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WINetworkPage.java
@@ -0,0 +1,499 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.text.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+
+/**
+ * Network panel for configurating the admin and EE port.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ */
+class WINetworkPage extends WizardBasePanel implements IWizardPanel {
+ private Color mActiveColor;
+
+ // TextField for port
+ private JTextField mAdminSSLPortText;
+ private JTextField mAgentSSLPortText;
+ private JTextField mGatewayPortText;
+ private JTextField mGatewaySSLPortText;
+ private JCheckBox mEnable;
+
+ private JTextArea mAgentDesc;
+ private JLabel mAgentPortLbl;
+ private JTextField mPortText;
+
+ protected AdminConnection mAdmin;
+ private boolean mBlankFieldError = false;
+ private boolean mNumberError = false;
+ private JLabel mPortLabel, mSSLPortLabel;
+
+ private static final String HELPINDEX =
+ "install-network-configuration-wizard-help";
+ private static final String PANELNAME = "NETWORKWIZARD";
+ private static final int MAX_PORT = 65535;
+ private static final int MIN_PORT = 1;
+ private boolean mEnableEEPorts;
+ private InstallWizardInfo mWizardInfo;
+ private boolean mWarning;
+
+ WINetworkPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WINetworkPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ mWizardInfo = wizardInfo;
+ if (wizardInfo.isNetworkDone())
+ return false;
+ setBorder(makeTitledBorder(PANELNAME));
+ boolean cloning = mWizardInfo.isCloning();
+ String selected_sub = mWizardInfo.getCloneSubsystem();
+ if (!cloning ||
+ (cloning && (selected_sub != null && !selected_sub.equals("ca")))) {
+ mAgentDesc.setVisible(false);
+ mAgentPortLbl.setVisible(false);
+ mPortText.setVisible(false);
+ }
+
+ if (wizardInfo.isOCSPInstalled() || wizardInfo.isOCSPServiceAdded()) {
+ mEnable.setSelected(true);
+ } else {
+ mEnable.setSelected(wizardInfo.isEEEnabled());
+ }
+
+ if (wizardInfo.isRAInstalled())
+ mEnable.setSelected(true);
+ mAdminSSLPortText.setText(wizardInfo.getAdminPort());
+ mAgentSSLPortText.setText(wizardInfo.getAgentPort());
+ if (!wizardInfo.isCAInstalled() && !wizardInfo.isRAInstalled() &&
+ wizardInfo.isKRAInstalled()) {
+ enableFields(mPortLabel, mGatewayPortText, false, getBackground());
+ enableFields(mSSLPortLabel, mGatewaySSLPortText, false, getBackground());
+ mEnable.setEnabled(false);
+ mEnableEEPorts = false;
+ } else {
+ mGatewaySSLPortText.setText(wizardInfo.getEESecurePort());
+ mGatewayPortText.setText(wizardInfo.getEEPort());
+ mEnable.setEnabled(true);
+ if (mEnable.isSelected()) {
+ enableFields(true, mActiveColor);
+ enableFields(mPortLabel, mGatewayPortText, true, mActiveColor);
+ } else {
+ enableFields(false, getBackground());
+ enableFields(mPortLabel, mGatewayPortText, false, getBackground());
+ }
+ enableFields(mSSLPortLabel, mGatewaySSLPortText, true, mActiveColor);
+ mEnableEEPorts = true;
+ }
+
+ return true;
+ }
+
+ private void enableFields(JComponent comp1, JTextComponent comp2,
+ boolean enable, Color color) {
+ if (comp1 != null) {
+ comp1.setEnabled(enable);
+ CMSAdminUtil.repaintComp(comp1);
+ }
+ if (comp2 != null) {
+ comp2.setEnabled(enable);
+ comp2.setBackground(color);
+ comp2.setEditable(enable);
+ CMSAdminUtil.repaintComp(comp2);
+ }
+ }
+
+ public boolean validatePanel() {
+ String adminPort = mAdminSSLPortText.getText().trim();
+ String agentPort = mAgentSSLPortText.getText().trim();
+ String eePort = mGatewayPortText.getText().trim();
+ String sslEEPort = mGatewaySSLPortText.getText().trim();
+ String masteragentport = mPortText.getText().trim();
+
+ if (adminPort.equals("") || agentPort.equals("")) {
+ setErrorMessage("BLANKFIELD");
+ return false;
+ }
+
+ if (mEnableEEPorts) {
+ if (sslEEPort.equals("") || (mEnable.isSelected() && eePort.equals(""))) {
+ setErrorMessage("BLANKFIELD");
+ return false;
+ }
+ }
+
+ boolean cloning = mWizardInfo.isCloning();
+ String selected_sub = mWizardInfo.getCloneSubsystem();
+ if (cloning && (selected_sub != null && selected_sub.equals("ca"))) {
+ if (masteragentport.equals("")) {
+ setErrorMessage("BLANKFIELD");
+ return false;
+ }
+ }
+
+ int num = 0;
+ try {
+ num = Integer.parseInt(adminPort);
+ if (num < MIN_PORT || num > MAX_PORT) {
+ setErrorMessage("PORTRANGE");
+ return false;
+ }
+ num = Integer.parseInt(agentPort);
+ if (num < MIN_PORT || num > MAX_PORT) {
+ setErrorMessage("PORTRANGE");
+ return false;
+ }
+ if (mEnableEEPorts) {
+ num = Integer.parseInt(sslEEPort);
+ if (num < MIN_PORT || num > MAX_PORT) {
+ setErrorMessage("PORTRANGE");
+ return false;
+ }
+ if (mEnable.isSelected()) {
+ num = Integer.parseInt(eePort);
+ if (num < MIN_PORT || num > MAX_PORT) {
+ setErrorMessage("PORTRANGE");
+ return false;
+ }
+ }
+ }
+ if (cloning && (selected_sub != null && selected_sub.equals("ca")))
+ num = Integer.parseInt(masteragentport);
+ } catch (NumberFormatException e) {
+ setErrorMessage("NUMBERFORMAT");
+ return false;
+ }
+
+ if (adminPort.equals(agentPort) || agentPort.equals(sslEEPort) ||
+ (mEnable.isSelected() && eePort.equals(sslEEPort))) {
+ setErrorMessage("SAMEPORT");
+ return false;
+ }
+
+ if (mEnableEEPorts) {
+ if (agentPort.equals(sslEEPort) ||
+ (mEnable.isSelected() && eePort.equals(sslEEPort))) {
+ setErrorMessage("SAMEPORT");
+ return false;
+ }
+ }
+ setErrorMessage("");
+ return true;
+ }
+
+ private void setEEPorts(InstallWizardInfo wizardInfo, Hashtable data) {
+ String eePort = mGatewayPortText.getText().trim();
+ String eeSSLPort = mGatewaySSLPortText.getText().trim();
+ wizardInfo.setEEPort(eePort);
+ wizardInfo.setEESecurePort(eeSSLPort);
+ data.put(ConfigConstants.PR_EE_PORT, eePort);
+ data.put(ConfigConstants.PR_EE_SECURE_PORT, eeSSLPort);
+ if (mEnable.isSelected()) {
+ data.put(ConfigConstants.PR_EE_PORT_ENABLE,
+ ConfigConstants.TRUE);
+ wizardInfo.setEEEnable(ConfigConstants.TRUE);
+ } else {
+ data.put(ConfigConstants.PR_EE_PORT_ENABLE,
+ ConfigConstants.FALSE);
+ wizardInfo.setEEEnable(ConfigConstants.FALSE);
+ }
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ ConsoleInfo consoleInfo = wizardInfo.getAdminConsoleInfo();
+ CMSConfigCert configCertCgi = new CMSConfigCert();
+ configCertCgi.initialize(wizardInfo);
+ Hashtable data = new Hashtable();
+ data.put(ConfigConstants.TASKID, TaskId.TASK_CONFIGURE_NETWORK);
+ data.put(ConfigConstants.OPTYPE, OpDef.OP_MODIFY);
+ String agentPort = mAgentSSLPortText.getText().trim();
+ String radmPort = mAdminSSLPortText.getText().trim();
+ wizardInfo.setAgentPort(agentPort);
+ wizardInfo.setAdminPort(radmPort);
+ data.put(ConfigConstants.PR_AGENT_PORT, agentPort);
+ data.put(ConfigConstants.PR_RADM_PORT, radmPort);
+ data.put(ConfigConstants.PR_CERT_INSTANCE_NAME,
+ consoleInfo.get(ConfigConstants.PR_CERT_INSTANCE_NAME));
+ boolean cloning = mWizardInfo.isCloning();
+ String selected_sub = mWizardInfo.getCloneSubsystem();
+ if (cloning && (selected_sub != null && selected_sub.equals("ca")))
+ data.put(Constants.PR_MASTER_AGENT_PORT, mPortText.getText().trim());
+
+ if (mEnableEEPorts) {
+ setEEPorts(wizardInfo, data);
+ data.put(ConfigConstants.PR_EE_PORTS_ENABLE, ConfigConstants.TRUE);
+ } else
+ data.put(ConfigConstants.PR_EE_PORTS_ENABLE, ConfigConstants.FALSE);
+
+ startProgressStatus();
+ boolean ready = configCertCgi.configCert(data);
+ endProgressStatus();
+
+ if (!ready) {
+ String str = configCertCgi.getErrorMessage();
+ if (str.equals("")) {
+ String errorMsg = mResource.getString(
+ PANELNAME+"_ERRORMSG");
+ setErrorMessage(errorMsg);
+ } else
+ setErrorMessage(str);
+ }
+
+ return ready;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ JTextArea heading = createTextArea(mResource.getString(
+ "NETWORKWIZARD_TEXT_DESC_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(heading, gbc);
+
+ JLabel adminSSLport = makeJLabel("ADMINSSLPORT");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.fill = gbc.NONE;
+ add(adminSSLport, gbc);
+
+ mAdminSSLPortText = makeJTextField(10);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ //gbc.gridwidth = gbc.REMAINDER;
+ //gbc.fill = gbc.NONE;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(mAdminSSLPortText, gbc);
+ mActiveColor = mAdminSSLPortText.getBackground();
+
+ JLabel dummy2a = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ add(dummy2a, gbc);
+
+ JLabel agentPort = makeJLabel("AGENTSSLPORT");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(0, 0, COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.fill = gbc.NONE;
+ add(agentPort, gbc);
+
+ mAgentSSLPortText = makeJTextField(10);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ //gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ //gbc.gridwidth = gbc.REMAINDER;
+ add(mAgentSSLPortText, gbc);
+
+ JLabel dummy2b = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ add(dummy2b, gbc);
+
+ mSSLPortLabel = makeJLabel("GATEWAYSSLPORT");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, 0, COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.anchor = gbc.EAST;
+ add(mSSLPortLabel, gbc);
+
+ mGatewaySSLPortText = makeJTextField(10);
+ CMSAdminUtil.resetGBC(gbc);
+ //gbc.fill = gbc.NONE;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.anchor = gbc.WEST;
+ //gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mGatewaySSLPortText, gbc);
+
+ JLabel dummy2c = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ add(dummy2c, gbc);
+
+ mPortLabel = makeJLabel("GATEWAYPORT");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,COMPONENT_SPACE);
+ add(mPortLabel, gbc);
+
+ mGatewayPortText = makeJTextField(10);
+ CMSAdminUtil.resetGBC(gbc);
+ //gbc.fill = gbc.NONE;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ gbc.anchor = gbc.WEST;
+ add(mGatewayPortText, gbc);
+
+ // 610632 - remove the enable button
+
+ JLabel enableLbl = makeJLabel("ENABLED");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.fill = gbc.NONE;
+ gbc.anchor = gbc.CENTER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ // add(enableLbl, gbc);
+
+ mEnable = new JCheckBox();
+ mEnable.addActionListener(this);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.fill = gbc.NONE;
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ // add(mEnable, gbc);
+
+ JLabel dummy1 = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ add(dummy1, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mAgentDesc = createTextArea(mResource.getString(
+ PANELNAME+"_TEXT_HEADING1_LABEL"));
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(2*COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mAgentDesc, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mAgentPortLbl = makeJLabel("AGENTPORT");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mAgentPortLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mPortText = makeJTextField(30);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mPortText, gbc);
+
+ JLabel dummy2 = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ add(dummy2, gbc);
+
+ JLabel dummy = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.fill = gbc.NONE;
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ add(dummy, gbc);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ if (mEnable.isSelected()) {
+ enableFields(true, mActiveColor);
+ } else {
+ if (!mWarning && (mWizardInfo.isOCSPInstalled() || mWizardInfo.isOCSPServiceAdded())) {
+ mWarning = true;
+ String errormsg = mResource.getString(mPanelName+"_WARNING");
+ JOptionPane.showMessageDialog(mAdminFrame, errormsg, "Warning",
+ JOptionPane.WARNING_MESSAGE,
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_WARN_ICON));
+ } else {
+ enableFields(false, getBackground());
+ }
+ }
+ }
+
+ private void enableFields(boolean enable, Color color) {
+ mPortLabel.setEnabled(enable);
+ mGatewayPortText.setEnabled(enable);
+ mGatewayPortText.setEditable(enable);
+ mGatewayPortText.setBackground(color);
+ CMSAdminUtil.repaintComp(mPortLabel);
+ CMSAdminUtil.repaintComp(mGatewayPortText);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPCertDNPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPCertDNPage.java
new file mode 100644
index 000000000..d13124de6
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPCertDNPage.java
@@ -0,0 +1,83 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import com.netscape.admin.certsrv.wizard.*;
+import javax.swing.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Subject DN page for RA signing certificate
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIOCSPCertDNPage extends WICertDNPage {
+ private static final String PANELNAME = "INSTALLOCSPCERTDNWIZARD";
+ private static final String OCSPHELPINDEX = "install-ocspcert-subjectdn-wizard-help";
+
+ WIOCSPCertDNPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIOCSPCertDNPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isOCSPCloningDone())
+ return false;
+
+ if (!wizardInfo.isOCSPInstalled() || wizardInfo.isOCSPLocalCertDone() ||
+ wizardInfo.isOCSPCertRequestDone() || wizardInfo.isOCSPCertInstalledDone())
+ return false;
+ String str = wizardInfo.getOCSPSubjectName();
+ if (str == null || str.equals(""))
+ str = OCSP_CN+", "+OCSP_C;
+ wizardInfo.setOCSPSubjectName(str);
+ populateDN(str);
+ mHelpIndex = OCSPHELPINDEX;
+ return super.initializePanel(info);
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+
+ if (super.concludePanel(info)) {
+ wizardInfo.setOCSPSubjectName(mStr);
+ return true;
+ }
+
+ return false;
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ String str = mOText.getText().trim();
+ wizardInfo.setOCSPOComp(str);
+ str = mCText.getText().trim();
+ wizardInfo.setOCSPCComp(str);
+ }
+
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPCertSubmitPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPCertSubmitPage.java
new file mode 100644
index 000000000..dd58b5f1a
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPCertSubmitPage.java
@@ -0,0 +1,76 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+
+/**
+ * OCSP Certificate Submission.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIOCSPCertSubmitPage extends WICertSubmitPage implements IWizardPanel {
+ private static final String PANELNAME = "INSTALLOCSPCERTWIZARD";
+ private static final String OCSPHELPINDEX = "install-ocsptype-wizard-help";
+
+ WIOCSPCertSubmitPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isOCSPCloningDone())
+ return false;
+ wizardInfo.put(Constants.PR_CERTIFICATE_TYPE,
+ Constants.PR_OCSP_SIGNING_CERT);
+
+ if (!wizardInfo.isOCSPInstalled() ||
+ wizardInfo.isOCSPCertRequestDone() || wizardInfo.isOCSPCertInstalledDone()
+ ||
+ !wizardInfo.isCAInstalled()) {
+ wizardInfo.setOCSPCertLocalCA(Constants.FALSE);
+ return false;
+ }
+ if (wizardInfo.isOCSPLocalCertDone())
+ return false;
+
+ mHelpIndex = OCSPHELPINDEX;
+ return super.initializePanel(info);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (mSelfButton.isSelected())
+ wizardInfo.setOCSPCertLocalCA(Constants.TRUE);
+ else
+ wizardInfo.setOCSPCertLocalCA(Constants.FALSE);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPKeyPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPKeyPage.java
new file mode 100644
index 000000000..a49b428a7
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPKeyPage.java
@@ -0,0 +1,90 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import javax.swing.event.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Setup key information for RA signing certificate
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIOCSPKeyPage extends WIKeyPage implements IWizardPanel {
+ private static final String PANELNAME = "INSTALLOCSPKEYWIZARD";
+ private static final String OCSPHELPINDEX =
+ "install-ocspkey-configuration-wizard-help";
+
+ WIOCSPKeyPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIOCSPKeyPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ mWizardInfo = (InstallWizardInfo)info;
+
+ if (mWizardInfo.isCloning() && mWizardInfo.isOCSPCloningDone())
+ return false;
+ if (!mWizardInfo.isOCSPInstalled() || mWizardInfo.isOCSPLocalCertDone() ||
+ mWizardInfo.isOCSPCertRequestDone() || mWizardInfo.isOCSPCertInstalledDone())
+ return false;
+
+ if (super.initializePanel(info)) {
+ String ocspTokenName = mWizardInfo.getOCSPTokenName();
+ if (ocspTokenName == null || ocspTokenName.equals("")) {
+ mTokenBox.setSelectedIndex(0);
+ } else {
+ if (ocspTokenName.equals(Constants.PR_INTERNAL_TOKEN_NAME))
+ mTokenBox.setSelectedIndex(0);
+ else
+ mTokenBox.setSelectedItem(ocspTokenName);
+ }
+ }
+
+ mHelpIndex = OCSPHELPINDEX;
+
+ enableFields();
+ mIsCAKey = false;
+ mWizardInfo.setCertType(Constants.PR_OCSP_SIGNING_CERT);
+ return true;
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ super.getUpdateInfo(info);
+ mWizardInfo.setOCSPTokenName(mWizardInfo.getTokenName());
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPMessageDigestPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPMessageDigestPage.java
new file mode 100644
index 000000000..ec250dcd1
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPMessageDigestPage.java
@@ -0,0 +1,80 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.text.*;
+import javax.swing.border.*;
+import javax.swing.event.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Setup the message digest information for the installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIOCSPMessageDigestPage extends WMessageDigestPage {
+
+ private static final String PANELNAME = "INSTALLOCSPMESSAGEDIGESTWIZARD";
+
+ WIOCSPMessageDigestPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIOCSPMessageDigestPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isOCSPCloningDone())
+ return false;
+
+ if (!wizardInfo.isOCSPInstalled() || !wizardInfo.isOCSPCertLocalCA() ||
+ wizardInfo.isOCSPLocalCertDone() || wizardInfo.isOCSPCertRequestDone() ||
+ wizardInfo.isOCSPCertInstalledDone())
+ return false;
+
+ mCAKeyType = wizardInfo.getCAKeyType();
+
+ return super.initializePanel(info);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (mDSAHashTypeBox.isVisible())
+ wizardInfo.setHashType((String)mDSAHashTypeBox.getSelectedItem());
+ else
+ wizardInfo.setHashType((String)mRSAHashTypeBox.getSelectedItem());
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPRequestResultPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPRequestResultPage.java
new file mode 100644
index 000000000..a94fbf6e3
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPRequestResultPage.java
@@ -0,0 +1,63 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Display the OCSP signing certificate request result
+ *
+ * @author Michelle Zhao
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIOCSPRequestResultPage extends WIRequestResultPage {
+
+ WIOCSPRequestResultPage(JDialog parent) {
+ super(parent);
+ }
+
+ WIOCSPRequestResultPage(JDialog parent, JFrame adminFrame) {
+ super( parent, adminFrame);
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isOCSPCloningDone())
+ return false;
+
+ if (wizardInfo.isOCSPCertLocalCA() || !wizardInfo.isOCSPInstalled() ||
+ wizardInfo.isOCSPLocalCertDone() ||
+ (wizardInfo.isOCSPCertRequestSucc() && wizardInfo.isOCSPReqResultDisplayed()) ||
+ wizardInfo.isOCSPCertInstalledDone())
+ return false;
+
+ wizardInfo.setOCSPReqResultDisplayed(Constants.TRUE);
+ return super.initializePanel(info);
+ }
+
+}
+
+
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPTokenLogonPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPTokenLogonPage.java
new file mode 100644
index 000000000..aa4be933a
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPTokenLogonPage.java
@@ -0,0 +1,73 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * This panel asks for the information of the current internal database.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIOCSPTokenLogonPage extends WITokenLogonPage implements IWizardPanel {
+
+ private static final String OCSPHELPINDEX = "install-ocsptoken-logon-wizard-help";
+ private static final String PANELNAME = "OCSPTOKENLOGONWIZARD";
+
+ WIOCSPTokenLogonPage(JDialog dialog) {
+ super(PANELNAME);
+ mHelpIndex = OCSPHELPINDEX;
+ mParent = dialog;
+ }
+
+ WIOCSPTokenLogonPage(JDialog dialog, JFrame adminFrame) {
+ super(PANELNAME);
+ mHelpIndex = OCSPHELPINDEX;
+ mParent = dialog;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ String tokenname = wizardInfo.getOCSPTokenName();
+ String pwd = (String)wizardInfo.get("TOKEN:"+tokenname);
+
+ if (wizardInfo.isOCSPCertLocalCA() || !wizardInfo.isInstallCertNow()
+ || !wizardInfo.isOCSPInstalled() || wizardInfo.isOCSPCertInstalledDone())
+ return false;
+
+ if (pwd != null)
+ return false;
+
+ mTokenText.setText(tokenname);
+ mTokenName = tokenname;
+ return super.initializePanel(info);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIPasteCACertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIPasteCACertPage.java
new file mode 100644
index 000000000..816554588
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIPasteCACertPage.java
@@ -0,0 +1,67 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import javax.swing.*;
+
+/**
+ * The panel asks the user to paste the certificate.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIPasteCACertPage extends WIPasteCertPage {
+ private static final String PANELNAME = "INSTALLPASTECACERTWIZARD";
+ private static final String CAHELPINDEX = "install-cacert-paste-wizard-help";
+ private static final String CAKRAHELPINDEX = "install-cakracert-paste-wizard-help";
+
+ WIPasteCACertPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIPasteCACertPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isCACloningDone())
+ return false;
+
+ if (wizardInfo.isCACertLocalCA() || !wizardInfo.isInstallCertNow()
+ || !wizardInfo.isCAInstalled() || wizardInfo.isMigrationEnable()
+ || wizardInfo.isCACertInstalledDone())
+ return false;
+
+ wizardInfo.setCertType(Constants.PR_CA_SIGNING_CERT);
+
+ if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = CAKRAHELPINDEX;
+ else
+ mHelpIndex = CAHELPINDEX;
+
+ return super.initializePanel(info);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIPasteCertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIPasteCertPage.java
new file mode 100644
index 000000000..063382f32
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIPasteCertPage.java
@@ -0,0 +1,500 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.io.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.text.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * This page is to install the certificate in the internal token. The user can
+ * import the cert from the file, paste the Base 64 encoded blob in the
+ * text area or get the cert from the CMS where the request was sent.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIPasteCertPage extends WizardBasePanel implements IWizardPanel {
+ static private int transId = 1;
+ private JRadioButton mFileBtn;
+ private JRadioButton mBase64Btn;
+ private JTextField mFileText;
+ private JTextArea mBase64Text;
+ private JButton mPaste;
+ private String mCertContent = "";
+ private String mCertFilePath = "";
+ protected String mPanelName;
+ protected String mHelpIndex;
+ protected Color mActiveColor;
+ protected JTextArea introLbl;
+
+ protected JTextField mHostText, mPortText, mRIDText;
+ protected JLabel mHostLbl, mPortLbl, mRIDLbl;
+ protected String mHost, mPort, mRID;
+ protected JLabel mSSLText;
+ protected JCheckBox mSSL; // ssl or not
+ protected JLabel mQueryText;
+ protected JRadioButton mQueryBtn;
+
+ public static final int MAX_PORT = 65535;
+ public static final int MIN_PORT = 1;
+
+ WIPasteCertPage(String panelName) {
+ super(panelName);
+ mPanelName = panelName;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (mQueryBtn.isSelected())
+ enableFields(true, mActiveColor);
+ else
+ enableFields(false, getBackground());
+
+ String host = wizardInfo.getCMHost();
+ if (host != null && !host.equals(""))
+ mHostText.setText(host);
+ String port = wizardInfo.getCMEEPort();
+ if (port != null && !port.equals(""))
+ mPortText.setText(port);
+
+ String portType = wizardInfo.getCMEEType();
+ if (portType != null && portType.equals("http"))
+ mSSL.setSelected(false);
+
+ String rid = wizardInfo.getRequestID();
+ if (rid != null && !rid.equals(""))
+ mRIDText.setText(rid);
+
+ setBorder(makeTitledBorder(mPanelName));
+ return true;
+ }
+
+ public boolean validatePanel() {
+ if (mBase64Btn.isSelected()) {
+ mCertContent = mBase64Text.getText().trim();
+ if (mCertContent.equals("")) {
+ setErrorMessage("B64EEMPTY");
+ return false;
+ }
+ } else if (mFileBtn.isSelected()) {
+ mCertFilePath = mFileText.getText().trim();
+ if (mCertFilePath.equals("")) {
+ setErrorMessage("EMPTYFILE");
+ return false;
+ }
+ } else if (mQueryBtn.isSelected()) {
+ mHost = mHostText.getText().trim();
+ mPort = mPortText.getText().trim();
+ mRID = mRIDText.getText().trim();
+
+ if (mRID.equals("")) {
+ setErrorMessage("BLANKRID");
+ return false;
+ }
+ try {
+ int ridnumber = Integer.parseInt(mRID);
+ } catch (NumberFormatException e) {
+ setErrorMessage("INVALIDRID");
+ return false;
+ }
+
+ if (mHost.equals("")) {
+ setErrorMessage("BLANKHOST");
+ return false;
+ }
+ if (mPort.equals("")) {
+ setErrorMessage("BLANKPORT");
+ return false;
+ }
+
+ try {
+ int portnumber = Integer.parseInt(mPort);
+ if (portnumber < MIN_PORT || portnumber > MAX_PORT) {
+ setErrorMessage("OUTOFRANGE");
+ return false;
+ }
+ } catch (NumberFormatException e) {
+ setErrorMessage("INVALIDPORT");
+ return false;
+ }
+ return true;
+ }
+ return true;
+
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_GET_CERT_CONTENT;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_READ;
+ String reqType = wizardInfo.getCertType();
+ rawData = rawData+"&"+Constants.PR_CERTIFICATE_TYPE+"="+reqType;
+ if (mFileBtn.isSelected()) {
+ rawData = rawData+"&"+Constants.PR_CERT_FILEPATH+"="+mCertFilePath;
+ wizardInfo.setCertFilePath(mCertFilePath);
+ wizardInfo.setPKCS10("");
+ } else if (mBase64Btn.isSelected()) {
+ rawData = rawData+"&"+Constants.PR_PKCS10+"="+mCertContent;
+ //xxx It's not pkcs10, it's certificate.
+ wizardInfo.setPKCS10(mCertContent);
+ wizardInfo.setCertFilePath("");
+ } else if (mQueryBtn.isSelected()) {
+ if (mRID != null && !mRID.equals(""))
+ wizardInfo.setRequestID(mRID);
+ if (mHost != null && !mHost.equals(""))
+ wizardInfo.setCMHost(mHost);
+ if (mPort != null && !mPort.equals(""))
+ wizardInfo.setCMEEPort(mPort);
+ if (mSSL.isSelected())
+ wizardInfo.setCMEEType("https");
+ else
+ wizardInfo.setCMEEType("http");
+
+ String rawData1 = "importCert=true";
+ rawData1=rawData1+"&"+"requestId="+mRID;
+/*
+ CMSImportCert importCertCgi = new CMSImportCert();
+ importCertCgi.initialize(wizardInfo);
+ Hashtable data1 = new Hashtable();
+ data1.put("importCert", "true");
+ data1.put("requestId", mRID);
+*/
+
+ startProgressStatus();
+ boolean ready = send(mHost, Integer.parseInt(mPort), "/checkRequest",
+ rawData1, wizardInfo);
+
+ endProgressStatus();
+
+ if (!ready) {
+ String str = getErrorMessage();
+ if (str.equals(""))
+ setErrorMessage("Server Error");
+ else
+ setErrorMessage(str);
+ return ready;
+ }
+ String certS= wizardInfo.getPKCS10();
+ // Break the long single line:header,64 byte lines,trailer
+ // Assuming this is the only format we generate.
+ String CERT_NEW_HEADER = "-----BEGIN CERTIFICATE-----";
+ String CERT_NEW_TRAILER = "-----END CERTIFICATE-----";
+ String str = CERT_NEW_HEADER + "\n";
+ int len = certS.length();
+ for (int i = 0; i < len; i=i+64){
+ if (i+64 < len)
+ str = str + certS.substring(i,i+64) +"\n";
+ else
+ str = str + certS.substring(i,len) +"\n";
+ }
+ str = str + CERT_NEW_TRAILER;
+ certS = str;
+ rawData = rawData+"&"+Constants.PR_PKCS10+"="+certS;
+ wizardInfo.setPKCS10(certS);
+ wizardInfo.setCertFilePath("");
+ }
+
+ startProgressStatus();
+ boolean ready = send(rawData, wizardInfo);
+ endProgressStatus();
+
+ if (!ready) {
+ String str = getErrorMessage();
+ if (str.equals("")) {
+ String errorMsg = mResource.getString(
+ mPanelName+"_ERRORMSG");
+ setErrorMessage(errorMsg);
+ } else
+ setErrorMessage(str);
+ }
+
+ return ready;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(mHelpIndex);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ introLbl = createTextArea(mResource.getString(
+ mPanelName+"_LABEL_INTRO_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(introLbl, gbc);
+
+ mFileBtn = makeJRadioButton("FILE", true);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mFileBtn, gbc);
+
+ mFileText = makeJTextField(50);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, 4*COMPONENT_SPACE, COMPONENT_SPACE, 0);
+ add(mFileText, gbc);
+ mActiveColor = mFileText.getBackground();
+
+ mBase64Btn = makeJRadioButton("BASE64", false);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mBase64Btn, gbc);
+
+ JTextArea desc = createTextArea(mResource.getString(
+ "PASTECERTWIZARD_TEXT_DESC_LABEL"));
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,4*COMPONENT_SPACE,0,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+
+ mBase64Text = new JTextArea(null, null, 6, 10);
+ JScrollPane scrollPane = new JScrollPane(mBase64Text,
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
+ scrollPane.setPreferredSize(new Dimension(30, 50));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.5;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, 0, COMPONENT_SPACE);
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(scrollPane, gbc);
+
+ mPaste = makeJButton("PASTE");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mPaste, gbc);
+
+ JLabel dummy = new JLabel(" ");
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weighty = 1.0;
+ gbc.fill = gbc.BOTH;
+ add(dummy, gbc);
+
+ mQueryBtn = makeJRadioButton("QUERY", false);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mQueryBtn, gbc);
+
+ mQueryText = new JLabel(mResource.getString(
+ mPanelName + "_TEXT_QUERY_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0, 4*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mQueryText, gbc);
+
+ mHostLbl = makeJLabel("HOST");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.fill = gbc.NONE;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(0, 4*COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ add(mHostLbl, gbc);
+
+ mHostText = makeJTextField(23);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ add(mHostText, gbc);
+ mActiveColor = mHostText.getBackground();
+
+ mPortLbl = makeJLabel("PORT");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ add(mPortLbl, gbc);
+
+ mPortText = makeJTextField(23);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ add(mPortText, gbc);
+
+ mSSLText = new JLabel(mResource.getString(
+ mPanelName+"_TEXT_SSL_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ //gbc.gridwidth = gbc.REMAINDER;
+ add(mSSLText, gbc);
+
+ mSSL = makeJCheckBox("SSL", true);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mSSL, gbc);
+
+ mRIDLbl = makeJLabel("RID");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.fill = gbc.NONE;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(0, 4*COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ add(mRIDLbl, gbc);
+
+ mRIDText = makeJTextField(23);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ add(mRIDText, gbc);
+
+ JLabel label = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(label, gbc);
+
+ ButtonGroup buttonGrp = new ButtonGroup();
+ buttonGrp.add(mFileBtn);
+ buttonGrp.add(mBase64Btn);
+ buttonGrp.add(mQueryBtn);
+
+ enableFields(mFileText, true, mActiveColor);
+ enableFields(mBase64Text, false, getBackground());
+ enableFields(false,getBackground());
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mPaste)) {
+ mBase64Text.paste();
+ } else if (e.getSource().equals(mFileBtn)) {
+ enableFields(mFileText, true, mActiveColor);
+ enableFields(mBase64Text, false, getBackground());
+ enableFields(false, getBackground());
+ } else if (e.getSource().equals(mBase64Btn)) {
+ enableFields(mFileText, false, getBackground());
+ enableFields(mBase64Text, true, mActiveColor);
+ enableFields(false, getBackground());
+ } else if (e.getSource().equals(mQueryBtn)) {
+ enableFields(mFileText, false, getBackground());
+ enableFields(mBase64Text, false, getBackground());
+ enableFields(true, mActiveColor);
+ }
+ }
+
+ private void enableFields(JTextComponent comp1, boolean enable, Color color) {
+ comp1.setEnabled(enable);
+ comp1.setEditable(enable);
+ comp1.setBackground(color);
+ CMSAdminUtil.repaintComp(comp1);
+ }
+
+ protected void enableFields(boolean enabled, Color color) {
+ mQueryText.setEnabled(enabled);
+ //mQueryText.setEditable(enabled);
+ CMSAdminUtil.repaintComp(mQueryText);
+ mHostLbl.setEnabled(enabled);
+ mPortLbl.setEnabled(enabled);
+ mRIDLbl.setEnabled(enabled);
+ mHostText.setEnabled(enabled);
+ mHostText.setEditable(enabled);
+ mHostText.setBackground(color);
+ mPortText.setEnabled(enabled);
+ mPortText.setEditable(enabled);
+ mPortText.setBackground(color);
+ mRIDText.setEnabled(enabled);
+ mRIDText.setEditable(enabled);
+ mRIDText.setBackground(color);
+ CMSAdminUtil.repaintComp(mHostLbl);
+ CMSAdminUtil.repaintComp(mHostText);
+ CMSAdminUtil.repaintComp(mPortLbl);
+ CMSAdminUtil.repaintComp(mPortText);
+ CMSAdminUtil.repaintComp(mRIDLbl);
+ CMSAdminUtil.repaintComp(mRIDText);
+ mSSLText.setEnabled(enabled);
+ //mSSLText.setEditable(enabled);
+ CMSAdminUtil.repaintComp(mSSLText);
+ mSSL.setEnabled(enabled);
+ //mSSL.setEditable(enabled);
+ //mSSL.setBackground(color);
+ CMSAdminUtil.repaintComp(mSSL);
+
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIPasteKRACertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIPasteKRACertPage.java
new file mode 100644
index 000000000..7166d64bf
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIPasteKRACertPage.java
@@ -0,0 +1,68 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import javax.swing.*;
+
+/**
+ * The panel asks the user to paste the certificate.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIPasteKRACertPage extends WIPasteCertPage {
+ private static final String PANELNAME = "INSTALLPASTEKRACERTWIZARD";
+ private static final String KRAHELPINDEX = "install-kracert-paste-wizard-help";
+ private static final String RAKRAHELPINDEX = "install-rakra-kracert-paste-wizard-help";
+ private static final String CAKRAHELPINDEX = "install-cakra-kracert-paste-wizard-help";
+
+ WIPasteKRACertPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIPasteKRACertPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isKRACloningDone())
+ return false;
+ if (wizardInfo.isKRACertLocalCA() || !wizardInfo.isInstallCertNow() ||
+ !wizardInfo.isKRAInstalled() || wizardInfo.isKRACertInstalledDone())
+ return false;
+
+ wizardInfo.setCertType(Constants.PR_KRA_TRANSPORT_CERT);
+
+ if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = CAKRAHELPINDEX;
+ else if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = RAKRAHELPINDEX;
+ else
+ mHelpIndex = KRAHELPINDEX;
+
+ return super.initializePanel(info);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIPasteOCSPCertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIPasteOCSPCertPage.java
new file mode 100644
index 000000000..783d87da7
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIPasteOCSPCertPage.java
@@ -0,0 +1,63 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import javax.swing.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * The panel asks the user to paste the certificate.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIPasteOCSPCertPage extends WIPasteCertPage {
+
+ private static final String PANELNAME = "INSTALLPASTEOCSPCERTWIZARD";
+ private static final String OCSPHELPINDEX = "install-ocspcert-paste-wizard-help";
+
+ WIPasteOCSPCertPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIPasteOCSPCertPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+
+ if (wizardInfo.isCloning() && wizardInfo.isOCSPCloningDone())
+ return false;
+ if (wizardInfo.isOCSPCertLocalCA() || !wizardInfo.isInstallCertNow()
+ || !wizardInfo.isOCSPInstalled() || wizardInfo.isOCSPCertInstalledDone())
+ return false;
+
+ wizardInfo.setCertType(Constants.PR_OCSP_SIGNING_CERT);
+
+ mHelpIndex = OCSPHELPINDEX;
+ return super.initializePanel(info);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIPasteRACertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIPasteRACertPage.java
new file mode 100644
index 000000000..584c375d4
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIPasteRACertPage.java
@@ -0,0 +1,64 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import javax.swing.*;
+
+/**
+ * The panel asks the user to paste the certificate.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIPasteRACertPage extends WIPasteCertPage {
+ private static final String PANELNAME = "INSTALLPASTERACERTWIZARD";
+ private static final String RAHELPINDEX = "install-racert-paste-wizard-help";
+ private static final String RAKRAHELPINDEX = "install-rakracert-paste-wizard-help";
+
+ WIPasteRACertPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIPasteRACertPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isRACloningDone())
+ return false;
+ if (wizardInfo.isRACertLocalCA() || !wizardInfo.isInstallCertNow()
+ || !wizardInfo.isRAInstalled() || wizardInfo.isRACertInstalledDone())
+ return false;
+
+ wizardInfo.setCertType(Constants.PR_RA_SIGNING_CERT);
+
+ if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = RAKRAHELPINDEX;
+ else
+ mHelpIndex = RAHELPINDEX;
+ return super.initializePanel(info);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIPasteSSLCertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIPasteSSLCertPage.java
new file mode 100644
index 000000000..bf133bc15
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIPasteSSLCertPage.java
@@ -0,0 +1,60 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import javax.swing.*;
+
+/**
+ * The panel asks the user to paste the certificate.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIPasteSSLCertPage extends WIPasteCertPage {
+ private static final String PANELNAME = "INSTALLPASTESSLCERTWIZARD";
+ private static final String HELPINDEX = "install-sslcert-paste-wizard-help";
+
+ WIPasteSSLCertPage(JDialog parent) {
+ super(PANELNAME);
+ mHelpIndex = HELPINDEX;
+ mParent = parent;
+ }
+
+ WIPasteSSLCertPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mHelpIndex = HELPINDEX;
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning())
+ return false;
+ if (wizardInfo.isSSLCertLocalCA() || !wizardInfo.isInstallCertNow() ||
+ wizardInfo.isMigrationEnable() || wizardInfo.isSSLCertInstalledDone())
+ return false;
+
+ wizardInfo.setCertType(Constants.PR_SERVER_CERT);
+ return super.initializePanel(info);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIRACertDNPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIRACertDNPage.java
new file mode 100644
index 000000000..788fab869
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIRACertDNPage.java
@@ -0,0 +1,86 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import com.netscape.admin.certsrv.wizard.*;
+import javax.swing.*;
+
+/**
+ * Subject DN page for RA signing certificate
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIRACertDNPage extends WICertDNPage {
+ private static final String PANELNAME = "INSTALLRACERTDNWIZARD";
+ private static final String RAHELPINDEX = "install-racert-subjectdn-wizard-help";
+ private static final String RAKRAHELPINDEX = "install-rakracert-subjectdn-wizard-help";
+
+ WIRACertDNPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIRACertDNPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+
+ if (wizardInfo.isCloning() && wizardInfo.isRACloningDone())
+ return false;
+ if (!wizardInfo.isRAInstalled() || wizardInfo.isRALocalCertDone() ||
+ wizardInfo.isRACertRequestDone() || wizardInfo.isRACertInstalledDone())
+ return false;
+ String str = wizardInfo.getRASubjectName();
+ if (str == null || str.equals(""))
+ str = RA_CN+", "+RA_C;
+ wizardInfo.setRASubjectName(str);
+ populateDN(str);
+ if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = RAKRAHELPINDEX;
+ else
+ mHelpIndex = RAHELPINDEX;
+ return super.initializePanel(info);
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+
+ if (super.concludePanel(info)) {
+ wizardInfo.setRASubjectName(mStr);
+ return true;
+ }
+
+ return false;
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ String str = mOText.getText().trim();
+ wizardInfo.setRAOComp(str);
+ str = mCText.getText().trim();
+ wizardInfo.setRACComp(str);
+ }
+
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIRACertExtensionPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIRACertExtensionPage.java
new file mode 100644
index 000000000..85553c5c7
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIRACertExtensionPage.java
@@ -0,0 +1,75 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.border.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+
+/**
+ * Certificate Extension page for RA signing Certificate.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIRACertExtensionPage extends WICertExtensionPage {
+ private static final String PANELNAME = "INSTALLRACERTEXTENSION1WIZARD";
+ private static final String RAHELPINDEX = "install-racert-extension-wizard-help";
+ private static final String RAKRAHELPINDEX = "install-rakracert-extension-wizard-help";
+
+ WIRACertExtensionPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIRACertExtensionPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isRACloningDone())
+ return false;
+ if (!wizardInfo.isRAInstalled() ||
+ wizardInfo.isRALocalCertDone() || wizardInfo.isRACertRequestDone() ||
+ wizardInfo.isRACertInstalledDone())
+ return false;
+
+ if (!mModified) {
+ mAKICheckBox.setSelected(true);
+ mExtendedKeyCheckBox.setSelected(true);
+ mSSLClient.setSelected(true);
+ }
+
+ if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = RAKRAHELPINDEX;
+ else
+ mHelpIndex = RAHELPINDEX;
+
+ return super.initializePanel(info);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIRACertSubmitPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIRACertSubmitPage.java
new file mode 100644
index 000000000..771aa51b3
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIRACertSubmitPage.java
@@ -0,0 +1,76 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+
+/**
+ * RA Certificate Submission.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIRACertSubmitPage extends WICertSubmitPage implements IWizardPanel {
+ private static final String PANELNAME = "INSTALLRACERTWIZARD";
+ private static final String RAHELPINDEX = "install-ratype-wizard-help";
+ private static final String RAKRAHELPINDEX = "install-rakratype-wizard-help";
+
+ WIRACertSubmitPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isRACloningDone())
+ return false;
+ wizardInfo.put(Constants.PR_CERTIFICATE_TYPE,
+ Constants.PR_RA_SIGNING_CERT);
+ if (!wizardInfo.isRAInstalled() ||
+ wizardInfo.isRACertRequestDone() || wizardInfo.isRACertInstalledDone() ||
+ !wizardInfo.isCAInstalled()) {
+ wizardInfo.setRACertLocalCA(Constants.FALSE);
+ return false;
+ }
+ if (wizardInfo.isRALocalCertDone())
+ return false;
+ if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = RAKRAHELPINDEX;
+ else
+ mHelpIndex = RAHELPINDEX;
+ return super.initializePanel(info);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (mSelfButton.isSelected())
+ wizardInfo.setRACertLocalCA(Constants.TRUE);
+ else
+ wizardInfo.setRACertLocalCA(Constants.FALSE);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIRACertValidityPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIRACertValidityPage.java
new file mode 100644
index 000000000..fec7619df
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIRACertValidityPage.java
@@ -0,0 +1,74 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import javax.swing.event.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+
+/**
+ * Validity page for RA signing certificate.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIRACertValidityPage extends WICertValidityPage {
+ private static final String PANELNAME = "INSTALLRACERTVALIDWIZARD";
+ private static final String RAHELPINDEX = "install-racert-validity-wizard-help";
+ private static final String RAKRAHELPINDEX = "install-rakracert-validity-wizard-help";
+
+ WIRACertValidityPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIRACertValidityPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isRACloningDone())
+ return false;
+ if (!wizardInfo.isRAInstalled() || wizardInfo.isRALocalCertDone() ||
+ wizardInfo.isRACertRequestDone() || wizardInfo.isRACertInstalledDone())
+ return false;
+ if (super.initializePanel(info)) {
+ if (!wizardInfo.isRACertLocalCA())
+ return false;
+
+ if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled())
+ mHelpIndex = RAKRAHELPINDEX;
+ else
+ mHelpIndex = RAHELPINDEX;
+
+ return true;
+ }
+ return false;
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIRAKeyPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIRAKeyPage.java
new file mode 100644
index 000000000..9abb9e0ac
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIRAKeyPage.java
@@ -0,0 +1,94 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import javax.swing.event.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+
+/**
+ * Setup key information for RA signing certificate
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIRAKeyPage extends WIKeyPage implements IWizardPanel {
+ private static final String PANELNAME = "INSTALLRAKEYWIZARD";
+ private static final String RAHELPINDEX =
+ "install-rakey-configuration-wizard-help";
+ private static final String RAKRAHELPINDEX =
+ "install-rakrakey-configuration-wizard-help";
+
+ WIRAKeyPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIRAKeyPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ mWizardInfo = (InstallWizardInfo)info;
+
+ if (mWizardInfo.isCloning() && mWizardInfo.isRACloningDone())
+ return false;
+
+ if (!mWizardInfo.isRAInstalled() || mWizardInfo.isRALocalCertDone() ||
+ mWizardInfo.isRACertRequestDone() || mWizardInfo.isRACertInstalledDone())
+ return false;
+
+ if (super.initializePanel(info)) {
+ String raTokenName = mWizardInfo.getRATokenName();
+ if (raTokenName == null || raTokenName.equals("")) {
+ mTokenBox.setSelectedIndex(0);
+ } else {
+ if (raTokenName.equals(Constants.PR_INTERNAL_TOKEN_NAME))
+ mTokenBox.setSelectedIndex(0);
+ else
+ mTokenBox.setSelectedItem(raTokenName);
+ }
+ }
+
+ if (mWizardInfo.isRAInstalled() && mWizardInfo.isKRAInstalled())
+ mHelpIndex = RAKRAHELPINDEX;
+ else
+ mHelpIndex = RAHELPINDEX;
+
+ enableFields();
+ mIsCAKey = false;
+ return true;
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ super.getUpdateInfo(info);
+ mWizardInfo.setRATokenName(mWizardInfo.getTokenName());
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIRAMessageDigestPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIRAMessageDigestPage.java
new file mode 100644
index 000000000..ef843ba37
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIRAMessageDigestPage.java
@@ -0,0 +1,79 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.text.*;
+import javax.swing.border.*;
+import javax.swing.event.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Setup the message digest information for the installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIRAMessageDigestPage extends WMessageDigestPage {
+
+ private static final String PANELNAME = "INSTALLRAMESSAGEDIGESTWIZARD";
+
+ WIRAMessageDigestPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIRAMessageDigestPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning() && wizardInfo.isRACloningDone())
+ return false;
+ if (!wizardInfo.isRAInstalled() || !wizardInfo.isRACertLocalCA() ||
+ wizardInfo.isRALocalCertDone() || wizardInfo.isRACertRequestDone() ||
+ wizardInfo.isRACertInstalledDone())
+ return false;
+
+ mCAKeyType = wizardInfo.getCAKeyType();
+
+ return super.initializePanel(info);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (mDSAHashTypeBox.isVisible())
+ wizardInfo.setHashType((String)mDSAHashTypeBox.getSelectedItem());
+ else
+ wizardInfo.setHashType((String)mRSAHashTypeBox.getSelectedItem());
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIRARequestResultPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIRARequestResultPage.java
new file mode 100644
index 000000000..36c81b7d9
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIRARequestResultPage.java
@@ -0,0 +1,58 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Display the RA signing certificate request result
+ *
+ * @author Michelle Zhao
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIRARequestResultPage extends WIRequestResultPage {
+
+ WIRARequestResultPage(JDialog parent) {
+ super(parent);
+ }
+
+ WIRARequestResultPage(JDialog parent, JFrame adminFrame) {
+ super( parent, adminFrame);
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isRACertLocalCA() || !wizardInfo.isRAInstalled() ||
+ wizardInfo.isRALocalCertDone() ||
+ (wizardInfo.isRACertRequestSucc() && wizardInfo.isRAReqResultDisplayed()) ||
+ wizardInfo.isRACertInstalledDone())
+ return false;
+
+ wizardInfo.setRAReqResultDisplayed(Constants.TRUE);
+ return super.initializePanel(info);
+ }
+}
+
+
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIRATokenLogonPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIRATokenLogonPage.java
new file mode 100644
index 000000000..d6f9dbafe
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIRATokenLogonPage.java
@@ -0,0 +1,75 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+
+/**
+ * This panel asks for the information of the current internal database.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIRATokenLogonPage extends WITokenLogonPage implements IWizardPanel {
+
+ private static final String HELPINDEX = "install-ratoken-logon-wizard-help";
+ private static final String PANELNAME = "RATOKENLOGONWIZARD";
+
+ WIRATokenLogonPage(JDialog dialog) {
+ super(PANELNAME);
+ mHelpIndex = HELPINDEX;
+ mParent = dialog;
+ }
+
+ WIRATokenLogonPage(JDialog dialog, JFrame adminFrame) {
+ super(PANELNAME);
+ mHelpIndex = HELPINDEX;
+ mParent = dialog;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ String tokenname = wizardInfo.getRATokenName();
+ String pwd = (String)wizardInfo.get("TOKEN:"+tokenname);
+ if (wizardInfo.isCloning() && wizardInfo.isRACloningDone()) {
+ if (pwd != null && !pwd.equals(""))
+ return false;
+ }
+
+ if (wizardInfo.isRACertLocalCA() || !wizardInfo.isInstallCertNow()
+ || !wizardInfo.isRAInstalled() || wizardInfo.isRACertInstalledDone())
+ return false;
+ if (pwd != null)
+ return false;
+
+ mTokenText.setText(tokenname);
+ mTokenName = tokenname;
+ return super.initializePanel(info);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIRecreateDBPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIRecreateDBPage.java
new file mode 100644
index 000000000..f07de3134
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIRecreateDBPage.java
@@ -0,0 +1,139 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+
+/**
+ * Introduction page for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIRecreateDBPage extends WizardBasePanel implements IWizardPanel {
+ protected JRadioButton mYes;
+ protected JRadioButton mNo;
+ protected JTextArea mLabel;
+ private static final String PANELNAME = "INSTALLDBAGAIN";
+ private static final String HELPINDEX =
+ "install-internaldb-createdbagain-help";
+
+ WIRecreateDBPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WIRecreateDBPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning())
+ return false;
+ if (wizardInfo.isDBCreated()) {
+ setBorder(makeTitledBorder(PANELNAME));
+ return true;
+ }
+
+ return false;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mLabel = createTextArea(mResource.getString(
+ PANELNAME+"_TEXT_HEADING_LABEL"));
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mLabel, gbc);
+
+ mYes = makeJRadioButton("YES", false);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mYes, gbc);
+
+ mNo = makeJRadioButton("NO", true);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mNo, gbc);
+
+ ButtonGroup buttonGroup = new ButtonGroup();
+ buttonGroup.add(mYes);
+ buttonGroup.add(mNo);
+
+ JLabel dummy = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ add(dummy, gbc);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (mYes.isSelected()) {
+ wizardInfo.setDBCreateNow(ConfigConstants.TRUE);
+ } else {
+ wizardInfo.setDBCreateNow(ConfigConstants.FALSE);
+ }
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIRemoteCASubsystem.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIRemoteCASubsystem.java
new file mode 100644
index 000000000..890c8ce4b
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIRemoteCASubsystem.java
@@ -0,0 +1,291 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+import com.netscape.certsrv.common.*;
+import javax.swing.*;
+import java.awt.*;
+import java.util.*;
+
+/**
+ * Remote subsystems.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+
+class WIRemoteCASubsystem extends WizardBasePanel implements IWizardPanel {
+ protected JTextField mHostText;
+ protected JTextField mPortText;
+ protected JTextField mTimeoutText;
+ protected String mHost;
+ protected String mPort;
+ protected String mTimeout;
+ private String mHelpIndex;
+ public static final int MAX_PORT = 65535;
+ public static final int MIN_PORT = 1;
+ private static final String PANELNAME = "REMOTECAWIZARD";
+ private static final String RAHELPINDEX = "install-remote-ca-wizard-help";
+ private static final String RAKRAHELPINDEX = "install-rakra-remote-ca-wizard-help";
+
+ WIRemoteCASubsystem(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WIRemoteCASubsystem(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isServicesDone())
+ return false;
+ if (wizardInfo.isRAInstalled() && !wizardInfo.isCAInstalled()) {
+ setBorder(makeTitledBorder(PANELNAME));
+ if (wizardInfo.isKRAInstalled())
+ mHelpIndex = RAKRAHELPINDEX;
+ else
+ mHelpIndex = RAHELPINDEX;
+
+ return true;
+ }
+
+ return false;
+ }
+
+ public boolean validatePanel() {
+ mHost = mHostText.getText().trim();
+ mPort = mPortText.getText().trim();
+ mTimeout = mTimeoutText.getText().trim();
+ if (mHost.equals("")) {
+ setErrorMessage("BLANKHOST");
+ return false;
+ }
+ if (mPort.equals("")) {
+ setErrorMessage("BLANKPORT");
+ return false;
+ }
+ if (mTimeout.equals("")) {
+ setErrorMessage("BLANKTIMEOUT");
+ return false;
+ }
+
+ try {
+ int portnumber = Integer.parseInt(mPort);
+ if (portnumber < MIN_PORT || portnumber > MAX_PORT) {
+ setErrorMessage("OUTOFRANGE");
+ return false;
+ }
+ } catch (NumberFormatException e) {
+ setErrorMessage("INVALIDPORT");
+ return false;
+ }
+
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ wizardInfo.setCMHost(mHost);
+ wizardInfo.setCMPort(mPort);
+ wizardInfo.setCMTimeout(mTimeout);
+
+ if ((wizardInfo.isCAInstalled() || wizardInfo.isRAInstalled())
+ && !wizardInfo.isKRAInstalled()) {
+ return true;
+ }
+
+ ConsoleInfo consoleInfo = wizardInfo.getAdminConsoleInfo();
+ CMSConfigCert configCertCgi = new CMSConfigCert();
+ configCertCgi.initialize(wizardInfo);
+ Hashtable data = new Hashtable();
+
+ data.put(ConfigConstants.TASKID,TaskId.TASK_SELECT_SUBSYSTEMS);
+ data.put(ConfigConstants.OPTYPE, OpDef.OP_MODIFY);
+ data.put(ConfigConstants.PR_CERT_INSTANCE_NAME,
+ consoleInfo.get(ConfigConstants.PR_CERT_INSTANCE_NAME));
+ if (wizardInfo.getDBBindDN() != null)
+ data.put(ConfigConstants.PR_DB_BINDDN, wizardInfo.getDBBindDN());
+ if (wizardInfo.getInternalDBPasswd() != null)
+ data.put(ConfigConstants.PR_DB_PWD, wizardInfo.getInternalDBPasswd());
+ if (wizardInfo.isCAInstalled())
+ data.put(ConfigConstants.PR_CA, ConfigConstants.TRUE);
+ else
+ data.put(ConfigConstants.PR_CA, ConfigConstants.FALSE);
+
+ if (wizardInfo.isRAInstalled())
+ data.put(ConfigConstants.PR_RA, ConfigConstants.TRUE);
+ else
+ data.put(ConfigConstants.PR_RA, ConfigConstants.FALSE);
+
+ if (wizardInfo.isKRAInstalled())
+ data.put(ConfigConstants.PR_KRA, ConfigConstants.TRUE);
+ else
+ data.put(ConfigConstants.PR_KRA, ConfigConstants.FALSE);
+
+ String services = "";
+ if (wizardInfo.isCAInstalled()) {
+ if (!services.equals(""))
+ services = services+":";
+ services=services+ConfigConstants.PR_CA;
+ }
+ if (wizardInfo.isRAInstalled()) {
+ if (!services.equals(""))
+ services = services+":";
+ services=services+ConfigConstants.PR_RA;
+ //data.put(ConfigConstants.CA_HOST, wizardInfo.getCMHost());
+ //data.put(ConfigConstants.CA_PORT, wizardInfo.getCMPort());
+ }
+ if (wizardInfo.isKRAInstalled()) {
+ if (!services.equals(""))
+ services = services+":";
+ services=services+ConfigConstants.PR_KRA;
+ }
+ data.put(ConfigConstants.PR_SUBSYSTEMS, services);
+ data.put(ConfigConstants.REMOTE_KRA_ENABLED, ConfigConstants.FALSE);
+ data.put(ConfigConstants.CA_HOST, wizardInfo.getCMHost());
+ data.put(ConfigConstants.CA_PORT, wizardInfo.getCMPort());
+ data.put(ConfigConstants.CA_TIMEOUT, wizardInfo.getCMTimeout());
+ wizardInfo.enableRemoteDRM(ConfigConstants.FALSE);
+ wizardInfo.setSubsystems(services);
+ startProgressStatus();
+
+ CMSMessageBox dlg = new CMSMessageBox(mAdminFrame, "CGITASK", "CONFIGDB");
+
+ boolean ready = configCertCgi.configCert(data);
+
+ dlg.setVisible(false);
+
+ endProgressStatus();
+
+ if (!ready) {
+ String str = configCertCgi.getErrorMessage();
+ if (str.equals(""))
+ setErrorMessage("Server Error");
+ else
+ setErrorMessage(str);
+ }
+
+ return ready;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(mHelpIndex);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ JTextArea heading = createTextArea(mResource.getString(
+ "REMOTECAWIZARD_TEXT_HEADING_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(heading, gbc);
+
+ JLabel hostLbl = makeJLabel("HOST");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.fill = gbc.NONE;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0, 0,
+ COMPONENT_SPACE);
+ add(hostLbl, gbc);
+
+ mHostText = makeJTextField(30);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ add(mHostText, gbc);
+
+ JLabel portLbl = makeJLabel("PORT");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ add(portLbl, gbc);
+
+ mPortText = makeJTextField(10);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mPortText, gbc);
+
+ JLabel timeoutLbl = makeJLabel("TIMEOUT");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0, 0,
+ COMPONENT_SPACE);
+ add(timeoutLbl, gbc);
+
+ mTimeoutText = makeJTextField("30", 10);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mTimeoutText, gbc);
+
+ /*JLabel timeunitLbl = makeJLabel("TIMEUNIT");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0, 0,
+ COMPONENT_SPACE);
+ add(timeunitLbl, gbc);
+ */
+
+ JLabel label = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(label, gbc);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIRemoteKRASubsystem.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIRemoteKRASubsystem.java
new file mode 100644
index 000000000..29beb04af
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIRemoteKRASubsystem.java
@@ -0,0 +1,371 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+import javax.swing.*;
+import java.awt.*;
+import java.util.*;
+import java.awt.event.*;
+
+/**
+ * Remote subsystems.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+
+class WIRemoteKRASubsystem extends WizardBasePanel implements IWizardPanel {
+ protected JTextField mHostText, mPortText, mTimeoutText;
+ protected JLabel mHostLbl, mPortLbl, mTimeoutLbl, mTimeunitLbl;
+ protected JRadioButton mYes, mNo;
+ protected String mHost, mPort, mTimeout;
+ protected JTextArea mHeading;
+ protected Color mActiveColor;
+ public static final int MAX_PORT = 65535;
+ public static final int MIN_PORT = 1;
+ private static final String PANELNAME = "REMOTEKRAWIZARD";
+ private static final String HELPINDEX1 = "install-ca-remote-kra-wizard-help";
+ private static final String HELPINDEX2 = "install-ra-remote-kra-wizard-help";
+ private InstallWizardInfo mWizardInfo;
+
+ WIRemoteKRASubsystem(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WIRemoteKRASubsystem(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ mWizardInfo = wizardInfo;
+ if (wizardInfo.isServicesDone())
+ return false;
+ if ((wizardInfo.isCAInstalled() || wizardInfo.isRAInstalled())
+ && !wizardInfo.isKRAInstalled()) {
+ setBorder(makeTitledBorder(PANELNAME));
+ if (mYes.isSelected())
+ enableFields(true, mActiveColor);
+ else
+ enableFields(false, getBackground());
+ return true;
+ }
+ return false;
+ }
+
+ public boolean validatePanel() {
+ if (mNo.isSelected()) {
+ mHost = "";
+ mPort = "";
+ mTimeout = "";
+ return true;
+ }
+
+ mHost = mHostText.getText().trim();
+ mPort = mPortText.getText().trim();
+ mTimeout = mTimeoutText.getText().trim();
+ if (mHost.equals("")) {
+ setErrorMessage("BLANKHOST");
+ return false;
+ }
+ if (mPort.equals("")) {
+ setErrorMessage("BLANKPORT");
+ return false;
+ }
+ if (mTimeout.equals("")) {
+ setErrorMessage("BLANKTIMEOUT");
+ return false;
+ }
+
+ try {
+ int portnumber = Integer.parseInt(mPort);
+ if (portnumber < MIN_PORT || portnumber > MAX_PORT) {
+ setErrorMessage("OUTOFRANGE");
+ return false;
+ }
+ } catch (NumberFormatException e) {
+ setErrorMessage("INVALIDPORT");
+ return false;
+ }
+
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ wizardInfo.setDRMHost(mHost);
+ wizardInfo.setDRMPort(mPort);
+ wizardInfo.setDRMTimeout(mTimeout);
+ ConsoleInfo consoleInfo = wizardInfo.getAdminConsoleInfo();
+ CMSConfigCert configCertCgi = new CMSConfigCert();
+ configCertCgi.initialize(wizardInfo);
+ Hashtable data = new Hashtable();
+ data.put(ConfigConstants.TASKID,TaskId.TASK_SELECT_SUBSYSTEMS);
+ data.put(ConfigConstants.OPTYPE, OpDef.OP_MODIFY);
+ data.put(ConfigConstants.PR_CERT_INSTANCE_NAME,
+ consoleInfo.get(ConfigConstants.PR_CERT_INSTANCE_NAME));
+ if (wizardInfo.getDBBindDN() != null)
+ data.put(ConfigConstants.PR_DB_BINDDN, wizardInfo.getDBBindDN());
+ if (wizardInfo.getInternalDBPasswd() != null)
+ data.put(ConfigConstants.PR_DB_PWD, wizardInfo.getInternalDBPasswd());
+
+ if (wizardInfo.isCAInstalled())
+ data.put(ConfigConstants.PR_CA, ConfigConstants.TRUE);
+ else
+ data.put(ConfigConstants.PR_CA, ConfigConstants.FALSE);
+
+ if (wizardInfo.isRAInstalled())
+ data.put(ConfigConstants.PR_RA, ConfigConstants.TRUE);
+ else
+ data.put(ConfigConstants.PR_RA, ConfigConstants.FALSE);
+
+ if (wizardInfo.isKRAInstalled())
+ data.put(ConfigConstants.PR_KRA, ConfigConstants.TRUE);
+ else
+ data.put(ConfigConstants.PR_KRA, ConfigConstants.FALSE);
+
+ String services = "";
+ if (wizardInfo.isCAInstalled()) {
+ if (!services.equals(""))
+ services = services+":";
+ services=services+ConfigConstants.PR_CA;
+ } else {
+ data.put(ConfigConstants.CA_HOST, wizardInfo.getCMHost());
+ data.put(ConfigConstants.CA_PORT, wizardInfo.getCMPort());
+ data.put(ConfigConstants.CA_TIMEOUT, wizardInfo.getCMTimeout());
+ }
+
+ if (wizardInfo.isRAInstalled()) {
+ if (!services.equals(""))
+ services = services+":";
+ services=services+ConfigConstants.PR_RA;
+ }
+ if (wizardInfo.isKRAInstalled()) {
+ if (!services.equals(""))
+ services = services+":";
+ services=services+ConfigConstants.PR_KRA;
+ } else {
+ // connect to the remote KRA subystem
+ if (mYes.isSelected()) {
+ data.put(ConfigConstants.KRA_HOST, wizardInfo.getDRMHost());
+ data.put(ConfigConstants.KRA_PORT, wizardInfo.getDRMPort());
+ data.put(ConfigConstants.KRA_TIMEOUT, wizardInfo.getDRMTimeout());
+ data.put(ConfigConstants.REMOTE_KRA_ENABLED,
+ ConfigConstants.TRUE);
+ wizardInfo.enableRemoteDRM(ConfigConstants.TRUE);
+ } else {
+ data.put(ConfigConstants.REMOTE_KRA_ENABLED,
+ ConfigConstants.FALSE);
+ wizardInfo.enableRemoteDRM(ConfigConstants.FALSE);
+ }
+ }
+
+ data.put(ConfigConstants.PR_SUBSYSTEMS, services);
+ wizardInfo.setSubsystems(services);
+ startProgressStatus();
+ CMSMessageBox dlg = new CMSMessageBox(mAdminFrame, "CGITASK", "CONFIGDB");
+ boolean ready = configCertCgi.configCert(data);
+ dlg.setVisible(false);
+
+ endProgressStatus();
+
+ if (!ready) {
+ String str = configCertCgi.getErrorMessage();
+ if (str.equals(""))
+ setErrorMessage("Server Error");
+ else
+ setErrorMessage(str);
+ }
+
+ return ready;
+ }
+
+ public void callHelp() {
+ if (mWizardInfo.isCAInstalled()) {
+ CMSAdminUtil.help(HELPINDEX1);
+ } else {
+ CMSAdminUtil.help(HELPINDEX2);
+ }
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ JTextArea heading = createTextArea(mResource.getString(
+ "REMOTEKRAWIZARD_TEXT_ISREMOTEKRA_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(heading, gbc);
+
+ mNo = makeJRadioButton("NO", true);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mNo, gbc);
+
+ mYes = makeJRadioButton("YES", false);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mYes, gbc);
+
+ ButtonGroup btnGroup = new ButtonGroup();
+ btnGroup.add(mNo);
+ btnGroup.add(mYes);
+
+ mHeading = createTextArea(mResource.getString(
+ "REMOTEKRAWIZARD_TEXT_HEADING_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0,4*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mHeading, gbc);
+
+ mHostLbl = makeJLabel("HOST");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.fill = gbc.NONE;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0, 0,
+ COMPONENT_SPACE);
+ add(mHostLbl, gbc);
+
+ mHostText = makeJTextField(30);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ add(mHostText, gbc);
+ mActiveColor = mHostText.getBackground();
+
+ mPortLbl = makeJLabel("PORT");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ add(mPortLbl, gbc);
+
+ mPortText = makeJTextField(10);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mPortText, gbc);
+
+ mTimeoutLbl = makeJLabel("TIMEOUT");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.EAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0, 0,
+ COMPONENT_SPACE);
+ add(mTimeoutLbl, gbc);
+
+ mTimeoutText = makeJTextField("30", 10);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mTimeoutText, gbc);
+
+ /*mTimeunitLbl = makeJLabel("TIMEUNIT");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0, 0,
+ COMPONENT_SPACE);
+ add(mTimeunitLbl, gbc);
+ */
+
+ JLabel label = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(label, gbc);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ if (mYes.isSelected()) {
+ enableFields(true, mActiveColor);
+ } else {
+ enableFields(false, getBackground());
+ }
+ }
+
+ private void enableFields(boolean enabled, Color color) {
+ mHeading.setEnabled(enabled);
+ mHostLbl.setEnabled(enabled);
+ mPortLbl.setEnabled(enabled);
+ mTimeoutLbl.setEnabled(enabled);
+ mHostText.setEnabled(enabled);
+ mHostText.setEditable(enabled);
+ mHostText.setBackground(color);
+ mPortText.setEnabled(enabled);
+ mPortText.setEditable(enabled);
+ mPortText.setBackground(color);
+ mTimeoutText.setEnabled(enabled);
+ mTimeoutText.setEditable(enabled);
+ mTimeoutText.setBackground(color);
+ CMSAdminUtil.repaintComp(mHeading);
+ CMSAdminUtil.repaintComp(mHostLbl);
+ CMSAdminUtil.repaintComp(mHostText);
+ CMSAdminUtil.repaintComp(mPortLbl);
+ CMSAdminUtil.repaintComp(mPortText);
+ CMSAdminUtil.repaintComp(mTimeoutLbl);
+ CMSAdminUtil.repaintComp(mTimeoutText);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIReplAgreementPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIReplAgreementPage.java
new file mode 100644
index 000000000..df9bb1ab0
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIReplAgreementPage.java
@@ -0,0 +1,417 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Replication Agreeemnt
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIReplAgreementPage extends WizardBasePanel implements IWizardPanel {
+ private Color mActiveColor;
+ private JCheckBox mEnable;
+ private JTextField mAgreementText1, mAgreementText2;
+ private JPasswordField mManagerPwd1, mManagerPwdAgain1;
+ private JPasswordField mManagerPwd2, mManagerPwdAgain2;
+
+ private static final String PANELNAME = "REPLDBWIZARD";
+ private static final String HELPINDEX =
+ "install-internaldb-configuration-wizard-help";
+ private static final String EMPTYSTR = " ";
+
+ WIReplAgreementPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WIReplAgreementPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mEnable)) {
+ enableAgreement(mEnable.isSelected());
+ }
+ }
+
+ private void enableAgreement(boolean e) {
+ Color c;
+ if (e) {
+ c = mActiveColor;
+ } else {
+ c = getBackground();
+ }
+ mAgreementText1.setEditable(e);
+ mAgreementText1.setEnabled(e);
+ mAgreementText1.setBackground(c);
+ mManagerPwd1.setEditable(e);
+ mManagerPwd1.setEnabled(e);
+ mManagerPwd1.setBackground(c);
+ mManagerPwdAgain1.setEditable(e);
+ mManagerPwdAgain1.setEnabled(e);
+ mManagerPwdAgain1.setBackground(c);
+ mAgreementText2.setEditable(e);
+ mAgreementText2.setEnabled(e);
+ mAgreementText2.setBackground(c);
+ mManagerPwd2.setEditable(e);
+ mManagerPwd2.setEnabled(e);
+ mManagerPwd2.setBackground(c);
+ mManagerPwdAgain2.setEditable(e);
+ mManagerPwdAgain2.setEnabled(e);
+ mManagerPwdAgain2.setBackground(c);
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+
+ if (!wizardInfo.isCloneDBCreated())
+ return false;
+
+ if (wizardInfo.isCloning() && !wizardInfo.isAgreementDone()) {
+ setBorder(makeTitledBorder(PANELNAME));
+ mAgreementText1.setText("masterToconsumer");
+ mAgreementText2.setText("consumerTomaster");
+ return true;
+ }
+ return false;
+ }
+
+ public boolean validatePanel() {
+ if (!mEnable.isSelected())
+ return true;
+ String passwd1 = mManagerPwd1.getText().trim();
+ String passwdAgain1 = mManagerPwdAgain1.getText().trim();
+ String name1 = mAgreementText1.getText().trim();
+
+ if (passwd1.equals("") || passwdAgain1.equals("")) {
+ setErrorMessage("EMPTYPASSWORD");
+ return false;
+ }
+
+ if (!passwdAgain1.equals(passwd1)) {
+ setErrorMessage("NOTSAMEPASSWORD");
+ return false;
+ }
+
+ if (name1.equals("")) {
+ setErrorMessage("EMPTYNAME");
+ return false;
+ }
+
+ String passwd2 = mManagerPwd2.getText().trim();
+ String passwdAgain2 = mManagerPwdAgain2.getText().trim();
+ String name2 = mAgreementText2.getText().trim();
+
+ if (passwd2.equals("") || passwdAgain2.equals("")) {
+ setErrorMessage("EMPTYPASSWORD");
+ return false;
+ }
+
+ if (!passwdAgain2.equals(passwd2)) {
+ setErrorMessage("NOTSAMEPASSWORD");
+ return false;
+ }
+
+ if (name2.equals("")) {
+ setErrorMessage("EMPTYNAME");
+ return false;
+ }
+
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_CREATE_REPLICATION_AGREEMENT;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY;
+ boolean ready = false;
+ if (!mEnable.isSelected()) {
+ rawData = rawData+"&"+ConfigConstants.PR_ENABLE_REPLICATION+"="+
+ ConfigConstants.FALSE;
+ ready = send(rawData, wizardInfo);
+ } else {
+ rawData = rawData+"&"+ConfigConstants.PR_ENABLE_REPLICATION+"="+
+ ConfigConstants.TRUE;
+ rawData = rawData+"&"+ConfigConstants.PR_AGREEMENT_NAME_1+"="+
+ mAgreementText1.getText().trim();
+ rawData = rawData+"&"+ConfigConstants.PR_REPLICATION_MANAGER_PASSWD_1+"="+mManagerPwd1.getText().trim();
+ rawData = rawData+"&"+ConfigConstants.PR_AGREEMENT_NAME_2+"="+mAgreementText2.getText().trim();
+ rawData = rawData+"&"+ConfigConstants.PR_REPLICATION_MANAGER_PASSWD_2+"="+mManagerPwd2.getText().trim();
+
+ startProgressStatus();
+/*
+ CMSMessageBox dlg = new CMSMessageBox(mAdminFrame,
+ "CGITASK", "CREATEREPLICATIONAGREEMENT");
+*/
+ ready = send(rawData, wizardInfo);
+ // dlg.setVisible(false);
+ endProgressStatus();
+ }
+
+ if (!ready) {
+ String str = getErrorMessage(wizardInfo);
+ if (str.equals("")) {
+ String errorMsg = mResource.getString(
+ PANELNAME+"_ERRORMSG");
+ setErrorMessage(errorMsg);
+ } else
+ setErrorMessage(str);
+ }
+
+ return ready;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JTextArea desc = createTextArea(mResource.getString(
+ PANELNAME+"_TEXT_HEADING_LABEL"));
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mEnable = makeJCheckBox("ENABLE");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mEnable, gbc);
+ mEnable.setSelected(true);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JTextArea desc1 = createTextArea(mResource.getString(
+ PANELNAME+"_TEXT_MASTER1_LABEL"));
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc1, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel passwdLbl1 = makeJLabel("PASSWORD");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(passwdLbl1, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mManagerPwd1 = makeJPasswordField(30);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ //gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mManagerPwd1, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel passwdAgainLbl1 = makeJLabel("PASSWORDAGAIN");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, 4*COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(passwdAgainLbl1, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mManagerPwdAgain1 = makeJPasswordField(30);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ //gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mManagerPwdAgain1, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel desc2 = makeJLabel("MASTER2");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc2, gbc);
+/*
+ JTextArea desc2 = createTextArea(mResource.getString(
+ PANELNAME+"_TEXT_MASTER2_LABEL"));
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc2, gbc);
+*/
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel passwdLbl2 = makeJLabel("PASSWORD");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(passwdLbl2, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mManagerPwd2 = makeJPasswordField(30);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ //gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mManagerPwd2, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel passwdAgainLbl2 = makeJLabel("PASSWORDAGAIN");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, 4*COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(passwdAgainLbl2, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mManagerPwdAgain2 = makeJPasswordField(30);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ //gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mManagerPwdAgain2, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JTextArea desc3 = createTextArea(mResource.getString(
+ PANELNAME+"_TEXT_AGREEMENT_LABEL"));
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(2*COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc3, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JTextArea desc4 = createTextArea(mResource.getString(
+ PANELNAME+"_TEXT_AGREEMENT1_LABEL"));
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc4, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel agreementLbl1 = makeJLabel("NAME");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(agreementLbl1, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mAgreementText1 = makeJTextField(30);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ //gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mAgreementText1, gbc);
+ mActiveColor = mAgreementText1.getBackground();
+
+ CMSAdminUtil.resetGBC(gbc);
+ JTextArea desc5 = createTextArea(mResource.getString(
+ PANELNAME+"_TEXT_AGREEMENT2_LABEL"));
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc5, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel agreementLbl2 = makeJLabel("NAME");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(agreementLbl2, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mAgreementText2 = makeJTextField(30);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ //gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mAgreementText2, gbc);
+ mActiveColor = mAgreementText2.getBackground();
+
+ JLabel dummy = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ add(dummy, gbc);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ wizardInfo.setAgreementDone(ConfigConstants.TRUE);
+ if (!mEnable.isSelected())
+ wizardInfo.setReplicationEnabled(ConfigConstants.FALSE);
+ else
+ wizardInfo.setReplicationEnabled(ConfigConstants.TRUE);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIRequestResultPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIRequestResultPage.java
new file mode 100644
index 000000000..e3f9c53f3
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIRequestResultPage.java
@@ -0,0 +1,148 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.util.*;
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.install.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Certificate wizard request result page
+ *
+ * @author Michelle Zhao
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+public class WIRequestResultPage extends WizardBasePanel implements IWizardPanel {
+ private static final String PANELNAME = "REQUESTRESULTWIZARD";
+ private static final String HELPINDEX =
+ "install-request-result-wizard-help";
+
+ protected String mPanelName = PANELNAME;
+ protected String mHelpIndex = HELPINDEX;
+ protected JTextArea mDesc;
+ protected boolean print2RequestIDs = false;
+
+ protected String mRequestId;
+
+ WIRequestResultPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WIRequestResultPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+
+ if (!wizardInfo.requestSent())
+ return false;
+
+ setBorder(makeTitledBorder(PANELNAME));
+
+ String status = wizardInfo.getX509RequestStatus();
+ String str = wizardInfo.getX509RequestID();
+ String error = wizardInfo.getX509RequestError();
+
+ if (str != null && !str.equals("")) {
+ if (status != null && status.equals(Constants.PR_REQUEST_REJECTED)) {
+ // rejected
+ mDesc.setText(mResource.getString(mPanelName+"_TEXT_REJECT_LABEL") +
+ error + "\n\n"+ mResource.getString(mPanelName+"_TEXT_ID_LABEL") + str +
+ mResource.getString(mPanelName+"_TEXT_REJECTEND_LABEL"));
+ } else {
+ mDesc.setText(mResource.getString(mPanelName+"_TEXT_DESC_LABEL") +
+ mResource.getString(mPanelName+"_TEXT_ID_LABEL") + str +
+ mResource.getString(mPanelName+"_TEXT_END_LABEL"));
+ }
+ } else if (error != null && !error.equals(""))
+ mDesc.setText(error);
+ else
+ mDesc.setText(mResource.getString(mPanelName+"_TEXT_DESC_LABEL") +
+ mResource.getString(mPanelName+"_TEXT_NOID_LABEL"));
+
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ return true;
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ mDesc = createTextArea(mResource.getString(
+ mPanelName+"_TEXT_DESC_LABEL"));
+ //mDesc = createTextArea("request id");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mDesc, gbc);
+
+ JLabel label = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(label, gbc);
+
+ super.init();
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(mHelpIndex);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+
+ public void actionPerformed(ActionEvent event) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WISMTPPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WISMTPPage.java
new file mode 100644
index 000000000..3b7ba9d00
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WISMTPPage.java
@@ -0,0 +1,129 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * SMTP page for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WISMTPPage extends WizardBasePanel implements IWizardPanel {
+ private JTextField mServerTxt, mPortTxt;
+ private static final String PANELNAME = "SMTPWIZARD";
+ private static final String HELPINDEX =
+ "configuration-kra-wizard-change-keyscheme-help";
+
+ WISMTPPage() {
+ super(PANELNAME);
+ init();
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ return true;
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel headingLbl = makeJLabel("HEADING");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ add(headingLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel serverLbl = makeJLabel("SERVERNAME");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.weightx = 0.0;
+ gbc.weighty = 0.0;
+ gbc.fill = gbc.NONE;
+ add(serverLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mServerTxt = makeJTextField(30);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 0.0;
+ gbc.weighty = 0.0;
+ add(mServerTxt, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel dummy2 = new JLabel(" ");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(dummy2, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel portLbl = makeJLabel("PORT");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.weighty = 1.0;
+ add(portLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mPortTxt = makeJTextField(30);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 0.0;
+ gbc.weighty = 1.0;
+ add(mPortTxt, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel dummy3 = new JLabel(" ");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(dummy3, gbc);
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WISSLMessageDigestPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WISSLMessageDigestPage.java
new file mode 100644
index 000000000..820c17646
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WISSLMessageDigestPage.java
@@ -0,0 +1,79 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.text.*;
+import javax.swing.border.*;
+import javax.swing.event.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Setup the message digest information for the installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WISSLMessageDigestPage extends WMessageDigestPage {
+
+ private static final String PANELNAME = "INSTALLSSLMESSAGEDIGESTWIZARD";
+
+ WISSLMessageDigestPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WISSLMessageDigestPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning())
+ return false;
+ if (wizardInfo.isMigrationEnable() || !wizardInfo.isSSLCertLocalCA() ||
+ wizardInfo.isSSLLocalCertDone() || wizardInfo.isSSLCertRequestDone() ||
+ wizardInfo.isSSLCertInstalledDone())
+ return false;
+
+ mCAKeyType = wizardInfo.getCAKeyType();
+
+ return super.initializePanel(info);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (mDSAHashTypeBox.isVisible())
+ wizardInfo.setHashType((String)mDSAHashTypeBox.getSelectedItem());
+ else
+ wizardInfo.setHashType((String)mRSAHashTypeBox.getSelectedItem());
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WISSLRequestResultPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WISSLRequestResultPage.java
new file mode 100644
index 000000000..119221105
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WISSLRequestResultPage.java
@@ -0,0 +1,58 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Display the SSL certificate request result
+ *
+ * @author Michelle Zhao
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WISSLRequestResultPage extends WIRequestResultPage {
+
+ WISSLRequestResultPage(JDialog parent) {
+ super(parent);
+ }
+
+ WISSLRequestResultPage(JDialog parent, JFrame adminFrame) {
+ super( parent, adminFrame);
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning())
+ return false;
+ if (wizardInfo.isSSLCertLocalCA() || wizardInfo.isMigrationEnable() ||
+ wizardInfo.isSSLLocalCertDone()||
+ (wizardInfo.isSSLCertRequestSucc() && wizardInfo.isSSLReqResultDisplayed()) ||
+ wizardInfo.isSSLCertInstalledDone())
+ return false;
+
+ wizardInfo.setSSLReqResultDisplayed(Constants.TRUE);
+ return super.initializePanel(info);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WISSLTokenLogonPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WISSLTokenLogonPage.java
new file mode 100644
index 000000000..ff1ed7826
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WISSLTokenLogonPage.java
@@ -0,0 +1,72 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+
+/**
+ * This panel asks for the information of the current internal database.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WISSLTokenLogonPage extends WITokenLogonPage implements IWizardPanel {
+
+ private static final String HELPINDEX = "install-ssltoken-logon-wizard-help";
+ private static final String PANELNAME = "SSLTOKENLOGONWIZARD";
+
+ WISSLTokenLogonPage(JDialog dialog) {
+ super(PANELNAME);
+ mHelpIndex = HELPINDEX;
+ mParent = dialog;
+ }
+
+ WISSLTokenLogonPage(JDialog dialog, JFrame adminFrame) {
+ super(PANELNAME);
+ mHelpIndex = HELPINDEX;
+ mParent = dialog;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ String tokenname = wizardInfo.getSSLTokenName();
+ String pwd = (String)wizardInfo.get("TOKEN:"+tokenname);
+ if (wizardInfo.isCloning())
+ return false;
+ if (wizardInfo.isSSLCertLocalCA() || !wizardInfo.isInstallCertNow() ||
+ wizardInfo.isMigrationEnable() || wizardInfo.isSSLCertInstalledDone())
+ return false;
+ if (pwd != null)
+ return false;
+
+ mTokenName = tokenname;
+ mTokenText.setText(tokenname);
+ return super.initializePanel(info);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIServerCertDNPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIServerCertDNPage.java
new file mode 100644
index 000000000..b6ee85acc
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIServerCertDNPage.java
@@ -0,0 +1,116 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import com.netscape.admin.certsrv.wizard.*;
+import javax.swing.*;
+
+/**
+ * Subject DN page for SSL server certificate
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIServerCertDNPage extends WICertDNPage {
+ private static final String PANELNAME = "INSTALLSSLCERTDNWIZARD";
+ private static final String LOCALHELPINDEX = "install-sslcertlocal-subjectdn-wizard-help";
+ private static final String REMOTEHELPINDEX = "install-sslcertsub-subjectdn-wizard-help";
+
+ WIServerCertDNPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIServerCertDNPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning())
+ return false;
+ if (wizardInfo.isMigrationEnable() || wizardInfo.isSSLLocalCertDone() ||
+ wizardInfo.isSSLCertRequestDone() || wizardInfo.isSSLCertInstalledDone())
+ return false;
+ String machineName = wizardInfo.getMachineName();
+// dnDesc.setText("CN="+machineName+", O=Netscape Communications, C=US");
+ String str = wizardInfo.getSSLSubjectName();
+/*
+ if (wizardInfo.isCAInstalled()) { // It is for SSL Server cert for CA
+ // get O component
+ OComp = wizardInfo.getCAOComp();
+ CComp = wizardInfo.getCACComp();
+ }
+ else if (wizardInfo.isRAInstalled()) { // It is for SSL Server cert for RA
+ OComp = wizardInfo.getRAOComp();
+ CComp = wizardInfo.getRACComp();
+ }
+*/
+
+ String OUComp = wizardInfo.getOUComponent();
+ String OComp = wizardInfo.getOComponent();
+ String LComp = wizardInfo.getLComponent();
+ String STComp = wizardInfo.getSTComponent();
+ String CComp = wizardInfo.getCComponent();
+
+ if (str == null || str.equals("")) {
+ str = "CN="+machineName;
+ if (OUComp != null && !OUComp.equals("")) {
+ str = str+", OU="+OUComp;
+ }
+ if (OComp != null && !OComp.equals("")) {
+ str = str+", O="+OComp;
+ }
+ if (LComp != null && !LComp.equals("")) {
+ str = str+", L="+LComp;
+ }
+ if (STComp != null && !STComp.equals("")) {
+ str = str+", ST="+STComp;
+ }
+ if (CComp != null && !CComp.equals("")) {
+ str = str+", C="+CComp;
+ } else {
+ str = str+", "+SERVER_C;
+ }
+ }
+ wizardInfo.setSSLSubjectName(str);
+ populateDN(str);
+
+ if (wizardInfo.isSSLCertLocalCA())
+ mHelpIndex = LOCALHELPINDEX;
+ else
+ mHelpIndex = REMOTEHELPINDEX;
+
+ return super.initializePanel(info);
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+
+ if (super.concludePanel(info)) {
+ wizardInfo.setSSLSubjectName(mStr);
+ return true;
+ }
+
+ return false;
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIServerCertExtensionPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIServerCertExtensionPage.java
new file mode 100644
index 000000000..f958c88a1
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIServerCertExtensionPage.java
@@ -0,0 +1,71 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.border.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+
+/**
+ * Certificate Extension page for SSL server Certificate.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIServerCertExtensionPage extends WICertExtensionPage {
+ private static final String PANELNAME = "INSTALLSERVERCERTEXTENSION1WIZARD";
+ private static final String HELPINDEX = "install-sslcert-extension-wizard-help";
+
+ WIServerCertExtensionPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ mHelpIndex = HELPINDEX;
+ }
+
+ WIServerCertExtensionPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mHelpIndex = HELPINDEX;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning())
+ return false;
+ if (wizardInfo.isMigrationEnable() ||
+ wizardInfo.isSSLLocalCertDone() || wizardInfo.isSSLCertRequestDone() ||
+ wizardInfo.isSSLCertInstalledDone())
+ return false;
+
+ if (!mModified) {
+ mExtendedKeyCheckBox.setSelected(true);
+ mAKICheckBox.setSelected(true);
+ mSSLServer.setSelected(true);
+ mSSLClient.setSelected(true);
+ }
+ return super.initializePanel(info);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIServerCertSubmitPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIServerCertSubmitPage.java
new file mode 100644
index 000000000..417e706a5
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIServerCertSubmitPage.java
@@ -0,0 +1,89 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+
+/**
+ * Server Certificate Submission.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIServerCertSubmitPage extends WICertSubmitPage implements IWizardPanel {
+ private static final String PANELNAME = "INSTALLSERVERCERTWIZARD";
+ private static final String CALOCALHELPINDEX = "install-cassltypelocal-wizard-help";
+ private static final String CAREMOTEHELPINDEX = "install-cassltypesub-wizard-help";
+ private static final String CAKRALOCALHELPINDEX = "install-cakrassltypelocal-wizard-help";
+ private static final String CAKRAREMOTEHELPINDEX = "install-cakrassltypesub-wizard-help";
+
+ WIServerCertSubmitPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ wizardInfo.put(Constants.PR_CERTIFICATE_TYPE,
+ Constants.PR_SERVER_CERT);
+
+ if (wizardInfo.isCloning())
+ return false;
+
+ if (wizardInfo.isMigrationEnable() ||
+ wizardInfo.isSSLCertRequestDone() || wizardInfo.isSSLCertInstalledDone() ||
+ !wizardInfo.isCAInstalled()) {
+ wizardInfo.setSSLCertLocalCA(Constants.FALSE);
+ return false;
+ }
+
+ if (wizardInfo.isSSLLocalCertDone())
+ return false;
+
+ if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled()) {
+ if (wizardInfo.isSSLCertLocalCA()) {
+ mHelpIndex = CAKRALOCALHELPINDEX;
+ } else
+ mHelpIndex = CAKRAREMOTEHELPINDEX;
+ } else if (wizardInfo.isSSLCertLocalCA()) {
+ mHelpIndex = CALOCALHELPINDEX;
+ } else {
+ mHelpIndex = CAREMOTEHELPINDEX;
+ }
+
+ return super.initializePanel(info);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (mSelfButton.isSelected())
+ wizardInfo.setSSLCertLocalCA(Constants.TRUE);
+ else
+ wizardInfo.setSSLCertLocalCA(Constants.FALSE);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIServerCertValidityPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIServerCertValidityPage.java
new file mode 100644
index 000000000..047b9d7e8
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIServerCertValidityPage.java
@@ -0,0 +1,69 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import javax.swing.event.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+
+/**
+ * Validity page for SSL server certificate.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIServerCertValidityPage extends WICertValidityPage {
+ private static final String PANELNAME = "INSTALLSERVERCERTVALIDWIZARD";
+ private static final String HELPINDEX = "install-sslcert-validity-wizard-help";
+
+ WIServerCertValidityPage(JDialog parent) {
+ super(PANELNAME);
+ mHelpIndex = HELPINDEX;
+ mParent = parent;
+ }
+
+ WIServerCertValidityPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mHelpIndex = HELPINDEX;
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (wizardInfo.isCloning())
+ return false;
+ if (wizardInfo.isMigrationEnable() || wizardInfo.isSSLLocalCertDone() ||
+ wizardInfo.isSSLCertRequestDone() || wizardInfo.isSSLCertInstalledDone())
+ return false;
+ if (super.initializePanel(info)) {
+ if (!wizardInfo.isSSLCertLocalCA())
+ return false;
+ return true;
+ }
+ return false;
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIServerKeyPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIServerKeyPage.java
new file mode 100644
index 000000000..c14d0d2b3
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIServerKeyPage.java
@@ -0,0 +1,93 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import javax.swing.event.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+
+/**
+ * Setup key information for ssl server certificate
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIServerKeyPage extends WIKeyPage implements IWizardPanel {
+ private static final String PANELNAME = "INSTALLSERVERKEYWIZARD";
+ private static final String LOCALHELPINDEX =
+ "install-serverkeylocal-configuration-wizard-help";
+ private static final String REMOTEHELPINDEX =
+ "install-serverkeysub-configuration-wizard-help";
+
+ WIServerKeyPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WIServerKeyPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ mWizardInfo = (InstallWizardInfo)info;
+
+ if (mWizardInfo.isCloning())
+ return false;
+
+ if (mWizardInfo.isMigrationEnable() || mWizardInfo.isSSLLocalCertDone() ||
+ mWizardInfo.isSSLCertRequestDone() || mWizardInfo.isSSLCertInstalledDone())
+ return false;
+ if (super.initializePanel(info)) {
+ String sslTokenName = mWizardInfo.getSSLTokenName();
+ if (sslTokenName == null || sslTokenName.equals("")) {
+ mTokenBox.setSelectedIndex(0);
+ } else {
+ if (sslTokenName.equals(Constants.PR_INTERNAL_TOKEN_NAME))
+ mTokenBox.setSelectedIndex(0);
+ else
+ mTokenBox.setSelectedItem(sslTokenName);
+ }
+ }
+
+ if (mWizardInfo.isSSLCertLocalCA())
+ mHelpIndex = LOCALHELPINDEX;
+ else
+ mHelpIndex = REMOTEHELPINDEX;
+
+ enableFields();
+ mIsCAKey = false;
+ return true;
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ super.getUpdateInfo(info);
+ mWizardInfo.setSSLTokenName(mWizardInfo.getTokenName());
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIServicesPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIServicesPage.java
new file mode 100644
index 000000000..fb524e62f
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIServicesPage.java
@@ -0,0 +1,425 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Introduction page for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WIServicesPage extends WizardBasePanel implements IWizardPanel {
+ private JRadioButton mCACheckBox;
+ private JRadioButton mRACheckBox;
+ private JRadioButton mOCSPCheckBox;
+ private JRadioButton mKRACheckBox;
+
+ private JRadioButton mTKSCheckBox;
+ private JTextArea mServiceLbl;
+
+ private static final String PANELNAME = "SERVICESWIZARD";
+ private static final String HELPINDEX =
+ "install-services-configuration-wizard-help";
+
+ private String mClonedSubsystem = null;
+
+ WIServicesPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WIServicesPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ /* bug#54369 - disable RA for netkey */
+ mRACheckBox.setEnabled(false);
+
+ mClonedSubsystem = wizardInfo.getCloneSubsystem();
+
+
+ if(mClonedSubsystem != null)
+ {
+
+ mServiceLbl.setText(mResource.getString(PANELNAME +"_LABEL_INSTALL_CLONE_LABEL"));
+ if(mClonedSubsystem.equals(ConfigConstants.PR_CA))
+ {
+ mCACheckBox.setSelected(true);
+ }
+ else
+ mCACheckBox.setEnabled(false);
+
+ /* bug#54369 - disable RA for netkey
+ if(mClonedSubsystem.equals(ConfigConstants.PR_RA))
+ {
+ mRACheckBox.setSelected(true);
+ }
+ else
+ mRACheckBox.setEnabled(false);
+ */
+
+ if(mClonedSubsystem.equals(ConfigConstants.PR_KRA))
+ {
+ mKRACheckBox.setSelected(true);
+ }
+ else
+ mKRACheckBox.setEnabled(false);
+
+ if(mClonedSubsystem.equals(ConfigConstants.PR_TKS))
+ {
+ mTKSCheckBox.setSelected(true);
+ }
+ else
+ mTKSCheckBox.setEnabled(false);
+
+ if(mClonedSubsystem.equals(ConfigConstants.PR_OCSP))
+ {
+ mOCSPCheckBox.setSelected(true);
+ }
+ else
+ mOCSPCheckBox.setEnabled(false);
+
+ }
+
+
+ Debug.println("WIServicesPage: initializePanel.");
+ Debug.println("WIServicesPage: mClonedSubsystem " + mClonedSubsystem);
+
+
+ if (wizardInfo.isServicesDone())
+ return false;
+
+ setBorder(makeTitledBorder(PANELNAME));
+ String subsystemList = wizardInfo.getSubsystems();
+ if (subsystemList == null || subsystemList.equals("")) {
+ if (!mRACheckBox.isSelected() && mClonedSubsystem == null)
+ mCACheckBox.setSelected(true);
+
+ return true;
+ }
+
+
+
+ // get the subsystems from the list
+ int start = 0;
+ int end;
+ do {
+ end = subsystemList.indexOf(':', start);
+ if( end == -1 ) {
+ end = subsystemList.length(); // last string ends at end-of-line
+ }
+ if( end-start < 1 ) {
+ setErrorMessage("INCORRECTRESPONSE");
+ return false;
+ }
+ String sub = subsystemList.substring(start, end);
+ if( ConfigConstants.PR_CA.equals(sub) ) {
+ mCACheckBox.setSelected(true);
+ } else if( ConfigConstants.PR_RA.equals(sub) ) {
+ mRACheckBox.setSelected(true);
+ } else if( ConfigConstants.PR_KRA.equals(sub) ) {
+ mKRACheckBox.setSelected(true);
+ } else if( ConfigConstants.PR_TKS.equals(sub) ) {
+ mTKSCheckBox.setSelected(true);
+ } else if( ConfigConstants.PR_OCSP.equals(sub) ) {
+ mOCSPCheckBox.setSelected(true);
+ } else {
+ setErrorMessage("INCORRECTRESPONSE");
+ return false;
+ }
+ start = end+1;
+ } while( start < subsystemList.length() );
+
+ return true;
+ }
+
+ public boolean validatePanel() {
+ if (mCACheckBox.isSelected() && mRACheckBox.isSelected()) {
+ setErrorMessage("NOCOLOCATED");
+ return false;
+ }
+
+ if (!mCACheckBox.isSelected() && !mRACheckBox.isSelected() &&
+ !mOCSPCheckBox.isSelected() && !mKRACheckBox.isSelected() && !mTKSCheckBox.isSelected()) {
+ setErrorMessage("NOSERVICESINSTALLED");
+ return false;
+ }
+
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ Hashtable data = new Hashtable();
+ String services = "";
+ if (mCACheckBox.isSelected()) {
+ wizardInfo.setInstalledCA(ConfigConstants.TRUE);
+ data.put(ConfigConstants.PR_CA, ConfigConstants.TRUE);
+ if (!services.equals(""))
+ services = services+":";
+ services=services+ConfigConstants.PR_CA;
+ } else {
+ wizardInfo.setInstalledCA(ConfigConstants.FALSE);
+ data.put(ConfigConstants.PR_CA, ConfigConstants.FALSE);
+ }
+
+ if (mRACheckBox.isSelected()) {
+ wizardInfo.setInstalledRA(ConfigConstants.TRUE);
+ data.put(ConfigConstants.PR_RA, ConfigConstants.TRUE);
+ if (!services.equals(""))
+ services = services+":";
+ services=services+ConfigConstants.PR_RA;
+ } else {
+ wizardInfo.setInstalledRA(ConfigConstants.FALSE);
+ data.put(ConfigConstants.PR_RA, ConfigConstants.FALSE);
+ }
+ if (mKRACheckBox.isSelected()) {
+ wizardInfo.setInstalledKRA(ConfigConstants.TRUE);
+ data.put(ConfigConstants.PR_KRA, ConfigConstants.TRUE);
+ if (!services.equals(""))
+ services = services+":";
+ services=services+ConfigConstants.PR_KRA;
+ } else {
+ wizardInfo.setInstalledKRA(ConfigConstants.FALSE);
+ data.put(ConfigConstants.PR_KRA, ConfigConstants.FALSE);
+ }
+ if (mTKSCheckBox.isSelected()) {
+ wizardInfo.setInstalledTKS(ConfigConstants.TRUE);
+ data.put(ConfigConstants.PR_TKS, ConfigConstants.TRUE);
+ if (!services.equals(""))
+ services = services+":";
+ services=services+ConfigConstants.PR_TKS;
+ } else {
+ wizardInfo.setInstalledTKS(ConfigConstants.FALSE);
+ data.put(ConfigConstants.PR_TKS, ConfigConstants.FALSE);
+ }
+ if (mOCSPCheckBox.isSelected()) {
+ wizardInfo.setInstalledOCSP(ConfigConstants.TRUE);
+ data.put(ConfigConstants.PR_OCSP, ConfigConstants.TRUE);
+ if (!services.equals(""))
+ services = services+":";
+ services=services+ConfigConstants.PR_OCSP;
+ } else {
+ wizardInfo.setInstalledOCSP(ConfigConstants.FALSE);
+ data.put(ConfigConstants.PR_OCSP, ConfigConstants.FALSE);
+ }
+
+ if (services != null && !services.equals("")) {
+ wizardInfo.setSubsystems(services);
+ }
+
+
+ String rawData = ConfigConstants.PR_SUBSYSTEMS+"="+services;
+ rawData = rawData+"&"+ConfigConstants.TASKID+"="+TaskId.TASK_SELECT_SUBSYSTEMS;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY;
+ if (wizardInfo.getDBBindDN() != null)
+ rawData = rawData+"&"+ConfigConstants.PR_DB_BINDDN+"="+wizardInfo.getDBBindDN();
+ if (wizardInfo.getInternalDBPasswd() != null)
+ rawData = rawData+"&"+ConfigConstants.PR_DB_PWD+"="+
+ wizardInfo.getInternalDBPasswd();
+
+ rawData = rawData+"&"+ConfigConstants.REMOTE_KRA_ENABLED+"="+
+ ConfigConstants.FALSE;
+ wizardInfo.enableRemoteDRM(ConfigConstants.FALSE);
+ startProgressStatus();
+
+ //CMSMessageBox dlg = new CMSMessageBox(mAdminFrame, "CGITASK", "CREATESUB");
+ boolean ready = send(rawData, wizardInfo);
+ //dlg.setVisible(false);
+ endProgressStatus();
+
+ if (!ready) {
+ String str = getErrorMessage(wizardInfo);
+ if (str.equals("")) {
+ String errorMsg = mResource.getString(
+ PANELNAME+"_ERRORMSG");
+ setErrorMessage(errorMsg);
+ } else
+ setErrorMessage(str);
+ }
+
+ return ready;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mCACheckBox)) {
+ mTKSCheckBox.setSelected(false);
+ mKRACheckBox.setSelected(false);
+ mOCSPCheckBox.setSelected(false);
+ if(mClonedSubsystem != null)
+ mCACheckBox.setSelected(true);
+
+ mRACheckBox.setSelected(false);
+ } else if (e.getSource().equals(mOCSPCheckBox)) {
+ mTKSCheckBox.setSelected(false);
+ mKRACheckBox.setSelected(false);
+ mCACheckBox.setSelected(false);
+ mRACheckBox.setSelected(false);
+ if(mClonedSubsystem != null)
+ mOCSPCheckBox.setSelected(true);
+ } else if (e.getSource().equals(mRACheckBox)) {
+ mCACheckBox.setSelected(false);
+ mTKSCheckBox.setSelected(false);
+ mKRACheckBox.setSelected(false);
+ mOCSPCheckBox.setSelected(false);
+ if(mClonedSubsystem != null)
+ mRACheckBox.setSelected(true);
+ } else if (e.getSource().equals(mKRACheckBox)) {
+ mTKSCheckBox.setSelected(false);
+ mCACheckBox.setSelected(false);
+ mRACheckBox.setSelected(false);
+ mOCSPCheckBox.setSelected(false);
+ if(mClonedSubsystem != null)
+ mKRACheckBox.setSelected(true);
+ }else if (e.getSource().equals(mTKSCheckBox)) {
+ mCACheckBox.setSelected(false);
+ mRACheckBox.setSelected(false);
+ mOCSPCheckBox.setSelected(false);
+ mKRACheckBox.setSelected(false);
+ if(mClonedSubsystem != null)
+ mTKSCheckBox.setSelected(true);
+ }
+
+ super.actionPerformed(e);
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ mServiceLbl = createTextArea(mResource.getString(
+ PANELNAME+"_LABEL_INSTALL_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mServiceLbl, gbc);
+
+ mCACheckBox = makeJRadioButton("CA");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mCACheckBox, gbc);
+
+ mOCSPCheckBox = makeJRadioButton("OCSP");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mOCSPCheckBox, gbc);
+
+ mRACheckBox = makeJRadioButton("RA");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0, COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mRACheckBox, gbc);
+
+ mKRACheckBox = makeJRadioButton("KRA");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ //gbc.weighty = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mKRACheckBox, gbc);
+
+ mTKSCheckBox = makeJRadioButton("TKS");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ //gbc.weighty = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mTKSCheckBox, gbc);
+
+ JLabel dummy = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ add(dummy, gbc);
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ if (mCACheckBox.isSelected())
+ wizardInfo.setInstalledCA(ConfigConstants.TRUE);
+ else
+ wizardInfo.setInstalledCA(ConfigConstants.FALSE);
+ if (mRACheckBox.isSelected())
+ wizardInfo.setInstalledRA(ConfigConstants.TRUE);
+ else
+ wizardInfo.setInstalledRA(ConfigConstants.FALSE);
+ if (mKRACheckBox.isSelected())
+ wizardInfo.setInstalledKRA(ConfigConstants.TRUE);
+ else
+ wizardInfo.setInstalledKRA(ConfigConstants.FALSE);
+ if (mTKSCheckBox.isSelected())
+ wizardInfo.setInstalledTKS(ConfigConstants.TRUE);
+ else
+ wizardInfo.setInstalledTKS(ConfigConstants.FALSE);
+ if (mOCSPCheckBox.isSelected())
+ wizardInfo.setInstalledOCSP(ConfigConstants.TRUE);
+ else
+ wizardInfo.setInstalledOCSP(ConfigConstants.FALSE);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WISingleSignonPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WISingleSignonPage.java
new file mode 100644
index 000000000..49e06ac1e
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WISingleSignonPage.java
@@ -0,0 +1,532 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.io.*;
+import java.net.*;
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import javax.swing.event.*;
+import javax.swing.text.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+import com.netscape.management.client.comm.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Setup Single Signon for the installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WISingleSignonPage extends WizardBasePanel implements IWizardPanel, CommClient {
+
+ public static final String PW_TAG_INTERNAL_LDAP_DB = "Internal LDAP Database";
+ public static final String PW_TAG_INTERNAL_STORAGE_TOKEN = "internal";
+
+ private Color mActiveColor;
+ // private JPasswordField mSingleSignonPassword, mSingleSignonPasswordAgain;
+ private JCheckBox mPasswordConf;
+ private static final String HELPINDEX = "install-single-signon-wizard-help";
+ private static final String PANELNAME = "INSTALLSINGLESIGNON";
+ private boolean ca;
+ private boolean ra;
+ private boolean kra;
+ private String mDBPasswd;
+ private String capassword, rapassword, krapassword, sslpassword;
+ private JComboBox mTokenBox;
+ private static final String START_TASK_CGI = "Tasks/Operation/start";
+ private static final String PREFIX = "CGITASK";
+ private boolean mFinished = false;
+ protected String mCmd = null;
+ private String mAdminURL = null;
+ protected boolean mSuccess = false;
+ private String mReply = null;
+ protected String mSection = "";
+ protected String mErrorMsg = "";
+ private ConsoleInfo _consoleInfo = null;
+
+ WISingleSignonPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WISingleSignonPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+
+ String tokenList = wizardInfo.getTokensList();
+ StringTokenizer st1 = new StringTokenizer(tokenList, ":");
+
+ mTokenBox.removeAllItems();
+ while (st1.hasMoreElements()) {
+ String t1 = (String)st1.nextElement();
+ mTokenBox.addItem(t1);
+ }
+
+ mDBPasswd = wizardInfo.getInternalDBPasswd();
+
+ String tokenname = "";
+ String password = "";
+ if (wizardInfo.isCAInstalled()) {
+ tokenname = wizardInfo.getCATokenName();
+ password = (String)wizardInfo.get("TOKEN:"+tokenname);
+ if (password == null || password.equals("")) {
+ capassword = "";
+ } else {
+ capassword = password;
+ }
+ ca = true;
+ } else {
+ capassword = "";
+ ca = false;
+ }
+
+ if (wizardInfo.isRAInstalled()) {
+ tokenname = wizardInfo.getRATokenName();
+ password = (String)wizardInfo.get("TOKEN:"+tokenname);
+ if (password == null || password.equals("")) {
+ rapassword = "";
+ } else {
+ rapassword = password;
+ }
+ ra = true;
+ } else {
+ rapassword = "";
+ ra = false;
+ }
+
+ if (wizardInfo.isKRAInstalled()) {
+ tokenname = wizardInfo.getKRATokenName();
+ password = (String)wizardInfo.get("TOKEN:"+tokenname);
+ if (password == null || password.equals("")) {
+ krapassword = "";
+ } else {
+ krapassword = password;
+ }
+ kra = true;
+ } else {
+ krapassword = "";
+ kra = false;
+ }
+
+ tokenname = wizardInfo.getSSLTokenName();
+ password = (String)wizardInfo.get("TOKEN:"+tokenname);
+ if (password == null || password.equals("")) {
+ sslpassword = "";
+ } else {
+ sslpassword = password;
+ }
+ setBorder(makeTitledBorder(PANELNAME));
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+
+ /**
+ * Copy from CGITask.java
+ */
+ public boolean run(String cmd) {
+ // get the admin URL location first
+ String mAdminURL = _consoleInfo.getAdminURL();
+ if ( mAdminURL == null ) {
+ return false;
+ }
+
+ // Allow specifying e.g. "slapd-install" for instance
+ String instance = (String)_consoleInfo.get( cmd );
+ if (instance == null)
+ instance = (String)_consoleInfo.get( "ServerInstance" );
+ String fullCmd = mAdminURL + instance + "/" + cmd;
+
+ HttpManager h = new HttpManager();
+ // tell the http manager to use UTF8 encoding
+ h.setSendUTF8(true);
+
+ try {
+ mSuccess = false;
+ mFinished = false;
+
+ // _consoleInfo.get("arguments") is a hashtable of key/value pairs
+ // to use as the arguments to the CGI
+ Hashtable args = (Hashtable)_consoleInfo.get("arguments");
+ ByteArrayInputStream data = null;
+ if (args != null && !args.isEmpty())
+ data = com.netscape.admin.certsrv.task.CGITask.encode(args);
+ Debug.println( "Posting " + fullCmd );
+ // tell the http manager to notify us immediately of replies
+ // if we're using async mode
+ int flags = 0;
+ if (data == null)
+ h.post(new URL(fullCmd), this, null, null, 0, flags);
+ else
+ h.post(new URL(fullCmd), this, null, data, data.available(),
+ flags);
+ awaitSuccess();
+ Debug.println( "Command executed: " + fullCmd );
+ } catch (Exception e) {
+ if (e instanceof java.net.ConnectException) {
+ CMSAdminUtil.showMessageDialog(mResource,
+ PREFIX, "SERVERDOWN", CMSAdminUtil.ERROR_MESSAGE);
+ }
+ Debug.println( "Command " + fullCmd + " failed: " + e );
+ }
+ return mSuccess;
+ }
+
+ /**
+ * waiting for the http transaction to be finished.
+ */
+ public synchronized void awaitSuccess() {
+ while (!mFinished) {
+ try {
+ wait();
+ } catch (Exception e) { }
+ }
+ }
+
+ /**
+ * http transaction finished, notify the process
+ */
+ public synchronized void finish() {
+ mFinished = true;
+ notifyAll();
+ }
+
+ /**
+ * the operation is finished after we receive the http stream
+ */
+ public void replyHandler(InputStream response, CommRecord cr) {
+ try {
+ int nBytes = response.available();
+ if ( nBytes > 0 ) {
+ // the response from the DS CGIs will typically be in
+ // UTF8 encoding
+ byte[] data = new byte[nBytes];
+ nBytes = response.read( data );
+ mReply = new String( data, 0, nBytes, "UTF8" );
+ Debug.println( "CGITask.replyHandler: Response (" + nBytes +
+ " bytes) = " + mReply );
+ int index = 0;
+ if ((mReply.indexOf("NMC_") != -1) &&
+ ((index = mReply.indexOf(":")) != -1)) {
+ String sName = mReply.substring(0, index).trim();
+ String sValue = mReply.substring(index+1).trim();
+ if (sName.equalsIgnoreCase("NMC_Status")) {
+ int code = Integer.parseInt(sValue);
+ mSuccess = (code == 0);
+ } else if (sName.equalsIgnoreCase("NMC_ERRINFO")) {
+ mErrorMsg = sValue; }
+ }
+ }
+ } catch ( Exception e ) {
+ Debug.println( "CGITask.replyHandler: " + e.toString() );
+ }
+ finish();
+ }
+
+ /**
+ * this function will be called if error occurs
+ */
+ public void errorHandler(Exception error, CommRecord cr) {
+ Debug.println("CGITask.errorHandler: " + error );
+
+ // this is a hack. now we dont know how to set the timeout period longer.
+ // We always assume everything is fine so that we can proceed to the next
+ // config-cert panel.
+ mSuccess = true;
+ finish();
+ }
+
+ /**
+ * pass the username to the admin server
+ */
+ public String username(Object authObject, CommRecord cr) {
+ Debug.println( "username = " +
+ (String)_consoleInfo.getAuthenticationDN());
+ return _consoleInfo.getAuthenticationDN();
+ }
+
+ /**
+ * pass the user password to the admin server
+ */
+ public String password(Object authObject, CommRecord cr) {
+ Debug.println( "password = " +
+ (String)_consoleInfo.get( "AdminUserPassword" ) );
+ return (String)_consoleInfo.get( "AdminUserPassword" );
+ }
+ /**
+ * Starts CMS server.
+ */
+ public boolean startServer(InstallWizardInfo info) {
+ _consoleInfo = info.getAdminConsoleInfo();
+
+ Hashtable configParams = new Hashtable();
+ configParams.put("serverRoot",_consoleInfo.get("serverRoot"));
+ String servid = (String)_consoleInfo.get("servid");
+ int index = servid.indexOf("-");
+ if (index != -1) {
+ servid = servid.substring(index+1);
+ }
+ configParams.put("instanceID", servid);
+ // configParams.put("password", info.getSingleSignOnPassword());
+ _consoleInfo.put( "ServerInstance", "cert-" + servid);
+ _consoleInfo.put("arguments", configParams);
+ // Debug.println("password "+dialog.getPassword());
+
+ if (_consoleInfo.get("AdminUsername") == null) {
+ _consoleInfo.put("AdminUsername", _consoleInfo.getAuthenticationDN()
+);
+ }
+ Debug.println("AdminUsername = " + _consoleInfo.get("AdminUsername"));
+
+ if (_consoleInfo.get("AdminUserPassword") == null) {
+ _consoleInfo.put("AdminUserPassword", _consoleInfo.getAuthenticationPassword());
+ }
+ Debug.println("AdminUserPassword = " + _consoleInfo.get("AdminUserPassword"));
+ // call the CGI program
+ Debug.println("CMSStart: start() before run task="+START_TASK_CGI);
+ boolean status;
+ try {
+ status = run(START_TASK_CGI);
+ } catch (Exception e) {
+ Debug.println("Unexpected Error"+e.toString());
+ status = false;
+ }
+ Debug.println("CMSStart: start() after run status="+status);
+
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ // Comment out the single signon codes for now.
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_SINGLE_SIGNON;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY;
+ String tags = PW_TAG_INTERNAL_LDAP_DB;
+ rawData = rawData+"&"+PW_TAG_INTERNAL_LDAP_DB+"="+mDBPasswd;
+ rawData = rawData+"&pwcTokenname="+(String)(mTokenBox.getSelectedItem());
+
+ String tokenname = "";
+ if (!capassword.equals("")) {
+ tokenname = wizardInfo.getCATokenName();
+ rawData = rawData+"&"+tokenname+"="+capassword;
+ tags = tags+":"+tokenname;
+ }
+
+ if (!rapassword.equals("")) {
+ tokenname = wizardInfo.getRATokenName();
+ rawData = rawData+"&"+tokenname+"="+rapassword;
+ tags = tags+":"+tokenname;
+ }
+
+ if (!krapassword.equals("")) {
+ tokenname = wizardInfo.getKRATokenName();
+ rawData = rawData+"&"+tokenname+"="+krapassword;
+ tags = tags+":"+tokenname;
+ }
+
+ if (!sslpassword.equals("")) {
+ tokenname = wizardInfo.getSSLTokenName();
+ rawData = rawData+"&"+tokenname+"="+sslpassword;
+ tags = tags+":"+tokenname;
+ }
+
+ if (mPasswordConf.isSelected()) {
+ rawData = rawData+"&"+ConfigConstants.PR_DELETE_PASSWD_CONF+"="+
+ ConfigConstants.TRUE;
+ } else {
+ rawData = rawData+"&"+ConfigConstants.PR_DELETE_PASSWD_CONF+"="+
+ ConfigConstants.FALSE;
+ }
+ rawData = rawData+"&"+ConfigConstants.PR_SINGLE_SIGNON_PW_TAGS+"="+tags;
+ //data.put(ConfigConstants.PR_SINGLE_SIGNON, ConfigConstants.FALSE);
+
+ startProgressStatus();
+ //CMSMessageBox dlg = new CMSMessageBox(mAdminFrame, "CGITASK", "CREATESSON");
+
+ // boolean ready = send(rawData, wizardInfo);
+
+ boolean ready = true;
+ if (ready) {
+ rawData = ConfigConstants.TASKID+"="+TaskId.TASK_MISCELLANEOUS;
+/*
+ data.put(ConfigConstants.PR_ADMIN_PASSWD,
+ (String)consoleInfo.get(ConfigConstants.PR_ADMIN_PASSWD));
+*/
+ ready = send(rawData, wizardInfo);
+ } else {
+ String str = getErrorMessage();
+ if (str.equals("")) {
+ String errorMsg = mResource.getString(
+ PANELNAME+"_ERRORMSG");
+ setErrorMessage(errorMsg);
+ } else
+ setErrorMessage(str);
+ //dlg.setVisible(false);
+
+ endProgressStatus();
+ return false;
+ }
+
+ //startServer(wizardInfo);
+
+ //dlg.setVisible(false);
+
+ endProgressStatus();
+
+ if (!ready) {
+ String str = getErrorMessage(wizardInfo);
+ if (str.equals("")) {
+ String errorMsg = mResource.getString(
+ PANELNAME+"_ERRORMSG");
+ setErrorMessage(errorMsg);
+ } else
+ setErrorMessage(str);
+ }
+
+ return ready;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ JTextArea desc = createTextArea(mResource.getString(
+ PANELNAME+"_TEXT_HEADING_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+
+/*
+ JPanel panel1 = new JPanel();
+ GridBagLayout gb1 = new GridBagLayout();
+ panel1.setLayout(gb1);
+ //panel1.setBorder(new EtchedBorder());
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ add(panel1, gbc);
+*/
+
+ JTextArea heading = createTextArea(mResource.getString(
+ PANELNAME+"_TEXT_HEADING1_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ //gbc.fill = gbc.NONE;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(2*COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, 0);
+ add(heading, gbc);
+
+ JLabel tokenLbl = makeJLabel("TOKEN");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ //gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE, 0, COMPONENT_SPACE);
+ add(tokenLbl, gbc);
+
+ mTokenBox = new JComboBox();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ //gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0, 0);
+ add(mTokenBox, gbc);
+
+ JLabel dum = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.fill = gbc.BOTH;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0, 0);
+ add(dum, gbc);
+
+ JTextArea passwordConfText = createTextArea(mResource.getString(
+ PANELNAME+"_TEXT_PASSWDCONF_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(4*COMPONENT_SPACE,COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(passwordConfText, gbc);
+
+ mPasswordConf = makeJCheckBox("PASSWDCONF");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,2*COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mPasswordConf, gbc);
+
+ JLabel dummy = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.fill = gbc.BOTH;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ add(dummy, gbc);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WITokenLogonPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WITokenLogonPage.java
new file mode 100644
index 000000000..b3ecdbf5a
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WITokenLogonPage.java
@@ -0,0 +1,255 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.text.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+
+/**
+ * This panel asks for the information of the current internal database.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WITokenLogonPage extends WizardBasePanel implements IWizardPanel {
+ protected JTextField mTokenText;
+ protected JLabel mPasswordAgainLabel;
+ protected JPasswordField mPasswordText, mPasswordAgainText;
+ private static final String EMPTYSTR = " ";
+ protected String mHelpIndex;
+ protected String mPanelName;
+ protected JTextArea mDesc;
+ protected Color mActiveColor;
+ protected String mTokenName;
+
+ WITokenLogonPage(String panelName) {
+ super(panelName);
+ mPanelName = panelName;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ setBorder(makeTitledBorder(mPanelName));
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+
+ String tokenList = wizardInfo.getTokensList();
+ String tokenLoggedIn = wizardInfo.getTokensLogin();
+ String tokenInits = wizardInfo.getTokensInit();
+ StringTokenizer tokenizer = new StringTokenizer(tokenList, ":");
+ StringTokenizer tokenizerLoggedIn = new StringTokenizer(tokenLoggedIn, ":");
+ StringTokenizer tokenizerInits = new StringTokenizer(tokenInits, ":");
+ int index = 0;
+ String loggedIn = "";
+ String inits = "";
+ while (tokenizer.hasMoreElements()) {
+ String token = (String)tokenizer.nextElement();
+ loggedIn = (String)tokenizerLoggedIn.nextElement();
+ inits = (String)tokenizerInits.nextElement();
+ if (token.equalsIgnoreCase(mTokenName)) {
+ break;
+ }
+ index++;
+ }
+
+ if (inits.equals(Constants.FALSE)) {
+ mDesc.setText(mResource.getString(mPanelName+"_TEXT_INIT_LABEL"));
+ enableFields(mPasswordAgainLabel, mPasswordAgainText, true, mActiveColor);
+ } else {
+ mDesc.setText(mResource.getString(mPanelName+"_TEXT_HEADING_LABEL"));
+ enableFields(mPasswordAgainLabel, mPasswordAgainText, false, getBackground());
+ }
+
+ mTokenText.setEnabled(false);
+ mTokenText.setEditable(false);
+ mTokenText.setBackground(getBackground());
+ CMSAdminUtil.repaintComp(mTokenText);
+
+ return true;
+ }
+
+ public boolean validatePanel() {
+ String passwd = mPasswordText.getText();
+ if (passwd.equals("")) {
+ setErrorMessage("BLANKPASSWD");
+ return false;
+ }
+ if (mPasswordAgainText.isEnabled()) {
+ String passwdAgain = mPasswordAgainText.getText();
+ if (!passwd.equals(passwdAgain)) {
+ setErrorMessage("NOTSAMEPASSWD");
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)info;
+ cleanUpWizardInfo(wizardInfo);
+
+ String tokenname = mTokenText.getText().trim();
+ String pwd = mPasswordText.getText().trim();
+ wizardInfo.put("TOKEN:"+tokenname, pwd);
+
+ String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_INIT_TOKEN;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY;
+ rawData = rawData+"&"+ConfigConstants.PR_TOKEN_NAME+"="+tokenname;
+ rawData = rawData+"&"+ConfigConstants.PR_TOKEN_PASSWD+"="+pwd;
+ rawData = rawData+"&"+ConfigConstants.PR_CMS_SEED+"="+
+ (new Long(WizardBasePanel.mSeed).toString());
+
+ startProgressStatus();
+ boolean ready = send(rawData, wizardInfo);
+
+ if (!ready) {
+ String str = getErrorMessage(wizardInfo);
+ if (str == null) {
+ String errorMsg = mResource.getString(
+ mPanelName+"_ERRORMSG");
+ setErrorMessage(errorMsg);
+ } else
+ setErrorMessage(str);
+ } else {
+ rawData = ConfigConstants.TASKID+"="+TaskId.TASK_TOKEN_INFO;
+ rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_READ;
+ ready = send(rawData, wizardInfo);
+ }
+
+ if (!ready) {
+ String str = getErrorMessage(wizardInfo);
+ if (str.equals(""))
+ setErrorMessage("Server Error");
+ else
+ setErrorMessage(str);
+ }
+
+ endProgressStatus();
+
+ return ready;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(mHelpIndex);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mDesc = createTextArea("");
+/*
+ mDesc = createTextArea(mResource.getString(
+ mPanelName+"_TEXT_HEADING_LABEL"));
+*/
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mDesc, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel tokenLabel = makeJLabel("TOKEN");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, 0, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(tokenLabel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mTokenText = makeJTextField(30);
+ gbc.anchor = gbc.NORTHWEST;
+ //gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mTokenText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel passwordLabel = makeJLabel("PWD");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, 0, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(passwordLabel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mPasswordText = makeJPasswordField(30);
+ gbc.anchor = gbc.NORTHWEST;
+ // gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mPasswordText, gbc);
+ mActiveColor = mPasswordText.getBackground();
+
+ CMSAdminUtil.resetGBC(gbc);
+ mPasswordAgainLabel = makeJLabel("PWDAGAIN");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mPasswordAgainLabel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mPasswordAgainText = makeJPasswordField(30);
+ gbc.anchor = gbc.NORTHWEST;
+ // gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mPasswordAgainText, gbc);
+
+ JLabel dummy = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ add(dummy, gbc);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+
+ protected void enableFields(JComponent comp1, JTextComponent comp2, boolean enable, Color color) {
+ comp1.setEnabled(enable);
+ comp2.setEnabled(enable);
+ comp2.setEditable(enable);
+ comp2.setBackground(color);
+ CMSAdminUtil.repaintComp(comp1);
+ CMSAdminUtil.repaintComp(comp2);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WITrustDBPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WITrustDBPage.java
new file mode 100644
index 000000000..cd19963ff
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/config/install/WITrustDBPage.java
@@ -0,0 +1,138 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config.install;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Trust database page for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WITrustDBPage extends WizardBasePanel implements IWizardPanel {
+ private JPasswordField mPassword;
+ private JPasswordField mPasswordAgain;
+ private static final String PANELNAME = "TRUSTDBWIZARD";
+ private static final String HELPINDEX =
+ "configuration-kra-wizard-change-keyscheme-help";
+
+ WITrustDBPage() {
+ super(PANELNAME);
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ JTextArea desc = createTextArea(
+ CMSAdminUtil.wrapText(mResource.getString(
+ "TRUSTDBWIZARD_TEXT_DESC_LABEL"), 80), 2, 80);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+
+ JLabel passwdLbl = makeJLabel("PASSWD");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(passwdLbl, gbc);
+
+ mPassword = makeJPasswordField(20);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(mPassword, gbc);
+
+ JTextArea dummy = createTextArea(" ", 1, 15);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(dummy, gbc);
+
+ JLabel passwdAgainLbl = makeJLabel("PASSWDAGAIN");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0,COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ gbc.weighty = 1.0;
+ add(passwdAgainLbl, gbc);
+
+ mPasswordAgain = makeJPasswordField(20);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ gbc.weighty = 1.0;
+ add(mPasswordAgain, gbc);
+
+ JTextArea dummy1 = createTextArea(" ", 1, 15);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.insets = new Insets(0, COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(dummy1, gbc);
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/connection/AdminConnection.java b/base/console/src/com/netscape/admin/certsrv/connection/AdminConnection.java
new file mode 100644
index 000000000..acb023132
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/connection/AdminConnection.java
@@ -0,0 +1,818 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.connection;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.management.client.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.preferences.*;
+
+/**
+ * This class represents an administration connection shell
+ * to the certificate server. The user need to specify the
+ * connection factory
+ *
+ * @author thomask
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.certsrv.client.connection
+ * @see com.netscape.certsrv.client
+ */
+public class AdminConnection {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ public static int NO_TIMEOUT = 0;
+ public static int DEFAULT_TIMEOUT = 600000; //600 sec
+
+ private IConnectionFactory mFactory= null;
+ private IConnection mConn = null;
+ private IAuthenticator mAuth = null;
+ private int mDefaultTimeout = DEFAULT_TIMEOUT;
+ private int mCurrentTimeout = DEFAULT_TIMEOUT;
+ private boolean mIsKeepAlive = false;
+ private String mHost;
+ private int mPort;
+ private IConnectionListener mConnectionListener;
+ private String mAuthType="";
+ private String mPath=null;
+ private static FilePreferenceManager mPM = null;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+
+ /**
+ * Default Constructor<p>
+ * Construct an administartion connection with keep alive disabled
+ *
+ * @param auth authentication mechanism object
+ * @param factory factory used to create server connection
+ * @param host server host name
+ * @param port server port number
+ *
+ * @see com.netscape.certsrv.client.connection.IConnection
+ * @see com.netscape.certsrv.client.connection.IConnectionFactory
+ * @see com.netscape.certsrv.client.connection.IAuthenticator
+ */
+ public AdminConnection( IAuthenticator auth,
+ IConnectionFactory factory,
+ String host, int port, String path) {
+ if (mPM == null) {
+ mPM = new FilePreferenceManager(Framework.IDENTIFIER,
+ Framework.VERSION);
+ }
+ Preferences p = mPM.getPreferences(
+ Framework.PREFERENCES_GENERAL);
+ int timeout = p.getInt("CMSConnTimeout", 600000);
+ setDefaultTimeout(timeout);
+ setCurrentTimeout(timeout);
+ Debug.println("AdminConnection: " + timeout + " " +
+ mPM.getClass().getName());
+
+ mAuth = auth;
+ mFactory = factory;
+ mHost = host;
+ mPort = port;
+ mPath = path;
+ }
+
+ /**
+ * Default Constructor<p>
+ * Construct an administartion connection
+ *
+ * @param auth authentication mechanism object
+ * @param factory factory used to create server connection
+ * @param enableKeepAlive enable HTTP keep alive or not
+ * @param host server host name
+ * @param port server port number
+ *
+ * @see com.netscape.certsrv.client.connection.IConnection
+ * @see com.netscape.certsrv.client.connection.IConnectionFactory
+ * @see com.netscape.certsrv.client.connection.IAuthenticator
+ */
+ public AdminConnection( IAuthenticator auth,
+ IConnectionFactory factory,
+ boolean enableKeepAlive,
+ String host, int port, String path) {
+ if (mPM == null) {
+ mPM = new FilePreferenceManager(Framework.IDENTIFIER,
+ Framework.VERSION);
+ }
+ Preferences p = mPM.getPreferences(
+ Framework.PREFERENCES_GENERAL);
+ int timeout = p.getInt("CMSConnTimeout", 600000);
+ setDefaultTimeout(timeout);
+ setCurrentTimeout(timeout);
+ Debug.println("AdminConnection: " + timeout + " " +
+ mPM.getClass().getName());
+
+ mAuth = auth;
+ mFactory = factory;
+ mIsKeepAlive = enableKeepAlive;
+ mHost = host;
+ mPort = port;
+ mPath = path;
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+
+ private String b64encode (byte[] data) {
+ int i, k, n;
+ int len = data.length;
+ byte b;
+ StringBuffer b64 = new StringBuffer();
+ String base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+ for (i = 0; i < len; i += 3) {
+ byte d0 = data[i];
+ byte d1 = (i+1<len)? data[i+1]: (byte)0;
+ byte d2 = (i+2<len)? data[i+2]: (byte)0;
+ b = (byte)((d0 & (byte)0xFC) >>> 2);
+ b64.append(base64.charAt((int)b));
+ b = (byte)(((d0 & 0x03) << 4) | ((d1 & 0xF0) >>> 4));
+ b64.append(base64.charAt((int)b));
+ b = (byte)(((d1 & 0x0F) << 2) | ((d2 & 0xC0) >>> 6));
+ if (i+1 < len) {
+ b64.append(base64.charAt((int)b));
+ } else {
+ b64.append('=');
+ }
+ b = (byte)(d2 & 0x3F);
+ if (i+2 < len) {
+ b64.append(base64.charAt((int)b));
+ } else {
+ b64.append('=');
+ }
+ }
+
+ b64.append('\n');
+
+ return b64.toString();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * Set the listener.
+ */
+ public void setConnectionListener(IConnectionListener l) {
+ mConnectionListener = l;
+ }
+
+ /**
+ * Returns the authentication object for this connection.<p>
+ * The choice of authentication object is dependding on the
+ * authentication method used on the server side.
+ *
+ * @return authentication object
+ * @see com.netscape.certsrv.client.connection.IAuthenticator
+ * @see com.netscape.certsrv.client.connection.BasicAuthenticator
+ */
+ public IAuthenticator getAuthenticator() {
+ return mAuth;
+ }
+
+ /**
+ * Returns the connection object used to establish the connection
+ * This can be SSLavaConnection or SSLConnection. THIS OBJECT REFERENCE
+ * IS NOT STABLE, SINCE IT IS RECREATED EACH TIME IF KEEPALIVE IS NOT
+ * ENABLE.
+ *
+ * @return connection object
+ */
+ public IConnection getIConnection() {
+ return mConn;
+ }
+
+ /**
+ * Sets the one time current timeout value for specific operation
+ * if less then default timeout the default timeout is used.
+ *
+ * @param timeout time in ms
+ */
+ public void setCurrentTimeout(int timeout) {
+ mCurrentTimeout = timeout;
+ }
+
+
+ /**
+ * Sets the default timeout value
+ * @param timeout time in ms
+ */
+ public void setDefaultTimeout(int timeout) {
+ mDefaultTimeout = timeout;
+ }
+
+ /**
+ * OPERATION: ADD<p>
+ *
+ * <pre>
+ * FORMAT:
+ *
+ * GET/[OP_DEST]?
+ * OP_TYPE=[OP_TYPE]&
+ * OP_SCOPE=[OP_SCOPE]&
+ * RS_ID=[RS_ID]&
+ * [NAME=VALUE][&[NAME=VALUE]]
+ *
+ * </pre>
+ *
+ * Add new entries into the scope using the NVP information provided.
+ * This operation will ONLY be used by DYNAMIC content and
+ * configuartion, such as Users and Groups, and Policies.
+ *
+ * @param dest OP_DEST
+ * @param scope OP_SCOPE
+ * @param id RS_ID
+ * @param pairs NVP info
+ *
+ * @see http://warp/server/certificate/columbo/design/ui/admin-protocol-definition.html
+ *
+ */
+ public void add(String dest, String scope, String id, NameValuePairs pairs)
+ throws EAdminException {
+
+ checkParams(dest,scope,id,pairs);
+ Request request = new Request(mPath + "/" + dest);
+ request.set(Constants.OP_TYPE, OpDef.OP_ADD);
+ request.set(Constants.OP_SCOPE, scope);
+ request.set(Constants.RS_ID, id);
+ for (String name : pairs.keySet()) {
+ String value = pairs.get(name);
+ request.set(name, value);
+ }
+ Response response = sendRequest(request);
+ if (response.getReturnCode() == Response.SUCCESS) {
+ return;
+ }
+ throw new EAdminException(response.getErrorMessage(), true);
+ }
+
+ /**
+ * OPERATION: DELETE<p>
+ *
+ * <pre>
+ * FORMAT:
+ *
+ * GET/[OP_DEST]?
+ * OP_TYPE=[OP_TYPE]&
+ * OP_SCOPE=[OP_SCOPE]&
+ * RS_ID=[RS_ID]&
+ *
+ * </pre>
+ *
+ * Removing an entry with specified id from the scope specified.
+ *
+ * @param dest OP_DEST
+ * @param scope OP_SCOPE
+ * @param id RS_ID
+ *
+ * @see http://warp/server/certificate/columbo/design/ui/admin-protocol-definition.html
+ *
+ */
+ public void delete(String dest, String scope, String id)
+ throws EAdminException {
+
+ checkParams(dest,scope,id);
+ Request request = new Request(mPath + "/" + dest);
+ request.set(Constants.OP_TYPE, OpDef.OP_DELETE);
+ request.set(Constants.OP_SCOPE, scope);
+ request.set(Constants.RS_ID, id);
+ Response response = sendRequest(request);
+ if (response.getReturnCode() == Response.SUCCESS) {
+ return;
+ }
+ throw new EAdminException(response.getErrorMessage(), true);
+ }
+
+ public void delete(String dest, String scope, String id, NameValuePairs pairs)
+ throws EAdminException {
+
+ checkParams(dest,scope,id,pairs);
+ Request request = new Request(mPath + "/" + dest);
+ request.set(Constants.OP_TYPE, OpDef.OP_DELETE);
+ request.set(Constants.OP_SCOPE, scope);
+ request.set(Constants.RS_ID, id);
+ for (String name : pairs.keySet()) {
+ String value = pairs.get(name);
+ request.set(name, value);
+ }
+ Response response = sendRequest(request);
+ if (response.getReturnCode() == Response.SUCCESS) {
+ return;
+ }
+ throw new EAdminException(response.getErrorMessage(), true);
+ }
+
+ /**
+ * OPERATION: AUTH<p>
+ *
+ * <pre>
+ * FORMAT:
+ *
+ * GET/[OP_DEST]?
+ * OP_TYPE=[OP_TYPE]&
+ * OP_SCOPE=[OP_SCOPE]&
+ * [NAME=VALUE][&[NAME=VALUE]]
+ *
+ * </pre>
+ *
+ * getting properties (name-value pairs) using some criteria
+ * specified in NVP.
+ *
+ * @param dest OP_DEST
+ * @param scope OP_SCOPE
+ * @param pairs NVP search filter
+ *
+ * @see http://warp/server/certificate/columbo/design/ui/admin-protocol-definition.html
+ *
+ */
+ public void auth(String dest, String scope) throws EAdminException {
+ Request request = new Request(mPath + "/" + dest);
+ request.set(Constants.OP_TYPE, OpDef.OP_AUTH);
+ request.set(Constants.OP_SCOPE, scope);
+ Response response = sendRequest(request);
+ if (response.getReturnCode() == Response.SUCCESS) {
+ return;
+ }
+ throw new EAdminException(response.getErrorMessage(), true);
+ }
+
+ public String authType(String dest, String scope) throws EAdminException {
+ Request request = new Request(mPath + "/" + dest);
+ request.set(Constants.OP_TYPE, OpDef.OP_AUTH);
+ request.set(Constants.OP_SCOPE, scope);
+
+ Response response = sendRequest(request);
+ if (response.getReturnCode() == Response.SUCCESS) {
+ Enumeration e = response.getNames();
+ while (e.hasMoreElements()) {
+ String n = (String)e.nextElement();
+ if (n.equals("authType"))
+ mAuthType = response.get(n);
+ return mAuthType;
+ }
+ return "";
+ }
+ throw new EAdminException(response.getErrorMessage(), true);
+ }
+
+ /**
+ * OPERATION: SEARCH<p>
+ *
+ * <pre>
+ * FORMAT:
+ *
+ * GET/[OP_DEST]?
+ * OP_TYPE=[OP_TYPE]&
+ * OP_SCOPE=[OP_SCOPE]&
+ * [NAME=VALUE][&[NAME=VALUE]]
+ *
+ * </pre>
+ *
+ * getting properties (name-value pairs) using some criteria
+ * specified in NVP.
+ *
+ * @param dest OP_DEST
+ * @param scope OP_SCOPE
+ * @param pairs NVP search filter
+ *
+ * @see http://warp/server/certificate/columbo/design/ui/admin-protocol-definition.html
+ *
+ */
+ public NameValuePairs search(String dest, String scope, NameValuePairs filters)
+ throws EAdminException {
+
+ checkParams(dest,scope,"",filters);
+ Request request = new Request(mPath + "/" + dest);
+ request.set(Constants.OP_TYPE, OpDef.OP_SEARCH);
+ request.set(Constants.OP_SCOPE, scope);
+ for (String name : filters.keySet()) {
+ String value = filters.get(name);
+ request.set(name, value);
+ }
+
+ Response response = sendRequest(request);
+
+ if (response.getReturnCode() == Response.SUCCESS) {
+ NameValuePairs newpairs = new NameValuePairs();
+ Enumeration e = response.getNames();
+ while (e.hasMoreElements()) {
+ String n = (String)e.nextElement();
+ newpairs.put(n, response.get(n));
+ }
+ return newpairs;
+ }
+ throw new EAdminException(response.getErrorMessage(), true);
+ }
+
+ /**
+ * OPERATION: READ<p>
+ *
+ * <pre>
+ * FORMAT:
+ *
+ * GET/[OP_DEST]?
+ * OP_TYPE=[OP_TYPE]&
+ * OP_SCOPE=[OP_SCOPE]&
+ * RS_ID=[RS_ID]&
+ * [NAME=VALUE][&[NAME=VALUE]]
+ *
+ * </pre>
+ *
+ * getting specific properties (name-value pairs) using
+ * attributes specified in NVP.
+ *
+ * @param dest OP_DEST
+ * @param scope OP_SCOPE
+ * @param id RS_ID
+ * @param pairs NVP info
+ *
+ * @see http://warp/server/certificate/columbo/design/ui/admin-protocol-definition.html
+ *
+ */
+ public NameValuePairs read(String dest, String scope, String id, NameValuePairs pairs)
+ throws EAdminException {
+
+ checkParams(dest,scope,id);
+ Request request = new Request(mPath + "/" + dest);
+ request.set(Constants.OP_TYPE, OpDef.OP_READ);
+ request.set(Constants.OP_SCOPE, scope);
+ request.set(Constants.RS_ID, id);
+ for (String name : pairs.keySet()) {
+ String value = pairs.get(name);
+ request.set(name, value);
+ }
+
+ Response response = sendRequest(request);
+
+ if (response.getReturnCode() == Response.SUCCESS) {
+ NameValuePairs newpairs = new NameValuePairs();
+ Enumeration e = response.getNames();
+ while (e.hasMoreElements()) {
+ String n = (String)e.nextElement();
+ newpairs.put(n, response.get(n));
+ }
+ return newpairs;
+ }
+ throw new EAdminException(response.getErrorMessage(), true);
+ }
+
+ public NameValuePairs process(String dest, String scope, String id,
+ NameValuePairs pairs) throws EAdminException {
+ return process(dest, scope, id, pairs, false);
+ }
+
+ public NameValuePairs process(String dest, String scope, String id,
+ NameValuePairs pairs, boolean useGET) throws EAdminException {
+ Request request = new Request(mPath + "/" + dest);
+ request.set(Constants.OP_TYPE, OpDef.OP_PROCESS);
+ request.set(Constants.OP_SCOPE, scope);
+ request.set(Constants.RS_ID, id);
+
+ for (String name : pairs.keySet()) {
+ String value = pairs.get(name);
+ request.set(name, value);
+ }
+
+ Response response = sendRequest(request, useGET);
+ if (response.getReturnCode() == Response.SUCCESS) {
+ NameValuePairs newpairs = new NameValuePairs();
+ Enumeration e = response.getNames();
+ while (e.hasMoreElements()) {
+ String n = (String)e.nextElement();
+ newpairs.put(n, response.get(n));
+ }
+ return newpairs;
+ }
+ throw new EAdminException(response.getErrorMessage(), true);
+ }
+
+ public void validate(String dest, String scope, NameValuePairs pairs)
+ throws EAdminException {
+ Request request = new Request(mPath + "/" + dest);
+ request.set(Constants.OP_TYPE, OpDef.OP_VALIDATE);
+ request.set(Constants.OP_SCOPE, scope);
+ for (String name : pairs.keySet()) {
+ String value = pairs.get(name);
+ request.set(name, value);
+ }
+
+ Response response = sendRequest(request);
+ if (response.getReturnCode() == Response.SUCCESS) {
+ return;
+ }
+ throw new EAdminException(response.getErrorMessage(), true);
+ }
+
+ /**
+ * OPERATION: MODIFY<p>
+ *
+ * <pre>
+ * FORMAT:
+ *
+ * GET/[OP_DEST]?
+ * OP_TYPE=[OP_TYPE]&
+ * OP_SCOPE=[OP_SCOPE]&
+ * RS_ID=[RS_ID]&
+ * [NAME=VALUE][&[NAME=VALUE]]
+ *
+ * </pre>
+ *
+ * Modify an existing entry's attributes.
+ *
+ * @param dest OP_DEST
+ * @param scope OP_SCOPE
+ * @param id RS_ID
+ * @param pairs NVP info
+ *
+ * @see http://warp/server/certificate/columbo/design/ui/admin-protocol-definition.html
+ *
+ */
+ public void modify(String dest, String scope, String id, NameValuePairs pairs)
+ throws EAdminException {
+ modify(dest, scope, id, pairs, false);
+ }
+
+ public void modify(String dest, String scope, String id, NameValuePairs pairs, boolean useGET)
+ throws EAdminException {
+
+ checkParams(dest,scope,id,pairs);
+ Request request = new Request(mPath + "/" + dest);
+ request.set(Constants.OP_TYPE, OpDef.OP_MODIFY);
+ request.set(Constants.OP_SCOPE, scope);
+ request.set(Constants.RS_ID, id);
+ for (String name : pairs.keySet()) {
+ String value = pairs.get(name);
+ request.set(name, value);
+ }
+ Response response = sendRequest(request, useGET);
+ if (response.getReturnCode() == Response.SUCCESS) {
+ return;
+ } else if (response.getReturnCode() == Response.RESTART) {
+ mConnectionListener.restartCallback();
+ return;
+ }
+ throw new EAdminException(response.getErrorMessage(), true);
+ }
+
+ private synchronized void retryConnection() throws EAdminException {
+ if (mConn instanceof JSSConnection) {
+ JSSConnection conn = (JSSConnection)mConn;
+ if (!conn.isTokenPasswordInit()) {
+ mConn = null;
+ if (!conn.isSamePwd()) {
+ throw new EAdminException(CMSAdminResources.SERVERCONNECTION_DIFFERENT_PWD, false);
+ }
+ throw new EAdminException(CMSAdminResources.SERVERCONNECTION_TOKEN_INIT_FAILED, false);
+ }
+
+ if (!conn.isServerCertImported()) {
+ mConn = null;
+ throw new EAdminException(CMSAdminResources.SERVERCONNECTION_SERVER_CERT_IMPORTED_FAILED, false);
+ }
+ if (!conn.isCertAccepted()) {
+ mConn = null;
+ throw new EAdminException(CMSAdminResources.SERVERCONNECTION_SERVER_CERT_DENIED, false);
+ }
+ if (conn != null && conn.isAbortAction() && conn.isClientAuth()) {
+ mConn = null;
+ throw new EAdminException(CMSAdminResources.SERVERCONNECTION_NO_CLIENT_CERT, false);
+ }
+ if (conn != null && !conn.hasClientCert()) {
+ mConn = null;
+ throw new EAdminException(CMSAdminResources.SERVERCONNECTION_NO_CLIENT_CERT, false);
+ }
+ }
+ try {
+ mConn = mFactory.create(mHost, mPort);
+ } catch (UnknownHostException e) {
+ mConn = null;
+ throw new EAdminException(CMSAdminResources.UNKNOWNHOST, false);
+ } catch (IOException e) {
+ mConn = null;
+ throw new EAdminException(CMSAdminResources.SERVER_UNREACHABLE, false);
+ } catch (Exception e) {
+ mConn = null;
+ if (Debug.isEnabled()) {
+ e.printStackTrace();
+ }
+ throw new EAdminException(CMSAdminResources.UNKNOWNEXCEPTION, false);
+ }
+ }
+
+ /**
+ * Deliver the request through the connection object
+ *
+ * @param request request object
+ * @return response object
+ * @see com.netscape.certsrv.client.connection.Response
+ */
+ private synchronized Response sendRequest(Request request)
+ throws EAdminException {
+ return sendRequest(request, false);
+ }
+
+ private synchronized Response sendRequest(Request request, boolean useGET)
+ throws EAdminException {
+
+ try {
+ if (mConn == null) {
+ mConn = mFactory.create(mHost, mPort);
+ }
+ } catch (UnknownHostException e) {
+ mConn = null;
+ throw new EAdminException(CMSAdminResources.UNKNOWNHOST, false);
+ } catch (IOException e) {
+ retryConnection();
+ throw new EAdminException(CMSAdminResources.SERVER_UNREACHABLE, false);
+ } catch (Exception e) {
+ retryConnection();
+ if (Debug.isEnabled()) {
+ e.printStackTrace();
+ }
+ throw new EAdminException(CMSAdminResources.UNKNOWNEXCEPTION, false);
+ }
+
+ try {
+ return processRequest(request, useGET);
+ //all errors will set the connection to null
+ //to force re-connection and avoid null ptr exception
+
+ } catch (Exception e) {
+ retryConnection();
+
+ try {
+ return processRequest(request, useGET);
+ } catch (InterruptedIOException ex) {
+
+ //timeout occurred
+ mConn = null;
+
+ //set time out back to original
+ mCurrentTimeout = mDefaultTimeout;
+ throw new EAdminException(CMSAdminResources.SERVER_NORESPONSE, false);
+ } catch (SocketException ex) {
+ mConn = null;
+ throw new EAdminException(CMSAdminResources.SERVER_UNREACHABLE, false);
+ } catch (IOException ex) {
+ if (Debug.isEnabled()) {
+ ex.printStackTrace();
+ }
+ mConn = null;
+ throw new EAdminException(CMSAdminResources.SERVER_UNREACHABLE, false);
+ } catch (EAdminException ex) {
+ throw ex;
+ } catch (Exception ex) {
+ mConn = null;
+ if (Debug.isEnabled()) {
+ ex.printStackTrace();
+ }
+ throw new EAdminException(CMSAdminResources.UNKNOWNEXCEPTION, false);
+ }
+ }
+ }
+
+ private Response processRequest(Request request, boolean useGET) throws Exception {
+ //packaging the request
+ StringBuffer sb = new StringBuffer();
+ if (useGET) {
+ sb.append("GET /" + request.getPrefix() + "?");
+ Enumeration names = request.getElements();
+ while (names.hasMoreElements()) {
+ String name = (String)names.nextElement();
+ sb.append(name);
+ sb.append("=");
+ if (request.get(name) != null) {
+ sb.append(java.net.URLEncoder.encode(request.get(name)));
+ }
+ if (names.hasMoreElements())
+ sb.append("&");
+ }
+ } else {
+ sb.append("POST /" + request.getPrefix());
+ }
+ sb.append(" HTTP/1.0\n");
+
+ StringBuffer sb1 = new StringBuffer();
+ if (!useGET) {
+ sb.append("Content-type: application/x-www-form-urlencoded\n");
+ Enumeration names = request.getElements();
+ while (names.hasMoreElements()) {
+ String name = (String)names.nextElement();
+ sb1.append(name);
+ sb1.append("=");
+ if (request.get(name) != null) {
+ sb1.append(java.net.URLEncoder.encode(request.get(name)));
+ }
+ if (names.hasMoreElements())
+ sb1.append("&");
+ }
+ sb.append("Content-length: " + sb1.toString().length() + "\n");
+ }
+
+ sb.append("Pragma: no-cache\n");
+ if (mIsKeepAlive) {
+ sb.append("Connection: Keep-Alive\n");
+ }
+
+ if (mAuthType.equals("") || mAuthType.equals("pwd")) {
+ BasicAuthenticator auth = (BasicAuthenticator)mAuth;
+ // sun.misc.BASE64Encoder encoder = new sun.misc.BASE64Encoder();
+ // sb.append("Authorization: Basic " +
+ // encoder.encodeBuffer((auth.getUserid() +
+ // ":" + auth.getPassword()).getBytes()) + "\n");
+ sb.append("Authorization: Basic " +
+ b64encode((auth.getUserid() +
+ ":" + auth.getPassword()).getBytes()) + "\n");
+ } else if (mAuthType.equals("sslclientauth")) {
+ sb.append("\n");
+ } else {
+ throw new EAdminException(CMSAdminResources.AUTHENNOTSUPPORTED, false);
+ }
+
+ if (!useGET) {
+ sb.append(sb1.toString());
+ }
+ //Debug.println(sb.toString());
+
+ //System.out.println("AdminConnection: sendRequest() - sending");
+ int timeout = mDefaultTimeout;
+ if (mCurrentTimeout > mDefaultTimeout)
+ timeout = mCurrentTimeout;
+ mConn.setSoTimeout(timeout);
+ mConn.sendRequest(sb.toString());
+
+ Response resp = new Response(mConn.getResponse());
+
+ if (!mIsKeepAlive) {
+ mConn.disconnect();
+ mConn = null;
+ }
+
+ //set time out back to original
+ mConn.setSoTimeout(mDefaultTimeout);
+ mCurrentTimeout = mDefaultTimeout;
+ return resp;
+ }
+
+ private void checkParams(String dest,String scope,String id)
+ {
+ NameValuePairs pairs = new NameValuePairs();
+
+ checkParams(dest,scope,id,pairs);
+ }
+
+ private void checkParams(String dest,String scope,String id, NameValuePairs pairs)
+ {
+ boolean bad=false;
+ if (dest == null) {
+ Debug.println("** WARNING **: 'dest' = null");
+ bad = true;
+ }
+ if (scope == null) {
+ Debug.println("** WARNING ** : 'scope' = null");
+ bad = true;
+ }
+ if (id == null) {
+ Debug.println("** WARNING ** : 'id' = null");
+ bad = true;
+ }
+ if (pairs == null) {
+ Debug.println("** WARNING ** : 'pairs' = null");
+ bad = true;
+ }
+ if (bad) {
+ Debug.println("dest = "+dest);
+ Debug.println("scope = "+scope);
+ Debug.println("id = "+id);
+ Debug.println("---------");
+ }
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/connection/BasicAuthenticator.java b/base/console/src/com/netscape/admin/certsrv/connection/BasicAuthenticator.java
new file mode 100644
index 000000000..1d3796968
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/connection/BasicAuthenticator.java
@@ -0,0 +1,54 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.connection;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ * An interface represents authentiator.
+ *
+ * @author thomask
+ * @version $Revision$, $Date$
+ */
+public class BasicAuthenticator implements IAuthenticator {
+
+ private String mUserid = null;
+ private String mPassword = null;
+
+ public BasicAuthenticator(String userid, String password) {
+ mUserid = userid;
+ mPassword = password;
+ }
+
+ public String getUserid() {
+ return mUserid;
+ }
+
+ public String getPassword() {
+ return mPassword;
+ }
+
+ public void setUserId(String userid) {
+ mUserid = userid;
+ }
+
+ public void setPassword(String password) {
+ mPassword = password;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/connection/IAuthenticator.java b/base/console/src/com/netscape/admin/certsrv/connection/IAuthenticator.java
new file mode 100644
index 000000000..c91b7d8bc
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/connection/IAuthenticator.java
@@ -0,0 +1,30 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.connection;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ * An interface represents authentiator.
+ *
+ * @author thomask
+ * @version $Revision$, $Date$
+ */
+public interface IAuthenticator {
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/connection/IConnection.java b/base/console/src/com/netscape/admin/certsrv/connection/IConnection.java
new file mode 100644
index 000000000..0643e50eb
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/connection/IConnection.java
@@ -0,0 +1,55 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.connection;
+
+import java.io.IOException;
+import java.net.SocketException;
+
+/**
+ * Interface for all connection objects. Primarily act as
+ * the abstartion layer for SSLavaConnection and SSLConnection.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.certsrv.client.connection.SSLavaConnection
+ * @see com.netscape.certsrv.client.connection.SSLConnection
+ */
+public interface IConnection {
+
+ /**
+ * Send request to the server using this connection
+ */
+ public int sendRequest(String req) throws IOException;
+
+ /**
+ * Returns the response in byte array format
+ */
+ public byte[] getResponse();
+
+ /**
+ * Close the connection
+ */
+ public void disconnect();
+
+ /**
+ * SetTimeout
+ */
+ public void setSoTimeout(int timeout) throws SocketException;
+
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/connection/IConnectionFactory.java b/base/console/src/com/netscape/admin/certsrv/connection/IConnectionFactory.java
new file mode 100644
index 000000000..4c8573f23
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/connection/IConnectionFactory.java
@@ -0,0 +1,40 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.connection;
+
+import java.net.*;
+import java.io.*;
+
+/**
+ * Interface for all connection factory. Primarily act as
+ * the abstartion layer for different kind of connection factory.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.certsrv.client.connection
+ */
+public interface IConnectionFactory {
+
+ /**
+ * Creates connection using the host and port
+ */
+ public IConnection create(String host, int port)
+ throws IOException, UnknownHostException;
+
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/connection/JSSConnection.java b/base/console/src/com/netscape/admin/certsrv/connection/JSSConnection.java
new file mode 100644
index 000000000..27292b3d9
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/connection/JSSConnection.java
@@ -0,0 +1,761 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.connection;
+
+import java.util.*;
+import java.net.*;
+import java.io.*;
+import java.security.cert.CertificateFactory;
+import java.security.cert.X509Certificate;
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.Debug;
+import com.netscape.management.client.util.*;
+import org.mozilla.jss.ssl.*;
+import org.mozilla.jss.*;
+import org.mozilla.jss.util.*;
+import org.mozilla.jss.crypto.*;
+import org.mozilla.jss.pkcs11.*;
+import javax.swing.*;
+import java.awt.*;
+
+/**
+ * JSSConnection deals with establishing a connection to
+ * a server, sending requests and reading responses.
+ *
+ * XXX - Performance optimizations if any, persistent connection
+ * support, server auth verification and client authentication
+ * support to be added. NEED TO COME BACK AND CLEAN UP - coding
+ * standard.
+ *
+ * @author Jack Pan-Chen
+ * @author kanda
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ */
+public class JSSConnection implements IConnection, SSLCertificateApprovalCallback,
+ SSLClientCertificateSelectionCallback {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+
+ /* static variables */
+ static CryptoManager cryptoManager;
+ static CertificateFactory cf;
+ static SelectCertDialog selectCertDialog = null;
+ static PromptForTrustDialog promptForTrustDialog = null;
+
+ /* private valiable */
+ private InputStream httpIn;
+ private OutputStream httpOut;
+ private byte[] body;
+ private int bodyLen;
+ private String header;
+ private int available;
+ private int totalRead;
+ private boolean endOfHeader = false;
+
+ private static int HTTP_OK_RESPONSE = 200;
+ private static final String PANELNAME = "SSLCLIENT";
+ private boolean abort = false;;
+ private boolean mClientAuth = false;
+ private boolean mCertAccepted = true;
+ private boolean mClientCertFound = true;
+ private boolean mServerCertImported = true;
+ private boolean mTokenPasswordInit = true;
+ private boolean mTokenPasswdSame = true;
+
+ protected SSLSocket s = null;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public JSSConnection(String host, int port)
+ throws IOException, UnknownHostException {
+
+ UtilConsoleGlobals.initJSS();
+ cf = UtilConsoleGlobals.getX509CertificateFactory();
+ try {
+ cryptoManager = CryptoManager.getInstance();
+ } catch (Exception e) {
+ }
+
+ // SSLSocket needs to be set before getting an instance
+ // to get the ciphers
+ SSLSocket.enableSSL2Default(false);
+ SSLSocket.enableSSL3Default(true);
+ int TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA = 0xC005;
+ int TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA = 0xC00A;
+
+ int ciphers[] = SSLSocket.getImplementedCipherSuites();
+ for (int i = 0; ciphers != null && i < ciphers.length; i++) {
+ // make sure SSLv2 ciphers are not enabled
+ if ((ciphers[i] & 0xfff0) !=0xff00) {
+ Debug.println("JSSConnection Debug: non-SSL2 NSS Cipher Supported '0x" +
+ Integer.toHexString(ciphers[i]) + "'");
+ SSLSocket.setCipherPreferenceDefault(ciphers[i], true);
+ } else {
+ Debug.println("JSSConnection Debug: SSL2 (turned off) NSS Cipher Supported '0x" +
+ Integer.toHexString(ciphers[i]) + "'");
+ SSLSocket.setCipherPreferenceDefault(ciphers[i], false);
+ }
+
+ /* Enable ECC Cipher */
+
+ if (ciphers[i] == TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA) {
+ Debug.println("JSSConnection Debug: found TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA, setting preference");
+ SSLSocket.setCipherPreferenceDefault(TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA, true);
+ }
+ if (ciphers[i] == TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA) {
+ Debug.println("JSSConnection Debug: found TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, setting preference");
+ SSLSocket.setCipherPreferenceDefault(TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, true);
+ }
+ }
+ s = new SSLSocket(host, port, null, 0, this, this);
+ s.enableSSL2(false);
+ s.enableSSL2Default(false);
+ s.enableV2CompatibleHello(false);
+ s.enableSSL3(true);
+ s.enableSSL3Default(true);
+
+ // Initialze Http Input and Output Streams
+ httpIn = s.getInputStream();
+ httpOut = s.getOutputStream();
+ cryptoManager.setPasswordCallback(new pwcb());
+ Debug.println("JSSConnection Debug: end of JSSConnection constructor");
+ }
+
+ public boolean approve(org.mozilla.jss.crypto.X509Certificate serverCert,
+ ValidityStatus status)
+ {
+ if (!mCertAccepted)
+ return false;
+
+ boolean promptForTrust = true;
+
+ //if server auth is not enabled
+ if (!(UtilConsoleGlobals.isServerAuthEnabled())) {
+ return mCertAccepted;
+ }
+
+ Enumeration errors = status.getReasons();
+ //if there are more then 1 error we need to propmt user for trust
+ promptForTrust = errors.hasMoreElements();
+
+ /* if trusted already */
+ if (!promptForTrust)
+ return mCertAccepted;
+
+ //the x509certificate pass in by jss is lacking some
+ //api. so I am getting the encoding then
+ //use the default security provider provided by sun
+ //to decode certificate.
+ //due to the fact that current JSS(version2.1) will clobber
+ //the way jdk loads the default sun security provider I am
+ //using the workaround for now. Which is to load the sun
+ //provider before jss is loaded. (see static section above)
+ X509Certificate x509Cert = null;
+ try {
+ ByteArrayInputStream bais = new ByteArrayInputStream(serverCert.getEncoded());
+
+ while (bais.available() > 0) {
+ x509Cert = (X509Certificate)(cf.generateCertificate(bais));
+ Debug.println(x509Cert.toString());
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ //bring up the trust dialog
+ promptForTrustDialog = new PromptForTrustDialog(getFrame(), x509Cert, status);
+ promptForTrustDialog.setVisible(true);
+ mCertAccepted = promptForTrustDialog.isCertAccepted();
+ if (mCertAccepted) {
+ //user want to save this certificate not just this session
+ //so we have to store the cert as perm cert.
+ if (!(promptForTrustDialog.isAcceptedForOneSession())) {
+ try {
+ String nickname = serverCert.getNickname();
+
+ CryptoToken internalToken =
+ cryptoManager.getInternalKeyStorageToken();
+
+ if (!internalToken.passwordIsInitialized()) {
+ InitPasswordDialog initPasswordDialog =
+ new InitPasswordDialog(internalToken);
+ initPasswordDialog.setVisible(true);
+ if (initPasswordDialog.isCancel()) {
+ mTokenPasswordInit = false;
+ return false;
+ }
+ if (!initPasswordDialog.isPwdSame()) {
+ mTokenPasswdSame = false;
+ mTokenPasswordInit = false;
+ return false;
+ }
+ if (!initPasswordDialog.isTokenInit()) {
+ mTokenPasswordInit = false;
+ return false;
+ }
+ }
+
+ if (!internalToken.isLoggedIn()) {
+ internalToken.login(new pwcb());
+ }
+ if (abort) {
+ mServerCertImported = false;
+ mCertAccepted = false;
+ return false;
+ }
+ InternalCertificate internalCert =
+ cryptoManager.importCertToPerm(serverCert,
+ (nickname==null)?serverCert.getSubjectDN().toString():nickname);
+ internalCert.setSSLTrust(
+ org.mozilla.jss.crypto.InternalCertificate.TRUSTED_PEER |
+ org.mozilla.jss.crypto.InternalCertificate.VALID_PEER);
+ } catch (Exception e) {
+ mServerCertImported = false;
+ mCertAccepted = false;
+ if (Debug.getTrace()) {
+ e.printStackTrace();
+ }
+ return false;
+ }
+ }
+ }
+
+ return mCertAccepted;
+ }
+
+ public boolean isSamePwd() {
+ return mTokenPasswdSame;
+ }
+
+ public boolean isTokenPasswordInit() {
+ return mTokenPasswordInit;
+ }
+
+ public boolean hasClientCert() {
+ return mClientCertFound;
+ }
+
+ public boolean isClientAuth() {
+ return mClientAuth;
+ }
+
+ public boolean isCertAccepted() {
+ return mCertAccepted;
+ }
+
+ public boolean isAbortAction() {
+ return abort;
+ }
+
+ public boolean isServerCertImported() {
+ return mServerCertImported;
+ }
+
+ public String select(Vector nicknames)
+ {
+ selectCertDialog = null;
+ mClientAuth = true;
+ if (nicknames == null || nicknames.size() == 0) {
+ mClientCertFound = false;
+ return "";
+ }
+
+ selectCertDialog = new JSSConnection.SelectCertDialog();
+
+ Debug.println("JSSConnection::select(...) - SELECT CERTIFICATE");
+ selectCertDialog.setCertList(nicknames);
+ selectCertDialog.setVisible(true);
+ return (selectCertDialog.isCancel()?"":selectCertDialog.getSelectedCert());
+ }
+
+ public class pwcb implements PasswordCallback {
+ private int nthPrompt = 0;
+ private static final int MAX_PASSWORD_PROMPT = 20;
+ GetPasswordDialog getPasswordDialog = null;
+
+ public Password getPasswordFirstAttempt(PasswordCallbackInfo info)
+ throws PasswordCallback.GiveUpException {
+
+ if (abort)
+ throw new PasswordCallback.GiveUpException();
+
+ nthPrompt++;
+
+ if (getPasswordDialog == null)
+ getPasswordDialog = new GetPasswordDialog();
+
+ getPasswordDialog.setPasswordInfo(info, false);
+ getPasswordDialog.setVisible(true);
+
+ if (getPasswordDialog.isCancel()) {
+ nthPrompt = 0;
+ abort = true;
+ throw new PasswordCallback.GiveUpException();
+ }
+
+ return getPasswordDialog.getPassword();
+ }
+
+ public Password getPasswordAgain(PasswordCallbackInfo info)
+ throws GiveUpException
+ {
+
+ if (abort)
+ throw new PasswordCallback.GiveUpException();
+ nthPrompt++;
+ if (nthPrompt > MAX_PASSWORD_PROMPT || getPasswordDialog.isCancel()) {
+ nthPrompt = 0;
+ abort = true;
+ throw new PasswordCallback.GiveUpException();
+ }
+
+ getPasswordDialog.setPasswordInfo(info, true);
+ getPasswordDialog.setVisible(true);
+
+ return getPasswordDialog.getPassword();
+ }
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * Send request to the server using this connection
+ *
+ * @param req request object
+ * @return status 1-success, 0- failed
+ * @excpetion IOExcpetion
+ */
+ public int sendRequest(String req)
+ throws IOException {
+
+ int stat = 1;
+ if (req == null)
+ {
+ //System.out.println("Request is null");
+ return 0;
+ }
+ endOfHeader = false;
+
+ PrintStream ps = new PrintStream(httpOut);
+ ps.println(req);
+ ps.println();
+ ps.flush();
+ try
+ {
+ Thread.sleep(100);
+ }
+ catch (Exception e) {
+ Debug.println("JSSConnection Debug: in sendRequest:"+e.toString());
+ System.out.println("sleeping "+e.toString());
+ }
+ //System.out.println("Request Sent - bytes:" + httpOut.getTotal());
+
+ // Init the Reply stream
+ totalRead = 0;
+ header = null;
+ initReadResponse();
+ return stat;
+ }
+
+ /**
+ * Retrieve the input stream
+ */
+ public InputStream getInputStream()
+ throws IOException {
+
+ return s.getInputStream();
+ }
+
+ /**
+ * Read
+ */
+ public int read(byte[] buf)
+ throws IOException {
+
+ return httpIn.read(buf, 0, buf.length);
+ }
+
+ /**
+ * Get Header
+ */
+ public String getHeader() {
+ if (header == null)
+ return "No Header Read";
+ else
+ return header;
+ }
+
+ /**
+ * Get response
+ */
+ public byte[] getResponse() {
+ if (totalRead == 0)
+ return null;
+ else {
+ byte[] buf = new byte[bodyLen];
+ System.arraycopy(body, 0, buf, 0, bodyLen);
+ return buf;
+ }
+ }
+
+ /**
+ * get available
+ */
+ public int available()
+ throws IOException {
+
+ return httpIn.available();
+ }
+
+ /**
+ * Disconnect this connection
+ */
+ public void disconnect() {
+ try {
+ s.close();
+ } catch (Exception e) {
+ //ignor ?
+ }
+ }
+
+ /**
+ * Set time out
+ */
+ public void setSoTimeout(int timeout) throws SocketException {
+ //System.out.println("JSSConnection: setSoTimeout() - "+timeout);
+ s.setSoTimeout(timeout);
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+
+ private JFrame getFrame() {
+ if (UtilConsoleGlobals.getActivatedFrame() != null)
+ return UtilConsoleGlobals.getActivatedFrame();
+ return new JFrame();
+ }
+
+ private void initReadResponse()
+ throws IOException {
+
+ readHeader();
+ readBody();
+ }
+
+ private int readLineFromStream(InputStream is, byte line[],
+ int startpos, int len) throws IOException {
+ //return is.readLine(line, startpos, len);
+ int pos = startpos;
+ int count = 0;
+ while (len > 0)
+ {
+ int nRead = httpIn.read(line, pos, 1);
+ if (nRead == -1)
+ break;
+ count++;
+ if (line[pos] == '\n') {
+ break;
+ }
+ pos++;
+ }
+ return count > 0 ? count : -1;
+ }
+
+ private void readHeader() throws IOException
+ {
+ // Read the status line of response and parse for
+ // Errors.
+ byte[] headerLine = new byte[1096];
+ int nRead = readLineFromStream(httpIn, headerLine, 0, 1096);
+
+ //System.out.println("XXX read " + nRead);
+
+ if (requestFailed(new String(headerLine))) {
+ Debug.println("JSSConnection Debug: in readHeader requestFailed");
+ throw new IOException(getReasonPhrase(new String (headerLine)));
+ }
+
+ while (true) {
+ nRead = readLineFromStream(httpIn, headerLine, 0, 1096);
+ int available = httpIn.available();
+
+ //System.out.println("Available: " + available);
+
+ if (nRead == -1) {
+ System.out.println("Unexpected end of stream");
+ break;
+ }
+
+ processHeader(headerLine, nRead);
+
+ if (endOfHeader) {
+ //System.out.println("End of Header");
+ break;
+ } else {
+ //System.out.println("Header: " + new String(headerLine)
+ // + ", nRead: " + nRead);
+ }
+ }
+ }
+
+ private boolean endOfHeader(byte[] hdr, int available) {
+ if (available == 2) {
+ int c1 = (int)hdr[0];
+ int c2 = (int)hdr[1];
+
+ //System.out.println("C1= " + c1);
+ //System.out.println("C2= " + c2);
+
+ return true;
+ } else
+ return false;
+ }
+
+ private void readBody()
+ throws IOException {
+
+ body = new byte[bodyLen];
+ totalRead = 0;
+ while (totalRead < bodyLen) {
+ int nRead = httpIn.read(body, totalRead, bodyLen - totalRead);
+ totalRead += nRead;
+ }
+ }
+
+
+ private void processHeader(byte[] buf, int nRead)
+ {
+ if (endOfHeader(buf, nRead)) {
+ endOfHeader = true;
+ return;
+ }
+
+ String hdr = new String(buf, 0, nRead);
+ int index = 0;
+ if (hdr.toLowerCase().startsWith("content-length: ")) {
+ try {
+ String length = hdr.substring(hdr.indexOf(": ") + 1);
+ bodyLen = Integer.parseInt(length.trim());
+ return;
+ } catch (Exception e){e.printStackTrace(); }
+ }
+ }
+
+ private boolean requestFailed(String header) {
+ return (header.indexOf(Integer.toString(HTTP_OK_RESPONSE)) > 0) ? false: true;
+ }
+
+ private String getReasonPhrase(String header) {
+ String str1 = header.substring(header.indexOf(' ') +1);
+ return str1.substring(str1.indexOf(' ') +1);
+ }
+
+ class InitPasswordDialog extends AbstractDialog {
+ protected ResourceBundle mResource =
+ ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ SingleBytePasswordField pwd;
+ SingleBytePasswordField pwdAgain;
+ CryptoToken mToken;
+ boolean tokenPasswdInit = true;
+ boolean pwdSame = true;
+
+ public InitPasswordDialog(CryptoToken token) {
+ super(null,"",true, OK|CANCEL);
+ setMinimumSize(300, 150);
+ mToken = token;
+ setTitle(mResource.getString("SSLCLIENT_INITPASSWORD_DIALOG_TITLE"));
+ Container p = getContentPane();
+ p.setLayout(new GridBagLayout());
+
+ int y = 0;
+ pwd = new SingleBytePasswordField();
+ pwdAgain = new SingleBytePasswordField();
+ JLabel pwdLbl = new JLabel();
+ JLabel pwdAgainLbl = new JLabel();
+ pwdLbl.setText(mResource.getString("SSLCLIENT_INITPASSWORD_PWD_LABEL"));
+ pwdAgainLbl.setText(
+ mResource.getString("SSLCLIENT_INITPASSWORD_PWDAGAIN_LABEL"));
+ GridBagUtil.constrain(p, pwdLbl,
+ 0, y, 1, 1,
+ 0.0, 0.0,
+ GridBagConstraints.EAST, GridBagConstraints.NONE);
+ GridBagUtil.constrain(p, pwd,
+ 1, y, GridBagConstraints.REMAINDER, 1,
+ 1.0, 0.0,
+ GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL);
+ GridBagUtil.constrain(p, pwdAgainLbl,
+ 0, ++y, 1, 1,
+ 0.0, 0.0,
+ GridBagConstraints.WEST, GridBagConstraints.NONE);
+ GridBagUtil.constrain(p, pwdAgain,
+ 1, y, GridBagConstraints.REMAINDER, 1,
+ 1.0, 0.0,
+ GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL);
+/*
+ GridBagUtil.constrain(p, pwd,
+ 0, ++y, 1, 1,
+ 1.0, 0.0,
+ GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
+ 0, 0, 0, 0);
+*/
+
+ pack();
+ }
+
+ protected void okInvoked() {
+ if (!pwd.getText().equals(pwdAgain.getText())) {
+ pwdSame = false;
+ dispose();
+ return;
+ }
+
+ try {
+ mToken.initPassword(null, getPassword());
+ dispose();
+ } catch (Exception e) {
+ tokenPasswdInit = false;
+ }
+ }
+
+ public boolean isPwdSame() {
+ return pwdSame;
+ }
+
+ public boolean isTokenInit() {
+ return tokenPasswdInit;
+ }
+
+ public void setVisible(boolean visible) {
+ pack();
+ pwd.grabFocus();
+ super.setVisible(visible);
+ }
+
+ public Password getPassword() {
+ Password jssPwd = new Password(pwd.getText().toCharArray());
+ return jssPwd;
+ }
+ }
+
+ class GetPasswordDialog extends AbstractDialog {
+
+ MultilineLabel enterPwdLabel = new MultilineLabel();
+ protected ResourceBundle mResource =
+ ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ SingleBytePasswordField pwd;
+ public GetPasswordDialog() {
+ super(null,"",true, OK|CANCEL);
+ setTitle(mResource.getString("SSLCLIENT_PASSWORD_DIALOG_TITLE"));
+ Container p = getContentPane();
+ p.setLayout(new GridBagLayout());
+
+ int y = 0;
+ GridBagUtil.constrain(p, enterPwdLabel,
+ 0, y, 1, 1,
+ 1.0, 0.0,
+ GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
+ 0, 0, 0, 0);
+
+ pwd = new SingleBytePasswordField();
+ GridBagUtil.constrain(p, pwd,
+ 0, ++y, 1, 1,
+ 1.0, 0.0,
+ GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
+ 0, 0, 0, 0);
+
+ pack();
+ }
+
+ public void setVisible(boolean visible) {
+ pack();
+ pwd.grabFocus();
+ super.setVisible(visible);
+ }
+
+ public void setPasswordInfo(PasswordCallbackInfo info, boolean getPwdAgain) {
+ if (getPwdAgain)
+ enterPwdLabel.setText(mResource.getString(
+ "SSLCLIENT_PASSWORDAGAIN_DIALOG_LABEL")+" "+info.getName()+":");
+ else
+ enterPwdLabel.setText(mResource.getString(
+ "SSLCLIENT_PASSWORD_DIALOG_LABEL")+" "+ info.getName()+":");
+ Debug.println(info.getName());
+ }
+
+ public Password getPassword() {
+ Password jssPwd = new Password(pwd.getText().toCharArray());
+ return jssPwd;
+ }
+ }
+
+
+ class SelectCertDialog extends AbstractDialog {
+
+ JComboBox certList = new JComboBox();
+ protected ResourceBundle mResource = ResourceBundle.getBundle(
+ CMSAdminResources.class.getName());
+ public SelectCertDialog() {
+ super(null,"", true, OK|CANCEL);
+ setTitle(mResource.getString("SSLCLIENT_CERTSELECT_DIALOG_TITLE"));
+
+ Container p = getContentPane();
+ p.setLayout(new GridBagLayout());
+
+ int y = 0;
+ GridBagUtil.constrain(p, new JLabel(
+ mResource.getString("SSLCLIENT_CERTSELECT_DIALOG_LABEL")),
+ 0, y, 1, 1,
+ 1.0, 0.0,
+ GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
+ 0, 0, 0, 0);
+
+ GridBagUtil.constrain(p, certList,
+ 0, ++y, 1, 1,
+ 1.0, 0.0,
+ GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
+ 0, 0, 0, 0);
+ pack();
+ }
+
+ public void setCertList(Vector nicknames) {
+ certList.removeAllItems();
+ Enumeration enum1 = nicknames.elements();
+ while (enum1.hasMoreElements()) {
+ certList.insertItemAt(enum1.nextElement(), 0);
+ }
+ try {
+ certList.setSelectedIndex(0);
+ } catch (Exception e) {
+ }
+ }
+
+ public String getSelectedCert() {
+ return certList.getSelectedItem().toString();
+ }
+
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/connection/PromptForTrustDialog.java b/base/console/src/com/netscape/admin/certsrv/connection/PromptForTrustDialog.java
new file mode 100644
index 000000000..868eccc1b
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/connection/PromptForTrustDialog.java
@@ -0,0 +1,316 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+//package com.netscape.management.client.security;
+package com.netscape.admin.certsrv.connection;
+
+import com.netscape.management.nmclf.SuiConstants;
+import com.netscape.management.nmclf.SuiLookAndFeel;
+import com.netscape.management.client.util.*;
+import com.netscape.admin.certsrv.ug.*;
+
+import java.awt.event.*;
+import java.awt.*;
+import javax.swing.*;
+import java.io.*;
+import java.util.*;
+import java.net.*;
+import java.text.*;
+import java.security.cert.X509Certificate;
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+
+import org.mozilla.jss.ssl.SSLCertificateApprovalCallback.ValidityStatus;
+
+/**
+ * Dialog box that prompts user to either accept or reject
+ * an untrusted certificate.
+ */
+public class PromptForTrustDialog extends AbstractDialog implements SuiConstants {
+
+ private static boolean certIsAccepted = false;
+ private static boolean acceptedForSingleSession = false;
+ private X509Certificate mCert;
+
+ private UserConfirmationActionListener buttonActionListener =
+ new UserConfirmationActionListener();
+ protected ResourceBundle mResource;
+ //static ResourceSet _resource = new ResourceSet("com.netscape.admin.certsrv.connection.ServerAuthResource");
+
+ CertViewDialog viewCertDialog;
+ //ViewCertificateDialog viewCertDialog;
+ JCheckBox oneSession;
+
+
+ /**
+ * create a dialog that prompt user to either accept or reject an untrusted certificate
+ * @param parent the owner of the dialog
+ * @param cert certificate chain
+ * @param certChain_errCode cert chain errors (0 if no errors)
+ * @param serverCert_errCode server cert errors (0 if no errors)
+ *
+ *
+ */
+ public PromptForTrustDialog(Frame parent, X509Certificate cert,
+ ValidityStatus status) {
+ super(parent, "", true);
+ mResource = ResourceBundle.getBundle(
+ CMSAdminResources.class.getName());
+ mCert = cert;
+
+ setTitle(mResource.getString("SSLCLIENT_TRUST_DIALOG_TITLE"));
+
+ getContentPane().setLayout(new GridBagLayout());
+
+
+ //Add action button pane first so the accept button will
+ //get default focus. Already try various way with *Focus() call
+ //none of them work.
+ GridBagUtil.constrain(getContentPane(), createActionButtons(),
+ 0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.SOUTHEAST,
+ GridBagConstraints.NONE, 0, 0, 0, 0);
+
+ GridBagUtil.constrain(getContentPane(), siteAlert(), 0, 0, 1,
+ 1, 1.0, 1.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, VERT_WINDOW_INSET,
+ VERT_WINDOW_INSET, 0, 0);
+
+ //viewCertDialog = new ViewCertificateDialog(parent, cert, status);
+ viewCertDialog = new CertViewDialog((JFrame)parent);
+
+ setMinimumSize(400, 250);
+ if (parent == null) {
+ ModalDialogUtil.setCenteredDialog(this);
+ }
+ pack();
+ }
+
+
+ /**
+ * Handles all the action (Ok, Accept, Reject, and Help)
+ *
+ */
+ class UserConfirmationActionListener implements ActionListener {
+ public void actionPerformed(ActionEvent e) {
+ if (e.getActionCommand().equals("ACCEPT")) {
+ certIsAccepted = true;
+ setVisible(false);
+ } else if (e.getActionCommand().equals("REJECT")) {
+ certIsAccepted = false;
+ setVisible(false);
+ } else if (e.getActionCommand().equals("VIEWCERT")) {
+ String certContent = getPrettyPrint(mCert);
+ viewCertDialog.showDialog("", certContent);
+ }
+ }
+ }
+
+ private final static String spaces =
+ " " +
+ " " +
+ " " +
+ " " +
+ " ";
+ private static final char[] hexdigits = {
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+ 'A', 'B', 'C', 'D', 'E', 'F'
+ };
+
+ private String indent(int size) {
+ return spaces.substring(0, size);
+ }
+
+ private String getPrettyPrint(X509Certificate cert) {
+ String subjectdn = cert.getSubjectDN().toString();
+ String issuerdn = cert.getIssuerDN().toString();
+ String serial = cert.getSerialNumber().toString();
+ SimpleDateFormat formatter = new SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy");
+ String before = formatter.format(cert.getNotBefore());
+ String after = formatter.format(cert.getNotAfter());
+ String fingerprint = getHexString(cert.getSignature(), 16, 16, ":");
+ String str = "Subject name: "+subjectdn+"\n"+
+ "Issuer name: "+issuerdn+"\n"+"Serial number: "+serial+"\n"+
+ "Validity: "+before+" to "+after+"\n"+"Signature:\n"+
+ fingerprint+"\n";
+ return str;
+ }
+
+ private String getHexString(byte[] in, int indentSize, int lineLen,
+ String separator) {
+ StringBuffer sb = new StringBuffer();
+ int hexCount = 0;
+ char c[];
+ int j = 0;
+
+ if (lineLen == 0) {
+ c = new char[in.length * 3 + 1];
+ } else {
+ c = new char[lineLen * 3 + 1];
+ }
+
+ char sep = separator.charAt(0);
+
+ sb.append(indent(indentSize));
+ for (int i = 0; i < in.length; i++) {
+ if (lineLen > 0 && hexCount == lineLen) {
+ c[j++] = '\n';
+ sb.append(c, 0, j);
+ sb.append(indent(indentSize));
+ hexCount = 0;
+ j = 0;
+ }
+ byte x = in[i];
+
+ // output hex digits to buffer
+ c[j++] = hexdigits[(char) ((x >> 4) & 0xf)];
+ c[j++] = hexdigits[(char) (x & 0xf)];
+
+ // if not last char, output separator
+ if (i != in.length - 1) {
+ c[j++] = sep;
+ }
+
+ hexCount++;
+ }
+ if (j > 0) {
+ c[j++] = '\n';
+ sb.append(c, 0, j);
+ }
+ // sb.append("\n");
+
+ return sb.toString();
+ }
+
+ /**
+ * @return true if certificate is accepted
+ */
+ public boolean isCertAccepted() {
+ return certIsAccepted;
+ }
+
+ /**
+ * @return true certificate should only be accept for a single session
+ */
+ public boolean isAcceptedForOneSession() {
+ return oneSession.isSelected();
+ }
+
+
+ /**
+ * Allow reuse of this dialog, if it is not disposed.
+ * @param cert certificate chain
+ * @param certChain_errCode cert chain errors (0 if no errors)
+ * @param serverCert_errCode server cert errors (0 if no errors)
+ *
+ */
+ public void setCertificateInfo(X509Certificate cert,
+ ValidityStatus status) {
+ //viewCertDialog.setCertificate(cert, status);
+ }
+
+
+ /**
+ * Create a warning message panel
+ */
+ private JPanel siteAlert() {
+ JPanel notTrustedSiteWarning = new JPanel();
+ notTrustedSiteWarning.setLayout(new GridBagLayout());
+
+ JLabel warningImage = new JLabel(UIManager.getIcon("OptionPane.warningIcon"));
+ MultilineLabel warningMsg = new MultilineLabel(
+ mResource.getString("SSLCLIENT_TRUST_DIALOG_WARNMSG"));
+ oneSession = new JCheckBox(
+ mResource.getString("SSLCLIENT_TRUST_DIALOG_ACCEPTONESESSION"),
+ false);
+
+ GridBagUtil.constrain(notTrustedSiteWarning, warningImage, 0,
+ 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST,
+ GridBagConstraints.NONE, 0, 0, 0,
+ DIFFERENT_COMPONENT_SPACE);
+
+ GridBagUtil.constrain(notTrustedSiteWarning, warningMsg, 1, 0,
+ 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST,
+ GridBagConstraints.BOTH, 0, 0,
+ DIFFERENT_COMPONENT_SPACE, VERT_WINDOW_INSET);
+
+ GridBagUtil.constrain(notTrustedSiteWarning, oneSession, 1, 1,
+ 1, 1, 0.0, 0.0, GridBagConstraints.SOUTHWEST,
+ GridBagConstraints.NONE, 0, 0, 0, VERT_WINDOW_INSET);
+
+ GridBagUtil.constrain(notTrustedSiteWarning,
+ Box.createVerticalGlue(), 1, 2, 2, 1, 1.0, 1.0,
+ GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0,
+ 0, 0, 0);
+ return notTrustedSiteWarning;
+ }
+
+ JButton accept;
+ public void setVisible(boolean visible) {
+ if (visible) {
+ accept.grabFocus();
+ setDefaultButton(accept);
+ }
+ super.setVisible(visible);
+ }
+
+ /**
+ * create all the action buttons (Accept, Reject, View Certificate, and Help)
+ */
+ private JPanel createActionButtons() {
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.setLayout(new GridBagLayout());
+
+ accept = JButtonFactory.create(
+ mResource.getString("SSLCLIENT_TRUST_DIALOG_ACCEPT"),
+ buttonActionListener, "ACCEPT");
+ accept.registerKeyboardAction(buttonActionListener, "ACCEPT",
+ KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),
+ JComponent.WHEN_IN_FOCUSED_WINDOW);
+
+ JButton reject = JButtonFactory.create(
+ mResource.getString("SSLCLIENT_TRUST_DIALOG_REJECT"),
+ buttonActionListener, "REJECT");
+ reject.registerKeyboardAction(buttonActionListener, "REJECT",
+ KeyStroke.getKeyStroke(KeyEvent.VK_R, 0),
+ JComponent.WHEN_IN_FOCUSED_WINDOW);
+
+ JButton viewCert = JButtonFactory.create(
+ mResource.getString("SSLCLIENT_TRUST_DIALOG_VIEWCERT"), buttonActionListener, "VIEWCERT");
+ viewCert.registerKeyboardAction(buttonActionListener, "VIEWCERT",
+ KeyStroke.getKeyStroke(KeyEvent.VK_V, 0),
+ JComponent.WHEN_IN_FOCUSED_WINDOW);
+ JButtonFactory.resizeGroup(accept, reject);
+
+ int x = 0;
+ GridBagUtil.constrain(buttonPanel, accept, x, 0, 1, 1, 0.0,
+ 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, DIFFERENT_COMPONENT_SPACE, 0,
+ 0, COMPONENT_SPACE);
+
+ GridBagUtil.constrain(buttonPanel, reject, ++x, 0, 1, 1, 0.0,
+ 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, DIFFERENT_COMPONENT_SPACE, 0,
+ 0, COMPONENT_SPACE);
+
+ GridBagUtil.constrain(buttonPanel, viewCert, ++x, 0, 1, 1, 0.0,
+ 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, DIFFERENT_COMPONENT_SPACE, 0,
+ 0, DIFFERENT_COMPONENT_SPACE);
+
+ return buttonPanel;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/connection/Request.java b/base/console/src/com/netscape/admin/certsrv/connection/Request.java
new file mode 100644
index 000000000..8ed61e998
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/connection/Request.java
@@ -0,0 +1,70 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.connection;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ * A class represents a connection to certificate server.
+ *
+ * @author thomask
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public class Request {
+
+ private String mPrefix = null;
+
+ //internal structure is changed to vector to maintain
+ //the ordering
+
+ private Vector mName = new Vector();
+ private Vector mValue = new Vector();
+
+ public Request(String prefix) {
+ mPrefix = prefix;
+ }
+
+ public String getPrefix() {
+ return mPrefix;
+ }
+
+ public void set(String name, String value) {
+ mName.addElement(name);
+ mValue.addElement(value);
+ }
+
+ public String get(String name) {
+ int i = mName.indexOf(name);
+ try {
+ return (String) mValue.elementAt(i);
+ } catch (ArrayIndexOutOfBoundsException e) {
+ return "";
+ }
+ }
+
+ public Enumeration getElements() {
+ return mName.elements();
+ }
+
+ public void removeAll() {
+ mName.removeAllElements();
+ mValue.removeAllElements();
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/connection/Response.java b/base/console/src/com/netscape/admin/certsrv/connection/Response.java
new file mode 100644
index 000000000..bbb511443
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/connection/Response.java
@@ -0,0 +1,133 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.connection;
+
+import java.net.*;
+import java.io.*;
+import java.util.*;
+
+/**
+ * Response - now use vector to maintain the oredering
+ *
+ * @author kanda
+ * @author thomask
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public class Response {
+ boolean debug = true;
+ boolean test = true;
+ boolean testsuccess = true; // test success condition?
+
+ public static final int SUCCESS = 0;
+ public static final int RESTART = -1;
+
+ private int mRetcode;
+ private String mErrorMsg;
+
+ //internal structure is changed to vector to maintain
+ //the ordering
+
+ private Vector mName = new Vector();
+ private Vector mValue = new Vector();
+
+ public Response() {
+ // for testing only
+
+ }
+
+ public Response(byte[] resp) throws IOException {
+ ByteArrayInputStream bis = new ByteArrayInputStream(resp);
+ DataInputStream dis = new DataInputStream(bis);
+ mRetcode = dis.readInt();
+ byte[] mContents = null;
+
+ if (debug)
+ //System.out.println("===in Response===\n");
+
+ if ((mRetcode != SUCCESS) && (mRetcode != RESTART)) {
+ mErrorMsg = dis.readUTF();
+ } else {
+ if (resp.length > 4) {
+ mContents = new byte[resp.length - 4];
+ dis.read(mContents);
+ }
+ }
+ if (mContents != null) {
+ String resultStr = new String(mContents);
+ StringTokenizer st = new StringTokenizer(resultStr,
+ "&");
+ while (st.hasMoreTokens()) {
+ String p = st.nextToken();
+ int i = p.indexOf("=");
+ if (i == -1) {
+ return;
+ }
+ String t = URLdecode(p.substring(0, i));
+ String v = URLdecode(p.substring(i + 1));
+ mName.addElement(t);
+ mValue.addElement(v);
+ }
+ }
+ }
+
+ public int getReturnCode() {
+ return mRetcode;
+ }
+
+ public String getErrorMessage() {
+ return mErrorMsg;
+ }
+
+ /**
+ * URL decodes the given string.
+ */
+ public String URLdecode(String s) {
+ if (s == null)
+ return null;
+ ByteArrayOutputStream out = new ByteArrayOutputStream(s.length());
+ for (int i = 0; i < s.length(); i++) {
+ int c = (int) s.charAt(i);
+ if (c == '+') {
+ out.write(' ');
+ } else if (c == '%') {
+ int c1 = Character.digit(s.charAt(++i), 16);
+ int c2 = Character.digit(s.charAt(++i), 16);
+ out.write((char) (c1 * 16 + c2));
+ } else {
+ out.write(c);
+ }
+ } // end for
+ return out.toString();
+ }
+
+ public Enumeration getNames() {
+ return mName.elements();
+ }
+
+ public String get(String name) {
+ int i = mName.indexOf(name);
+ String value;
+ try {
+ value = (String) mValue.elementAt(i);
+ } catch (ArrayIndexOutOfBoundsException e) {
+ value = "";
+ }
+ return value;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/connection/SSLConnectionFactory.java b/base/console/src/com/netscape/admin/certsrv/connection/SSLConnectionFactory.java
new file mode 100644
index 000000000..7c74a239d
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/connection/SSLConnectionFactory.java
@@ -0,0 +1,81 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.connection;
+
+import java.net.*;
+import java.io.*;
+
+/**
+ * SSLConnectionFactory - factory method for creating supported SSL
+ * Connection type: SSLAVA_CONNECTION, SSL_CONNECTION. DEFAULT connection
+ * SSLAVA_CONNECTION will be used if type specified is incorrect.
+ *
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.certsrv.client.connection
+ */
+public class SSLConnectionFactory implements IConnectionFactory {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ public static final String JSS_CONNECTION = "JSS";
+ public static final String SSL_CONNECTION = "SSL";
+
+ private String mType;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+
+ /**
+ * Construct a specific SSL connection factory object
+ *
+ * DEFAULT connection SSLAVA_CONNECTION will be used if
+ * type specified is incorrect.
+ *
+ * @param type supported SSL connection type:
+ * SSLAVA_CONNECTION, SSL_CONNECTION
+ */
+ public SSLConnectionFactory(String type) {
+ if ((!type.equals(JSS_CONNECTION))&&(!type.equals(SSL_CONNECTION)) ) {
+ System.out.println("SSL Connection Type not found default is used");
+ mType = JSS_CONNECTION;
+ } else {
+ mType = type;
+ }
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * Creates connection using the host and port
+ */
+ public IConnection create(String host, int port)
+ throws IOException, UnknownHostException {
+
+ if (mType.equals(JSS_CONNECTION))
+ return new JSSConnection(host, port);
+ return new JSSConnection(host, port);
+ //return new SSLConnection(host, port);
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/images/CertificateServer.gif b/base/console/src/com/netscape/admin/certsrv/images/CertificateServer.gif
new file mode 100644
index 000000000..ed84e0540
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/CertificateServer.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/CertificateServerL.gif b/base/console/src/com/netscape/admin/certsrv/images/CertificateServerL.gif
new file mode 100644
index 000000000..99e27663a
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/CertificateServerL.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/LOGobjs.gif b/base/console/src/com/netscape/admin/certsrv/images/LOGobjs.gif
new file mode 100644
index 000000000..05fab2ad7
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/LOGobjs.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/UGobjs.gif b/base/console/src/com/netscape/admin/certsrv/images/UGobjs.gif
new file mode 100644
index 000000000..7f5ff1ee2
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/UGobjs.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/acl.gif b/base/console/src/com/netscape/admin/certsrv/images/acl.gif
new file mode 100644
index 000000000..8c706b81c
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/acl.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/aclobj.gif b/base/console/src/com/netscape/admin/certsrv/images/aclobj.gif
new file mode 100644
index 000000000..95eb0e93b
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/aclobj.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/aclplugin.gif b/base/console/src/com/netscape/admin/certsrv/images/aclplugin.gif
new file mode 100644
index 000000000..61b75df0e
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/aclplugin.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/alertl.gif b/base/console/src/com/netscape/admin/certsrv/images/alertl.gif
new file mode 100644
index 000000000..453d1b2bd
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/alertl.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/allfolder16n.gif b/base/console/src/com/netscape/admin/certsrv/images/allfolder16n.gif
new file mode 100644
index 000000000..50bb5c4d0
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/allfolder16n.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/allgroup16n.gif b/base/console/src/com/netscape/admin/certsrv/images/allgroup16n.gif
new file mode 100644
index 000000000..45a69a7be
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/allgroup16n.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/alllogdoc16n.gif b/base/console/src/com/netscape/admin/certsrv/images/alllogdoc16n.gif
new file mode 100644
index 000000000..e517db51c
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/alllogdoc16n.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/alllogfolder16n.gif b/base/console/src/com/netscape/admin/certsrv/images/alllogfolder16n.gif
new file mode 100644
index 000000000..14453609e
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/alllogfolder16n.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/alluser16n.gif b/base/console/src/com/netscape/admin/certsrv/images/alluser16n.gif
new file mode 100644
index 000000000..d37b766f5
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/alluser16n.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/alluserwithcert16n.gif b/base/console/src/com/netscape/admin/certsrv/images/alluserwithcert16n.gif
new file mode 100644
index 000000000..69b0da381
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/alluserwithcert16n.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/auth.gif b/base/console/src/com/netscape/admin/certsrv/images/auth.gif
new file mode 100644
index 000000000..6ede96ae2
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/auth.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/authobj.gif b/base/console/src/com/netscape/admin/certsrv/images/authobj.gif
new file mode 100644
index 000000000..26f58c19c
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/authobj.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/authplugin.gif b/base/console/src/com/netscape/admin/certsrv/images/authplugin.gif
new file mode 100644
index 000000000..b1015ad97
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/authplugin.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/cert24.gif b/base/console/src/com/netscape/admin/certsrv/images/cert24.gif
new file mode 100644
index 000000000..99e27663a
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/cert24.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/cert41.gif b/base/console/src/com/netscape/admin/certsrv/images/cert41.gif
new file mode 100644
index 000000000..c33d7cfa0
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/cert41.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/cert42.gif b/base/console/src/com/netscape/admin/certsrv/images/cert42.gif
new file mode 100644
index 000000000..23f38b9d5
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/cert42.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/cms-branding.gif b/base/console/src/com/netscape/admin/certsrv/images/cms-branding.gif
new file mode 100644
index 000000000..b696929e5
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/cms-branding.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/error.gif b/base/console/src/com/netscape/admin/certsrv/images/error.gif
new file mode 100644
index 000000000..ba9c07e17
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/error.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/genobject.gif b/base/console/src/com/netscape/admin/certsrv/images/genobject.gif
new file mode 100644
index 000000000..93f9ab123
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/genobject.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/jobobj.gif b/base/console/src/com/netscape/admin/certsrv/images/jobobj.gif
new file mode 100644
index 000000000..95eb0e93b
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/jobobj.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/jobplugin.gif b/base/console/src/com/netscape/admin/certsrv/images/jobplugin.gif
new file mode 100644
index 000000000..61b75df0e
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/jobplugin.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/jobs.gif b/base/console/src/com/netscape/admin/certsrv/images/jobs.gif
new file mode 100644
index 000000000..8c706b81c
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/jobs.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/ldapub.gif b/base/console/src/com/netscape/admin/certsrv/images/ldapub.gif
new file mode 100644
index 000000000..c709d2b62
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/ldapub.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/messagel.gif b/base/console/src/com/netscape/admin/certsrv/images/messagel.gif
new file mode 100644
index 000000000..e46c67a09
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/messagel.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/notsecure.gif b/base/console/src/com/netscape/admin/certsrv/images/notsecure.gif
new file mode 100644
index 000000000..4c52ba9d9
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/notsecure.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/plug.gif b/base/console/src/com/netscape/admin/certsrv/images/plug.gif
new file mode 100644
index 000000000..83a230d4d
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/plug.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/plugin.gif b/base/console/src/com/netscape/admin/certsrv/images/plugin.gif
new file mode 100644
index 000000000..a12b2cd0e
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/plugin.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/pluginfolder.gif b/base/console/src/com/netscape/admin/certsrv/images/pluginfolder.gif
new file mode 100644
index 000000000..3499e9077
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/pluginfolder.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/red-ball-small.gif b/base/console/src/com/netscape/admin/certsrv/images/red-ball-small.gif
new file mode 100644
index 000000000..f6b3c372c
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/red-ball-small.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/rule-16.gif b/base/console/src/com/netscape/admin/certsrv/images/rule-16.gif
new file mode 100644
index 000000000..bbaa218f5
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/rule-16.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/ruleDisable-16.gif b/base/console/src/com/netscape/admin/certsrv/images/ruleDisable-16.gif
new file mode 100644
index 000000000..c54f5e6bb
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/ruleDisable-16.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/ruleplugin-16.gif b/base/console/src/com/netscape/admin/certsrv/images/ruleplugin-16.gif
new file mode 100644
index 000000000..aa3ba590b
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/ruleplugin-16.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/rulesobj.gif b/base/console/src/com/netscape/admin/certsrv/images/rulesobj.gif
new file mode 100644
index 000000000..bdbf3b80c
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/rulesobj.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/secure.gif b/base/console/src/com/netscape/admin/certsrv/images/secure.gif
new file mode 100644
index 000000000..352ad2f82
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/secure.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/servlet-16.gif b/base/console/src/com/netscape/admin/certsrv/images/servlet-16.gif
new file mode 100644
index 000000000..6274a8006
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/servlet-16.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/servlet-plugin-16.gif b/base/console/src/com/netscape/admin/certsrv/images/servlet-plugin-16.gif
new file mode 100644
index 000000000..8ebbdad58
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/servlet-plugin-16.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/images/servletobj.gif b/base/console/src/com/netscape/admin/certsrv/images/servletobj.gif
new file mode 100644
index 000000000..9b83ac34d
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/images/servletobj.gif
Binary files differ
diff --git a/base/console/src/com/netscape/admin/certsrv/keycert/CertSetupWizard.java b/base/console/src/com/netscape/admin/certsrv/keycert/CertSetupWizard.java
new file mode 100644
index 000000000..f7650decb
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/keycert/CertSetupWizard.java
@@ -0,0 +1,82 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.keycert;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.wizard.*;
+
+/**
+ * Wizard for Key and Certificate management
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.keycert
+ */
+
+public class CertSetupWizard extends WizardWidget {
+
+ public CertSetupWizard(CMSBaseResourceModel parent, CertSetupWizardInfo info) {
+ super(parent.getFrame());
+ JFrame frame = parent.getFrame();
+ info.addEntry(info.FRAME, frame);
+ info.addEntry(info.SERVERINFO, parent.getServerInfo());
+ setWizardInfo(info);
+ addPage(new WIntroPage(this, frame));
+// addPage(new WTokenSelectionPage());
+ addPage(new WOperationSelectionPage(this, frame));
+// addPage(new WGenerateReqPage(this));
+ addPage(new WCertTypePage(this, frame));
+ //addPage(new WServerCertSubmitPage(this, frame));
+// addPage(new WCACertRequest1Page());
+// addPage(new WOtherCertRequest1Page());
+// addPage(new WCAKeyPage());
+ addPage(new WKeyPage(this, frame));
+ addPage(new WTokenLogonPage(this, frame));
+ addPage(new WCertMessageDigestPage(this, frame));
+// addPage(new WWarningPage());
+ addPage(new WCertDNPage(this, frame));
+ addPage(new WCertValidityPage(this, frame));
+// addPage(new WCertDNValidityPage());
+// addPage(new WWarningExecute1Page());
+ addPage(new WCertExtensionPage(this, frame));
+ addPage(new WExecute1Page(this, frame));
+// addPage(new WRAKeyPage());
+// addPage(new WSSLKeyPage());
+// addPage(new WWarningExecutePage());
+ addPage(new WExecutePage(this, frame));
+ addPage(new WIssueImportStatusPage(this, frame));
+ addPage(new WManualCertRequestPage(this, frame));
+ addPage(new WRequestStatusPage(this, frame));
+// addPage(new WIntroInstallCertPage());
+ addPage(new WInstallOpPage(this, frame));
+ addPage(new WInstallCertChainPage(this, frame));
+ addPage(new WPasteCertPage(this, frame));
+ addPage(new WDisplayCertPage(this, frame));
+ addPage(new WInstallStatusPage(this, frame));
+ show();
+ }
+
+ protected void callHelp() {
+ if (mCurrent instanceof IWizardPanel) {
+ ((IWizardPanel)mCurrent).callHelp();
+ }
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/keycert/CertSetupWizardInfo.java b/base/console/src/com/netscape/admin/certsrv/keycert/CertSetupWizardInfo.java
new file mode 100644
index 000000000..81ffc2d0e
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/keycert/CertSetupWizardInfo.java
@@ -0,0 +1,412 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.keycert;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.console.*;
+
+/**
+ * WizardInfo for certificate setup wizard
+ * Once complete, we need to zap this object.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.keycert
+ */
+public class CertSetupWizardInfo extends WizardInfo {
+
+ private AdminConnection mConnection;
+ private ConsoleInfo mConsoleInfo;
+ public static final String FRAME = "frame";
+ public static final String SERVERINFO = "serverInfo";
+ public static final String TOKENNAME = "tokenName";
+ public static final String DBPASSWD = "dbPasswd";
+ public static final String OPTYPE = "operationType";
+ public static final String INSTALLTYPE = "install";
+ public static final String REQUESTTYPE = "request";
+// public static final String CA_SIGNING_CERT = "caSigningCert";
+ // public static final String RA_SIGNING_CERT = " raSigningCert";
+ // public static final String KRA_TRANSPORT_CERT = "kraTransportCert";
+ // public static final String SSL_SERVER_CERT = "sslServerCert";
+ public static final String SERVER_CERT_CHAIN = "serverCertChain";
+ public static final String TRUSTED_CA_CERT = "trustedCACert";
+ public static final String TRUSTED_CERT = "trustedCert";
+// public static final String SERVER_CERT = "serverCert";
+ public static final String SELF_SIGNED = "selfSigned";
+ public static final String SUBORDINATE_CA = "subordinateCA";
+ public static final String CA_EMAIL = "caEmail";
+ public static final String CA_URL = "caUrl";
+ public static final String MANUAL = "manual";
+ public static final String SUBMIT_METHOD = "reqSubmitMethod";
+ public static final String KEY_MATERIAL = "keyMaterial";
+ public static final String CA_TYPE = "caType";
+ public static final String DERVALUE = "derValue";
+ public static final String INSTALLCERTTYPE = "installCertType";
+ public static final String ALL_INFO = "allInfo";
+ public static final String BEGIN_YEAR = "beginYear";
+ public static final String BEGIN_MONTH = "beginMonth";
+ public static final String BEGIN_DATE = "beginDate";
+ public static final String BEGIN_HOUR = "beginHour";
+ public static final String BEGIN_MIN = "beginMin";
+ public static final String BEGIN_SEC = "beginSec";
+ public static final String AFTER_YEAR = "afterYear";
+ public static final String AFTER_MONTH = "afterMonth";
+ public static final String AFTER_DATE = "afterDate";
+ public static final String AFTER_HOUR = "afterHour";
+ public static final String AFTER_MIN = "afterMin";
+ public static final String AFTER_SEC = "afterSec";
+ public static final String NICKNAME = "nickname";
+ public static final String CERT_CONTENT = "certContent";
+
+ public CertSetupWizardInfo(AdminConnection conn, ConsoleInfo info) {
+ super();
+ mConnection = conn;
+ mConsoleInfo = info;
+ }
+
+ public JFrame getFrame() {
+ return (JFrame)get(FRAME);
+ }
+
+ public CMSServerInfo getServerInfo() {
+ return (CMSServerInfo)get(SERVERINFO);
+ }
+
+ public AdminConnection getAdminConnection() {
+ return mConnection;
+ }
+
+ public ConsoleInfo getAdminConsoleInfo() {
+ return mConsoleInfo;
+ }
+
+ // if mode = 0, then it is in root cert mode.
+ // if mode = 1, then it is in user cert mode.
+ public void setMode(String mode) {
+ put("mode", mode);
+ }
+
+ public String getMode() {
+ return (String)get("mode");
+ }
+
+ public String getCertType() {
+ return (String)get(Constants.PR_CERTIFICATE_TYPE);
+ }
+
+ public void setCertType(String certType) {
+ put(Constants.PR_CERTIFICATE_TYPE, certType);
+ }
+
+ public String getSubmitMethod() {
+ return (String)get(SUBMIT_METHOD);
+ }
+
+ public String getCAType() {
+ return (String)get(CA_TYPE);
+ }
+
+ public boolean isNewKey() {
+ String isNew = (String)get(KEY_MATERIAL);
+ if (isNew != null && isNew.equals(Constants.TRUE))
+ return true;
+ return false;
+ }
+
+ public String getOperationType() {
+ String opType = (String)get(OPTYPE);
+ return opType;
+ }
+
+ public boolean isSSLCertLocalCA() {
+ String val = (String)get(ConfigConstants.PR_SSLCERT_LOCALCA);
+ if (val == null)
+ return false;
+ else if (val.equals(Constants.TRUE))
+ return true;
+ return false;
+ }
+
+ // set true or false
+ public void setSSLCertLocalCA(String val) {
+ put(ConfigConstants.PR_SSLCERT_LOCALCA, val);
+ }
+
+ public byte[] getDERValue() {
+ byte[] derValue = (byte[])get(DERVALUE);
+ return derValue;
+ }
+
+ public String getTokenName() {
+ return (String)get(TOKENNAME);
+ }
+
+ public String getKeyLength() {
+ return (String)get(Constants.PR_KEY_LENGTH);
+ }
+
+ public String getKeyCurveName() {
+ return (String)get(Constants.PR_KEY_CURVENAME);
+ }
+
+ public String getKeyType() {
+ return (String)get(Constants.PR_KEY_TYPE);
+ }
+
+ public String getSubjectName() {
+ return (String)get(Constants.PR_SUBJECT_NAME);
+ }
+
+ public void setSubjectName(String str) {
+ put(Constants.PR_SUBJECT_NAME, str);
+ }
+
+ public String getCSR() {
+ return (String)get(Constants.PR_CSR);
+ }
+
+ public String getPKCS10() {
+ String val = (String)get(Constants.PR_PKCS10);
+ if (val != null && !val.equals(""))
+ return val;
+ return null;
+ }
+
+ public void setPKCS10(String b64E) {
+ put(Constants.PR_PKCS10, b64E);
+ }
+
+ public String getCertFilePath() {
+ String val = (String)get(Constants.PR_CERT_FILEPATH);
+ if (val != null && !val.equals(""))
+ return val;
+ return null;
+ }
+
+ public void setCertFilePath(String path) {
+ put(Constants.PR_CERT_FILEPATH, path);
+ }
+
+ public String getCertSubjectName() {
+ return (String)get(Constants.PR_CERT_SUBJECT_NAME);
+ }
+
+ public String getIssuerName() {
+ return (String)get(Constants.PR_ISSUER_NAME);
+ }
+
+ public String getSerialNumber() {
+ return (String)get(Constants.PR_SERIAL_NUMBER);
+ }
+
+ public String getNotBefore() {
+ return (String)get(Constants.PR_BEFORE_VALIDDATE);
+ }
+
+ public String getNotAfter() {
+ return (String)get(Constants.PR_AFTER_VALIDDATE);
+ }
+
+ public String getInstallCertType() {
+ return (String)get(INSTALLCERTTYPE);
+ }
+
+ public String getValidityPeriod() {
+ return (String)get(Constants.PR_VALIDITY_PERIOD);
+ }
+
+ public String getTokenList() {
+ return (String)get(Constants.PR_TOKEN_LIST);
+ }
+
+ public Boolean isCertAdded() {
+ return (Boolean)get(Constants.PR_ADD_CERT);
+ }
+
+ public NameValuePairs getNameValuePairs() {
+ return (NameValuePairs)get(ALL_INFO);
+ }
+
+ public String getBeginYear() {
+ return (String)get(Constants.PR_BEGIN_YEAR);
+ }
+
+ public String getBeginMonth() {
+ return (String)get(Constants.PR_BEGIN_MONTH);
+ }
+
+ public String getBeginDate() {
+ return (String)get(Constants.PR_BEGIN_DATE);
+ }
+
+ public String getBeginHour() {
+ return (String)get(Constants.PR_BEGIN_HOUR);
+ }
+
+ public String getBeginMin() {
+ return (String)get(Constants.PR_BEGIN_MIN);
+ }
+
+ public String getBeginSec() {
+ return (String)get(Constants.PR_BEGIN_SEC);
+ }
+
+ public String getAfterYear() {
+ return (String)get(Constants.PR_AFTER_YEAR);
+ }
+
+ public String getAfterMonth() {
+ return (String)get(Constants.PR_AFTER_MONTH);
+ }
+
+ public String getAfterDate() {
+ return (String)get(Constants.PR_AFTER_DATE);
+ }
+
+ public String getAfterHour() {
+ return (String)get(Constants.PR_AFTER_HOUR);
+ }
+
+ public String getAfterMin() {
+ return (String)get(Constants.PR_AFTER_MIN);
+ }
+
+ public String getAfterSec() {
+ return (String)get(Constants.PR_AFTER_SEC);
+ }
+
+ public String getNickname() {
+ return (String)get(Constants.PR_NICKNAME);
+ }
+
+ public String getCertContent() {
+ return (String)get(Constants.PR_CERT_CONTENT);
+ }
+
+ public String getHashType() {
+ return (String)get(ConfigConstants.PR_HASH_TYPE);
+ }
+
+ public void setHashType(String type) {
+ put(ConfigConstants.PR_HASH_TYPE, type);
+ }
+
+ public String getSignedByType() {
+ return (String)get(ConfigConstants.PR_SIGNEDBY_TYPE);
+ }
+
+ public void setSignedByType(String type) {
+ put(ConfigConstants.PR_SIGNEDBY_TYPE, type);
+ }
+
+
+ public boolean isLoggedIn() {
+ String value = (String)get(Constants.PR_LOGGED_IN);
+ if (value != null && value.equals(Constants.FALSE))
+ return false;
+ return true;
+ }
+
+ public String getCertRequestDir() {
+ return (String)get(Constants.PR_CERT_REQUEST_DIR);
+ }
+
+ public void setCMHost(String host) {
+ put(ConfigConstants.CA_HOST, host);
+ }
+
+ public String getCMHost() {
+ return (String)get(ConfigConstants.CA_HOST);
+ }
+
+ public void setCMEEPort(String port) {
+ put(ConfigConstants.CA_EEPORT, port);
+ }
+
+ public String getCMEEPort() {
+ return (String)get(ConfigConstants.CA_EEPORT);
+ }
+
+ public void setCMEEType(String type) {
+ put(ConfigConstants.CA_EETYPE, type);
+ }
+
+ public String getCMEEType() {
+ return (String)get(ConfigConstants.CA_EETYPE);
+ }
+
+ public void setRequestStatus(String requestStatus) {
+ put(getCertType()+ConfigConstants.PR_CERT_REQUEST+"Status", requestStatus);
+ }
+
+ public String getRequestStatus() {
+ return (String)get(getCertType()+ConfigConstants.PR_CERT_REQUEST+"Status");
+ }
+
+ public void setRequestID(String requestID) {
+ put(getCertType()+ConfigConstants.PR_CERT_REQUEST, requestID);
+ }
+
+ public String getRequestID() {
+ return (String)get(getCertType()+ConfigConstants.PR_CERT_REQUEST);
+ }
+
+ public void setRequestSent(boolean sent) {
+ if (sent)
+ put(getCertType()+"Sent", ConfigConstants.TRUE);
+ else
+ put(getCertType()+"Sent", ConfigConstants.FALSE);
+ }
+
+ public boolean requestSent() {
+ String str = (String)get(getCertType()+"Sent");
+ if (str == null || str.equals(ConfigConstants.FALSE))
+ return false;
+ return true;
+ }
+
+ public void setRequestError(String error) {
+ put(getCertType()+"Error", error);
+ }
+
+ public String getRequestError() {
+ return (String)get(getCertType()+"Error");
+ }
+
+ public void setCertSubType(String str) {
+ put(Constants.PR_CERTIFICATE_SUBTYPE, str);
+ }
+
+ public String getCertSubType() {
+ return (String)get(Constants.PR_CERTIFICATE_SUBTYPE);
+ }
+
+ public void setNicknames(String str) {
+ put(Constants.PR_ALL_NICKNAMES, str);
+ }
+
+ public String getNicknames() {
+ return (String)get(Constants.PR_ALL_NICKNAMES);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/keycert/WCACertRequest1Page.java b/base/console/src/com/netscape/admin/certsrv/keycert/WCACertRequest1Page.java
new file mode 100644
index 000000000..fe5ebd2d7
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/keycert/WCACertRequest1Page.java
@@ -0,0 +1,237 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.keycert;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Certificate Request from certificate setup wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.keycert
+ */
+class WCACertRequest1Page extends WizardBasePanel implements IWizardPanel {
+ private JTextArea mMethodText;
+ private JRadioButton mCABtn;
+ private JRadioButton mSubBtn;
+ private JRadioButton mExistingKeyBtn;
+ private JRadioButton mNewKeyBtn;
+ private JRadioButton mEmailBtn;
+ private JRadioButton mURLBtn;
+ private JRadioButton mManualBtn;
+ private Color mActiveColor;
+ private static final String PANELNAME = "CACERTREQUESTWIZARD";
+ private static final String HELPINDEX =
+ "configuration-kra-wizard-change-keyscheme-help";
+
+ WCACertRequest1Page() {
+ super(PANELNAME);
+ init();
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ if (wizardInfo.getOperationType().equals(wizardInfo.INSTALLTYPE))
+ return false;
+
+ if (wizardInfo.getCertType().equals(Constants.PR_CA_SIGNING_CERT))
+ return true;
+
+ return false;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ JLabel caLbl = makeJLabel("CATYPE");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(caLbl, gbc);
+
+ mCABtn = makeJRadioButton("SELFSIGN", true);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0,4*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mCABtn, gbc);
+
+ mSubBtn = makeJRadioButton("SUBORDINATE", false);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0,4*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mSubBtn, gbc);
+
+ ButtonGroup caGroup = new ButtonGroup();
+ caGroup.add(mCABtn);
+ caGroup.add(mSubBtn);
+
+ JLabel keyLbl = makeJLabel("KEYPAIR");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(keyLbl, gbc);
+
+ mExistingKeyBtn = makeJRadioButton("OLDKEY", true);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0, 4*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mExistingKeyBtn, gbc);
+
+ mNewKeyBtn = makeJRadioButton("NEWKEY", true);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0, 4*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mNewKeyBtn, gbc);
+
+ ButtonGroup keyGroup = new ButtonGroup();
+ keyGroup.add(mExistingKeyBtn);
+ keyGroup.add(mNewKeyBtn);
+
+ mMethodText = createTextArea(
+ CMSAdminUtil.wrapText(mResource.getString(
+ "CACERTREQUESTWIZARD_TEXT_METHOD_LABEL"), 100), 1, 100);
+ mActiveColor = mMethodText.getBackground();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mMethodText, gbc);
+
+ mEmailBtn = makeJRadioButton("EMAIL", true);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0, 4*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mEmailBtn, gbc);
+
+ mURLBtn = makeJRadioButton("URL", false);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0, 4*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mURLBtn, gbc);
+
+ mManualBtn = makeJRadioButton("MANUAL", false);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0, 4*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ add(mManualBtn, gbc);
+
+ ButtonGroup methodGroup = new ButtonGroup();
+ methodGroup.add(mEmailBtn);
+ methodGroup.add(mURLBtn);
+ methodGroup.add(mManualBtn);
+
+ enableFields(false, getBackground());
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+
+ if (mCABtn.isSelected())
+ wizardInfo.addEntry(wizardInfo.CA_TYPE, wizardInfo.SELF_SIGNED);
+ else if (mSubBtn.isSelected())
+ wizardInfo.addEntry(wizardInfo.CA_TYPE, wizardInfo.SUBORDINATE_CA);
+
+ if (mNewKeyBtn.isSelected())
+ wizardInfo.addEntry(wizardInfo.KEY_MATERIAL, Constants.TRUE);
+ else if (mExistingKeyBtn.isSelected())
+ wizardInfo.addEntry(wizardInfo.KEY_MATERIAL, Constants.FALSE);
+
+ if (mEmailBtn.isSelected())
+ wizardInfo.addEntry(wizardInfo.SUBMIT_METHOD, wizardInfo.CA_EMAIL);
+ else if (mURLBtn.isSelected())
+ wizardInfo.addEntry(wizardInfo.SUBMIT_METHOD, wizardInfo.CA_URL);
+ else if (mManualBtn.isSelected())
+ wizardInfo.addEntry(wizardInfo.SUBMIT_METHOD, wizardInfo.MANUAL);
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mCABtn))
+ if (mCABtn.isSelected())
+ enableFields(false, getBackground());
+ else
+ enableFields(true, mActiveColor);
+ else if (e.getSource().equals(mSubBtn))
+ if (mSubBtn.isSelected())
+ enableFields(true, mActiveColor);
+ else
+ enableFields(false, getBackground());
+ }
+
+ private void enableFields(boolean enable, Color color) {
+ mMethodText.setEnabled(enable);
+ mEmailBtn.setEnabled(enable);
+ mURLBtn.setEnabled(enable);
+ mManualBtn.setEnabled(enable);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/keycert/WCAKeyPage.java b/base/console/src/com/netscape/admin/certsrv/keycert/WCAKeyPage.java
new file mode 100644
index 000000000..fe06a6313
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/keycert/WCAKeyPage.java
@@ -0,0 +1,102 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.keycert;
+
+import java.awt.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+
+/**
+ * Setup CA signing cert for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WCAKeyPage extends WBaseKeyPage implements IWizardPanel {
+ private static final String PANELNAME = "CAKEYWIZARD";
+ private static final String HELPINDEX =
+ "configuration-kra-wizard-change-keyscheme-help";
+
+ WCAKeyPage() {
+ super(PANELNAME);
+ init();
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ if (wizardInfo.getOperationType().equals(wizardInfo.INSTALLTYPE))
+ // (wizardInfo.isNewKey()))
+ return false;
+
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+/*
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ AdminConnection connection = wizardInfo.getAdminConnection();
+ NameValuePairs nvps = new NameValuePairs();
+
+ nvps.add(Constants.PR_TOKEN_NAME, wizardInfo.getTokenName());
+ nvps.add(Constants.PR_KEY_LENGTH, (String)mKeyLengthBox.getSelectedItem());
+ nvps.add(Constants.PR_KEY_TYPE, (String)mKeyTypeBox.getSelectedItem());
+
+ try {
+ NameValuePairs response = connection.process(
+ DestDef.DEST_SERVER_ADMIN,
+ ScopeDef.SC_CA_SIGNINGCERT,
+ Constants.PR_CERT_REQUEST, nvps);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ return false;
+ }
+*/
+
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ super.init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ wizardInfo.addEntry(Constants.PR_KEY_LENGTH,
+ (String)mKeyLengthBox.getSelectedItem());
+ wizardInfo.addEntry(Constants.PR_KEY_TYPE,
+ (String)mKeyTypeBox.getSelectedItem());
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/keycert/WCertDNPage.java b/base/console/src/com/netscape/admin/certsrv/keycert/WCertDNPage.java
new file mode 100644
index 000000000..1c2268bb2
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/keycert/WCertDNPage.java
@@ -0,0 +1,196 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.keycert;
+
+import javax.swing.*;
+import javax.swing.border.*;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+
+/**
+ * CA signing cert for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WCertDNPage extends WBaseDNPage implements IWizardPanel {
+ private static final String PANELNAME = "CERTDNWIZARD";
+ private static final String HELPINDEX =
+ "configuration-keycert-wizard-subjectdn-help";
+
+ private String certType = "";
+
+ WCertDNPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WCertDNPage(JDialog parent, JFrame frame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = frame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_SUBJECT_NAME, wizardInfo.getSubjectName());
+ wizardInfo.addEntry(wizardInfo.ALL_INFO, nvps);
+
+ if (wizardInfo.getOperationType().equals(wizardInfo.INSTALLTYPE) ||
+ !wizardInfo.isNewKey())
+ return false;
+
+ String title = "";
+ certType = wizardInfo.getCertType();
+ if (certType.equals(Constants.PR_CA_SIGNING_CERT))
+ title = mResource.getString("CERTDNWIZARD_BORDER_CASIGNING_LABEL");
+ else if (certType.equals(Constants.PR_OCSP_SIGNING_CERT))
+ title = mResource.getString("CERTDNWIZARD_BORDER_OCSPSIGNING_LABEL");
+ else if (certType.equals(Constants.PR_RA_SIGNING_CERT))
+ title = mResource.getString("CERTDNWIZARD_BORDER_RASIGNING_LABEL");
+ else if (certType.equals(Constants.PR_KRA_TRANSPORT_CERT))
+ title = mResource.getString("CERTDNWIZARD_BORDER_KRATRANSPORT_LABEL");
+ else if (certType.equals(Constants.PR_SERVER_CERT) ||
+ certType.equals(Constants.PR_SERVER_CERT_RADM))
+ title = mResource.getString("CERTDNWIZARD_BORDER_SERVER_LABEL");
+ else if (certType.equals(Constants.PR_OTHER_CERT))
+ title = mResource.getString("CERTDNWIZARD_BORDER_OTHER_LABEL");
+ setBorder(new TitledBorder(title));
+
+/*
+ if (wizardInfo.getOperationType().equals(wizardInfo.INSTALLTYPE) ||
+ (wizardInfo.getCAType().equals(wizardInfo.SELF_SIGNED)))
+ return false;
+*/
+
+ String subjectName = wizardInfo.getSubjectName();
+
+ //mSubjectStringText.setText(subjectName)
+
+ //dnDesc.setText(subjectName);
+ //enableFields(true, mActiveColor);
+ if (subjectName != null)
+ populateDN(subjectName);
+ return true;
+ }
+
+ public boolean validatePanel() {
+ if (certType.equals(Constants.PR_SERVER_CERT_RADM))
+ return true;
+ return super.validatePanel();
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ startProgressStatus();
+ String str1 = mSubjectDNText.getText().trim();
+ String str2 = mSubjectStringText.getText().trim();
+ String str = "";
+
+ if (mDNComponents.isSelected()) {
+ str = str1;
+ } else {
+ str = str2;
+ }
+
+ if (str.equals("")) {
+ setErrorMessage("BLANKFIELD");
+ return false;
+ //str = dnDesc.getText().trim();
+ }
+
+ str = CMSAdminUtil.getPureString(str);
+
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ AdminConnection connection = wizardInfo.getAdminConnection();
+ NameValuePairs nvps = new NameValuePairs();
+
+ nvps.put(Constants.PR_SUBJECT_NAME, str);
+ wizardInfo.addEntry(Constants.PR_SUBJECT_NAME, str);
+
+ try {
+ connection.validate(DestDef.DEST_SERVER_ADMIN,
+ ScopeDef.SC_SUBJECT_NAME, nvps);
+ } catch (EAdminException e) {
+ //showErrorDialog(e.toString());
+ setErrorMessage(e.toString());
+ endProgressStatus();
+ return false;
+ }
+
+ if (wizardInfo.isNewKey()) {
+ String type = wizardInfo.getKeyType();
+ if (type.equals("ECC")) {
+ nvps.put(Constants.PR_KEY_CURVENAME, wizardInfo.getKeyCurveName());
+ } else {
+ nvps.put(Constants.PR_KEY_LENGTH, wizardInfo.getKeyLength());
+ }
+
+ nvps.put(Constants.PR_KEY_TYPE, type);
+ nvps.put(Constants.PR_TOKEN_NAME, wizardInfo.getTokenName());
+ }
+
+ wizardInfo.addEntry(wizardInfo.ALL_INFO, nvps);
+/*
+ try {
+ NameValuePairs response = connection.process(
+ DestDef.DEST_SERVER_ADMIN,
+ ScopeDef.SC_CERT_REQUEST, wizardInfo.getCertType(), nvps);
+ for (int i=0; i<response.size(); i++) {
+ NameValuePair nvp = response.elementAt(i);
+ String key = nvp.getName();
+ String value = nvp.getValue();
+ if (key.equals(Constants.PR_CSR)) {
+ wizardInfo.addEntry(Constants.PR_CSR, value);
+ break;
+ }
+ }
+ } catch (EAdminException e) {
+ //showErrorDialog(e.toString());
+ setErrorMessage(e.toString());
+ return false;
+ }
+*/
+
+ endProgressStatus();
+ wizardInfo.setSubjectName(str);
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/keycert/WCertDNValidityPage.java b/base/console/src/com/netscape/admin/certsrv/keycert/WCertDNValidityPage.java
new file mode 100644
index 000000000..d6359cf6c
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/keycert/WCertDNValidityPage.java
@@ -0,0 +1,100 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.keycert;
+
+import java.awt.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+
+/**
+ * CA signing cert for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WCertDNValidityPage extends WBaseDNValidityPage implements IWizardPanel {
+ private static final String PANELNAME = "CERTDNVALIDWIZARD";
+ private static final String HELPINDEX =
+ "configuration-kra-wizard-change-keyscheme-help";
+
+ WCertDNValidityPage() {
+ super(PANELNAME);
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ if (wizardInfo.getOperationType().equals(wizardInfo.INSTALLTYPE) ||
+ (wizardInfo.getCAType().equals(wizardInfo.SUBORDINATE_CA)))
+ return false;
+
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ String str = mSubjectDNText.getText().trim();
+
+ if (str.equals("")) {
+ setErrorMessage("BLANKFIELD");
+ return false;
+ }
+
+ str = CMSAdminUtil.getPureString(str);
+
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ wizardInfo.addEntry(Constants.PR_SUBJECT_NAME, str);
+
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ String valid = mValidityText.getText().trim();
+ int period = Integer.parseInt(valid);
+ int index = mUnitBox.getSelectedIndex();
+
+ if (index == 1) {
+ period = period*30;
+ } else if (index == 2) {
+ period = period*365;
+ }
+ wizardInfo.addEntry(Constants.PR_VALIDITY_PERIOD, ""+period);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/keycert/WCertExtensionPage.java b/base/console/src/com/netscape/admin/certsrv/keycert/WCertExtensionPage.java
new file mode 100644
index 000000000..f7505be2e
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/keycert/WCertExtensionPage.java
@@ -0,0 +1,273 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.keycert;
+
+import javax.swing.border.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+
+/**
+ * Certificate Extension for setup wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WCertExtensionPage extends WBaseCertExtensionPage implements
+ IWizardPanel {
+ private static final String PANELNAME = "CERTEXTENSION1WIZARD";
+ private static final String HELPINDEX =
+ "configuration-keycert-wizard-extension-help";
+
+ WCertExtensionPage(JDialog parent) {
+ super(PANELNAME);
+ mPanelName = PANELNAME;
+ mParent = parent;
+ init();
+ }
+
+ WCertExtensionPage(JDialog parent, JFrame frame) {
+ super(PANELNAME);
+ mPanelName = PANELNAME;
+ mParent = parent;
+ mAdminFrame = frame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ //System.out.println("extension");
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ if (wizardInfo.getOperationType().equals(wizardInfo.INSTALLTYPE))
+ return false;
+
+ if (wizardInfo.getCAType().equals(wizardInfo.SUBORDINATE_CA)
+ && !(wizardInfo.isSSLCertLocalCA()))
+ return false;
+
+ String title = "";
+
+ if (!mModified) {
+ String certType = wizardInfo.getCertType();
+ if (certType.equals(Constants.PR_CA_SIGNING_CERT)) {
+ title = mResource.getString(
+ "CERTEXTENSION1WIZARD_BORDER_CASIGNING_LABEL");
+ mBasicCheckBox.setSelected(true);
+ mAKICheckBox.setSelected(true);
+ mCACheckBox.setSelected(true);
+ mSKICheckBox.setSelected(true);
+ mCertPathBox.setSelected(false);
+ mExtendedKeyCheckBox.setSelected(false);
+ mExtendedKeyCheckBox.setEnabled(true);
+ mKeyUsageBox.setSelected(true);
+ mOCSPNoCheck.setSelected(false);
+ mOCSPNoCheck.setEnabled(true);
+ mAIACheckBox.setSelected(true);
+ } else if (certType.equals(Constants.PR_OCSP_SIGNING_CERT)) {
+ title = mResource.getString(
+ "CERTEXTENSION1WIZARD_BORDER_OCSPSIGNING_LABEL");
+ mKeyUsageBox.setSelected(true);
+ mSKICheckBox.setSelected(false);
+ mSKICheckBox.setEnabled(true);
+ mBasicCheckBox.setEnabled(false);
+ mAKICheckBox.setSelected(true);
+ mAKICheckBox.setEnabled(true);
+ mCACheckBox.setSelected(false);
+ mCACheckBox.setEnabled(false);
+ mCertPathBox.setEnabled(false);
+ mExtendedKeyCheckBox.setSelected(true);
+ mOCSPSigning.setSelected(true);
+ mOCSPNoCheck.setSelected(false);
+ mOCSPNoCheck.setEnabled(true);
+ mAIACheckBox.setSelected(true);
+ } else if (certType.equals(Constants.PR_RA_SIGNING_CERT)) {
+ title = mResource.getString(
+ "CERTEXTENSION1WIZARD_BORDER_RASIGNING_LABEL");
+ mAKICheckBox.setSelected(true);
+ mExtendedKeyCheckBox.setSelected(true);
+ mSSLClient.setSelected(true);
+ } else if (certType.equals(Constants.PR_KRA_TRANSPORT_CERT)) {
+ title = mResource.getString(
+ "CERTEXTENSION1WIZARD_BORDER_KRATRANSPORT_LABEL");
+ mAKICheckBox.setSelected(true);
+ } else if (certType.equals(Constants.PR_SERVER_CERT)) {
+ title = mResource.getString(
+ "CERTEXTENSION1WIZARD_BORDER_SERVER_LABEL");
+ mExtendedKeyCheckBox.setSelected(true);
+ mSSLServer.setSelected(true);
+ mAKICheckBox.setSelected(true);
+ mSKICheckBox.setSelected(false);
+ mSKICheckBox.setEnabled(true);
+ mOCSPNoCheck.setSelected(false);
+ mOCSPNoCheck.setEnabled(true);
+ mAIACheckBox.setSelected(true);
+ } else if (certType.equals(Constants.PR_SERVER_CERT_RADM)) {
+ title = mResource.getString(
+ "CERTEXTENSION1WIZARD_BORDER_SERVER_LABEL");
+ mExtendedKeyCheckBox.setSelected(true);
+ mAKICheckBox.setSelected(true);
+ mSSLServer.setSelected(true);
+ }
+ }
+
+ setBorder(new TitledBorder(title));
+
+ return super.initializePanel(info);
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+
+ if (mMIMECheckBox.isSelected()) {
+ startProgressStatus();
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(ConfigConstants.PR_CERTIFICATE_EXTENSION, mMIMEText.getText().trim());
+ AdminConnection connection = wizardInfo.getAdminConnection();
+ try {
+ connection.validate(
+ DestDef.DEST_SERVER_ADMIN, ScopeDef.SC_CERTIFICATE_EXTENSION, nvps);
+ } catch (EAdminException e) {
+ setErrorMessage(e.toString());
+ return false;
+ }
+ endProgressStatus();
+ }
+
+ NameValuePairs nvps = new NameValuePairs();
+
+ nvps.put(Constants.PR_SUBJECT_NAME, wizardInfo.getSubjectName());
+ if (wizardInfo.isNewKey()) {
+ String type = wizardInfo.getKeyType();
+ if (type.equals("ECC")) {
+ nvps.put(Constants.PR_KEY_CURVENAME, wizardInfo.getKeyCurveName());
+ } else {
+ nvps.put(Constants.PR_KEY_LENGTH, wizardInfo.getKeyLength());
+ }
+ nvps.put(Constants.PR_KEY_TYPE, type);
+ nvps.put(Constants.PR_TOKEN_NAME, wizardInfo.getTokenName());
+ }
+ //nvps.add(Constants.PR_VALIDITY_PERIOD, wizardInfo.getValidityPeriod());
+ addValidityPeriod(wizardInfo, nvps);
+
+ if (mBasicCheckBox.isSelected())
+ addBasicConstraints(nvps);
+
+ if (mExtendedKeyCheckBox.isSelected())
+ addExtendedKey(nvps);
+
+ if (mAIACheckBox.isSelected())
+ nvps.put(Constants.PR_AIA, Constants.TRUE);
+
+ if (mAKICheckBox.isSelected())
+ nvps.put(Constants.PR_AKI, Constants.TRUE);
+
+ if (mSKICheckBox.isSelected())
+ nvps.put(Constants.PR_SKI, Constants.TRUE);
+
+ if (mOCSPNoCheck.isSelected())
+ nvps.put(Constants.PR_OCSP_NOCHECK, Constants.TRUE);
+
+ if (mKeyUsageBox.isSelected())
+ nvps.put(Constants.PR_KEY_USAGE, Constants.TRUE);
+
+ if (mMIMECheckBox.isSelected())
+ nvps.put(Constants.PR_DER_EXTENSION, mMIMEText.getText().trim());
+
+ wizardInfo.addEntry(wizardInfo.ALL_INFO, nvps);
+
+ mModified = true;
+ return true;
+ }
+
+ private void addValidityPeriod(CertSetupWizardInfo wizardInfo,
+ NameValuePairs nvps) {
+ nvps.put(Constants.PR_BEGIN_YEAR, wizardInfo.getBeginYear());
+ nvps.put(Constants.PR_BEGIN_MONTH, wizardInfo.getBeginMonth());
+ nvps.put(Constants.PR_BEGIN_DATE, wizardInfo.getBeginDate());
+ nvps.put(Constants.PR_BEGIN_HOUR, wizardInfo.getBeginHour());
+ nvps.put(Constants.PR_BEGIN_MIN, wizardInfo.getBeginMin());
+ nvps.put(Constants.PR_BEGIN_SEC, wizardInfo.getBeginSec());
+ nvps.put(Constants.PR_AFTER_YEAR, wizardInfo.getAfterYear());
+ nvps.put(Constants.PR_AFTER_MONTH, wizardInfo.getAfterMonth());
+ nvps.put(Constants.PR_AFTER_DATE, wizardInfo.getAfterDate());
+ nvps.put(Constants.PR_AFTER_HOUR, wizardInfo.getAfterHour());
+ nvps.put(Constants.PR_AFTER_MIN, wizardInfo.getAfterMin());
+ nvps.put(Constants.PR_AFTER_SEC, wizardInfo.getAfterSec());
+ }
+
+ private void addBasicConstraints(NameValuePairs nvps) {
+
+ if (mCACheckBox.isSelected())
+ nvps.put(Constants.PR_IS_CA, Constants.TRUE);
+
+ String certLen = mCertPathText.getText().trim();
+ if (!certLen.equals(""))
+ nvps.put(Constants.PR_CERT_LEN, certLen);
+ }
+
+ private void addExtendedKey(NameValuePairs nvps) {
+
+ if (mSSLClient.isSelected())
+ nvps.put(Constants.PR_SSL_CLIENT_BIT, Constants.TRUE);
+ if (mSSLServer.isSelected())
+ nvps.put(Constants.PR_SSL_SERVER_BIT, Constants.TRUE);
+ if (mSSLMail.isSelected())
+ nvps.put(Constants.PR_SSL_MAIL_BIT, Constants.TRUE);
+ if (mObjectSigning.isSelected())
+ nvps.put(Constants.PR_OBJECT_SIGNING_BIT, Constants.TRUE);
+ if (mTimeStamping.isSelected())
+ nvps.put(Constants.PR_TIMESTAMPING_BIT, Constants.TRUE);
+ if (mOCSPSigning.isSelected())
+ nvps.put(Constants.PR_OCSP_SIGNING, Constants.TRUE);
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+
+ private String getScope(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ String certType = wizardInfo.getCertType();
+ String scope = "";
+ if (certType.equals(Constants.PR_CA_SIGNING_CERT)) {
+ scope = ScopeDef.SC_CA_SIGNINGCERT;
+ } else if (certType.equals(Constants.PR_RA_SIGNING_CERT)) {
+ scope = ScopeDef.SC_RA_SIGNINGCERT;
+ } else if (certType.equals(Constants.PR_KRA_TRANSPORT_CERT)) {
+ scope = ScopeDef.SC_KRA_TRANSPORTCERT;
+ } else if (certType.equals(Constants.PR_SERVER_CERT)) {
+ scope = ScopeDef.SC_SERVER_CERT;
+ }
+
+ return scope;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/keycert/WCertMessageDigestPage.java b/base/console/src/com/netscape/admin/certsrv/keycert/WCertMessageDigestPage.java
new file mode 100644
index 000000000..a378e91d3
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/keycert/WCertMessageDigestPage.java
@@ -0,0 +1,113 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.keycert;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.text.*;
+import javax.swing.border.*;
+import javax.swing.event.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+import com.netscape.admin.certsrv.task.*;
+
+/**
+ * Setup the message digest information for the installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WCertMessageDigestPage extends WMessageDigestPage {
+
+ private static final String PANELNAME = "CERTMESSAGEDIGESTWIZARD";
+ private static final String HELPINDEX =
+ "configuration-keycert-wizard-messagedigest-help";
+
+ WCertMessageDigestPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ }
+
+ WCertMessageDigestPage(JDialog parent, JFrame adminFrame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = adminFrame;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ String certType = wizardInfo.getCertType();
+
+ mCAKeyType = (String)wizardInfo.get(Constants.PR_KEY_TYPE);
+
+ if (wizardInfo.getOperationType().equals(wizardInfo.INSTALLTYPE))
+ return false;
+
+ if ((wizardInfo.getCAType().equals(wizardInfo.SUBORDINATE_CA))
+ && !(wizardInfo.isSSLCertLocalCA()))
+ return false;
+
+ if (!wizardInfo.isNewKey())
+ return false;
+
+ if (wizardInfo.getCAType().equals(wizardInfo.SELF_SIGNED) &&
+ certType.equals(Constants.PR_CA_SIGNING_CERT)) {
+ enableSignedByFields(true);
+ } else {
+ enableSignedByFields(false);
+ }
+
+ if ((!certType.equals(Constants.PR_CA_SIGNING_CERT)) &&
+ (!certType.equals(Constants.PR_OCSP_SIGNING_CERT))) {
+
+ // (!certType.equals(Constants.PR_KRA_TRANSPORT_CERT))) {
+ // non-signing cert, algorithm specified by CA
+ return false;
+ }
+
+ return super.initializePanel(info);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ if (mDSAHashTypeBox.isVisible())
+ wizardInfo.setHashType((String)mDSAHashTypeBox.getSelectedItem());
+ else if (mECCHashTypeBox.isVisible())
+ wizardInfo.setHashType((String)mECCHashTypeBox.getSelectedItem());
+ else if (mRSAHashTypeBox.isVisible())
+ wizardInfo.setHashType((String)mRSAHashTypeBox.getSelectedItem());
+
+ if (mDSASignedByTypeBox.isVisible())
+ wizardInfo.setSignedByType((String)mDSASignedByTypeBox.getSelectedItem());
+ else if (mECCSignedByTypeBox.isVisible())
+ wizardInfo.setSignedByType((String)mECCSignedByTypeBox.getSelectedItem());
+ else if (mRSASignedByTypeBox.isVisible())
+ wizardInfo.setSignedByType((String)mRSASignedByTypeBox.getSelectedItem());
+
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/keycert/WCertRequestPage.java b/base/console/src/com/netscape/admin/certsrv/keycert/WCertRequestPage.java
new file mode 100644
index 000000000..8fa126148
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/keycert/WCertRequestPage.java
@@ -0,0 +1,81 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.keycert;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+
+/**
+ * Introduction page for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WCertRequestPage extends WBaseCertRequestPage implements IWizardPanel {
+ private static final String PANELNAME = "COPYCERTREQUESTWIZARD";
+ private static final String HELPINDEX =
+ "configuration-kra-wizard-change-keyscheme-help";
+
+ WCertRequestPage() {
+ super(PANELNAME);
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+
+ if (wizardInfo.getOperationType().equals(wizardInfo.INSTALLTYPE) ||
+ wizardInfo.getCAType().equals(wizardInfo.SELF_SIGNED))
+ return false;
+
+ String str = wizardInfo.getCSR();
+// mText.setText(CMSAdminUtil.certRequestWrapText(str, 40));
+ mText.setText(str);
+ setBorder(makeTitledBorder("COPYCERTREQUESTWIZARD"));
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/keycert/WCertTypePage.java b/base/console/src/com/netscape/admin/certsrv/keycert/WCertTypePage.java
new file mode 100644
index 000000000..88350fc32
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/keycert/WCertTypePage.java
@@ -0,0 +1,500 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.keycert;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Select certificate type from certificate setup wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.keycert
+ */
+class WCertTypePage extends WizardBasePanel implements IWizardPanel,
+ ItemListener {
+ private String mCASigningCert;
+ private String mRASigningCert;
+ private String mOCSPSigningCert;
+ private String mServerCert, mServerCertRadm, mOtherCert;
+ private String mKRATransportCert;
+ private JTextArea mCALbl;
+ private JRadioButton mCABtn;
+ private JRadioButton mSubBtn;
+ private JComboBox mCertBox;
+ private JTextArea mCertType;
+ private JTextField mCertTypeText;
+ private Color mActiveColor;
+ private static final String PANELNAME = "CERTTYPEWIZARD";
+ private static final String HELPINDEX =
+ "configuration-keycert-wizard-certtype-help";
+
+ WCertTypePage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WCertTypePage(JDialog parent, JFrame frame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = frame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ if (wizardInfo.getOperationType().equals(wizardInfo.INSTALLTYPE))
+ return false;
+
+ setBorder(makeTitledBorder(PANELNAME));
+ if (wizardInfo.getCertType() != null) {
+ return true;
+ }
+
+ AdminConnection connection = wizardInfo.getAdminConnection();
+ NameValuePairs nvps = new NameValuePairs();
+
+ try {
+ NameValuePairs response = connection.search(DestDef.DEST_SERVER_ADMIN,
+ ScopeDef.SC_SUBSYSTEM, nvps);
+
+ for (String name : response.keySet()) {
+ String type = response.get(name);
+
+ if (type.equals(Constants.PR_RA_INSTANCE))
+ mRASigningCert = mResource.getString(
+ "CERTTYPEWIZARD_LABEL_RASIGNINGCERT_LABEL");
+ else if (type.equals(Constants.PR_CA_INSTANCE))
+ mCASigningCert = mResource.getString(
+ "CERTTYPEWIZARD_LABEL_CASIGNINGCERT_LABEL");
+ else if (type.equals(Constants.PR_KRA_INSTANCE))
+ mKRATransportCert = mResource.getString(
+ "CERTTYPEWIZARD_LABEL_KRATRANSPORTCERT_LABEL");
+ }
+ } catch (EAdminException e) {
+ //showErrorDialog(e.toString());
+ setErrorMessage(e.toString());
+ }
+
+ mOCSPSigningCert = mResource.getString(
+ "CERTTYPEWIZARD_LABEL_OCSPSIGNINGCERT_LABEL");
+
+ mServerCert = mResource.getString(
+ "CERTTYPEWIZARD_LABEL_SERVERCERT_LABEL");
+
+ mServerCertRadm = mResource.getString(
+ "CERTTYPEWIZARD_LABEL_SERVERCERTRADM_LABEL");
+
+ mOtherCert = mResource.getString(
+ "CERTTYPEWIZARD_LABEL_OTHER_LABEL");
+
+ mCertBox.removeAllItems();
+
+ if (mCASigningCert != null)
+ mCertBox.addItem(mCASigningCert);
+
+ if (mRASigningCert != null)
+ mCertBox.addItem(mRASigningCert);
+
+ if (mKRATransportCert != null)
+ mCertBox.addItem(mKRATransportCert);
+
+ if (mOCSPSigningCert != null)
+ mCertBox.addItem(mOCSPSigningCert);
+
+ if (mServerCert != null)
+ mCertBox.addItem(mServerCert);
+
+/*
+ if (mServerCertRadm != null)
+ mCertBox.addItem(mServerCertRadm);
+*/
+
+ mCertBox.addItem(mOtherCert);
+ mCertBox.setSelectedIndex(0);
+
+ String certType = (String)mCertBox.getSelectedItem();
+
+ if (certType.equals(mOtherCert)) {
+ mCABtn.setEnabled(false);
+ mSubBtn.setEnabled(false);
+ mCALbl.setEnabled(false);
+ mCertType.setEnabled(true);
+ mCertTypeText.setEnabled(true);
+ mCertTypeText.setBackground(mActiveColor);
+ } else {
+ mCABtn.setEnabled(true);
+ mSubBtn.setEnabled(true);
+ mCALbl.setEnabled(true);
+ mCertType.setEnabled(false);
+ mCertTypeText.setEnabled(false);
+ mCertTypeText.setBackground(getBackground());
+ if ((mCASigningCert != null) && (certType.equals(mCASigningCert)))
+ enableFields(true,"casigning");
+ else if ((mCASigningCert != null) && (mOCSPSigningCert != null)
+ && (certType.equals(mOCSPSigningCert)))
+ enableFields(true,"ocspsigning");
+ else if ((mCASigningCert != null) && (mServerCert != null)
+ && (certType.equals(mServerCert)))
+ enableFields(true,"server");
+ else if ((mCASigningCert != null) && (mServerCertRadm != null)
+ && (certType.equals(mServerCertRadm)))
+ enableFields(true,"server");
+ else
+ enableFields(false,"other");
+ }
+
+ CMSAdminUtil.repaintComp(mCABtn);
+ CMSAdminUtil.repaintComp(mSubBtn);
+ CMSAdminUtil.repaintComp(mCALbl);
+ CMSAdminUtil.repaintComp(mCertType);
+ CMSAdminUtil.repaintComp(mCertTypeText);
+ return true;
+ }
+
+ public boolean validatePanel() {
+ String str = (String)mCertBox.getSelectedItem();
+ if (str.equals(mOtherCert)) {
+ if (mCertTypeText.getText().equals("")) {
+ setErrorMessage("BLANKCERTTYPE");
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ NameValuePairs nvps = new NameValuePairs();
+ AdminConnection connection = wizardInfo.getAdminConnection();
+ startProgressStatus();
+ String item = ((String)mCertBox.getSelectedItem()).trim();
+
+ if (mCASigningCert != null && item.equals(mCASigningCert.trim()))
+ wizardInfo.put(Constants.PR_CERTIFICATE_TYPE,
+ Constants.PR_CA_SIGNING_CERT);
+ else if (mRASigningCert != null && item.equals(mRASigningCert.trim()))
+ wizardInfo.put(Constants.PR_CERTIFICATE_TYPE,
+ Constants.PR_RA_SIGNING_CERT);
+ else if (mKRATransportCert != null &&
+ item.equals(mKRATransportCert.trim()))
+ wizardInfo.put(Constants.PR_CERTIFICATE_TYPE,
+ Constants.PR_KRA_TRANSPORT_CERT);
+ else if (mServerCert != null && item.equals(mServerCert.trim()))
+ wizardInfo.put(Constants.PR_CERTIFICATE_TYPE,
+ Constants.PR_SERVER_CERT);
+ else if (mServerCertRadm != null && item.equals(mServerCertRadm.trim()))
+ wizardInfo.put(Constants.PR_CERTIFICATE_TYPE,
+ Constants.PR_SERVER_CERT_RADM);
+ else if (mOCSPSigningCert != null && item.equals(mOCSPSigningCert.trim()))
+ wizardInfo.put(Constants.PR_CERTIFICATE_TYPE,
+ Constants.PR_OCSP_SIGNING_CERT);
+ else if (mOtherCert != null && item.equals(mOtherCert.trim()))
+ wizardInfo.put(Constants.PR_CERTIFICATE_TYPE,
+ Constants.PR_OTHER_CERT);
+
+ if (item.equals(mOtherCert.trim())) {
+ try {
+ NameValuePairs response = null;
+
+ response = connection.read(DestDef.DEST_SERVER_ADMIN,
+ ScopeDef.SC_GET_NICKNAMES, wizardInfo.getCertType(), nvps);
+ String value = response.get(Constants.PR_ALL_NICKNAMES);
+ wizardInfo.setNicknames(value);
+ } catch (EAdminException e) {
+ setErrorMessage(e.toString());
+ endProgressStatus();
+ return false;
+ }
+ }
+
+ endProgressStatus();
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+/*
+ JTextArea desc = createTextArea(
+ CMSAdminUtil.wrapText(mResource.getString(
+ "CERTTYPEWIZARD_TEXT_HEADING_LABEL"), 80), 1, 80);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+*/
+ JTextArea heading = createTextArea(mResource.getString(
+ PANELNAME+"_LABEL_HEADING_LABEL"));
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(heading, gbc);
+
+ JTextArea heading1 = createTextArea(mResource.getString(
+ PANELNAME+"_LABEL_HEADING1_LABEL"));
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(heading1, gbc);
+
+ mCertBox = new JComboBox();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(mCertBox, gbc);
+ mCertBox.addItemListener(this);
+
+ JLabel dummy = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(dummy, gbc);
+
+ mCertType = createTextArea(mResource.getString(
+ PANELNAME+"_LABEL_CERTTYPE_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mCertType, gbc);
+
+/*
+ JLabel dummy1 = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(dummy1, gbc);
+*/
+
+ mCertTypeText = makeJTextField(10);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(mCertTypeText, gbc);
+ mActiveColor = mCertTypeText.getBackground();
+
+ JLabel dummy2 = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(dummy2, gbc);
+
+ mCALbl = createTextArea(mResource.getString(
+ "CERTTYPEWIZARD_TEXT_CATYPE_LABEL"));
+/*
+ mCALbl = makeJLabel("CATYPE");
+*/
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.insets = new Insets(2*COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ add(mCALbl, gbc);
+
+ mCABtn = makeJRadioButton("SELFSIGN", true);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mCABtn, gbc);
+
+ mSubBtn = makeJRadioButton("SUBORDINATE", false);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(0,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mSubBtn, gbc);
+
+ ButtonGroup caGroup = new ButtonGroup();
+ caGroup.add(mCABtn);
+ caGroup.add(mSubBtn);
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ String str = (String)mCertBox.getSelectedItem();
+
+ /*
+ if ((mCASigningCert == null) || (!str.equals(mCASigningCert))) {
+ wizardInfo.addEntry(wizardInfo.CA_TYPE, wizardInfo.SUBORDINATE_CA);
+ return;
+ }
+ */
+
+ if ((mCASigningCert != null) && (str.equals(mCASigningCert))) {
+ if (mCABtn.isSelected()) {
+ wizardInfo.addEntry(wizardInfo.CA_TYPE, wizardInfo.SELF_SIGNED);
+ } else if (mSubBtn.isSelected()) {
+ wizardInfo.addEntry(wizardInfo.CA_TYPE,
+ wizardInfo.SUBORDINATE_CA);
+ }
+ } else if ((mCASigningCert != null) && (mServerCert != null)
+ && (str.equals(mServerCert))) {
+ wizardInfo.addEntry(wizardInfo.CA_TYPE, wizardInfo.SUBORDINATE_CA);
+ if (mCABtn.isSelected())
+ wizardInfo.setSSLCertLocalCA(Constants.TRUE);
+ else if (mSubBtn.isSelected())
+ wizardInfo.setSSLCertLocalCA(Constants.FALSE);
+ } else if ((mCASigningCert != null) && (mServerCertRadm != null)
+ && (str.equals(mServerCertRadm))) {
+ wizardInfo.addEntry(wizardInfo.CA_TYPE, wizardInfo.SUBORDINATE_CA);
+ if (mCABtn.isSelected())
+ wizardInfo.setSSLCertLocalCA(Constants.TRUE);
+ else if (mSubBtn.isSelected())
+ wizardInfo.setSSLCertLocalCA(Constants.FALSE);
+ } else if ((mCASigningCert != null) && (mOCSPSigningCert != null)
+ && (str.equals(mOCSPSigningCert))) {
+ wizardInfo.addEntry(wizardInfo.CA_TYPE, wizardInfo.SUBORDINATE_CA);
+ if (mCABtn.isSelected())
+ wizardInfo.setSSLCertLocalCA(Constants.TRUE);
+ else if (mSubBtn.isSelected())
+ wizardInfo.setSSLCertLocalCA(Constants.FALSE);
+ } else if (mOtherCert != null && str.equals(mOtherCert)) {
+ wizardInfo.addEntry(wizardInfo.CA_TYPE, wizardInfo.SUBORDINATE_CA);
+ wizardInfo.setCertSubType(mCertTypeText.getText());
+ } else {
+ wizardInfo.addEntry(wizardInfo.CA_TYPE, wizardInfo.SUBORDINATE_CA);
+ }
+ }
+
+ public void itemStateChanged(ItemEvent e) {
+ if (e.getSource().equals(mCertBox)) {
+ String str = (String)mCertBox.getSelectedItem();
+ if (str == null)
+ return;
+
+ if (str.equals(mOtherCert)) {
+ mCABtn.setEnabled(false);
+ mSubBtn.setEnabled(false);
+ mCALbl.setEnabled(false);
+ mCertType.setEnabled(true);
+ mCertTypeText.setEnabled(true);
+ mCertTypeText.setBackground(mActiveColor);
+ } else {
+ mCABtn.setEnabled(true);
+ mSubBtn.setEnabled(true);
+ mCALbl.setEnabled(true);
+ mCertType.setEnabled(false);
+ mCertTypeText.setEnabled(false);
+ mCertTypeText.setBackground(getBackground());
+ if ((mCASigningCert != null) && (str.equals(mCASigningCert)))
+ enableFields(true,"casigning");
+ else if ((mCASigningCert != null) && (mOCSPSigningCert != null)
+ && (str.equals(mOCSPSigningCert)))
+ enableFields(true,"ocspsigning");
+ else if ((mCASigningCert != null) && (mServerCert != null)
+ && (str.equals(mServerCert)))
+ enableFields(true,"server");
+ else if ((mCASigningCert != null) && (mServerCertRadm != null)
+ && (str.equals(mServerCertRadm)))
+ enableFields(true,"server");
+ else
+ enableFields(false,"other");
+ }
+ CMSAdminUtil.repaintComp(mCertType);
+ CMSAdminUtil.repaintComp(mCertTypeText);
+ }
+ }
+
+ private void enableFields(boolean enable,String type) {
+ String label = null;
+ String b1 = null;
+ String b2 = null;
+ if (type.equals("casigning")) {
+ label =
+ mResource.getString("CERTTYPEWIZARD_TEXT_CATYPE_LABEL");
+ b1 =
+ mResource.getString("CERTTYPEWIZARD_RADIOBUTTON_SELFSIGN_LABEL");
+ b2 =
+ mResource.getString("CERTTYPEWIZARD_RADIOBUTTON_SUBORDINATE_LABEL");
+ } else if (type.equals("server")) {
+ label =
+ mResource.getString("CERTTYPEWIZARD_TEXT_SERVERTYPE_LABEL");
+ b1 =
+ mResource.getString("CERTTYPEWIZARD_RADIOBUTTON_SERVER_SELFSIGN_LABEL");
+ b2 =
+ mResource.getString("CERTTYPEWIZARD_RADIOBUTTON_SERVER_SUBORDINATE_LABEL");
+ } else if (type.equals("ocspsigning")) {
+ label =
+ mResource.getString("CERTTYPEWIZARD_TEXT_OCSPTYPE_LABEL");
+ b1 =
+ mResource.getString("CERTTYPEWIZARD_RADIOBUTTON_SELFSIGNOCSP_LABEL");
+ b2 =
+ mResource.getString("CERTTYPEWIZARD_RADIOBUTTON_SUBORDINATEOCSP_LABEL");
+ }
+
+ mCALbl.setEnabled(enable);
+ mCALbl.invalidate();
+ mCALbl.validate();
+ if (label != null) mCALbl.setText(label);
+ mCALbl.repaint(1);
+ mCABtn.setEnabled(enable);
+ mCABtn.invalidate();
+ mCABtn.validate();
+ if (b1 != null) mCABtn.setText(b1);
+ mCABtn.repaint(1);
+ mSubBtn.setEnabled(enable);
+ mSubBtn.invalidate();
+ mSubBtn.validate();
+ if (b2 != null) mSubBtn.setText(b2);
+ mSubBtn.repaint(1);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/keycert/WCertValidityPage.java b/base/console/src/com/netscape/admin/certsrv/keycert/WCertValidityPage.java
new file mode 100644
index 000000000..8567703d4
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/keycert/WCertValidityPage.java
@@ -0,0 +1,139 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.keycert;
+
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import javax.swing.event.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+
+/**
+ * CA signing cert for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WCertValidityPage extends WBaseValidityPage implements IWizardPanel {
+ private static final String PANELNAME = "CERTVALIDWIZARD";
+ private String mCertType = "";
+ private static final String HELPINDEX =
+ "configuration-keycert-wizard-validityperiod-help";
+
+ WCertValidityPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WCertValidityPage(JDialog parent, JFrame frame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = frame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ if (wizardInfo.getOperationType().equals(wizardInfo.INSTALLTYPE) )
+ return false;
+ if ((wizardInfo.getCAType().equals(wizardInfo.SUBORDINATE_CA))
+ && !(wizardInfo.isSSLCertLocalCA()))
+ return false;
+
+ String title = "";
+ mCertType = wizardInfo.getCertType();
+ if (mCertType.equals(Constants.PR_CA_SIGNING_CERT))
+ title = mResource.getString("CERTVALIDWIZARD_BORDER_CASIGNING_LABEL");
+ else if (mCertType.equals(Constants.PR_OCSP_SIGNING_CERT))
+ title = mResource.getString("CERTVALIDWIZARD_BORDER_OCSPSIGNING_LABEL");
+ else if (mCertType.equals(Constants.PR_RA_SIGNING_CERT))
+ title = mResource.getString("CERTVALIDWIZARD_BORDER_RASIGNING_LABEL");
+ else if (mCertType.equals(Constants.PR_KRA_TRANSPORT_CERT))
+ title = mResource.getString("CERTVALIDWIZARD_BORDER_KRATRANSPORT_LABEL");
+ else if (mCertType.equals(Constants.PR_SERVER_CERT) ||
+ mCertType.equals(Constants.PR_SERVER_CERT_RADM))
+ title = mResource.getString("CERTVALIDWIZARD_BORDER_SERVER_LABEL");
+ setBorder(new TitledBorder(title));
+
+ return true;
+ }
+
+ public boolean validatePanel() {
+ boolean status = super.validatePanel();
+ if (status && !mWarningDisplayed) {
+ Date currTime = new Date();
+ if (currTime.before(mBeforeDate)) {
+ if (mCertType.equals(Constants.PR_CA_SIGNING_CERT))
+ setErrorMessage("INVALIDCACERT");
+ else if (mCertType.equals(Constants.PR_OCSP_SIGNING_CERT))
+ setErrorMessage("INVALIDOCSPCERT");
+ else if (mCertType.equals(Constants.PR_RA_SIGNING_CERT))
+ setErrorMessage("INVALIDRACERT");
+ else if (mCertType.equals(Constants.PR_KRA_TRANSPORT_CERT))
+ setErrorMessage("INVALIDKRACERT");
+ else if (mCertType.equals(Constants.PR_SERVER_CERT))
+ setErrorMessage("INVALIDSSLCERT");
+ mWarningDisplayed = true;
+ return false;
+ }
+ }
+ return status;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ return true;
+ }
+
+ protected void init() {
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ wizardInfo.addEntry(Constants.PR_BEGIN_YEAR, mBYear.getText().trim());
+ int beforeMonth = Integer.parseInt(mBMonth.getText().trim());
+ wizardInfo.addEntry(Constants.PR_BEGIN_MONTH, ""+(beforeMonth-1));
+ wizardInfo.addEntry(Constants.PR_BEGIN_DATE, mBDay.getText().trim());
+ wizardInfo.addEntry(Constants.PR_BEGIN_HOUR, mBHour.getText().trim());
+ wizardInfo.addEntry(Constants.PR_BEGIN_MIN, mBMin.getText().trim());
+ wizardInfo.addEntry(Constants.PR_BEGIN_SEC, mBSec.getText().trim());
+ wizardInfo.addEntry(Constants.PR_AFTER_YEAR, mEYear.getText().trim());
+ int afterMonth = Integer.parseInt(mEMonth.getText().trim());
+ wizardInfo.addEntry(Constants.PR_AFTER_MONTH, ""+(afterMonth-1));
+ wizardInfo.addEntry(Constants.PR_AFTER_DATE, mEDay.getText().trim());
+ wizardInfo.addEntry(Constants.PR_AFTER_HOUR, mEHour.getText().trim());
+ wizardInfo.addEntry(Constants.PR_AFTER_MIN, mEMin.getText().trim());
+ wizardInfo.addEntry(Constants.PR_AFTER_SEC, mESec.getText().trim());
+ //wizardInfo.addEntry(Constants.PR_VALIDITY_PERIOD, ""+period);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/keycert/WDisplayCertPage.java b/base/console/src/com/netscape/admin/certsrv/keycert/WDisplayCertPage.java
new file mode 100644
index 000000000..a7fe56352
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/keycert/WDisplayCertPage.java
@@ -0,0 +1,258 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.keycert;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * This page is to install the certificate in the internal token. It
+ * displays the certificate information.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WDisplayCertPage extends WizardBasePanel implements IWizardPanel {
+ private CertSetupWizardInfo wizardInfo;
+ private JButton mAdd;
+ private boolean isAdd = false;
+ private static final String PANELNAME = "DISPLAYCERTWIZARD";
+ private static final String HELPINDEX =
+ "configuration-keycert-wizard-displaycert-help";
+ private JTextArea mTextArea;
+ private JTextField mCertNameField;
+ private Color mActiveColor;
+
+ WDisplayCertPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WDisplayCertPage(JDialog parent, JFrame frame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = frame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ wizardInfo = (CertSetupWizardInfo)info;
+ if (wizardInfo.getOperationType().equals(wizardInfo.REQUESTTYPE))
+ return false;
+
+ setBorder(makeTitledBorder(PANELNAME));
+ mTextArea.setText(wizardInfo.getCertContent());
+ if (wizardInfo.getInstallCertType().equals(Constants.PR_OTHER_CERT)) {
+ mCertNameField.setEditable(true);
+ mCertNameField.setBackground(mActiveColor);
+ mCertNameField.setEnabled(true);
+ } else {
+ mCertNameField.setEditable(false);
+ mCertNameField.setBackground(getBackground());
+ mCertNameField.setEnabled(false);
+ }
+
+ String certName = wizardInfo.getNickname();
+ if (certName != null && !certName.equals(""))
+ mCertNameField.setText(certName);
+
+ CMSAdminUtil.repaintComp(mCertNameField);
+ return true;
+ }
+
+ public boolean validatePanel() {
+ if (mCertNameField.isEditable()) {
+ String str = mCertNameField.getText();
+ if (str == null || str.length() == 0) {
+ setErrorMessage("EMPTYCERTNAME");
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ AdminConnection connection = wizardInfo.getAdminConnection();
+ CMSServerInfo serverInfo = wizardInfo.getServerInfo();
+ String certType = wizardInfo.getInstallCertType();
+ String pathname = "";
+ if (certType.equals(Constants.PR_CA_SIGNING_CERT)) {
+ pathname = "prevCACert.txt";
+ } else if (certType.equals(Constants.PR_OCSP_SIGNING_CERT)) {
+ pathname = "prevOCSPCert.txt";
+ } else if (certType.equals(Constants.PR_RA_SIGNING_CERT)) {
+ pathname = "prevRACert.txt";
+ } else if (certType.equals(Constants.PR_KRA_TRANSPORT_CERT)) {
+ pathname = "prevKRACert.txt";
+ } else if (certType.equals(Constants.PR_SERVER_CERT)) {
+ pathname = "prevSSLCert.txt";
+ } else if (certType.equals(Constants.PR_SERVER_CERT_RADM)) {
+ pathname = "prevSSLCertRadm.txt";
+ } else if (certType.equals(Constants.PR_CROSS_CERT)) {
+ pathname = "prevCROSSCert.txt";
+ } else if (certType.equals(Constants.PR_OTHER_CERT)) {
+ pathname = "prevOTHERCert.txt";
+ }
+
+ NameValuePairs nvps = new NameValuePairs();
+ String cert = wizardInfo.getPKCS10();
+
+ if (cert == null) {
+ nvps.put(Constants.PR_CERT_FILEPATH,
+ wizardInfo.getCertFilePath());
+ } else {
+ nvps.put(Constants.PR_PKCS10, wizardInfo.getPKCS10());
+ }
+
+ nvps.put(Constants.PR_NICKNAME, mCertNameField.getText().trim());
+ nvps.put("pathname", pathname);
+ nvps.put(Constants.PR_SERVER_ROOT, serverInfo.getServerRoot());
+ nvps.put(Constants.PR_SERVER_ID, serverInfo.getServerId());
+
+ try {
+ connection.modify(
+ DestDef.DEST_SERVER_ADMIN,
+ (certType.equals(Constants.PR_CROSS_CERT))?
+ (ScopeDef.SC_IMPORT_CROSS_CERT):(ScopeDef.SC_INSTALL_CERT),
+ certType, nvps);
+ } catch (EAdminException ex) {
+ showErrorDialog(ex.toString());
+ //setErrorMessage(ex.toString());
+ wizardInfo.addEntry(Constants.PR_ADD_CERT, new Boolean(false));
+ return false;
+ }
+ wizardInfo.addEntry(Constants.PR_ADD_CERT, new Boolean(true));
+/*
+ CMSAdminUtil.showMessageDialog(mResource, PANELNAME,
+ "INSTALL", JOptionPane.INFORMATION_MESSAGE);
+*/
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label1 = makeJLabel("NAME");
+ gbc.fill = gbc.NONE;
+ gbc.anchor = gbc.WEST;
+ gbc.insets = new Insets(COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE);
+ add(label1, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mCertNameField = new JTextField(30);
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.anchor = gbc.WEST;
+ gbc.weightx=1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ add(mCertNameField, gbc);
+ mActiveColor = mCertNameField.getBackground();
+
+ mCertNameField.setEditable(false);
+ mCertNameField.setBackground(getBackground());
+ mCertNameField.setEnabled(false);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel certLbl = makeJLabel("CONTENT");
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.anchor = gbc.WEST;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ add(certLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mTextArea = new JTextArea("",100,90);
+ Font f = new Font("Monospaced", Font.PLAIN, 12);
+ if (f != null) mTextArea.setFont(f);
+ mTextArea.setEditable(false);
+ mTextArea.setBackground(getBackground());
+ JScrollPane scrollPanel = new JScrollPane(mTextArea,
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
+ scrollPanel.setAlignmentX(LEFT_ALIGNMENT);
+ scrollPanel.setAlignmentY(TOP_ALIGNMENT);
+ scrollPanel.setBorder(BorderFactory.createLoweredBevelBorder());
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ //gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx=1.0;
+ gbc.weighty=1.0;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(scrollPanel, gbc);
+
+/*
+ mAdd = makeJButton("ADD");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ add(mAdd, gbc);
+*/
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ Boolean bool = wizardInfo.isCertAdded();
+ if (bool == null)
+ wizardInfo.addEntry(Constants.PR_ADD_CERT, new Boolean(false));
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mAdd)) {
+
+ }
+ }
+
+ private String[] parseStr(String dn) {
+ StringTokenizer tokenizer = new StringTokenizer(dn, ",");
+ int numTokens = tokenizer.countTokens();
+ String[] results = new String[numTokens];
+ int i=0;
+ while (tokenizer.hasMoreElements()) {
+ results[i] = (String)tokenizer.nextToken();
+ i++;
+ }
+ return results;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/keycert/WExecute1Page.java b/base/console/src/com/netscape/admin/certsrv/keycert/WExecute1Page.java
new file mode 100644
index 000000000..d13bca6e4
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/keycert/WExecute1Page.java
@@ -0,0 +1,158 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.keycert;
+
+import java.awt.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Introduction page for certificate setup wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.keycert
+ */
+class WExecute1Page extends WizardBasePanel implements IWizardPanel {
+ private static final String PANELNAME = "EXECUTE1WIZARD";
+ private static final String HELPINDEX =
+ "configuration-keycert-wizard-certrequest-help";
+ private JTextArea desc;
+
+ WExecute1Page(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WExecute1Page(JDialog parent, JFrame frame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = frame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ if (wizardInfo.getOperationType().equals(wizardInfo.REQUESTTYPE) &&
+// !wizardInfo.isNewKey() &&
+ wizardInfo.getCAType().equals(wizardInfo.SUBORDINATE_CA) &&
+ !(wizardInfo.isSSLCertLocalCA())) {
+
+ String title = "";
+ String certType = wizardInfo.getCertType();
+ if (certType.equals(Constants.PR_CA_SIGNING_CERT))
+ title = mResource.getString("EXECUTE1WIZARD_BORDER_CASIGNING_LABEL");
+ else if (certType.equals(Constants.PR_OCSP_SIGNING_CERT))
+ title = mResource.getString("EXECUTE1WIZARD_BORDER_OCSPSIGNING_LABEL");
+ else if (certType.equals(Constants.PR_RA_SIGNING_CERT))
+ title = mResource.getString("EXECUTE1WIZARD_BORDER_RASIGNING_LABEL");
+ else if (certType.equals(Constants.PR_KRA_TRANSPORT_CERT))
+ title = mResource.getString("EXECUTE1WIZARD_BORDER_KRATRANSPORT_LABEL");
+ else if (certType.equals(Constants.PR_SERVER_CERT) ||
+ certType.equals(Constants.PR_SERVER_CERT_RADM))
+ title = mResource.getString("EXECUTE1WIZARD_BORDER_SERVER_LABEL");
+ else if (certType.equals(Constants.PR_OTHER_CERT))
+ title = mResource.getString("EXECUTE1WIZARD_BORDER_OTHER_LABEL");
+ setBorder(new TitledBorder(title));
+
+ String str = "";
+ if (wizardInfo.isNewKey()) {
+ str = mResource.getString("EXECUTE1WIZARD_TEXT_NEWKEY_LABEL");
+ } else {
+ str = mResource.getString("EXECUTE1WIZARD_TEXT_OLDKEY_LABEL");
+ }
+ desc.setText(str);
+ return true;
+ }
+
+ return false;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ startProgressStatus();
+ AdminConnection connection = wizardInfo.getAdminConnection();
+ NameValuePairs nvps = wizardInfo.getNameValuePairs();
+ if (wizardInfo.getCertType().equals(Constants.PR_OTHER_CERT) &&
+ !wizardInfo.isNewKey()) {
+ nvps.put(Constants.PR_NICKNAME, wizardInfo.getNickname());
+ }
+
+ try {
+ NameValuePairs response = connection.process(
+ DestDef.DEST_SERVER_ADMIN, ScopeDef.SC_CERT_REQUEST,
+ wizardInfo.getCertType(), nvps);
+ for (String key : response.keySet()) {
+ String value = response.get(key);
+ if (key.equals(Constants.PR_CSR)) {
+ wizardInfo.addEntry(Constants.PR_CSR, value);
+ } else if (key.equals(Constants.PR_CERT_REQUEST_DIR)) {
+ wizardInfo.addEntry(Constants.PR_CERT_REQUEST_DIR, value);
+ }
+ }
+ } catch (EAdminException e) {
+ setErrorMessage(e.toString());
+ endProgressStatus();
+ return false;
+ }
+
+ endProgressStatus();
+
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ desc = createTextArea("");
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/keycert/WExecutePage.java b/base/console/src/com/netscape/admin/certsrv/keycert/WExecutePage.java
new file mode 100644
index 000000000..a3ce14257
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/keycert/WExecutePage.java
@@ -0,0 +1,158 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.keycert;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Introduction page for certificate setup wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.keycert
+ */
+class WExecutePage extends WizardBasePanel implements IWizardPanel {
+ private static final String PANELNAME = "EXECUTEWIZARD";
+ private static final String HELPINDEX =
+ "configuration-keycert-wizard-selfsignedcert-help";
+ private JTextArea desc;
+
+ WExecutePage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WExecutePage(JDialog parent, JFrame frame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = frame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ if (wizardInfo.getOperationType().equals(wizardInfo.REQUESTTYPE) &&
+// !wizardInfo.isNewKey() &&
+ ((wizardInfo.getCertType().equals(Constants.PR_CA_SIGNING_CERT) &&
+ wizardInfo.getCAType().equals(wizardInfo.SELF_SIGNED))
+ ||
+ (wizardInfo.getCertType().equals(Constants.PR_OCSP_SIGNING_CERT) &&
+ wizardInfo.isSSLCertLocalCA())
+ ||
+ (wizardInfo.getCertType().equals(Constants.PR_SERVER_CERT) &&
+ wizardInfo.isSSLCertLocalCA())
+ ||
+ (wizardInfo.getCertType().equals(Constants.PR_SERVER_CERT_RADM) &&
+ wizardInfo.isSSLCertLocalCA()))) {
+
+ setBorder(makeTitledBorder(PANELNAME));
+
+ if (wizardInfo.isNewKey()) {
+ String str = mResource.getString(
+ "EXECUTEWIZARD_TEXT_NEWKEY_LABEL");
+ desc.setText(str);
+ } else {
+ String str = mResource.getString(
+ "EXECUTEWIZARD_TEXT_OLDKEY_LABEL");
+ desc.setText(str);
+ }
+ return true;
+ }
+
+ return false;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ startProgressStatus();
+ AdminConnection connection = wizardInfo.getAdminConnection();
+ CMSServerInfo serverInfo = wizardInfo.getServerInfo();
+
+ String dir = "";
+ if (wizardInfo.getCertType().equals(Constants.PR_CA_SIGNING_CERT))
+ dir = "prevCACert.txt";
+ else if (wizardInfo.getCertType().equals(Constants.PR_OCSP_SIGNING_CERT))
+ dir = "prevOCSPCert.txt";
+ else if (wizardInfo.getCertType().equals(Constants.PR_SERVER_CERT))
+ dir = "prevSSLCert.txt";
+ else if (wizardInfo.getCertType().equals(Constants.PR_SERVER_CERT_RADM))
+ dir = "prevSSLCertRadm.txt";
+
+ NameValuePairs nvps = wizardInfo.getNameValuePairs();
+
+ if (wizardInfo.isNewKey()) {
+ if (wizardInfo.getHashType() != null)
+ nvps.put(ConfigConstants.PR_HASH_TYPE, wizardInfo.getHashType());
+ if (wizardInfo.getSignedByType() != null)
+ nvps.put(ConfigConstants.PR_SIGNEDBY_TYPE, wizardInfo.getSignedByType());
+ }
+
+ nvps.put("pathname", dir);
+ try {
+ connection.modify(
+ DestDef.DEST_SERVER_ADMIN, ScopeDef.SC_ISSUE_IMPORT_CERT,
+ wizardInfo.getCertType(), nvps);
+ } catch (EAdminException e) {
+ setErrorMessage(e.toString());
+ endProgressStatus();
+ return false;
+ }
+
+ endProgressStatus();
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ desc = createTextArea("");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/keycert/WGenerateReqPage.java b/base/console/src/com/netscape/admin/certsrv/keycert/WGenerateReqPage.java
new file mode 100644
index 000000000..b2a0005b6
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/keycert/WGenerateReqPage.java
@@ -0,0 +1,92 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.keycert;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Generate Request page for certificate setup wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.keycert
+ */
+class WGenerateReqPage extends WizardBasePanel implements IWizardPanel {
+ private static final String PANELNAME = "GENERATEREQWIZARD";
+ private static final String HELPINDEX =
+ "configuration-kra-wizard-change-keyscheme-help";
+
+ WGenerateReqPage() {
+ super(PANELNAME);
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ if (wizardInfo.getOperationType().equals(wizardInfo.INSTALLTYPE))
+ return false;
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ JTextArea desc = new JTextArea(
+ CMSAdminUtil.wrapText(mResource.getString(
+ "GENERATEREQWIZARD_TEXT_REQUEST_LABEL"), 80), 2, 80);
+
+ desc.setBackground(getBackground());
+ desc.setEditable(false);
+ desc.setCaretColor(getBackground());
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/keycert/WInstallCertChainPage.java b/base/console/src/com/netscape/admin/certsrv/keycert/WInstallCertChainPage.java
new file mode 100644
index 000000000..0ea476b6a
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/keycert/WInstallCertChainPage.java
@@ -0,0 +1,141 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.keycert;
+
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * This page allows the user to do such selections as the installation of
+ * certificates, server certificate chain, or trusted CA.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.keycert
+ */
+class WInstallCertChainPage extends WizardBasePanel implements IWizardPanel {
+ private JComboBox mCertBox;
+ private String mTrustedCACert;
+ private String mTrustedCert, mOtherCert, mCrossCert;
+ private static final String PANELNAME = "INSTALLCERTCHAINWIZARD";
+ private static final String HELPINDEX =
+ "configuration-keycert-wizard-installcerttype-help";
+
+ WInstallCertChainPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WInstallCertChainPage(JDialog parent, JFrame frame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = frame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ if (wizardInfo.getOperationType().equals(wizardInfo.REQUESTTYPE))
+ return false;
+
+ setBorder(makeTitledBorder(PANELNAME));
+
+ String mode = wizardInfo.getMode();
+ if (mode != null && mode.equals("0")) {
+ return true;
+ }
+
+ return false;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ JTextArea introLbl = createTextArea(mResource.getString(
+ PANELNAME+"_LABEL_INTRO_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(introLbl, gbc);
+
+ JTextArea opLbl = createTextArea(mResource.getString(
+ PANELNAME+"_LABEL_INSTALLCERT_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(opLbl, gbc);
+
+ mCertBox = makeJComboBox("CERTCHAINTYPE");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.weighty = 1.0;
+ add(mCertBox, gbc);
+
+ JTextArea dummy = createTextArea(" ", 1, 10);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0, 0, COMPONENT_SPACE,COMPONENT_SPACE);
+ add(dummy, gbc);
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ String str = (String)(mCertBox.getSelectedItem());
+ if (str.startsWith("Trusted")) {
+ wizardInfo.addEntry(wizardInfo.INSTALLCERTTYPE, Constants.PR_TRUSTED_CA_CERT);
+ } else if (str.startsWith("Untrusted")) {
+ wizardInfo.addEntry(wizardInfo.INSTALLCERTTYPE, Constants.PR_SERVER_CERT_CHAIN);
+ }
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/keycert/WInstallOpPage.java b/base/console/src/com/netscape/admin/certsrv/keycert/WInstallOpPage.java
new file mode 100644
index 000000000..5b4d2d340
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/keycert/WInstallOpPage.java
@@ -0,0 +1,221 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.keycert;
+
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * This page allows the user to do such selections as the installation of
+ * certificates, server certificate chain, or trusted CA.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.keycert
+ */
+class WInstallOpPage extends WizardBasePanel implements IWizardPanel {
+ private JComboBox mCertBox;
+ private String mCASigningCert;
+ private String mOCSPSigningCert;
+ private String mRASigningCert;
+ private String mKRATransportCert;
+ private String mServerCert, mServerCertRadm;
+ private String mOtherCert, mCrossCert;
+ private Vector mCerts;
+ private static final String PANELNAME = "INSTALLOPWIZARD";
+ private static final String HELPINDEX =
+ "configuration-keycert-wizard-installcerttype-help";
+
+ WInstallOpPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ mCerts = new Vector();
+ init();
+ }
+
+ WInstallOpPage(JDialog parent, JFrame frame) {
+ super(PANELNAME);
+ mParent = parent;
+ mCerts = new Vector();
+ mAdminFrame = frame;
+ init();
+ }
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ if (wizardInfo.getOperationType().equals(wizardInfo.REQUESTTYPE))
+ return false;
+ String mode = wizardInfo.getMode();
+ if (mode != null && mode.equals("0"))
+ return false;
+
+ setBorder(makeTitledBorder(PANELNAME));
+
+ if (wizardInfo.getInstallCertType() != null) {
+ return true;
+ }
+
+ AdminConnection connection = wizardInfo.getAdminConnection();
+ NameValuePairs nvps = new NameValuePairs();
+
+ try {
+ NameValuePairs response = connection.search(DestDef.DEST_SERVER_ADMIN,
+ ScopeDef.SC_SUBSYSTEM, nvps);
+ for (String name : response.keySet()) {
+ String type = response.get(name);
+
+ if (type.equals(Constants.PR_RA_INSTANCE))
+ mRASigningCert = mResource.getString(
+ PANELNAME+"_LABEL_RASIGNINGCERT_LABEL");
+ else if (type.equals(Constants.PR_CA_INSTANCE))
+ mCASigningCert = mResource.getString(
+ PANELNAME+"_LABEL_CASIGNINGCERT_LABEL");
+ else if (type.equals(Constants.PR_KRA_INSTANCE))
+ mKRATransportCert = mResource.getString(
+ PANELNAME+"_LABEL_KRATRANSPORTCERT_LABEL");
+ }
+ } catch (EAdminException e) {
+ //showErrorDialog(e.toString());
+ setErrorMessage(e.toString());
+ }
+
+ mOCSPSigningCert = mResource.getString(
+ PANELNAME+"_LABEL_OCSPSIGNINGCERT_LABEL");
+ mServerCert = mResource.getString(
+ PANELNAME+"_LABEL_SERVERCERT_LABEL");
+ mServerCertRadm = mResource.getString(
+ PANELNAME+"_LABEL_SERVERCERTRADM_LABEL");
+ mCrossCert = mResource.getString(
+ PANELNAME+"_LABEL_CROSSCERT_LABEL");
+ mOtherCert = mResource.getString(
+ PANELNAME+"_LABEL_OTHERCERT_LABEL");
+
+ mCertBox.removeAllItems();
+ mCerts.removeAllElements();
+
+ if (mCASigningCert != null) {
+ mCertBox.addItem(mCASigningCert);
+ mCerts.addElement(Constants.PR_CA_SIGNING_CERT);
+ }
+ if (mOCSPSigningCert != null) {
+ mCertBox.addItem(mOCSPSigningCert);
+ mCerts.addElement(Constants.PR_OCSP_SIGNING_CERT);
+ }
+ if (mRASigningCert != null) {
+ mCertBox.addItem(mRASigningCert);
+ mCerts.addElement(Constants.PR_RA_SIGNING_CERT);
+ }
+ if (mKRATransportCert != null) {
+ mCertBox.addItem(mKRATransportCert);
+ mCerts.addElement(Constants.PR_KRA_TRANSPORT_CERT);
+ }
+ if (mServerCert != null) {
+ mCertBox.addItem(mServerCert);
+ mCerts.addElement(Constants.PR_SERVER_CERT);
+ }
+
+ if (mCrossCert != null) {
+ mCertBox.addItem(mCrossCert);
+ mCerts.addElement(Constants.PR_CROSS_CERT);
+ }
+
+ if (mOtherCert != null) {
+ mCertBox.addItem(mOtherCert);
+ mCerts.addElement(Constants.PR_OTHER_CERT);
+ }
+
+ // that means the wizard is launched from the task page
+ if (mode == null) {
+ mCertBox.addItem("Untrusted CA Certificate Chain");
+ mCertBox.addItem("Trusted CA Certificate Chain");
+ }
+
+ mCertBox.setSelectedIndex(0);
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ JTextArea introLbl = createTextArea(mResource.getString(
+ PANELNAME+"_LABEL_INTRO_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(introLbl, gbc);
+
+ JTextArea opLbl = createTextArea(mResource.getString(
+ PANELNAME+"_LABEL_INSTALLCERT_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(opLbl, gbc);
+
+ mCertBox = makeJComboBox("CERTTYPE");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.weighty = 1.0;
+ add(mCertBox, gbc);
+
+ JTextArea dummy = createTextArea(" ", 1, 10);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0, 0, COMPONENT_SPACE,COMPONENT_SPACE);
+ add(dummy, gbc);
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ int index = mCertBox.getSelectedIndex();
+ wizardInfo.addEntry(wizardInfo.INSTALLCERTTYPE, mCerts.elementAt(index));
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/keycert/WInstallStatusPage.java b/base/console/src/com/netscape/admin/certsrv/keycert/WInstallStatusPage.java
new file mode 100644
index 000000000..25022bbb9
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/keycert/WInstallStatusPage.java
@@ -0,0 +1,105 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.keycert;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Introduction page for certificate setup wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.keycert
+ */
+class WInstallStatusPage extends WizardBasePanel implements IWizardPanel {
+ private JTextArea mDesc;
+ private static final String PANELNAME = "INSTALLSTATUSWIZARD";
+ private static final String HELPINDEX =
+ "configuration-keycert-wizard-installcertstatus-help";
+
+ WInstallStatusPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WInstallStatusPage(JDialog parent, JFrame frame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = frame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ if (wizardInfo.getOperationType().equals(wizardInfo.REQUESTTYPE))
+ return false;
+ if (wizardInfo.isCertAdded().booleanValue())
+ mDesc.setText(mResource.getString(
+ "INSTALLSTATUSWIZARD_TEXT_SUCCESS_LABEL"));
+ else
+ mDesc.setText(mResource.getString(
+ "INSTALLSTATUSWIZARD_TEXT_FAIL_LABEL"));
+
+ setBorder(makeTitledBorder(PANELNAME));
+
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ mDesc = createTextArea("");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mDesc, gbc);
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/keycert/WIntroInstallCertPage.java b/base/console/src/com/netscape/admin/certsrv/keycert/WIntroInstallCertPage.java
new file mode 100644
index 000000000..18c6ef068
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/keycert/WIntroInstallCertPage.java
@@ -0,0 +1,93 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.keycert;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Introduction page for certificate setup wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.keycert
+ */
+class WIntroInstallCertPage extends WizardBasePanel implements IWizardPanel {
+ private static final String PANELNAME = "INTROINSTALLCERTWIZARD";
+ private static final String HELPINDEX =
+ "configuration-kra-wizard-change-keyscheme-help";
+
+ WIntroInstallCertPage() {
+ super(PANELNAME);
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ if (wizardInfo.getOperationType().equals(wizardInfo.REQUESTTYPE))
+ return false;
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ JTextArea desc = new JTextArea(
+ CMSAdminUtil.wrapText(mResource.getString(
+ "INTROINSTALLCERTWIZARD_TEXT_DESC_LABEL"), 80), 2, 80);
+
+ desc.setBackground(getBackground());
+ desc.setEditable(false);
+ desc.setCaretColor(getBackground());
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/keycert/WIntroPage.java b/base/console/src/com/netscape/admin/certsrv/keycert/WIntroPage.java
new file mode 100644
index 000000000..abcec63f3
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/keycert/WIntroPage.java
@@ -0,0 +1,120 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.keycert;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Introduction page for certificate setup wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.keycert
+ */
+class WIntroPage extends WizardBasePanel implements IWizardPanel {
+ private static final String PANELNAME = "INTROKEYCERTWIZARD";
+ private static final String HELPINDEX =
+ "configuration-keycert-wizard-introduction-help";
+
+ WIntroPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WIntroPage(JDialog parent, JFrame frame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = frame;
+ init();
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ setBorder(makeTitledBorder(PANELNAME));
+ return true;
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ startProgressStatus();
+ AdminConnection connection = wizardInfo.getAdminConnection();
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_TOKEN_LIST, "");
+ try {
+ NameValuePairs response = connection.read(DestDef.DEST_SERVER_ADMIN,
+ ScopeDef.SC_TOKEN, Constants.RS_ID_CONFIG, nvps);
+ for (String name : response.keySet()) {
+ String value = response.get(name);
+ if (name.equals(Constants.PR_TOKEN_LIST))
+ wizardInfo.addEntry(name, value);
+ }
+ } catch (EAdminException e) {
+ //showErrorDialog(e.toString());
+ setErrorMessage(e.toString());
+ endProgressStatus();
+ return false;
+ }
+ endProgressStatus();
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+/*
+ JTextArea desc = new JTextArea(
+ CMSAdminUtil.wrapText(mResource.getString(
+ "INTROKEYCERTWIZARD_TEXT_DESC_LABEL"), 80), 2, 80);
+*/
+ JTextArea desc = createTextArea(mResource.getString(
+ "INTROKEYCERTWIZARD_TEXT_DESC_LABEL"));
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/keycert/WIssueImportStatusPage.java b/base/console/src/com/netscape/admin/certsrv/keycert/WIssueImportStatusPage.java
new file mode 100644
index 000000000..65e02ddd7
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/keycert/WIssueImportStatusPage.java
@@ -0,0 +1,105 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.keycert;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Introduction page for certificate setup wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.keycert
+ */
+class WIssueImportStatusPage extends WizardBasePanel implements IWizardPanel {
+ private static final String PANELNAME = "ISSUEIMPORTSTATUSWIZARD";
+ private static final String HELPINDEX =
+ "configuration-keycert-wizard-selfsignedstatus-help";
+ private JTextArea desc;
+
+ WIssueImportStatusPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WIssueImportStatusPage(JDialog parent, JFrame frame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = frame;
+ init();
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ setBorder(makeTitledBorder(PANELNAME));
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ String str = "";
+
+ if (wizardInfo.getOperationType().equals(wizardInfo.REQUESTTYPE) &&
+ (wizardInfo.getCAType().equals(wizardInfo.SELF_SIGNED) ||
+ wizardInfo.isSSLCertLocalCA())) {
+ str = mResource.getString(
+ "ISSUEIMPORTSTATUSWIZARD_TEXT_DESC_LABEL");
+ desc.setText(str);
+ return true;
+ }
+ return false;
+ }
+
+ public boolean isLastPage() {
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ desc = createTextArea("");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/keycert/WKeyPage.java b/base/console/src/com/netscape/admin/certsrv/keycert/WKeyPage.java
new file mode 100644
index 000000000..40d601c1d
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/keycert/WKeyPage.java
@@ -0,0 +1,809 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.keycert;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.border.*;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+import javax.swing.text.*;
+
+/**
+ * Setup key information for certificate setup wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WKeyPage extends WizardBasePanel implements IWizardPanel, ItemListener {
+ private Color mActiveColor;
+ private JPanel mNicknamePanel;
+ private JRadioButton mExistingKeyBtn;
+ private JRadioButton mNewKeyBtn;
+ private JComboBox mKeyTypeBox, mDSAKeyTypeBox;
+ private JComboBox mKeyLengthBox, mDSAKeyLengthBox, mKeyCurveBox;
+ private JComboBox mTokenBox, mNicknameBox;
+ private JTextField mKeyLengthText;
+ private JTextField mKeyCurveText;
+ private JLabel keyHeading, keyTypeLbl, keyLengthLbl, keyCurveLbl, unitLbl,
+ unit1Lbl, mTokenLbl, mNicknameLbl;
+ private JLabel keyLengthCustomText, keyCurveCustomText;
+ private static final String PANELNAME = "KEYWIZARD";
+ private CertSetupWizardInfo wizardInfo;
+ private static final String HELPINDEX =
+ "configuration-keycert-wizard-key-help";
+
+ WKeyPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WKeyPage(JDialog parent, JFrame frame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = frame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ wizardInfo = (CertSetupWizardInfo)info;
+ if (wizardInfo.getOperationType().equals(wizardInfo.INSTALLTYPE))
+ return false;
+
+ String title = "";
+ String certType = wizardInfo.getCertType();
+ if (certType.equals(Constants.PR_CA_SIGNING_CERT))
+ title = mResource.getString("KEYWIZARD_BORDER_CASIGNING_LABEL");
+ else if (certType.equals(Constants.PR_RA_SIGNING_CERT))
+ title = mResource.getString("KEYWIZARD_BORDER_RASIGNING_LABEL");
+ else if (certType.equals(Constants.PR_KRA_TRANSPORT_CERT))
+ title = mResource.getString("KEYWIZARD_BORDER_KRATRANSPORT_LABEL");
+ else if (certType.equals(Constants.PR_OCSP_SIGNING_CERT))
+ title = mResource.getString("KEYWIZARD_BORDER_OCSPSIGNING_LABEL");
+ else if (certType.equals(Constants.PR_SERVER_CERT) ||
+ certType.equals(Constants.PR_SERVER_CERT_RADM))
+ title = mResource.getString("KEYWIZARD_BORDER_SERVER_LABEL");
+ else if (certType.equals(Constants.PR_OTHER_CERT))
+ title = mResource.getString("KEYWIZARD_BORDER_OTHER_LABEL");
+
+ setBorder(new TitledBorder(title));
+ if (certType.equals(Constants.PR_OTHER_CERT)) {
+ mNicknamePanel.setVisible(true);
+ mNicknameLbl.setVisible(true);
+ mNicknameBox.setVisible(true);
+ if (mNicknameBox.getItemCount() <= 0) {
+ String str = wizardInfo.getNicknames();
+ StringTokenizer tokenizer1 = new StringTokenizer(str, ",");
+ while (tokenizer1.hasMoreTokens()) {
+ mNicknameBox.addItem((String)tokenizer1.nextToken());
+ }
+ }
+ } else {
+ mNicknamePanel.setVisible(false);
+ mNicknameLbl.setVisible(false);
+ mNicknameBox.setVisible(false);
+ }
+
+ if (mTokenBox.getItemCount() > 0) {
+/*
+ if (mNewKeyBtn.isSelected() || certType.equals(Constants.PR_OTHER_CERT)) {
+ mTokenBox.setEnabled(true);
+ mTokenLbl.setEnabled(true);
+ } else {
+ mTokenBox.setEnabled(false);
+ mTokenLbl.setEnabled(false);
+ }
+*/
+ return true;
+ }
+
+ String tokenList = wizardInfo.getTokenList();
+ StringTokenizer tokenizer = new StringTokenizer(tokenList, ",");
+ while (tokenizer.hasMoreTokens()) {
+ mTokenBox.addItem((String)tokenizer.nextToken());
+ }
+
+ mTokenBox.addItemListener(this);
+
+ if (certType.equals(Constants.PR_CA_SIGNING_CERT) ||
+ certType.equals(Constants.PR_RA_SIGNING_CERT) ||
+ certType.equals(Constants.PR_OCSP_SIGNING_CERT) ) {
+ mDSAKeyTypeBox.setVisible(true);
+ mKeyTypeBox.setVisible(false);
+ } else {
+ mDSAKeyTypeBox.setVisible(false);
+ mKeyTypeBox.setVisible(true);
+ }
+
+ String type = (String)mKeyTypeBox.getSelectedItem();
+ if (mDSAKeyTypeBox.isVisible()) {
+ type = (String)mDSAKeyTypeBox.getSelectedItem();
+ }
+
+ setLengthCurveFields(type);
+ enableKeyLengthFields();
+
+ //if (mNewKeyBtn.isSelected() || certType.equals(Constants.PR_OTHER_CERT)) {
+ if (mNewKeyBtn.isSelected()) {
+ mTokenBox.setEnabled(true);
+ mTokenLbl.setEnabled(true);
+ } else {
+ mTokenBox.setEnabled(false);
+ mTokenLbl.setEnabled(false);
+ }
+
+/*
+ if (certType.equals(Constants.PR_SERVER_CERT)) {
+ mKeyLengthBox.removeItem("4096");
+ mKeyLengthBox.setSelectedIndex(0);
+ }
+*/
+
+ if (certType.equals(Constants.PR_SERVER_CERT_RADM)) {
+ mKeyLengthBox.removeItem("768");
+ mKeyLengthBox.removeItem("4096");
+ mKeyLengthBox.removeItem("Custom");
+ mKeyLengthBox.setSelectedIndex(0);
+ }
+
+ CMSAdminUtil.repaintComp(mTokenBox);
+ CMSAdminUtil.repaintComp(mTokenLbl);
+ CMSAdminUtil.repaintComp(mNicknamePanel);
+ CMSAdminUtil.repaintComp(mNicknameLbl);
+ CMSAdminUtil.repaintComp(mNicknameBox);
+
+ return true;
+ }
+
+ public boolean validatePanel() {
+ if (mKeyLengthText.isVisible() && mKeyLengthText.isEnabled()) {
+ String str = mKeyLengthText.getText().trim();
+ if (str.equals("")) {
+ setErrorMessage("BLANKLEN");
+ return false;
+ } else {
+ try {
+ int num = Integer.parseInt(str);
+ if (num <= 0) {
+ setErrorMessage("INVALIDKEYLEN");
+ return false;
+ }
+ } catch (NumberFormatException e) {
+ setErrorMessage("NONINTEGER");
+ return false;
+ }
+ }
+ }
+
+ /*
+ if (mKeyCurveText.isVisible() && mKeyCurveText.isEnabled()) {
+ String str = mKeyCurveText.getText().trim();
+ if (str.equals("")) {
+ setErrorMessage("BLANKCURVE");
+ return false;
+ }
+ }*/
+
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ AdminConnection connection = wizardInfo.getAdminConnection();
+ NameValuePairs nvps = new NameValuePairs();
+
+ if (mNewKeyBtn.isSelected()) {
+ String val = "";
+
+ if (mKeyLengthBox.isVisible()) {
+ val = (String)mKeyLengthBox.getSelectedItem();
+ } else if (mKeyCurveBox.isVisible()) {
+ val = (String)mKeyCurveBox.getSelectedItem();
+ } else {
+ if (mDSAKeyLengthBox.isVisible())
+ val = (String)mDSAKeyLengthBox.getSelectedItem();
+ }
+
+ if (val.equals("Custom")) {
+ if (mKeyCurveBox.isVisible()) { // ECC
+ wizardInfo.addEntry(Constants.PR_KEY_CURVENAME,
+ mKeyCurveText.getText().trim());
+ nvps.put(Constants.PR_KEY_CURVENAME, mKeyCurveText.getText().trim());
+ } else {
+ wizardInfo.addEntry(Constants.PR_KEY_LENGTH,
+ mKeyLengthText.getText().trim());
+ nvps.put(Constants.PR_KEY_LENGTH, mKeyLengthText.getText().trim());
+ }
+ } else {
+ if (mKeyCurveBox.isVisible()) { // ECC
+ wizardInfo.addEntry(Constants.PR_KEY_CURVENAME, val.trim());
+ nvps.put(Constants.PR_KEY_CURVENAME, val.trim());
+ } else {
+ wizardInfo.addEntry(Constants.PR_KEY_LENGTH, val.trim());
+ nvps.put(Constants.PR_KEY_LENGTH, val.trim());
+ }
+ }
+
+ if (mKeyTypeBox.isVisible()) {
+ wizardInfo.addEntry(Constants.PR_KEY_TYPE,
+ (String)mKeyTypeBox.getSelectedItem());
+ nvps.put(Constants.PR_KEY_TYPE, (String) mKeyTypeBox.getSelectedItem());
+ } else if (mDSAKeyTypeBox.isVisible()) {
+ wizardInfo.addEntry(Constants.PR_KEY_TYPE,
+ (String)mDSAKeyTypeBox.getSelectedItem());
+ nvps.put(Constants.PR_KEY_TYPE, (String) mDSAKeyTypeBox.getSelectedItem());
+ }
+ }
+
+ startProgressStatus();
+
+ String certType = wizardInfo.getCertType();
+ nvps.put(Constants.PR_SUBJECT_NAME, "");
+ nvps.put(Constants.PR_CERTIFICATE_TYPE, certType);
+
+ try {
+ // validate the key length or curvename
+ if (mKeyCurveBox.isVisible()) { //ECC
+ connection.validate(DestDef.DEST_SERVER_ADMIN,
+ ScopeDef.SC_KEY_CURVENAME, nvps);
+ } else {
+ connection.validate(DestDef.DEST_SERVER_ADMIN,
+ ScopeDef.SC_KEY_LENGTH, nvps);
+ }
+
+ NameValuePairs response = null;
+ if (!mNewKeyBtn.isSelected()) {
+
+ if (mNicknameBox.isVisible()) {
+ String nicknameStr = (String)mNicknameBox.getSelectedItem();
+ nvps.put(Constants.PR_NICKNAME, nicknameStr);
+ response = connection.process(
+ DestDef.DEST_SERVER_ADMIN,
+ ScopeDef.SC_SUBJECT_NAME,
+ wizardInfo.getCertType(), nvps);
+ wizardInfo.addEntry(Constants.PR_NICKNAME, nicknameStr);
+ } else {
+ response = connection.read(
+ DestDef.DEST_SERVER_ADMIN,
+ ScopeDef.SC_SUBJECT_NAME,
+ wizardInfo.getCertType(), nvps);
+ }
+
+ String value = response.get(Constants.PR_SUBJECT_NAME);
+ wizardInfo.addEntry(Constants.PR_SUBJECT_NAME, value);
+ }
+
+ if (mNewKeyBtn.isSelected()) {
+ String tokenName = (String)mTokenBox.getSelectedItem();
+ if (tokenName.equals("internal"))
+ tokenName = Constants.PR_INTERNAL_TOKEN_NAME;
+ nvps.clear();
+ nvps.put(Constants.PR_TOKEN_NAME, tokenName);
+ response = connection.process(DestDef.DEST_SERVER_ADMIN,
+ ScopeDef.SC_TOKEN_STATUS, Constants.RS_ID_CONFIG, nvps);
+
+ String value = response.get(Constants.PR_LOGGED_IN);
+ wizardInfo.addEntry(Constants.PR_LOGGED_IN, value);
+ wizardInfo.addEntry(Constants.PR_TOKEN_NAME, tokenName);
+ }
+ } catch (EAdminException e) {
+ //showErrorDialog(e.toString());
+ setErrorMessage(e.toString());
+ endProgressStatus();
+ return false;
+ }
+
+ endProgressStatus();
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ JPanel panel = new JPanel();
+ GridBagLayout gb1 = new GridBagLayout();
+ panel.setLayout(gb1);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ add(panel, gbc);
+
+ JTextArea selectTokenLbl = createTextArea(mResource.getString(
+ PANELNAME+"_LABEL_SELECTTOKEN_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, 0, COMPONENT_SPACE,0);
+ panel.add(selectTokenLbl, gbc);
+
+ mTokenLbl = makeJLabel("TOKEN");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.CENTER;
+ gbc.insets = new Insets(COMPONENT_SPACE, 0,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ gbc.fill = gbc.NONE;
+ panel.add(mTokenLbl, gbc);
+
+ mTokenBox = new JComboBox();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ //gbc.weightx = 1.0;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ panel.add(mTokenBox, gbc);
+
+ JTextArea dummy2 = createTextArea(" ", 1, 5);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ panel.add(dummy2, gbc);
+
+ JTextArea createKeyLbl = createTextArea(mResource.getString(
+ PANELNAME+"_LABEL_KEYPAIR_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(createKeyLbl, gbc);
+
+ mExistingKeyBtn = makeJRadioButton("OLDKEY", true);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mExistingKeyBtn, gbc);
+
+ mNicknamePanel = new JPanel();
+ GridBagLayout gb3 = new GridBagLayout();
+ mNicknamePanel.setLayout(gb3);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ gbc.fill = gbc.BOTH;
+ gbc.weightx = 1.0;
+ add(mNicknamePanel, gbc);
+
+ mNicknameLbl = makeJLabel("NICKNAME");
+ CMSAdminUtil.resetGBC(gbc);
+ //gbc.anchor = gbc.CENTER;
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ //gbc.fill = gbc.NONE;
+ gbc.fill = gbc.HORIZONTAL;
+ mNicknamePanel.add(mNicknameLbl, gbc);
+
+ JLabel dummy18 = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.fill = gbc.HORIZONTAL;
+ mNicknamePanel.add(dummy18, gbc);
+
+ mNicknameBox = new JComboBox();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ //gbc.fill = gbc.NONE;
+ gbc.fill = gbc.BOTH;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE, 2*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ mNicknamePanel.add(mNicknameBox, gbc);
+
+/*
+ JTextArea dummy22 = createTextArea(" ", 1, 5);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ mNicknamePanel.add(dummy22, gbc);
+*/
+
+ mNewKeyBtn = makeJRadioButton("NEWKEY", false);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mNewKeyBtn, gbc);
+
+ ButtonGroup grp = new ButtonGroup();
+ grp.add(mExistingKeyBtn);
+ grp.add(mNewKeyBtn);
+
+/*
+ JPanel panel = new JPanel();
+ GridBagLayout gb1 = new GridBagLayout();
+ panel.setLayout(gb1);
+*/
+
+ keyHeading = makeJLabel("KEY");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ add(keyHeading, gbc);
+
+ keyTypeLbl = makeJLabel("KEYTYPE");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.CENTER;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, 4*COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(keyTypeLbl, gbc);
+
+ mKeyTypeBox = makeJComboBox("KEYTYPE");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ gbc.fill = gbc.NONE;
+ add(mKeyTypeBox, gbc);
+
+ mDSAKeyTypeBox = makeJComboBox("DSAKEYTYPE");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ gbc.fill = gbc.NONE;
+ add(mDSAKeyTypeBox, gbc);
+
+ JLabel dummy = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(dummy, gbc);
+
+ keyLengthLbl = makeJLabel("KEYLENGTH");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.CENTER;
+ gbc.fill = gbc.NONE;
+ //gbc.weighty = 1.0;
+ //gbc.gridheight = gbc.REMAINDER;
+ gbc.insets = new Insets(0, 4*COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(keyLengthLbl, gbc);
+ //panel.add(keyLengthLbl, gbc);
+
+ mKeyLengthBox = makeJComboBox("KEYLENGTH");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ //gbc.weighty = 1.0;
+ //gbc.gridheight = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mKeyLengthBox, gbc);
+ //panel.add(mKeyLengthBox, gbc);
+
+ mDSAKeyLengthBox = makeJComboBox("DSAKEYLENGTH");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ //gbc.weighty = 1.0;
+ //gbc.gridheight = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mDSAKeyLengthBox, gbc);
+ //panel.add(mDSAKeyLengthBox, gbc);
+
+ keyCurveLbl = makeJLabel("KEYCURVE");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.CENTER;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, 4*COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(keyCurveLbl, gbc);
+
+ mKeyCurveBox = makeJComboBox("KEYCURVE");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mKeyCurveBox, gbc);
+
+ unitLbl = makeJLabel("UNITS");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.CENTER;
+ gbc.gridwidth = gbc.REMAINDER;
+ //gbc.gridheight = gbc.REMAINDER;
+ //gbc.weighty = 1.0;
+ gbc.insets = new Insets(0, 0,COMPONENT_SPACE, COMPONENT_SPACE);
+ add(unitLbl, gbc);
+ //panel.add(unitLbl, gbc);
+
+ JPanel panel1 = new JPanel();
+ GridBagLayout gb2 = new GridBagLayout();
+ panel1.setLayout(gb2);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, 0, 0, 0);
+ add(panel1, gbc);
+
+ keyLengthCustomText = makeJLabel("CUSTOMKEY");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ panel1.add(keyLengthCustomText, gbc);
+
+ keyCurveCustomText = makeJLabel("CUSTOMKEYCURVE");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ panel1.add(keyCurveCustomText, gbc);
+
+ mKeyLengthText = makeJTextField(7);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ //gbc.gridheight = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, 0, 0);
+ panel1.add(mKeyLengthText, gbc);
+ mActiveColor = mKeyLengthText.getBackground();
+
+ mKeyCurveText = makeJTextField(7);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, 0, 0);
+ panel1.add(mKeyCurveText, gbc);
+
+ unit1Lbl = makeJLabel("UNITS");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ //gbc.gridheight = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, 0, COMPONENT_SPACE);
+ panel1.add(unit1Lbl, gbc);
+
+ JLabel dummy1 = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ add(dummy1, gbc);
+
+ enableFields(false, getBackground());
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ if (mNewKeyBtn.isSelected()) {
+ wizardInfo.addEntry(wizardInfo.KEY_MATERIAL, Constants.TRUE);
+ } else if (mExistingKeyBtn.isSelected())
+ wizardInfo.addEntry(wizardInfo.KEY_MATERIAL, Constants.FALSE);
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ Object source = e.getSource();
+ if (source.equals(mExistingKeyBtn)) {
+ enableFields(false, getBackground());
+ enableKeyLengthFields();
+ mTokenBox.setEnabled(false);
+ mTokenLbl.setEnabled(false);
+ } else if (source.equals(mNewKeyBtn)) {
+ String certType = wizardInfo.getCertType();
+ if (certType.equals(Constants.PR_CA_SIGNING_CERT)) {
+ WarningDialog dialog = new WarningDialog(wizardInfo.getFrame(),
+ "_TEXT_DESC_LABEL");
+ }
+ enableFields(true, mActiveColor);
+ enableKeyLengthFields();
+ mTokenBox.setEnabled(true);
+ mTokenLbl.setEnabled(true);
+ }
+ CMSAdminUtil.repaintComp(mTokenBox);
+ CMSAdminUtil.repaintComp(mTokenLbl);
+ }
+
+ public void setLengthCurveFields(String type) {
+ if (type.equals("RSA")) {
+ mDSAKeyLengthBox.setVisible(false);
+ mKeyLengthBox.setVisible(true);
+ mKeyCurveBox.setVisible(false);
+ keyLengthCustomText.setVisible(true);
+ keyCurveCustomText.setVisible(false);
+ keyLengthLbl.setVisible(true);
+ keyCurveLbl.setVisible(false);
+ unit1Lbl.setVisible(true);
+ unitLbl.setVisible(true);
+ mKeyLengthText.setVisible(true);
+ mKeyCurveText.setVisible(false);
+ } else if (type.equals("ECC")) {
+ mDSAKeyLengthBox.setVisible(false);
+ mKeyLengthBox.setVisible(false);
+ mKeyCurveBox.setVisible(true);
+ keyLengthCustomText.setVisible(false);
+ keyCurveCustomText.setVisible(true);
+ keyLengthLbl.setVisible(false);
+ keyCurveLbl.setVisible(true);
+ unit1Lbl.setVisible(false);
+ unitLbl.setVisible(false);
+ mKeyLengthText.setVisible(false);
+ mKeyCurveText.setVisible(true);
+ } else {
+ mDSAKeyLengthBox.setVisible(true);
+ mKeyLengthBox.setVisible(false);
+ mKeyCurveBox.setVisible(false);
+ keyLengthCustomText.setVisible(true);
+ keyCurveCustomText.setVisible(false);
+ keyLengthLbl.setVisible(true);
+ keyCurveLbl.setVisible(false);
+ unit1Lbl.setVisible(true);
+ unitLbl.setVisible(true);
+ mKeyLengthText.setVisible(true);
+ mKeyCurveText.setVisible(false);
+ }
+ }
+
+
+ public void itemStateChanged(ItemEvent e) {
+ if (e.getSource().equals(mKeyLengthBox) ||
+ e.getSource().equals(mKeyCurveBox) ||
+ e.getSource().equals(mDSAKeyLengthBox)) {
+ enableKeyLengthFields();
+ } else if (e.getSource().equals(mKeyTypeBox) ||
+ e.getSource().equals(mDSAKeyTypeBox)) {
+ String type = "";
+ if (mKeyTypeBox.isVisible())
+ type = (String)mKeyTypeBox.getSelectedItem();
+ else if (mDSAKeyTypeBox.isVisible())
+ type = (String)mDSAKeyTypeBox.getSelectedItem();
+
+ setLengthCurveFields(type);
+ enableKeyLengthFields();
+ CMSAdminUtil.repaintComp(this);
+ }
+ }
+
+ private void enableKeyLengthFields() {
+ String value = "";
+
+ if (mKeyLengthBox.isVisible())
+ value = (String)mKeyLengthBox.getSelectedItem();
+ else if (mKeyCurveBox.isVisible())
+ value = (String)mKeyCurveBox.getSelectedItem();
+ else
+ value = (String)mDSAKeyLengthBox.getSelectedItem();
+
+ if (value.equals("Custom") && mNewKeyBtn.isSelected()) {
+ if (mKeyCurveBox.isVisible()) { //ECC
+ enableFields(keyCurveCustomText, mKeyCurveText, true, mActiveColor);
+ } else {
+ enableFields(keyLengthCustomText, mKeyLengthText, true, mActiveColor);
+ enableFields(unit1Lbl, null, true, mActiveColor);
+ }
+ } else {
+ if (mKeyCurveBox.isVisible()) { //ECC
+ enableFields(keyCurveCustomText, mKeyCurveText, false,
+ getBackground());
+ } else {
+ enableFields(keyLengthCustomText, mKeyLengthText, false,
+ getBackground());
+ enableFields(unit1Lbl, null, false, getBackground());
+ }
+ }
+ }
+
+ protected void enableFields(JComponent comp1, JTextComponent comp2,
+ boolean enable, Color color) {
+ if (comp1 != null) {
+ comp1.setEnabled(enable);
+ CMSAdminUtil.repaintComp(comp1);
+ }
+ if (comp2 != null) {
+ comp2.setEnabled(enable);
+ comp2.setBackground(color);
+ comp2.setEditable(enable);
+ CMSAdminUtil.repaintComp(comp2);
+ }
+ }
+
+ private void enableFields(boolean enable, Color color) {
+ keyHeading.setEnabled(enable);
+ keyTypeLbl.setEnabled(enable);
+ keyLengthLbl.setEnabled(enable);
+ keyCurveLbl.setEnabled(enable);
+ unitLbl.setEnabled(enable);
+ unit1Lbl.setEnabled(enable);
+ keyLengthCustomText.setEnabled(enable);
+ keyCurveCustomText.setEnabled(enable);
+ mKeyLengthText.setEnabled(enable);
+ mKeyLengthText.setEditable(enable);
+ mKeyLengthText.setBackground(color);
+ mKeyCurveText.setEnabled(enable);
+ mKeyCurveText.setEditable(enable);
+ mKeyCurveText.setBackground(color);
+ mKeyTypeBox.setEnabled(enable);
+ mDSAKeyTypeBox.setEnabled(enable);
+ mKeyLengthBox.setEnabled(enable);
+ mKeyCurveBox.setEnabled(enable);
+ mDSAKeyLengthBox.setEnabled(enable);
+ repaintComp(keyHeading);
+ repaintComp(keyTypeLbl);
+ repaintComp(keyLengthLbl);
+ repaintComp(keyCurveLbl);
+ repaintComp(unitLbl);
+ repaintComp(unit1Lbl);
+ repaintComp(keyLengthCustomText);
+ repaintComp(keyCurveCustomText);
+ repaintComp(mKeyLengthText);
+ repaintComp(mKeyCurveText);
+ repaintComp(mKeyTypeBox);
+ repaintComp(mDSAKeyTypeBox);
+ repaintComp(mKeyLengthBox);
+ repaintComp(mKeyCurveBox);
+ repaintComp(mDSAKeyLengthBox);
+ }
+
+ private void repaintComp(JComponent component) {
+ component.invalidate();
+ component.validate();
+ component.repaint(1);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/keycert/WManualCertRequestPage.java b/base/console/src/com/netscape/admin/certsrv/keycert/WManualCertRequestPage.java
new file mode 100644
index 000000000..4ad069133
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/keycert/WManualCertRequestPage.java
@@ -0,0 +1,199 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.keycert;
+
+import java.util.*;
+import java.awt.*;
+import java.io.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+import com.netscape.admin.certsrv.task.*;
+
+/**
+ * Generate cert request page for cert setup wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.keycert
+ */
+class WManualCertRequestPage extends WBaseManualCertRequestPage implements IWizardPanel {
+
+ public static final String SERVER_CERT = "server";
+ public static final String CLIENT_CERT = "client";
+ public static final String CA_CERT = "ca";
+ public static final String RA_CERT = "ra";
+ public static final String OCSP_CERT = "ocsp";
+ public static final String OBJECT_SIGNING_CERT = "objSignClient";
+ public static final String OTHER_CERT = "other";
+ public static final String ROUTER_CERT = "router"; // deprecated
+ public static final String CEP_CERT = "CEP-Request";
+
+ private static final String PANELNAME = "MANUALCERTREQUESTWIZARD";
+ private static final String HELPINDEX =
+ "configuration-keycert-wizard-displaycertrequest-help";
+
+ WManualCertRequestPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WManualCertRequestPage(JDialog parent, JFrame frame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = frame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+
+ if (wizardInfo.getOperationType().equals(wizardInfo.INSTALLTYPE) ||
+ wizardInfo.getCAType().equals(wizardInfo.SELF_SIGNED))
+ return false;
+
+ String str = wizardInfo.getCSR();
+// mText.setText(CMSAdminUtil.certRequestWrapText(str, 40));
+ mText.setText(str);
+ mText.selectAll();
+ setBorder(makeTitledBorder(PANELNAME));
+
+ CMSServerInfo serverInfo = wizardInfo.getServerInfo();
+ String certType = wizardInfo.getCertType();
+ if (certType.equals(Constants.PR_CA_SIGNING_CERT)) {
+ mDesc.setText(mResource.getString(mPanelName+"_TEXT_CADESC_LABEL"));
+ str = mResource.getString(mPanelName+"_TEXT_CAFILELOC_LABEL");
+ } else if (certType.equals(Constants.PR_OCSP_SIGNING_CERT)) {
+ str = mResource.getString(mPanelName+"_TEXT_OCSPFILELOC_LABEL");
+ mDesc.setText(mResource.getString(mPanelName+"_TEXT_RADESC_LABEL"));
+ } else if (certType.equals(Constants.PR_RA_SIGNING_CERT)) {
+ str = mResource.getString(mPanelName+"_TEXT_RAFILELOC_LABEL");
+ mDesc.setText(mResource.getString(mPanelName+"_TEXT_RADESC_LABEL"));
+ } else if (certType.equals(Constants.PR_KRA_TRANSPORT_CERT)) {
+ str = mResource.getString(mPanelName+"_TEXT_KRAFILELOC_LABEL");
+ mDesc.setText(mResource.getString(mPanelName+"_TEXT_KRADESC_LABEL"));
+ } else if (certType.equals(Constants.PR_SERVER_CERT)) {
+ str = mResource.getString(mPanelName+"_TEXT_SSLFILELOC_LABEL");
+ mDesc.setText(mResource.getString(mPanelName+"_TEXT_SSLDESC_LABEL"));
+ } else if (certType.equals(Constants.PR_SERVER_CERT_RADM)) {
+ str = mResource.getString(mPanelName+"_TEXT_SSLRADMFILELOC_LABEL");
+ mDesc.setText(mResource.getString(mPanelName+"_TEXT_SSLDESC_LABEL"));
+ } else if (certType.equals(Constants.PR_OTHER_CERT)) {
+ str = mResource.getString(mPanelName+"_TEXT_OTHERFILELOC_LABEL");
+ mDesc.setText(mResource.getString(mPanelName+"_TEXT_OTHERDESC_LABEL"));
+ }
+
+ String dir = wizardInfo.getCertRequestDir();
+ mFileName.setText(str+dir+".");
+
+ if (mSendNowBox.isSelected())
+ enableFields(true, mActiveColor);
+ else
+ enableFields(false, getBackground());
+ String host = wizardInfo.getCMHost();
+ if (host != null && !host.equals(""))
+ mHostText.setText(host);
+ String port = wizardInfo.getCMEEPort();
+ if (port != null && !port.equals(""))
+ mPortText.setText(port);
+
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return super.validatePanel();
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ if (!mSendNowBox.isSelected())
+ return true;
+
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ if (mHost != null && !mHost.equals(""))
+ wizardInfo.setCMHost(mHost);
+ if (mPort != null && !mPort.equals(""))
+ wizardInfo.setCMEEPort(mPort);
+ if (mSSL.isSelected())
+ wizardInfo.setCMEEType("https");
+ else
+ wizardInfo.setCMEEType("http");
+
+ CMSCertRequest requestCertCgi = new CMSCertRequest();
+ requestCertCgi.initialize(wizardInfo);
+ Hashtable data = new Hashtable();
+
+ String certType = null;
+
+ String mReqType = wizardInfo.getCertType();
+ String mReq = null;
+
+ mReq = wizardInfo.getCSR();
+
+ if (mReqType.equals(Constants.PR_CA_SIGNING_CERT)){
+ data.put("profileId", "caCACert");
+ }else if (mReqType.equals(Constants.PR_SERVER_CERT) ||
+ mReqType.equals(Constants.PR_KRA_TRANSPORT_CERT)){
+ data.put("profileId", "caServerCert");
+ }else if (mReqType.equals(Constants.PR_OCSP_SIGNING_CERT)){
+ data.put("profileId", "caOCSPCert");
+ }else if (mReqType.equals(Constants.PR_RA_SIGNING_CERT)){
+ data.put("profileId", "caRACert");
+ }else if (mReqType.equals(Constants.PR_OTHER_CERT)) {
+ data.put("profileId", "caOtherCert");
+ } else {
+ data.put("profileId", mReqType);
+ }
+
+ data.put("cert_request_type", "pkcs10");
+ data.put("cert_request", mReq);
+
+ startProgressStatus();
+ boolean ready = requestCertCgi.requestCert(data);
+ endProgressStatus();
+
+ if (!ready) {
+ String str = requestCertCgi.getErrorMessage();
+ if (str.equals(""))
+ setErrorMessage("Server Error");
+ else
+ setErrorMessage(str);
+ }
+
+ wizardInfo.setRequestSent(ready);
+ return ready;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/keycert/WOperationSelectionPage.java b/base/console/src/com/netscape/admin/certsrv/keycert/WOperationSelectionPage.java
new file mode 100644
index 000000000..f2cdeff3d
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/keycert/WOperationSelectionPage.java
@@ -0,0 +1,134 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.keycert;
+
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Operation Selection page for certificate setup wizard
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.keycert
+ */
+class WOperationSelectionPage extends WizardBasePanel implements IWizardPanel {
+ private JRadioButton mInstallBtn;
+ private JRadioButton mRequestBtn;
+ private JComboBox mToken;
+ private static final String PANELNAME = "OPERATIONSELECTIONWIZARD";
+ private static final String HELPINDEX =
+ "configuration-keycert-wizard-operationselection-help";
+
+ WOperationSelectionPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WOperationSelectionPage(JDialog parent, JFrame frame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = frame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ String mode = wizardInfo.getMode();
+ // Fixes Bugscape Bug #55862: console - Certificate Setup Wizard
+ // throws Null Pointer Exception
+ if (mode != null && mode.equals("0")) {
+ info.addEntry(wizardInfo.OPTYPE, wizardInfo.INSTALLTYPE);
+ return false;
+ }
+ setBorder(makeTitledBorder(PANELNAME));
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ startProgressStatus();
+ if (mRequestBtn.isSelected())
+ info.addEntry(wizardInfo.OPTYPE, wizardInfo.REQUESTTYPE);
+ else
+ info.addEntry(wizardInfo.OPTYPE, wizardInfo.INSTALLTYPE);
+ endProgressStatus();
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JTextArea operationTypeLbl = createTextArea(mResource.getString(
+ PANELNAME+"_LABEL_OPERATIONTYPE_LABEL"));
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(operationTypeLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mRequestBtn = makeJRadioButton("REQUEST", true);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mRequestBtn, gbc);
+
+ ButtonGroup btnGroup = new ButtonGroup();
+ CMSAdminUtil.resetGBC(gbc);
+ mInstallBtn = makeJRadioButton("INSTALL", false);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(0,COMPONENT_SPACE,COMPONENT_SPACE, 0);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mInstallBtn, gbc);
+
+ btnGroup.add(mInstallBtn);
+ btnGroup.add(mRequestBtn);
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/keycert/WOtherCertRequest1Page.java b/base/console/src/com/netscape/admin/certsrv/keycert/WOtherCertRequest1Page.java
new file mode 100644
index 000000000..1dbd614d1
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/keycert/WOtherCertRequest1Page.java
@@ -0,0 +1,176 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.keycert;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Certificate Request from certificate setup wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.keycert
+ */
+class WOtherCertRequest1Page extends WizardBasePanel implements IWizardPanel {
+ private JRadioButton mExistingKeyBtn;
+ private JRadioButton mNewKeyBtn;
+ private JRadioButton mEmailBtn;
+ private JRadioButton mURLBtn;
+ private JRadioButton mManualBtn;
+ private static final String PANELNAME = "CACERTREQUESTWIZARD";
+ private static final String HELPINDEX =
+ "configuration-kra-wizard-change-keyscheme-help";
+
+ WOtherCertRequest1Page() {
+ super(PANELNAME);
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ if (wizardInfo.getOperationType().equals(wizardInfo.INSTALLTYPE))
+ return false;
+
+ String type = wizardInfo.getCertType();
+ if (type.equals(Constants.PR_CA_SIGNING_CERT))
+ return false;
+
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+
+ if (mNewKeyBtn.isSelected())
+ wizardInfo.addEntry(wizardInfo.KEY_MATERIAL, Constants.TRUE);
+ else if (mExistingKeyBtn.isSelected())
+ wizardInfo.addEntry(wizardInfo.KEY_MATERIAL, Constants.FALSE);
+
+ if (mEmailBtn.isSelected())
+ wizardInfo.addEntry(wizardInfo.SUBMIT_METHOD, wizardInfo.CA_EMAIL);
+ else if (mURLBtn.isSelected())
+ wizardInfo.addEntry(wizardInfo.SUBMIT_METHOD, wizardInfo.CA_URL);
+ else if (mManualBtn.isSelected())
+ wizardInfo.addEntry(wizardInfo.SUBMIT_METHOD, wizardInfo.MANUAL);
+
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ JTextArea methodText = createTextArea(
+ CMSAdminUtil.wrapText(mResource.getString(
+ "CACERTREQUESTWIZARD_TEXT_METHOD_LABEL"), 80), 2, 80);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(methodText, gbc);
+
+ mEmailBtn = makeJRadioButton("EMAIL", true);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0, 4*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mEmailBtn, gbc);
+
+ mURLBtn = makeJRadioButton("URL", false);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0, 4*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mURLBtn, gbc);
+
+ mManualBtn = makeJRadioButton("MANUAL", false);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0, 4*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mManualBtn, gbc);
+
+ JLabel keyLbl = makeJLabel("KEYPAIR");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(keyLbl, gbc);
+
+ mExistingKeyBtn = makeJRadioButton("OLDKEY", true);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0, 4*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mExistingKeyBtn, gbc);
+
+ mNewKeyBtn = makeJRadioButton("NEWKEY", false);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(0, 4*COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ add(mNewKeyBtn, gbc);
+
+ ButtonGroup methodGroup = new ButtonGroup();
+ methodGroup.add(mURLBtn);
+ methodGroup.add(mManualBtn);
+ methodGroup.add(mEmailBtn);
+
+ ButtonGroup keyGroup = new ButtonGroup();
+ keyGroup.add(mExistingKeyBtn);
+ keyGroup.add(mNewKeyBtn);
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/keycert/WPasteCertPage.java b/base/console/src/com/netscape/admin/certsrv/keycert/WPasteCertPage.java
new file mode 100644
index 000000000..50e14a50e
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/keycert/WPasteCertPage.java
@@ -0,0 +1,261 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.keycert;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.text.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * This page is to install the certificate in the internal token. The user can
+ * import the cert from the file or paste the Base 64 encoded blob in the
+ * text area.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WPasteCertPage extends WizardBasePanel implements IWizardPanel {
+ private JRadioButton mFileBtn;
+ private JRadioButton mBase64Btn;
+ private JTextField mFileText;
+ private JTextArea mBase64Text;
+ private JButton mPaste;
+ private JTextArea introLbl;
+ private Color mActiveColor;
+ private String mCertContent = "";
+ private String mCertFilePath = "";
+ private static final String PANELNAME = "PASTECERTWIZARD";
+ private static final String HELPINDEX =
+ "configuration-keycert-wizard-pastecert-help";
+
+ WPasteCertPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WPasteCertPage(JDialog parent, JFrame frame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = frame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ if (wizardInfo.getOperationType().equals(wizardInfo.REQUESTTYPE))
+ return false;
+ setBorder(makeTitledBorder(PANELNAME));
+ return true;
+ }
+
+ public boolean validatePanel() {
+ if (mBase64Btn.isSelected()) {
+ mCertContent = mBase64Text.getText().trim();
+ if (mCertContent.equals("")) {
+ setErrorMessage("B64EEMPTY");
+ return false;
+ }
+ } else if (mFileBtn.isSelected()) {
+ mCertFilePath = mFileText.getText().trim();
+ if (mCertFilePath.equals("")) {
+ setErrorMessage("EMPTYFILE");
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ startProgressStatus();
+ wizardInfo.addEntry(Constants.PR_PKCS10, mCertContent);
+ //cert = CMSAdminUtil.getPureString(mBase64Text.getText().trim());
+
+ AdminConnection connection = wizardInfo.getAdminConnection();
+ NameValuePairs nvps = new NameValuePairs();
+
+ if (mFileBtn.isSelected()) {
+ nvps.put(Constants.PR_CERT_FILEPATH, mCertFilePath);
+ wizardInfo.setCertFilePath(mCertFilePath);
+ wizardInfo.setPKCS10("");
+ } else if (mBase64Btn.isSelected()) {
+ nvps.put(Constants.PR_PKCS10, mCertContent);
+ wizardInfo.setPKCS10(mCertContent);
+ wizardInfo.setCertFilePath("");
+ }
+
+ try {
+ NameValuePairs response = connection.process(
+ DestDef.DEST_SERVER_ADMIN,
+ ScopeDef.SC_CERTINFO, wizardInfo.getInstallCertType(), nvps);
+
+ for (String name : response.keySet()) {
+ String str = response.get(name);
+ wizardInfo.addEntry(name, str);
+ }
+/*
+ for (int i=0; i<response.size(); i++) {
+ NameValuePair nvp = response.elementAt(i);
+ String name = nvp.getName();
+ String str = nvp.getValue();
+ wizardInfo.addEntry(name, str);
+ }
+*/
+ } catch (EAdminException e) {
+ //showErrorDialog(e.toString());
+ setErrorMessage(e.toString());
+ endProgressStatus();
+ return false;
+ }
+
+ endProgressStatus();
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ introLbl = createTextArea(mResource.getString(
+ PANELNAME+"_LABEL_INTRO_LABEL"));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(introLbl, gbc);
+
+ mFileBtn = makeJRadioButton("FILE", true);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mFileBtn, gbc);
+
+ mFileText = makeJTextField(50);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, 4*COMPONENT_SPACE, COMPONENT_SPACE, 0);
+ add(mFileText, gbc);
+ mActiveColor = mFileText.getBackground();
+
+ mBase64Btn = makeJRadioButton("BASE64", false);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mBase64Btn, gbc);
+
+ JTextArea desc = createTextArea(mResource.getString(
+ "PASTECERTWIZARD_TEXT_DESC_LABEL"));
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,4*COMPONENT_SPACE,0,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+
+ mBase64Text = new JTextArea(null, null, 0, 0);
+ Font f = new Font("Monospaced", Font.PLAIN, 12);
+ if (f != null) mBase64Text.setFont(f);
+ JScrollPane scrollPane = new JScrollPane(mBase64Text,
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
+ scrollPane.setPreferredSize(new Dimension(50, 20));
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE, 0,
+ COMPONENT_SPACE);
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(scrollPane, gbc);
+
+ mPaste = makeJButton("PASTE");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mPaste, gbc);
+
+ JLabel dummy = new JLabel(" ");
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weighty = 1.0;
+ gbc.fill = gbc.BOTH;
+ add(dummy, gbc);
+
+ ButtonGroup buttonGrp = new ButtonGroup();
+ buttonGrp.add(mFileBtn);
+ buttonGrp.add(mBase64Btn);
+
+ enableFields(mFileText, true, mActiveColor);
+ enableFields(mBase64Text, false, getBackground());
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mPaste)) {
+ mBase64Text.paste();
+ } else if (e.getSource().equals(mFileBtn)) {
+ enableFields(mFileText, true, mActiveColor);
+ enableFields(mBase64Text, false, getBackground());
+ } else if (e.getSource().equals(mBase64Btn)) {
+ enableFields(mFileText, false, getBackground());
+ enableFields(mBase64Text, true, mActiveColor);
+ }
+ }
+
+ private void enableFields(JTextComponent comp1, boolean enable, Color color) {
+ comp1.setEnabled(enable);
+ comp1.setEditable(enable);
+ comp1.setBackground(color);
+ CMSAdminUtil.repaintComp(comp1);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/keycert/WRAKeyPage.java b/base/console/src/com/netscape/admin/certsrv/keycert/WRAKeyPage.java
new file mode 100644
index 000000000..616deb74f
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/keycert/WRAKeyPage.java
@@ -0,0 +1,72 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.keycert;
+
+import java.awt.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+
+/**
+ * Setup CA signing cert for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WRAKeyPage extends WBaseKeyPage implements IWizardPanel {
+ private static final String PANELNAME = "RAKEYWIZARD";
+ private static final String HELPINDEX =
+ "configuration-kra-wizard-change-keyscheme-help";
+
+ WRAKeyPage() {
+ super(PANELNAME);
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/keycert/WRequestStatusPage.java b/base/console/src/com/netscape/admin/certsrv/keycert/WRequestStatusPage.java
new file mode 100644
index 000000000..a52def44a
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/keycert/WRequestStatusPage.java
@@ -0,0 +1,142 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.keycert;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.install.*;
+
+/**
+ * Request status page for certificate setup wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.keycert
+ */
+class WRequestStatusPage extends WizardBasePanel implements IWizardPanel {
+ private static final String PANELNAME = "REQUESTSTATUSWIZARD";
+ private static final String HELPINDEX =
+ "configuration-keycert-wizard-certrequeststatus-help";
+ protected JTextArea mDesc;
+
+ protected String mRequestId;
+
+ WRequestStatusPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WRequestStatusPage(JDialog parent, JFrame frame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = frame;
+ init();
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ setBorder(makeTitledBorder(PANELNAME));
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+
+ if (!wizardInfo.requestSent()) {
+ String str = "";
+ if (wizardInfo.getOperationType().equals(wizardInfo.REQUESTTYPE) &&
+ (!wizardInfo.getCAType().equals(wizardInfo.SELF_SIGNED))) {
+ str = mResource.getString(
+ "REQUESTSTATUSWIZARD_TEXT_REQUEST_LABEL");
+ mDesc.setText(str);
+ return true;
+ }
+ return false;
+ } else {
+ String status = wizardInfo.getRequestStatus();
+ String str = wizardInfo.getRequestID();
+ String error = wizardInfo.getRequestError();
+
+ if (str != null && !str.equals("")) {
+ if (status != null && status.equals("5")) {
+ // rejected
+ mDesc.setText(mResource.getString("REQUESTRESULTWIZARD_TEXT_REJECT_LABEL") + error + "\n\n"+ mResource.getString("REQUESTRESULTWIZARD_TEXT_ID_LABEL") + str + mResource.getString("REQUESTRESULTWIZARD_TEXT_REJECTEND_LABEL"));
+ } else {
+ // success
+ mDesc.setText(mResource.getString("REQUESTRESULTWIZARD_TEXT_DESC_LABEL") +
+ mResource.getString("REQUESTRESULTWIZARD_TEXT_ID_LABEL") + str +
+ mResource.getString("REQUESTRESULTWIZARD_TEXT_END_LABEL"));
+ }
+ }
+ else if (error != null)
+ mDesc.setText(error);
+ else
+ mDesc.setText(mResource.getString("REQUESTRESULTWIZARD_TEXT_DESC_LABEL") +
+ mResource.getString("REQUESTRESULTWIZARD_TEXT_NOID_LABEL"));
+ }
+ return true;
+ }
+
+ public boolean isLastPage() {
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ mDesc = createTextArea(" ");
+ //mDesc = createTextArea("request id");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mDesc, gbc);
+
+ JLabel label = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(label, gbc);
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/keycert/WSSLKeyPage.java b/base/console/src/com/netscape/admin/certsrv/keycert/WSSLKeyPage.java
new file mode 100644
index 000000000..7065f68b6
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/keycert/WSSLKeyPage.java
@@ -0,0 +1,72 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.keycert;
+
+import java.awt.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.config.*;
+
+/**
+ * Setup CA signing cert for installation wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config.install
+ */
+class WSSLKeyPage extends WBaseKeyPage implements IWizardPanel {
+ private static final String PANELNAME = "SSLKEYWIZARD";
+ private static final String HELPINDEX =
+ "configuration-kra-wizard-change-keyscheme-help";
+
+ WSSLKeyPage() {
+ super(PANELNAME);
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/keycert/WTokenLogonPage.java b/base/console/src/com/netscape/admin/certsrv/keycert/WTokenLogonPage.java
new file mode 100644
index 000000000..53a623d0a
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/keycert/WTokenLogonPage.java
@@ -0,0 +1,178 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.keycert;
+
+import java.awt.*;
+import javax.swing.*;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * This panel asks for the user to logon to the keycert token .
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.keycert
+ */
+class WTokenLogonPage extends WizardBasePanel implements IWizardPanel {
+ protected JLabel mTokenNameText;
+ protected JPasswordField mPasswordText, mPasswordAgainText;
+ private static final String EMPTYSTR = " ";
+ protected JTextArea mDesc;
+ protected String mTokenName;
+ private static final String PANELNAME = "TOKENLOGONWIZARD";
+ private static final String HELPINDEX =
+ "configuration-keycert-wizard-tokenlogon-help";
+
+ WTokenLogonPage(JDialog parent) {
+ super(PANELNAME);
+ mParent = parent;
+ init();
+ }
+
+ WTokenLogonPage(JDialog parent, JFrame frame) {
+ super(PANELNAME);
+ mParent = parent;
+ mAdminFrame = frame;
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ setBorder(makeTitledBorder(mPanelName));
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+
+ if (!wizardInfo.isNewKey() || wizardInfo.isLoggedIn())
+ return false;
+
+ mDesc.setText(mResource.getString(mPanelName+"_TEXT_HEADING_LABEL"));
+ mTokenNameText.setText(wizardInfo.getTokenName());
+
+ return true;
+ }
+
+ public boolean validatePanel() {
+ String passwd = mPasswordText.getText();
+ if (passwd.equals("")) {
+ setErrorMessage("BLANKPASSWD");
+ return false;
+ }
+
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ AdminConnection connection = wizardInfo.getAdminConnection();
+ String tokenname = mTokenNameText.getText().trim();
+
+ if (tokenname.equals("internal")) {
+ tokenname = Constants.PR_INTERNAL_TOKEN_NAME;
+ }
+
+ String pwd = mPasswordText.getText().trim();
+ startProgressStatus();
+
+ try {
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_TOKEN_NAME, tokenname);
+ nvps.put(Constants.PR_TOKEN_PASSWD, pwd);
+ connection.modify(DestDef.DEST_SERVER_ADMIN,
+ ScopeDef.SC_TOKEN_LOGON, Constants.RS_ID_CONFIG, nvps);
+ } catch (EAdminException e) {
+ setErrorMessage(e.toString());
+ endProgressStatus();
+ return false;
+ }
+
+ endProgressStatus();
+
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mDesc = createTextArea("");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mDesc, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel tokenLabel = makeJLabel("TOKEN");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, 0, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(tokenLabel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mTokenNameText = new JLabel(" ");
+ gbc.anchor = gbc.NORTHWEST;
+ //gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mTokenNameText, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel passwordLabel = makeJLabel("PWD");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(passwordLabel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mPasswordText = makeJPasswordField(30);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ add(mPasswordText, gbc);
+
+ JLabel dummy = new JLabel(" ");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ add(dummy, gbc);
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/keycert/WTokenSelectionPage.java b/base/console/src/com/netscape/admin/certsrv/keycert/WTokenSelectionPage.java
new file mode 100644
index 000000000..b595e1ffd
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/keycert/WTokenSelectionPage.java
@@ -0,0 +1,158 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.keycert;
+
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Token Selection page for certificate setup wizard
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.keycert
+ */
+class WTokenSelectionPage extends WizardBasePanel implements IWizardPanel {
+ private JRadioButton mInstallBtn;
+ private JRadioButton mRequestBtn;
+ private JComboBox mToken;
+ private static final String PANELNAME = "TOKENSELECTIONWIZARD";
+ private static final String HELPINDEX =
+ "configuration-kra-wizard-change-keyscheme-help";
+
+ WTokenSelectionPage() {
+ super(PANELNAME);
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ String tokenList = (String)wizardInfo.getEntry(Constants.PR_TOKEN_LIST);
+ StringTokenizer tokenizer = new StringTokenizer(tokenList, ",");
+ while (tokenizer.hasMoreTokens()) {
+ mToken.addItem((String)tokenizer.nextToken());
+ }
+ return true;
+ }
+
+ public boolean validatePanel() {
+ return true;
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ info.addEntry(wizardInfo.TOKENNAME, (String)mToken.getSelectedItem());
+ if (mRequestBtn.isSelected())
+ info.addEntry(wizardInfo.OPTYPE, wizardInfo.REQUESTTYPE);
+ else
+ info.addEntry(wizardInfo.OPTYPE, wizardInfo.INSTALLTYPE);
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel operationTypeLbl = makeJLabel("OPERATIONTYPE");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(operationTypeLbl, gbc);
+
+ ButtonGroup btnGroup = new ButtonGroup();
+ CMSAdminUtil.resetGBC(gbc);
+ mInstallBtn = makeJRadioButton("INSTALL", true);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,4*COMPONENT_SPACE,
+ COMPONENT_SPACE, 0);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mInstallBtn, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mRequestBtn = makeJRadioButton("REQUEST", false);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(0, 4*COMPONENT_SPACE, 2*COMPONENT_SPACE,
+ COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mRequestBtn, gbc);
+
+ btnGroup.add(mInstallBtn);
+ btnGroup.add(mRequestBtn);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel tokenTypeLbl = makeJLabel("TOKENSELECTION");
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(tokenTypeLbl, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel tokenLbl = makeJLabel("TOKEN");
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.weighty = 0.0;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE,4*COMPONENT_SPACE, COMPONENT_SPACE,0);
+ add(tokenLbl, gbc);
+
+ mToken = new JComboBox();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.fill = gbc.NONE;
+ gbc.weighty = 0.0;
+ gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(mToken, gbc);
+
+ JTextArea dummy2 = createTextArea(" ", 1, 20);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ add(dummy2, gbc);
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/keycert/WWarningExecute1Page.java b/base/console/src/com/netscape/admin/certsrv/keycert/WWarningExecute1Page.java
new file mode 100644
index 000000000..be844576c
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/keycert/WWarningExecute1Page.java
@@ -0,0 +1,161 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.keycert;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Introduction page for certificate setup wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.keycert
+ */
+class WWarningExecute1Page extends WizardBasePanel implements IWizardPanel {
+ private JButton mAgree;
+ private boolean mIsAgree = false;
+ private static final String PANELNAME = "WARNINGEXECUTE1WIZARD";
+ private static final String HELPINDEX =
+ "configuration-kra-wizard-change-keyscheme-help";
+
+ WWarningExecute1Page() {
+ super(PANELNAME);
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ if (wizardInfo.getOperationType().equals(wizardInfo.REQUESTTYPE) &&
+ wizardInfo.isNewKey() &&
+ wizardInfo.getCertType().equals(Constants.PR_CA_SIGNING_CERT) &&
+ wizardInfo.getCAType().equals(wizardInfo.SUBORDINATE_CA))
+ return true;
+
+ return false;
+ }
+
+ public boolean validatePanel() {
+ if (mIsAgree)
+ return true;
+ else {
+ setErrorMessage("PROCEED");
+ return false;
+ }
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ AdminConnection connection = wizardInfo.getAdminConnection();
+ NameValuePairs nvps = wizardInfo.getNameValuePairs();
+ try {
+ NameValuePairs response = connection.process(
+ DestDef.DEST_SERVER_ADMIN, ScopeDef.SC_CERT_REQUEST,
+ wizardInfo.getCertType(), nvps);
+ for (String key : response.keySet()) {
+ String value = response.get(key);
+ if (key.equals(Constants.PR_CSR)) {
+ wizardInfo.addEntry(Constants.PR_CSR, value);
+ break;
+ }
+ }
+ } catch (EAdminException e) {
+ setErrorMessage(e.toString());
+ return false;
+ }
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ Icon icon = CMSAdminUtil.getImage(CMSAdminResources.IMAGE_WARN_ICON);
+
+ JLabel label = new JLabel(icon);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(label, gbc);
+
+ JTextArea desc = new JTextArea(
+ CMSAdminUtil.wrapText(mResource.getString(
+ "WARNINGEXECUTE1WIZARD_TEXT_DESC_LABEL"), 80), 3, 80);
+
+ desc.setBackground(getBackground());
+ desc.setEditable(false);
+ desc.setCaretColor(getBackground());
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+
+ JTextArea desc1 = new JTextArea(
+ CMSAdminUtil.wrapText(mResource.getString(
+ "WARNINGEXECUTE1WIZARD_LABEL_WARNING_LABEL"), 60), 3, 60);
+ desc1.setBackground(getBackground());
+ desc1.setEditable(false);
+ desc1.setCaretColor(getBackground());
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(desc1, gbc);
+
+ mAgree = makeJButton("OK");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mAgree, gbc);
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mAgree)) {
+ mIsAgree = true;
+ }
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/keycert/WWarningExecutePage.java b/base/console/src/com/netscape/admin/certsrv/keycert/WWarningExecutePage.java
new file mode 100644
index 000000000..a64f67188
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/keycert/WWarningExecutePage.java
@@ -0,0 +1,154 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.keycert;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Introduction page for certificate setup wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.keycert
+ */
+class WWarningExecutePage extends WizardBasePanel implements IWizardPanel {
+ private JButton mAgree;
+ private boolean mIsAgree = false;
+ private static final String PANELNAME = "WARNINGEXECUTEWIZARD";
+ private static final String HELPINDEX =
+ "configuration-kra-wizard-change-keyscheme-help";
+
+ WWarningExecutePage() {
+ super(PANELNAME);
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ if (wizardInfo.getOperationType().equals(wizardInfo.REQUESTTYPE) &&
+ wizardInfo.isNewKey() &&
+ wizardInfo.getCertType().equals(Constants.PR_CA_SIGNING_CERT) &&
+ wizardInfo.getCAType().equals(wizardInfo.SELF_SIGNED))
+ return true;
+
+ return false;
+ }
+
+ public boolean validatePanel() {
+ if (mIsAgree)
+ return true;
+ else {
+ setErrorMessage("PROCEED");
+ return false;
+ }
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+ AdminConnection connection = wizardInfo.getAdminConnection();
+ NameValuePairs nvps = wizardInfo.getNameValuePairs();
+ try {
+ connection.modify(
+ DestDef.DEST_SERVER_ADMIN, ScopeDef.SC_ISSUE_IMPORT_CERT,
+ wizardInfo.getCertType(), nvps);
+ } catch (EAdminException e) {
+ setErrorMessage(e.toString());
+ return false;
+ }
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ Icon icon = CMSAdminUtil.getImage(CMSAdminResources.IMAGE_WARN_ICON);
+
+ JLabel label = new JLabel(icon);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(label, gbc);
+
+ JTextArea desc = new JTextArea(
+ CMSAdminUtil.wrapText(mResource.getString(
+ "WARNINGEXECUTEWIZARD_TEXT_DESC_LABEL"), 80), 3, 80);
+
+ desc.setBackground(getBackground());
+ desc.setEditable(false);
+ desc.setCaretColor(getBackground());
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+
+ JTextArea desc1 = new JTextArea(
+ CMSAdminUtil.wrapText(mResource.getString(
+ "WARNINGEXECUTEWIZARD_LABEL_WARNING_LABEL"), 60), 3, 60);
+ desc1.setBackground(getBackground());
+ desc1.setEditable(false);
+ desc1.setCaretColor(getBackground());
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(desc1, gbc);
+
+ mAgree = makeJButton("OK");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mAgree, gbc);
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mAgree)) {
+ mIsAgree = true;
+ }
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/keycert/WWarningPage.java b/base/console/src/com/netscape/admin/certsrv/keycert/WWarningPage.java
new file mode 100644
index 000000000..7a4eabe57
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/keycert/WWarningPage.java
@@ -0,0 +1,143 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.keycert;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.wizard.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Introduction page for certificate setup wizard.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.keycert
+ */
+class WWarningPage extends WizardBasePanel implements IWizardPanel {
+ private JButton mAgree;
+ private boolean mIsAgree = false;
+ private static final String PANELNAME = "WARNINGWIZARD";
+ private static final String HELPINDEX =
+ "configuration-kra-wizard-change-keyscheme-help";
+
+ WWarningPage() {
+ super(PANELNAME);
+ init();
+ }
+
+ public boolean isLastPage() {
+ return false;
+ }
+
+ public boolean initializePanel(WizardInfo info) {
+ CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info;
+
+ if (wizardInfo.getOperationType().equals(wizardInfo.REQUESTTYPE) &&
+ wizardInfo.isNewKey() &&
+ wizardInfo.getCertType().equals(Constants.PR_CA_SIGNING_CERT))
+ return true;
+
+ return false;
+ }
+
+ public boolean validatePanel() {
+ if (mIsAgree)
+ return true;
+ else {
+ setErrorMessage("PROCEED");
+ return false;
+ }
+ }
+
+ public boolean concludePanel(WizardInfo info) {
+ return true;
+ }
+
+ public void callHelp() {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+
+ protected void init() {
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ setLayout(gb);
+
+ Icon icon = CMSAdminUtil.getImage(CMSAdminResources.IMAGE_WARN_ICON);
+
+ JLabel label = new JLabel(icon);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(label, gbc);
+
+ JTextArea desc = new JTextArea(
+ CMSAdminUtil.wrapText(mResource.getString(
+ "WARNINGWIZARD_TEXT_DESC_LABEL"), 80), 3, 80);
+
+ desc.setBackground(getBackground());
+ desc.setEditable(false);
+ desc.setCaretColor(getBackground());
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(desc, gbc);
+
+ JTextArea desc1 = new JTextArea(
+ CMSAdminUtil.wrapText(mResource.getString(
+ "WARNINGWIZARD_LABEL_WARNING_LABEL"), 80), 1, 80);
+ desc1.setBackground(getBackground());
+ desc1.setEditable(false);
+ desc1.setCaretColor(getBackground());
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ add(desc1, gbc);
+
+ mAgree = makeJButton("OK");
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ add(mAgree, gbc);
+
+ super.init();
+ }
+
+ public void getUpdateInfo(WizardInfo info) {
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mAgree)) {
+ mIsAgree = true;
+ }
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/managecert/CertificateInfoDialog.java b/base/console/src/com/netscape/admin/certsrv/managecert/CertificateInfoDialog.java
new file mode 100644
index 000000000..3a5c43705
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/managecert/CertificateInfoDialog.java
@@ -0,0 +1,351 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.managecert;
+
+import com.netscape.admin.certsrv.*;
+import javax.swing.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Certificate Information dialog
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.managecert
+ */
+public class CertificateInfoDialog extends JDialog
+ implements ActionListener {
+ private String PREFIX = "CERTINFODIALOG";
+
+ private JFrame mParent;
+ private ResourceBundle mResource;
+ private JTextArea mTextArea;
+ private JLabel mCertNameField, mStatusLbl;
+ private JButton mClose, mHelp, mTrust;
+ private AdminConnection mConn;
+ private String mCertName;
+ private String mCertDate;
+ private JButton mActionBtn;
+ private static final String HELPINDEX =
+ "configuration-managecert-wizard-trustcert-help";
+
+ JLabel changeLbl = null;
+
+ public CertificateInfoDialog(JFrame parent) {
+ super(parent,true);
+ mParent = parent;
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ setSize(650, 400);
+ setTitle(mResource.getString(PREFIX+"_TITLE"));
+ setLocationRelativeTo(parent);
+ getRootPane().setDoubleBuffered(true);
+ setDisplay();
+ }
+
+ public void showDialog(String name, String content, String trust) {
+ mCertNameField.setText(name);
+ mTextArea.setText(content);
+ String actionStr = "";
+ String statusStr = "";
+ if (trust.equals("Trust")) {
+ //mTrust.setText(" Trust ");
+ actionStr = mResource.getString(PREFIX+"_BUTTON_UNTRUST_LABEL");
+ statusStr = mResource.getString(PREFIX+"_LABEL_TRUSTSTATUS_LABEL");
+ mActionBtn.setText(actionStr);
+ mStatusLbl.setText(statusStr);
+ } else if (trust.equals("Untrust")){
+ //mTrust.setText(trust);
+ actionStr = mResource.getString(PREFIX+"_BUTTON_TRUST_LABEL");
+ statusStr = mResource.getString(PREFIX+"_LABEL_UNTRUSTSTATUS_LABEL");
+ mActionBtn.setText(actionStr);
+ mStatusLbl.setText(statusStr);
+ } else { /* user certs can't be changed */
+ actionStr = mResource.getString(PREFIX+"_BUTTON_USER_LABEL");
+ statusStr = mResource.getString(PREFIX+"_LABEL_USER_LABEL");
+ mActionBtn.setText(actionStr);
+ mActionBtn.setEnabled(false);
+ mStatusLbl.setText(statusStr);
+ changeLbl.setEnabled(false);
+ }
+ this.show();
+ }
+
+ public void showDialog(String name, String content, String trust,
+ String date, AdminConnection conn) {
+ mConn = conn;
+ mCertName = name;
+ mCertDate = date;
+ showDialog(name, content, trust);
+ }
+
+ public void actionPerformed(ActionEvent evt) {
+ if (evt.getSource().equals(mClose)) {
+ this.hide();
+ this.dispose();
+ } else if (evt.getSource().equals(mActionBtn)) {
+ String trustLbl = mActionBtn.getText().trim();
+ String trustaction = mResource.getString(PREFIX+"_BUTTON_TRUST_LABEL");
+ String untrustaction = mResource.getString(PREFIX+"_BUTTON_UNTRUST_LABEL");
+ String trust = "";
+ if (trustLbl.equals(trustaction))
+ trust = "Trust";
+ else if (trustLbl.equals(untrustaction))
+ trust = "Untrust";
+ else // user certs not to be changable
+ return;
+
+ NameValuePairs nvps = new NameValuePairs();
+ String value = mCertName+";"+mCertDate;
+ nvps.put("certName0", value);
+
+ try {
+ mConn.modify(DestDef.DEST_SERVER_ADMIN, ScopeDef.SC_TRUST,
+ trust, nvps);
+ String actionStr = "";
+ String statusStr = "";
+ if (trust.equals("Trust")) {
+ actionStr = mResource.getString(PREFIX+"_BUTTON_UNTRUST_LABEL");
+ statusStr = mResource.getString(PREFIX+"_LABEL_TRUSTSTATUS_LABEL");
+ } else {
+ actionStr = mResource.getString(PREFIX+"_BUTTON_TRUST_LABEL");
+ statusStr = mResource.getString(PREFIX+"_LABEL_UNTRUSTSTATUS_LABEL");
+ }
+
+ mActionBtn.setText(actionStr);
+ mStatusLbl.setText(statusStr);
+ } catch (EAdminException ex) {
+ CMSAdminUtil.showErrorDialog(mParent, mResource, ex.toString(),
+ CMSAdminUtil.ERROR_MESSAGE);
+ }
+ } else if (evt.getSource().equals(mHelp)) {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+ }
+
+/*
+ private void refresh() {
+ try {
+ NameValuePairs results = mConn.process(
+ DestDef.DEST_SERVER_ADMIN, ScopeDef.SC_CERT_PRETTY_PRINT,
+ Constants.RS_ID_CONFIG, nvps);
+ if (nvps.size() <= 0)
+ return;
+ NameValuePair nvp = results.elementAt(0);
+ String name = nvp.getName();
+ String value = nvp.getValue();
+ CertificateInfoDialog dialog = new CertificateInfoDialog(mParent);
+ dialog.showDialog(name, value);
+ } catch (EAdminException ex) {
+ CMSAdminUtil.showErrorDialog(mParent, mResource, ex.toString(),
+ CMSAdminUtil.ERROR_MESSAGE);
+ }
+ }
+*/
+
+ private void setDisplay() {
+ getContentPane().setLayout(new BorderLayout());
+ JPanel center = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ center.setLayout(gb);
+
+ //content panel
+ JPanel content = makeContentPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.fill = gbc.BOTH;
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(content, gbc);
+ center.add(content);
+
+ //action panel
+ JPanel action = makeActionPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints(action, gbc);
+ center.add(action);
+
+ getContentPane().add("Center",center);
+ }
+
+ private JPanel makeActionPane() {
+ mClose = CMSAdminUtil.makeJButton(mResource, PREFIX, "CLOSE",
+ null, this);
+
+ mHelp = CMSAdminUtil.makeJButton(mResource, PREFIX, "HELP", null, this);
+ Dimension d = mClose.getMinimumSize();
+ if (d.width < CMSAdminUtil.DEFAULT_BUTTON_SIZE) {
+ d.width = CMSAdminUtil.DEFAULT_BUTTON_SIZE;
+ mClose.setMinimumSize(d);
+ }
+ d = mHelp.getMinimumSize();
+ if (d.width < CMSAdminUtil.DEFAULT_BUTTON_SIZE) {
+ d.width = CMSAdminUtil.DEFAULT_BUTTON_SIZE;
+ mHelp.setMinimumSize(d);
+ }
+ //JButton[] buttons = {mClose, mHelp};
+ JButton[] buttons = {mClose};
+ return CMSAdminUtil.makeJButtonPanel( buttons );
+ }
+
+ private JPanel makeContentPane() {
+ JPanel content = new JPanel();
+ GridBagLayout gb3 = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ content.setLayout(gb3);
+ content.setBorder(CMSAdminUtil.makeTitledBorder(mResource,
+ "CERTINFODIALOG", "CERT"));
+
+ JPanel panel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ panel.setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.insets = new Insets(0, 0, 0, 0);
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.fill = gbc.BOTH;
+ content.add(panel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label1 = CMSAdminUtil.makeJLabel(mResource, PREFIX, "CERTNAME",
+ null);
+ gbc.fill = gbc.NONE;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ 0, //CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE, CMSAdminUtil.COMPONENT_SPACE);
+ gb.setConstraints(label1, gbc);
+ panel.add(label1);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mCertNameField = new JLabel(" ");
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.anchor = gbc.WEST;
+ gbc.weightx=1.0;
+ //gbc.fill = gbc.NONE;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE, CMSAdminUtil.COMPONENT_SPACE);
+ gb.setConstraints(mCertNameField, gbc);
+ panel.add(mCertNameField);
+
+
+ //CMSAdminUtil.addEntryField(content, label1, mCertNameField, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label2 = CMSAdminUtil.makeJLabel(mResource, PREFIX, "CONTENT", null);
+ gbc.fill = gbc.NONE;
+ gbc.anchor = gbc.WEST;
+ //gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0,
+ CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE, CMSAdminUtil.COMPONENT_SPACE);
+ gb.setConstraints(label2, gbc);
+ panel.add(label2);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label3 = new JLabel(" ");
+ //gbc.fill = gbc.NONE;
+ gbc.weightx = 1.0;
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.insets = new Insets(0,
+ CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE, CMSAdminUtil.COMPONENT_SPACE);
+ gb.setConstraints(label3, gbc);
+ panel.add(label3);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mTextArea = new JTextArea("",100,90);
+ mTextArea.setEditable(false);
+ mTextArea.setBackground(getBackground());
+ JScrollPane scrollPanel = new JScrollPane(mTextArea,
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
+ scrollPanel.setAlignmentX(LEFT_ALIGNMENT);
+ scrollPanel.setAlignmentY(TOP_ALIGNMENT);
+ scrollPanel.setBorder(BorderFactory.createLoweredBevelBorder());
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = gbc.REMAINDER;
+// gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx=1.0;
+ gbc.weighty=1.0;
+ gbc.insets = new Insets(0,
+ CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE, CMSAdminUtil.COMPONENT_SPACE);
+ gb3.setConstraints(scrollPanel, gbc);
+ content.add(scrollPanel);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mStatusLbl = CMSAdminUtil.makeJLabel(mResource, PREFIX, "TRUSTSTATUS", null);
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(0,
+ CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE, CMSAdminUtil.COMPONENT_SPACE);
+ gb3.setConstraints(mStatusLbl, gbc);
+ content.add(mStatusLbl);
+
+ CMSAdminUtil.resetGBC(gbc);
+ changeLbl = CMSAdminUtil.makeJLabel(mResource, PREFIX, "MODIFY", null);
+ gbc.anchor = gbc.WEST;
+ gbc.insets = new Insets(0,
+ CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE, CMSAdminUtil.COMPONENT_SPACE);
+ gb3.setConstraints(changeLbl, gbc);
+ content.add(changeLbl);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mActionBtn = CMSAdminUtil.makeJButton(mResource, PREFIX,"UNTRUST", null, this);
+ gbc.anchor = gbc.WEST;
+ gbc.insets = new Insets(0,
+ CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE, CMSAdminUtil.COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.fill = gbc.NONE;
+ gb3.setConstraints(mActionBtn, gbc);
+ content.add(mActionBtn);
+/*
+ CMSAdminUtil.resetGBC(gbc);
+ mTrust = CMSAdminUtil.makeJButton(mResource, PREFIX, "TRUST", null, this);
+ gbc.fill = gbc.NONE;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(0,
+ CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE, CMSAdminUtil.COMPONENT_SPACE);
+ gbc.gridwidth = gbc.REMAINDER;
+ gb3.setConstraints(mTrust, gbc);
+ content.add(mTrust);
+*/
+
+ return content;
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/managecert/ManageCertDialog.java b/base/console/src/com/netscape/admin/certsrv/managecert/ManageCertDialog.java
new file mode 100644
index 000000000..4fd902584
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/managecert/ManageCertDialog.java
@@ -0,0 +1,362 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.managecert;
+
+import java.util.*;
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.table.*;
+import javax.swing.*;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * This class lists out all the CA certificates from the internal token.
+ *
+ * @author chrisho
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.managecert
+ */
+public class ManageCertDialog extends JDialog implements ActionListener,
+ MouseListener {
+ private static final String PANELNAME = "MANAGECERTDIALOG";
+ static final Dimension DEFAULT_SIZE = new Dimension(460,500);
+ static final Dimension BUTTON_MIN_SIZE = new Dimension(100,30);
+
+ protected ResourceBundle mResource;
+ private JFrame mParent;
+ private JTable mTable;
+ private ManageCertModel mDataModel;
+ private JButton mClose, mDelete, mEdit, mHelp;
+ private AdminConnection mConn;
+ private static final String HELPINDEX =
+ "configuration-managecert-wizard-certlists-help";
+
+ public ManageCertDialog(JFrame parent) {
+ super(parent, true);
+ mParent = parent;
+ setSize(460,500);
+ getRootPane().setDoubleBuffered(true);
+ setLocationRelativeTo(parent);
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ setTitle(mResource.getString(PANELNAME+"_TITLE"));
+ setDisplay();
+ }
+
+ public void showDialog(AdminConnection conn) {
+ mConn = conn;
+ refresh();
+ this.show();
+ }
+
+ private void refresh() {
+ NameValuePairs response=null;
+ try {
+ response = mConn.search(DestDef.DEST_SERVER_ADMIN, ScopeDef.SC_ALL_CERTLIST,
+ new NameValuePairs());
+ } catch (EAdminException e) {
+ CMSAdminUtil.showErrorDialog(mParent, mResource, e.toString(),
+ CMSAdminUtil.ERROR_MESSAGE);
+ }
+
+ if (response == null) { /* we must have gotten timed out */
+ return;
+ }
+
+ mDataModel.removeAllRows();
+
+ String[] vals = new String[response.size()];
+ int i=0;
+ for (String entry : response.keySet()) {
+ vals[i++] = entry.trim();
+ }
+
+ CMSAdminUtil.bubbleSort(vals);
+
+ for (i=0; i<vals.length; i++) {
+ String entry = vals[i];
+ String value = response.get(entry);
+ addRows(entry, value);
+ }
+ mTable.getSelectionModel().clearSelection();
+ setButtons();
+ }
+
+ private void addRows(String entry, String value) {
+ StringTokenizer tokenizer = new StringTokenizer(value, ";");
+ int numTokens = tokenizer.countTokens();
+ while (tokenizer.hasMoreTokens()) {
+ String token = (String)tokenizer.nextToken();
+ String expiredDate = token.substring(0, token.length()-2);
+ String trust = token.substring(token.length()-1);
+ Vector v = new Vector();
+ v.addElement(entry);
+ v.addElement(expiredDate);
+ if (trust.equals("T"))
+ v.addElement("Trusted");
+ else if (trust.equals("U"))
+ v.addElement("Untrusted");
+ else if (trust.equals("u"))
+ v.addElement("N/A");
+ mDataModel.addRow(v);
+ }
+ }
+
+ private void setDisplay() {
+ getContentPane().setLayout(new BorderLayout());
+ JPanel center = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ center.setLayout(gb);
+
+ //content panel
+ JPanel content = makeContentPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.fill = gbc.BOTH;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(content, gbc);
+ center.add(content);
+
+ //action panel
+ JPanel action = makeActionPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints(action, gbc);
+ center.add(action);
+
+ getContentPane().add("Center",center);
+ }
+
+ public JPanel makeActionPane() {
+ JPanel panel = new JPanel();
+
+ mClose = new JButton();
+ mClose.setText(mResource.getString(
+ "MANAGECERTDIALOG_BUTTON_CLOSE_LABEL"));
+ mClose.addActionListener(this);
+
+ mEdit = new JButton();
+ mEdit.setText(mResource.getString(
+ "MANAGECERTDIALOG_BUTTON_EDIT_VIEW_LABEL"));
+ mEdit.addActionListener(this);
+
+ mDelete = new JButton();
+ mDelete.setText(mResource.getString(
+ "MANAGECERTDIALOG_BUTTON_DELETE_LABEL"));
+ mDelete.addActionListener(this);
+
+ mHelp = new JButton();
+ mHelp.setText(mResource.getString(
+ "MANAGECERTDIALOG_BUTTON_HELP_LABEL"));
+ mHelp.addActionListener(this);
+
+ //JButton[] buttons = {mClose, mEdit, mDelete, mHelp};
+ JButton[] buttons = {mClose, mEdit, mDelete};
+ return CMSAdminUtil.makeJButtonPanel(buttons, true);
+ }
+
+ public JPanel makeContentPane() {
+ JPanel content = new JPanel();
+ content.setBorder(CMSAdminUtil.makeTitledBorder(mResource,
+ "MANAGECERTDIALOG", "CERT"));
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ content.setLayout(gb);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mDataModel = new ManageCertModel();
+ mTable = new JTable(mDataModel);
+ JScrollPane scrollPane = JTable.createScrollPaneForTable(mTable);
+ scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ mTable.setPreferredScrollableViewportSize(new Dimension(200, 350));
+ mTable.setAutoscrolls(true);
+ mTable.sizeColumnsToFit(true);
+ mTable.addMouseListener(this);
+ scrollPane.setBackground(Color.white);
+ setLabelCellRenderer(mTable, 0);
+ setLabelCellRenderer(mTable, 1);
+ setLabelCellRenderer(mTable, 2);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.fill = gbc.BOTH;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE, CMSAdminUtil.COMPONENT_SPACE);
+ gb.setConstraints(scrollPane, gbc);
+ content.add(scrollPane);
+
+ return content;
+ }
+
+ protected void setLabelCellRenderer(JTable table, int index) {
+ table.getColumnModel().getColumn(index).setCellRenderer(
+ new DefaultTableCellRenderer());
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ Object source = e.getSource();
+ if (source.equals(mClose)) {
+ this.hide();
+ this.dispose();
+ } else if (source.equals(mDelete)) {
+ try {
+ // make sure selected cert is not a user cert
+ boolean userCert = false;
+ int[] rows = mTable.getSelectedRows();
+ for (int i=0; i<rows.length; i++) {
+ String trust =
+ (String)mDataModel.getValueAt(rows[i], 2);
+ if (trust.equals("N/A")) {
+ userCert = true;
+ }
+
+ String value = (String)mDataModel.getValueAt(rows[i], 0);
+ if (
+ (value.indexOf(Constants.PR_CA_SIGNING_NICKNAME) != -1) || (value.indexOf(Constants.PR_OCSP_SIGNING_CERT) != -1) ) {
+ userCert = true;
+ }
+ }
+
+ if (userCert == false) {
+ NameValuePairs nvps = getCerts();
+ mConn.modify(DestDef.DEST_SERVER_ADMIN, ScopeDef.SC_DELETE_CERTS,
+ Constants.RS_ID_CONFIG, nvps);
+ refresh();
+ } else {
+ // user certs can't be removed from here
+ CMSAdminUtil.showErrorDialog(mParent, mResource,
+ mResource.getString("CERTIMPORTDIALOG_DIALOG_CANTDELETE_MESSAGE"),
+ CMSAdminUtil.ERROR_MESSAGE);
+ }
+ } catch (EAdminException ex) {
+ CMSAdminUtil.showErrorDialog(mParent, mResource, ex.toString(),
+ CMSAdminUtil.ERROR_MESSAGE);
+ }
+ } else if (source.equals(mEdit)) {
+ displayCert();
+ } else if (source.equals(mHelp)) {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+ }
+
+ private void displayCert() {
+ try {
+ NameValuePairs nvps = getCerts();
+ NameValuePairs results = mConn.process(
+ DestDef.DEST_SERVER_ADMIN, ScopeDef.SC_CERT_PRETTY_PRINT,
+ Constants.RS_ID_CONFIG, nvps);
+ if (nvps.size() <= 0)
+ return;
+ String name = results.keySet().iterator().next(); // first element
+ String print = results.get(name);
+ CertificateInfoDialog dialog = new CertificateInfoDialog(mParent);
+ dialog.showDialog(name, print, getTrustLbl(), getDate(),mConn);
+ refresh();
+ } catch (EAdminException ex) {
+ CMSAdminUtil.showErrorDialog(mParent, mResource, ex.toString(),
+ CMSAdminUtil.ERROR_MESSAGE);
+ }
+ }
+
+ //==== MOUSELISTENER ======================
+ public void mouseClicked(MouseEvent e) {
+ setButtons();
+
+ //we track the double click action on the table entry - View op
+ if(mTable.getSelectedRow() >= 0) {
+ if(e.getClickCount() == 2) {
+ displayCert();
+ }
+ }
+ }
+
+ public void mouseReleased(MouseEvent e) {
+ }
+
+ public void mousePressed(MouseEvent e) {
+ }
+
+ public void mouseEntered(MouseEvent e) {
+ }
+
+ public void mouseExited(MouseEvent e) {
+ }
+
+ private void setButtons() {
+ //enable and disable buttons accordingly
+ if (mTable.getSelectionModel().isSelectionEmpty()) {
+ mDelete.setEnabled(false);
+ mEdit.setEnabled(false);
+ return;
+ }
+
+ if(mDataModel.getRowCount()< 0) {
+ mDelete.setEnabled(false);
+ mEdit.setEnabled(false);
+ return;
+ }
+
+ mDelete.setEnabled(true);
+ mEdit.setEnabled(true);
+ }
+
+ private NameValuePairs getCerts() {
+ int[] rows = mTable.getSelectedRows();
+ NameValuePairs nvps = new NameValuePairs();
+ String name = "certName";
+ for (int i=0; i<rows.length; i++) {
+ String value = (String)mDataModel.getValueAt(rows[i], 0);
+ String date = (String)mDataModel.getValueAt(rows[i], 1);
+ nvps.put(name + i, value + ";" + date);
+ }
+ return nvps;
+ }
+
+ private String getTrustLbl() {
+ int row = mTable.getSelectedRow();
+ String trust = (String)mDataModel.getValueAt(row, 2);
+ if (trust.equals("Trusted"))
+ return "Trust";
+ else if (trust.equals("Untrusted"))
+ return "Untrust";
+ else if (trust.equals("N/A"))
+ return "N/A";
+ else
+ return "Unknown";
+
+ }
+
+ private String getDate() {
+ int row = mTable.getSelectedRow();
+ return (String)mDataModel.getValueAt(row, 1);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/managecert/ManageCertModel.java b/base/console/src/com/netscape/admin/certsrv/managecert/ManageCertModel.java
new file mode 100644
index 000000000..2cae90759
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/managecert/ManageCertModel.java
@@ -0,0 +1,55 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.managecert;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Manage certificate data model - represents the instance
+ * table information
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ */
+public class ManageCertModel extends CMSTableModel
+{
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ public static final String COL1 = "CERTNAME";
+ public static final String COL2 = "EXPIRED";
+ public static final String COL3 = "TRUST";
+
+ private static String[] mColumns = {COL1, COL2, COL3};
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public ManageCertModel() {
+ super();
+ init(mColumns);
+ }
+
+ public boolean isCellEditable(int row, int col) {
+ return false;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/menu/CertManagementAction.java b/base/console/src/com/netscape/admin/certsrv/menu/CertManagementAction.java
new file mode 100644
index 000000000..a7300e973
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/menu/CertManagementAction.java
@@ -0,0 +1,47 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.menu;
+
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.management.client.console.*;
+import com.netscape.admin.certsrv.security.*;
+import com.netscape.admin.certsrv.*;
+
+/**
+ * Certificate Management
+ *
+ * This class is responsible for calling the cert management wizard
+ * when user select the cert management menu item
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @date 04/07/97
+ */
+public class CertManagementAction implements IMenuAction {
+
+ protected ConsoleInfo mConsoleInfo;
+
+ public CertManagementAction(ConsoleInfo info) {
+ mConsoleInfo = info;
+ }
+
+ public void perform(IPage viewInstance) {
+ (new CertManagementDialog( mConsoleInfo )).showModal();
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/menu/KeyCertAction.java b/base/console/src/com/netscape/admin/certsrv/menu/KeyCertAction.java
new file mode 100644
index 000000000..e10f92c78
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/menu/KeyCertAction.java
@@ -0,0 +1,48 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.menu;
+
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.management.client.console.*;
+import com.netscape.admin.certsrv.security.*;
+import com.netscape.admin.certsrv.*;
+
+/**
+ * Key and Certificate Wizard action
+ *
+ * This class is responsible for calling the key and cert wizard
+ * when user select the key and cert menu item
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @date 04/07/97
+ */
+public class KeyCertAction implements IMenuAction {
+
+ protected ConsoleInfo mConsoleInfo;
+
+ public KeyCertAction(ConsoleInfo info) {
+ mConsoleInfo = info;
+ }
+
+ public void perform(IPage viewInstance) {
+ KeyCertWizard wizard = new KeyCertWizard(mConsoleInfo);
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/menu/PKCS11ManagementAction.java b/base/console/src/com/netscape/admin/certsrv/menu/PKCS11ManagementAction.java
new file mode 100644
index 000000000..57dde4e66
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/menu/PKCS11ManagementAction.java
@@ -0,0 +1,47 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.menu;
+
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.management.client.console.*;
+import com.netscape.admin.certsrv.security.*;
+import com.netscape.admin.certsrv.*;
+
+/**
+ * PKCS#11 Management
+ *
+ * This class is responsible for calling the PKCS11 management wizard
+ * when user select the pkcs11 management menu item
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @date 04/07/97
+ */
+public class PKCS11ManagementAction implements IMenuAction {
+
+ protected ConsoleInfo mConsoleInfo;
+
+ public PKCS11ManagementAction(ConsoleInfo info) {
+ mConsoleInfo = info;
+ }
+
+ public void perform(IPage viewInstance) {
+ (new PKCS11ManagementDialog( mConsoleInfo )).showModal();
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/menu/RefreshTabPane.java b/base/console/src/com/netscape/admin/certsrv/menu/RefreshTabPane.java
new file mode 100644
index 000000000..f52a7f1a6
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/menu/RefreshTabPane.java
@@ -0,0 +1,101 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.menu;
+
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.management.client.console.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.ug.*;
+import java.awt.*;
+
+/**
+ * Refresh Tab Pane
+ *
+ * This class is responsible for refreshing the selected tab pane
+ * when user selects the refresh menu item
+ *
+ * @author Christine Ho
+ * @author jpanchen
+ *
+ * @version $Revision$, $Date$
+ *
+ * @see com.netscape.admin.certsrv.IRefreshTab
+ * @see com.netscape.admin.certsrv.IRefreshTabPanel
+ * @see com.netscape.admin.certsrv.CMSBaseResourceModel
+ * @see com.netscape.admin.certsrv.IMenuAction
+ */
+public class RefreshTabPane implements IMenuAction {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ protected IRefreshTabPanel mPanel; //object ref to selected tab pane
+
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+
+ /**
+ * Default Constructor that creates the refresh menu
+ * call back item.
+ */
+ public RefreshTabPane(CMSBaseResourceModel model) {
+ model.setRefreshCallback(this);
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * perform the refresh function on the selected
+ * tab panel, if the tab panel support the IRefreshTab
+ * intreface.
+ */
+ public void perform(IPage viewInstance) {
+ if (mPanel != null) {
+ if (mPanel instanceof IRefreshTabPanel) {
+ CMSBasePanel panel = mPanel.getSelectedTab();
+ if (panel instanceof IRefreshTab) {
+ IRefreshTab tab = (IRefreshTab)panel;
+ tab.refresh();
+ }
+ }
+ }
+ }
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ /**
+ * Accepts the selection notification from the
+ * resource model. we must verify the class and
+ * determine if the tab support the IRefreshTab
+ * interface. If not, null is set.
+ */
+ public void select(Component c) {
+ if (c instanceof IRefreshTabPanel) {
+ mPanel = (IRefreshTabPanel)c;
+ } else {
+ mPanel = null;
+ }
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/misc/MessageFormatter.java b/base/console/src/com/netscape/admin/certsrv/misc/MessageFormatter.java
new file mode 100644
index 000000000..1ec1e72ba
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/misc/MessageFormatter.java
@@ -0,0 +1,138 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.misc;
+
+import java.io.*;
+import java.util.*;
+import java.text.*;
+import java.lang.reflect.*;
+
+/**
+ * Factors out common function of formatting internatinalized
+ * messages taking arguments and using java.util.ResourceBundle
+ * and java.text.MessageFormat mechanism.
+ * <P>
+ *
+ * @author galperin
+ * @version $Revision$, $Date$
+ * @see java.text.MessageFormat
+ * @see java.util.ResourceBundle
+ */
+public class MessageFormatter {
+
+ private static final Class [] toStringSignature = { Locale.class };
+
+ public static String getLocalizedString(
+ Locale locale, String resourceBundleBaseName,
+ String keyword) {
+ return getLocalizedString(locale, resourceBundleBaseName,
+ keyword, null);
+ }
+
+ public static String getLocalizedString(
+ Locale locale, String resourceBundleBaseName,
+ String keyword, Object params) {
+ Object o[] = new Object[1];
+ o[0] = params;
+ return getLocalizedString(locale, resourceBundleBaseName,
+ keyword, o);
+ }
+
+ public static String getLocalizedString(
+ String resourceBundleBaseName,
+ String keyword, Object param) {
+ Object o[] = new Object[1];
+ o[0] = param;
+ return getLocalizedString(Locale.getDefault(), resourceBundleBaseName,
+ keyword, o);
+ }
+
+ public static String getLocalizedString(
+ String resourceBundleBaseName,
+ String keyword, Object [] params) {
+ return getLocalizedString(Locale.getDefault(), resourceBundleBaseName,
+ keyword, params);
+ }
+
+ public static String getLocalizedString(
+ Locale locale, String resourceBundleBaseName,
+ String keyword, Object [] params) {
+
+ String localizedFormat = null;
+
+ try {
+ // if you are worried about the efficiency of the
+ // following line, dont worry. ResourceBundle has
+ // an internal cache. So resource bundle wont be
+ // instantiated everytime you call toString().
+
+ localizedFormat = ResourceBundle.getBundle(
+ resourceBundleBaseName,locale).getString(keyword);
+ } catch (MissingResourceException e) {
+ return "Failed resolving format [" + keyword +
+ "] in resource bundle [" +
+ resourceBundleBaseName + "] for locale [" +
+ locale + "]";
+ }
+ Object [] localizedParams = params;
+ Object [] localeArg = null;
+ if (params != null) {
+ for(int i=0; i < params.length; ++i) {
+ if (!(params[i] instanceof String) ||
+ !(params[i] instanceof Date) ||
+ !(params[i] instanceof Number)) {
+ if (localizedParams == params) {
+
+ // only done once
+ // NB if the following variant of cloning code is used
+ // localizedParams = (Object [])mParams.clone();
+ // it causes ArrayStoreException in
+ // localizedParams[i] = params[i].toString();
+ // below
+
+ localizedParams = new Object [params.length];
+ System.arraycopy(params,0,localizedParams,0,
+ params.length);
+ }
+ try {
+ Method toStringMethod = params[i].getClass().getMethod(
+ "toString",toStringSignature);
+ if (localeArg == null) {
+ // only done once
+ localeArg = new Object [] { locale };
+ }
+ localizedParams[i] = toStringMethod.invoke(
+ params[i],localeArg);
+ } catch (Exception e) {
+ // no method for localization, fall back
+ localizedParams[i] = params[i].toString();
+ }
+ }
+ }
+ }
+ try {
+ // XXX - runtime exception may be raised by the following function
+ MessageFormat format = new MessageFormat(localizedFormat);
+ return format.format(localizedParams);
+ } catch (IllegalArgumentException e) {
+ // XXX - for now, we just print the unformatted message
+ // if the exception is raised
+ return localizedFormat;
+ }
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/notification/RequestCompletePanel.java b/base/console/src/com/netscape/admin/certsrv/notification/RequestCompletePanel.java
new file mode 100644
index 000000000..c01407193
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/notification/RequestCompletePanel.java
@@ -0,0 +1,280 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.notification;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.config.*;
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.*;
+
+/**
+ * notification settings tab for RequestCompletion
+ *
+ * @author cfu
+ * @version $Revision$, $Date$
+ */
+public class RequestCompletePanel extends CMSBaseTab implements ItemListener {
+ private static final String RA_HELPINDEX =
+ "notification-ra-certissued-help";
+ private static final String CA_HELPINDEX =
+ "notification-ca-certissued-help";
+ private JTextField mEmailFormText;
+ private JTextField mEmailSubjectText;
+ private JCheckBox mEnable;
+ private Color mActiveColor;
+ private JLabel mEmailFormLabel;
+ private JLabel mEmailSubjectLabel;
+ private JTextField mSenderEmailText;
+ private JLabel mSenderEmailLabel;
+ protected AdminConnection mAdmin;
+ protected CMSBaseResourceModel mModel;
+ private String mServletName;
+ private CMSTabPanel mParent;
+ private String mPanelName;
+
+ /*
+ public RequestCompletePanel(String panelName, CMSTabPanel parent) {
+ this(panelName, parent, true);
+ mPanelName = panelName;
+ }
+ */
+ public RequestCompletePanel(String panelName, CMSTabPanel parent,
+ String servletName) {
+ super(panelName, parent);
+ if (servletName.equals(DestDef.DEST_RA_ADMIN)) {
+ mHelpToken = RA_HELPINDEX;
+ } else {
+ mHelpToken = CA_HELPINDEX;
+ }
+ mServletName = servletName;
+ mModel = parent.getResourceModel();
+ mParent = parent;
+ }
+
+ public void init() {
+ mAdmin = mModel.getServerInfo().getAdmin();
+ JPanel emailInfo = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mCenterPanel.setLayout(gb);
+
+ //add the enable checkbox
+ mEnable = makeJCheckBox("ENABLE");
+ mEnable.setSelected(true);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(DIFFERENT_COMPONENT_SPACE,
+ DIFFERENT_COMPONENT_SPACE,
+ 0,
+ DIFFERENT_COMPONENT_SPACE);
+ gb.setConstraints(mEnable, gbc);
+ mCenterPanel.add(mEnable);
+
+ //add the setting panel
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(emailInfo, gbc);
+ mCenterPanel.add(emailInfo);
+
+ GridBagLayout gb1 = new GridBagLayout();
+ emailInfo.setLayout(gb1);
+ emailInfo.setBorder(makeTitledBorder("EMAILINFO"));
+
+ // add sender email label and text field
+ CMSAdminUtil.resetGBC(gbc);
+ mSenderEmailLabel = makeJLabel("SENDER");
+ mSenderEmailText = makeJTextField(30);
+ mActiveColor = mSenderEmailText.getBackground();
+ CMSAdminUtil.addEntryField(emailInfo,
+ mSenderEmailLabel, mSenderEmailText, gbc);
+
+ // add email subject label and text field
+ CMSAdminUtil.resetGBC(gbc);
+ mEmailSubjectLabel = makeJLabel("SUBJECT");
+ mEmailSubjectText = makeJTextField(30);
+ mActiveColor = mEmailSubjectText.getBackground();
+ CMSAdminUtil.addEntryField(emailInfo,
+ mEmailSubjectLabel, mEmailSubjectText, gbc);
+
+ // add form name label and text field
+ CMSAdminUtil.resetGBC(gbc);
+ mEmailFormLabel = makeJLabel("FORMNAME");
+ mEmailFormText = makeJTextField(30);
+ mActiveColor = mEmailFormText.getBackground();
+ CMSAdminUtil.addEntryField(emailInfo,
+ mEmailFormLabel, mEmailFormText, gbc);
+
+ refresh();
+ }
+
+ public void refresh() {
+ mModel.progressStart();
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_ENABLE, "");
+ nvps.put(Constants.PR_NOTIFICATION_FORM_NAME, "");
+ nvps.put(Constants.PR_NOTIFICATION_SUBJECT, "");
+ nvps.put(Constants.PR_NOTIFICATION_SENDER, "");
+
+ try {
+ NameValuePairs val = mAdmin.read(mServletName,
+ ScopeDef.SC_NOTIFICATION_REQ_COMP, Constants.RS_ID_CONFIG, nvps);
+
+ populate(val);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ }
+ mModel.progressStop();
+ clearDirtyFlag();
+ mParent.setOKCancel();
+ }
+
+ protected void populate(NameValuePairs nvps) {
+ for (String name : nvps.keySet()) {
+ String value = nvps.get(name);
+ if (name.equals(Constants.PR_NOTIFICATION_FORM_NAME)) {
+ mEmailFormText.setText(value);
+ } else if (name.equals(Constants.PR_NOTIFICATION_SUBJECT)) {
+ mEmailSubjectText.setText(value);
+ } else if (name.equals(Constants.PR_NOTIFICATION_SENDER)) {
+ mSenderEmailText.setText(value);
+ } else if (name.equals(Constants.PR_ENABLE)) {
+ if (value.equals(Constants.TRUE))
+ mEnable.setSelected(true);
+ else
+ mEnable.setSelected(false);
+ }
+ }
+
+ if (mEnable.isSelected())
+ enableFields(true, mActiveColor);
+ else
+ enableFields(false, getBackground());
+ }
+
+ private int getIndex(String val, String[] array) {
+ for (int i=0; i<array.length; i++) {
+ if (val.equals(array[i]))
+ return i;
+ }
+ return -1;
+ }
+
+ private void enableFields(boolean enable, Color color) {
+ mEmailFormText.setEnabled(enable);
+ mEmailFormText.setEditable(enable);
+ mEmailFormText.setBackground(color);
+ mEmailFormLabel.setEnabled(enable);
+ mEmailFormLabel.setBackground(color);
+
+ mEmailSubjectText.setEnabled(enable);
+ mEmailSubjectText.setEditable(enable);
+ mEmailSubjectText.setBackground(color);
+ mEmailSubjectLabel.setEnabled(enable);
+ mEmailSubjectLabel.setBackground(color);
+
+ mSenderEmailText.setEnabled(enable);
+ mSenderEmailText.setEditable(enable);
+ mSenderEmailText.setBackground(color);
+ mSenderEmailLabel.setEnabled(enable);
+ mSenderEmailLabel.setBackground(color);
+
+ repaintComp(mEmailFormLabel);
+ repaintComp(mSenderEmailLabel);
+ repaintComp(mEmailSubjectLabel);
+ }
+
+ private void repaintComp(JComponent component) {
+ component.invalidate();
+ component.validate();
+ component.repaint(1);
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ super.actionPerformed(e);
+ if (mEnable.isSelected()) {
+ enableFields(true, mActiveColor);
+ } else {
+ enableFields(false, getBackground());
+ }
+ }
+
+ /**
+ * Implementation for saving panel information
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean applyCallback() {
+ // check blank fields
+ String emailForm = mEmailFormText.getText().trim();
+ String emailSubject = mEmailSubjectText.getText().trim();
+ String senderEmail = mSenderEmailText.getText().trim();
+
+ if (mEnable.isSelected() && (emailForm.equals("") ||
+ senderEmail.equals("") ||
+ emailSubject.equals(""))) {
+ showMessageDialog("BLANKFIELD");
+ return false;
+ }
+
+ NameValuePairs nvps = new NameValuePairs();
+ if (mEnable.isSelected())
+ nvps.put(Constants.PR_ENABLE, Constants.TRUE);
+ else
+ nvps.put(Constants.PR_ENABLE, Constants.FALSE);
+
+ if (mEnable.isSelected()){
+ nvps.put(Constants.PR_NOTIFICATION_FORM_NAME, emailForm);
+ nvps.put(Constants.PR_NOTIFICATION_SUBJECT, emailSubject);
+ nvps.put(Constants.PR_NOTIFICATION_SENDER, senderEmail);
+ }
+
+ mModel.progressStart();
+ try {
+ mAdmin.modify(mServletName, ScopeDef.SC_NOTIFICATION_REQ_COMP,
+ Constants.RS_ID_CONFIG, nvps);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ return false;
+ }
+
+ mModel.progressStop();
+ clearDirtyFlag();
+ return true;
+ }
+
+ /**
+ * Implementation for reset values
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean resetCallback() {
+ refresh();
+ return true;
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/notification/RequestInQPanel.java b/base/console/src/com/netscape/admin/certsrv/notification/RequestInQPanel.java
new file mode 100644
index 000000000..aa37ed149
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/notification/RequestInQPanel.java
@@ -0,0 +1,302 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.notification;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.config.*;
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.*;
+
+/**
+ * notification settings tab for RequestInQueue
+ *
+ * @author cfu
+ * @version $Revision$, $Date$
+ */
+public class RequestInQPanel extends CMSBaseTab implements ItemListener {
+ private static final String RA_HELPINDEX =
+ "notification-ra-reqinq-help";
+ private static final String CA_HELPINDEX =
+ "notification-ca-reqinq-help";
+ private JTextField mEmailFormText;
+ private JTextField mEmailSubjectText;
+ private JCheckBox mEnable;
+ private Color mActiveColor;
+ private JLabel mEmailFormLabel;
+ private JLabel mEmailSubjectLabel;
+ private JTextField mSenderEmailText;
+ private JLabel mSenderEmailLabel;
+ private JTextField mReceiverEmailText;
+ private JLabel mReceiverEmailLabel;
+ protected AdminConnection mAdmin;
+ protected CMSBaseResourceModel mModel;
+ private String mServletName;
+ private CMSTabPanel mParent;
+ private String mPanelName;
+ /*
+ public RequestInQPanel(String panelName, CMSTabPanel parent) {
+ this(panelName, parent, true);
+ mPanelName = panelName;
+ }
+ */
+ public RequestInQPanel(String panelName, CMSTabPanel parent,
+ String servletName) {
+ super(panelName, parent);
+ if (servletName.equals(DestDef.DEST_RA_ADMIN)) {
+ mHelpToken = RA_HELPINDEX;
+ } else {
+ mHelpToken = CA_HELPINDEX;
+ }
+ mServletName = servletName;
+ mModel = parent.getResourceModel();
+ mParent = parent;
+ }
+
+ public void init() {
+ mAdmin = mModel.getServerInfo().getAdmin();
+ JPanel emailInfo = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mCenterPanel.setLayout(gb);
+
+ //add the enable checkbox
+ mEnable = makeJCheckBox("ENABLE");
+ mEnable.setSelected(true);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(DIFFERENT_COMPONENT_SPACE,
+ DIFFERENT_COMPONENT_SPACE,
+ 0,
+ DIFFERENT_COMPONENT_SPACE);
+ gb.setConstraints(mEnable, gbc);
+ mCenterPanel.add(mEnable);
+
+ //add the setting panel
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(emailInfo, gbc);
+ mCenterPanel.add(emailInfo);
+
+ GridBagLayout gb1 = new GridBagLayout();
+ emailInfo.setLayout(gb1);
+ emailInfo.setBorder(makeTitledBorder("EMAILINFO"));
+
+ // add sender email label and text field
+ CMSAdminUtil.resetGBC(gbc);
+ mSenderEmailLabel = makeJLabel("SENDER");
+ mSenderEmailText = makeJTextField(30);
+ mActiveColor = mSenderEmailText.getBackground();
+ CMSAdminUtil.addEntryField(emailInfo,
+ mSenderEmailLabel, mSenderEmailText, gbc);
+
+ // add email subject label and text field
+ CMSAdminUtil.resetGBC(gbc);
+ mEmailSubjectLabel = makeJLabel("SUBJECT");
+ mEmailSubjectText = makeJTextField(30);
+ mActiveColor = mEmailSubjectText.getBackground();
+ CMSAdminUtil.addEntryField(emailInfo,
+ mEmailSubjectLabel, mEmailSubjectText, gbc);
+
+ // add receiver email label and text field
+ CMSAdminUtil.resetGBC(gbc);
+ mReceiverEmailLabel = makeJLabel("RECEIVER");
+ mReceiverEmailText = makeJTextField(30);
+ mActiveColor = mReceiverEmailText.getBackground();
+ CMSAdminUtil.addEntryField(emailInfo,
+ mReceiverEmailLabel, mReceiverEmailText, gbc);
+
+ // add form name label and text field
+ CMSAdminUtil.resetGBC(gbc);
+ mEmailFormLabel = makeJLabel("FORMNAME");
+ mEmailFormText = makeJTextField(30);
+ mActiveColor = mEmailFormText.getBackground();
+ CMSAdminUtil.addEntryField(emailInfo,
+ mEmailFormLabel, mEmailFormText, gbc);
+
+ refresh();
+ }
+
+ public void refresh() {
+ mModel.progressStart();
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_ENABLE, "");
+ nvps.put(Constants.PR_NOTIFICATION_FORM_NAME, "");
+ nvps.put(Constants.PR_NOTIFICATION_SUBJECT, "");
+ nvps.put(Constants.PR_NOTIFICATION_SENDER, "");
+ nvps.put(Constants.PR_NOTIFICATION_RECEIVER, "");
+
+ try {
+ NameValuePairs val = mAdmin.read(mServletName,
+ ScopeDef.SC_NOTIFICATION_RIQ, Constants.RS_ID_CONFIG, nvps);
+
+ populate(val);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ }
+ mModel.progressStop();
+ clearDirtyFlag();
+ mParent.setOKCancel();
+ }
+
+ protected void populate(NameValuePairs nvps) {
+ for (String name : nvps.keySet()) {
+ String value = nvps.get(name);
+ if (name.equals(Constants.PR_NOTIFICATION_FORM_NAME)) {
+ mEmailFormText.setText(value);
+ } else if (name.equals(Constants.PR_NOTIFICATION_SUBJECT)) {
+ mEmailSubjectText.setText(value);
+ } else if (name.equals(Constants.PR_NOTIFICATION_SENDER)) {
+ mSenderEmailText.setText(value);
+ } else if (name.equals(Constants.PR_NOTIFICATION_RECEIVER)) {
+ mReceiverEmailText.setText(value);
+ } else if (name.equals(Constants.PR_ENABLE)) {
+ if (value.equals(Constants.TRUE))
+ mEnable.setSelected(true);
+ else
+ mEnable.setSelected(false);
+ }
+ }
+
+ if (mEnable.isSelected())
+ enableFields(true, mActiveColor);
+ else
+ enableFields(false, getBackground());
+ }
+
+ private int getIndex(String val, String[] array) {
+ for (int i=0; i<array.length; i++) {
+ if (val.equals(array[i]))
+ return i;
+ }
+ return -1;
+ }
+
+ private void enableFields(boolean enable, Color color) {
+ mEmailFormText.setEnabled(enable);
+ mEmailFormText.setEditable(enable);
+ mEmailFormText.setBackground(color);
+ mEmailFormLabel.setEnabled(enable);
+ mEmailFormLabel.setBackground(color);
+
+ mEmailSubjectText.setEnabled(enable);
+ mEmailSubjectText.setEditable(enable);
+ mEmailSubjectText.setBackground(color);
+ mEmailSubjectLabel.setEnabled(enable);
+ mEmailSubjectLabel.setBackground(color);
+
+ mSenderEmailText.setEnabled(enable);
+ mSenderEmailText.setEditable(enable);
+ mSenderEmailText.setBackground(color);
+ mSenderEmailLabel.setEnabled(enable);
+ mSenderEmailLabel.setBackground(color);
+
+ mReceiverEmailText.setEnabled(enable);
+ mReceiverEmailText.setEditable(enable);
+ mReceiverEmailText.setBackground(color);
+ mReceiverEmailLabel.setEnabled(enable);
+ mReceiverEmailLabel.setBackground(color);
+
+ repaintComp(mEmailFormLabel);
+ repaintComp(mSenderEmailLabel);
+ repaintComp(mReceiverEmailLabel);
+ repaintComp(mEmailSubjectLabel);
+ }
+
+ private void repaintComp(JComponent component) {
+ component.invalidate();
+ component.validate();
+ component.repaint(1);
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ super.actionPerformed(e);
+ if (mEnable.isSelected()) {
+ enableFields(true, mActiveColor);
+ } else {
+ enableFields(false, getBackground());
+ }
+ }
+
+ /**
+ * Implementation for saving panel information
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean applyCallback() {
+ // check blank fields
+ String emailForm = mEmailFormText.getText().trim();
+ String emailSubject = mEmailSubjectText.getText().trim();
+ String senderEmail = mSenderEmailText.getText().trim();
+ String receiverEmail = mReceiverEmailText.getText().trim();
+
+ if (mEnable.isSelected() && (emailForm.equals("") ||
+ senderEmail.equals("") ||
+ emailSubject.equals("") ||
+ receiverEmail.equals(""))) {
+ showMessageDialog("BLANKFIELD");
+ return false;
+ }
+
+ NameValuePairs nvps = new NameValuePairs();
+ if (mEnable.isSelected())
+ nvps.put(Constants.PR_ENABLE, Constants.TRUE);
+ else
+ nvps.put(Constants.PR_ENABLE, Constants.FALSE);
+
+ if (mEnable.isSelected()){
+ nvps.put(Constants.PR_NOTIFICATION_FORM_NAME, emailForm);
+ nvps.put(Constants.PR_NOTIFICATION_SUBJECT, emailSubject);
+ nvps.put(Constants.PR_NOTIFICATION_SENDER, senderEmail);
+ nvps.put(Constants.PR_NOTIFICATION_RECEIVER, receiverEmail);
+ }
+
+ mModel.progressStart();
+ try {
+ mAdmin.modify(mServletName, ScopeDef.SC_NOTIFICATION_RIQ,
+ Constants.RS_ID_CONFIG, nvps);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ return false;
+ }
+
+ mModel.progressStop();
+ clearDirtyFlag();
+ return true;
+ }
+
+ /**
+ * Implementation for reset values
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean resetCallback() {
+ refresh();
+ return true;
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/notification/RequestRevokedPanel.java b/base/console/src/com/netscape/admin/certsrv/notification/RequestRevokedPanel.java
new file mode 100644
index 000000000..60b0e2949
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/notification/RequestRevokedPanel.java
@@ -0,0 +1,283 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.notification;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.config.*;
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.*;
+
+/**
+ * notification settings tab for RequestCompletion
+ *
+ * @author cfu
+ * @version $Revision$, $Date$
+ */
+public class RequestRevokedPanel extends CMSBaseTab implements ItemListener {
+ private static final String RA_HELPINDEX =
+ "configuration-notifications";
+ private static final String CA_HELPINDEX =
+ "configuration-notifications";
+ private JTextField mEmailFormText;
+ private JTextField mEmailSubjectText;
+ private JCheckBox mEnable;
+ private Color mActiveColor;
+ private JLabel mEmailFormLabel;
+ private JLabel mEmailSubjectLabel;
+ private JTextField mSenderEmailText;
+ private JLabel mSenderEmailLabel;
+ protected AdminConnection mAdmin;
+ protected CMSBaseResourceModel mModel;
+ private String mServletName;
+ private CMSTabPanel mParent;
+ private String mPanelName;
+
+ /*
+ public RequestRevokedPanel(String panelName, CMSTabPanel parent) {
+ this(panelName, parent, true);
+ mPanelName = panelName;
+ }
+ */
+ public RequestRevokedPanel(String panelName, CMSTabPanel parent,
+ String servletName) {
+ super(panelName, parent);
+ if (servletName.equals(DestDef.DEST_RA_ADMIN)) {
+ mHelpToken = RA_HELPINDEX;
+ } else {
+ mHelpToken = CA_HELPINDEX;
+ }
+ mServletName = servletName;
+ mModel = parent.getResourceModel();
+ mParent = parent;
+ }
+
+ public void init() {
+ mAdmin = mModel.getServerInfo().getAdmin();
+ JPanel emailInfo = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mCenterPanel.setLayout(gb);
+
+ //add the enable checkbox
+ mEnable = makeJCheckBox("ENABLE");
+ mEnable.setSelected(true);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(DIFFERENT_COMPONENT_SPACE,
+ DIFFERENT_COMPONENT_SPACE,
+ 0,
+ DIFFERENT_COMPONENT_SPACE);
+ gb.setConstraints(mEnable, gbc);
+ mCenterPanel.add(mEnable);
+
+ //add the setting panel
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(emailInfo, gbc);
+ mCenterPanel.add(emailInfo);
+
+ GridBagLayout gb1 = new GridBagLayout();
+ emailInfo.setLayout(gb1);
+ emailInfo.setBorder(makeTitledBorder("EMAILINFO"));
+
+ // add sender email label and text field
+ CMSAdminUtil.resetGBC(gbc);
+ mSenderEmailLabel = makeJLabel("SENDER");
+ mSenderEmailText = makeJTextField(30);
+ mActiveColor = mSenderEmailText.getBackground();
+ CMSAdminUtil.addEntryField(emailInfo,
+ mSenderEmailLabel, mSenderEmailText, gbc);
+
+ // add email subject label and text field
+ CMSAdminUtil.resetGBC(gbc);
+ mEmailSubjectLabel = makeJLabel("SUBJECT");
+ mEmailSubjectText = makeJTextField(30);
+ mActiveColor = mEmailSubjectText.getBackground();
+ CMSAdminUtil.addEntryField(emailInfo,
+ mEmailSubjectLabel, mEmailSubjectText, gbc);
+
+ // add form name label and text field
+ CMSAdminUtil.resetGBC(gbc);
+ mEmailFormLabel = makeJLabel("FORMNAME");
+ mEmailFormText = makeJTextField(30);
+ mActiveColor = mEmailFormText.getBackground();
+ CMSAdminUtil.addEntryField(emailInfo,
+ mEmailFormLabel, mEmailFormText, gbc);
+
+ refresh();
+ }
+
+ public void refresh() {
+ mModel.progressStart();
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.put(Constants.PR_ENABLE, "");
+ nvps.put(Constants.PR_NOTIFICATION_FORM_NAME, "");
+ nvps.put(Constants.PR_NOTIFICATION_SUBJECT, "");
+ nvps.put(Constants.PR_NOTIFICATION_SENDER, "");
+
+ try {
+ NameValuePairs val = mAdmin.read(mServletName,
+ ScopeDef.SC_NOTIFICATION_REV_COMP, Constants.RS_ID_CONFIG, nvps);
+
+ populate(val);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ }
+ mModel.progressStop();
+ clearDirtyFlag();
+ mParent.setOKCancel();
+ }
+
+ protected void populate(NameValuePairs nvps) {
+ String clientCert = "";
+
+ String version = "";
+ for (String name : nvps.keySet()) {
+ String value = nvps.get(name);
+ if (name.equals(Constants.PR_NOTIFICATION_FORM_NAME)) {
+ mEmailFormText.setText(value);
+ } else if (name.equals(Constants.PR_NOTIFICATION_SUBJECT)) {
+ mEmailSubjectText.setText(value);
+ } else if (name.equals(Constants.PR_NOTIFICATION_SENDER)) {
+ mSenderEmailText.setText(value);
+ } else if (name.equals(Constants.PR_ENABLE)) {
+ if (value.equals(Constants.TRUE))
+ mEnable.setSelected(true);
+ else
+ mEnable.setSelected(false);
+ }
+ }
+
+ if (mEnable.isSelected())
+ enableFields(true, mActiveColor);
+ else
+ enableFields(false, getBackground());
+ }
+
+ private int getIndex(String val, String[] array) {
+ for (int i=0; i<array.length; i++) {
+ if (val.equals(array[i]))
+ return i;
+ }
+ return -1;
+ }
+
+ private void enableFields(boolean enable, Color color) {
+ mEmailFormText.setEnabled(enable);
+ mEmailFormText.setEditable(enable);
+ mEmailFormText.setBackground(color);
+ mEmailFormLabel.setEnabled(enable);
+ mEmailFormLabel.setBackground(color);
+
+ mEmailSubjectText.setEnabled(enable);
+ mEmailSubjectText.setEditable(enable);
+ mEmailSubjectText.setBackground(color);
+ mEmailSubjectLabel.setEnabled(enable);
+ mEmailSubjectLabel.setBackground(color);
+
+ mSenderEmailText.setEnabled(enable);
+ mSenderEmailText.setEditable(enable);
+ mSenderEmailText.setBackground(color);
+ mSenderEmailLabel.setEnabled(enable);
+ mSenderEmailLabel.setBackground(color);
+
+ repaintComp(mEmailFormLabel);
+ repaintComp(mSenderEmailLabel);
+ repaintComp(mEmailSubjectLabel);
+ }
+
+ private void repaintComp(JComponent component) {
+ component.invalidate();
+ component.validate();
+ component.repaint(1);
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ super.actionPerformed(e);
+ if (mEnable.isSelected()) {
+ enableFields(true, mActiveColor);
+ } else {
+ enableFields(false, getBackground());
+ }
+ }
+
+ /**
+ * Implementation for saving panel information
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean applyCallback() {
+ // check blank fields
+ String emailForm = mEmailFormText.getText().trim();
+ String emailSubject = mEmailSubjectText.getText().trim();
+ String senderEmail = mSenderEmailText.getText().trim();
+
+ if (mEnable.isSelected() && (emailForm.equals("") ||
+ senderEmail.equals("") ||
+ emailSubject.equals(""))) {
+ showMessageDialog("BLANKFIELD");
+ return false;
+ }
+
+ NameValuePairs nvps = new NameValuePairs();
+ if (mEnable.isSelected())
+ nvps.put(Constants.PR_ENABLE, Constants.TRUE);
+ else
+ nvps.put(Constants.PR_ENABLE, Constants.FALSE);
+
+ if (mEnable.isSelected()){
+ nvps.put(Constants.PR_NOTIFICATION_FORM_NAME, emailForm);
+ nvps.put(Constants.PR_NOTIFICATION_SUBJECT, emailSubject);
+ nvps.put(Constants.PR_NOTIFICATION_SENDER, senderEmail);
+ }
+
+ mModel.progressStart();
+ try {
+ mAdmin.modify(mServletName, ScopeDef.SC_NOTIFICATION_REV_COMP,
+ Constants.RS_ID_CONFIG, nvps);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ return false;
+ }
+
+ mModel.progressStop();
+ clearDirtyFlag();
+ return true;
+ }
+
+ /**
+ * Implementation for reset values
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean resetCallback() {
+ refresh();
+ return true;
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/security/AbstractCipher.java b/base/console/src/com/netscape/admin/certsrv/security/AbstractCipher.java
new file mode 100644
index 000000000..ec330fc0c
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/AbstractCipher.java
@@ -0,0 +1,82 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import javax.swing.*;
+import javax.swing.border.*;
+import com.netscape.management.nmclf.*;
+
+/**
+ *
+ * Representation of a cipher under cipher preference.
+ *
+ * @version 1.0 98/07/10
+ * @author <A HREF="mailto:shihcm@netscape.com">shihcm@netscape.com</A>
+ *
+ * @see com.netscape.admin.certsrv.security.AbstractCipher
+ * @see com.netscape.admin.certsrv.security.IAbstractCipherSet
+ * @see com.netscape.admin.certsrv.security.AbstractCipher
+ */
+
+public final class AbstractCipher extends JCheckBox {
+
+ /**
+ *
+ * Symbolic name, used for storage purpose
+ * for example we currently use ssl2-RC4EXPORT to represent:
+ * "RC4 with 40 bit encryption and MD5 message authentication"
+ */
+ private String symbolicName = "";
+
+ /**
+ * Create an abstric cipher
+ *
+ * @param displayName cipher representation to be displayed
+ * @param symbolicName cipher name used for reference and storage
+ *
+ */
+ public AbstractCipher(String displayName, String symbolicName) {
+ this(displayName, symbolicName, false);
+ }
+
+ /**
+ * Create an abstric cipher
+ *
+ * @param displayName cipher representation to be displayed
+ * @param symbolicName cipher name used for reference and storage
+ * @param enabled enable cipher
+ *
+ */
+ public AbstractCipher(String displayName, String symbolicName,
+ boolean enabled) {
+ super(displayName, enabled);
+ this.symbolicName = symbolicName;
+ }
+
+ /**
+ *
+ * Get symbolic name
+ *
+ * @return string, symbolic name
+ *
+ */
+ public String getSymbolicName() {
+ return symbolicName;
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/AbstractCipherPreference.java b/base/console/src/com/netscape/admin/certsrv/security/AbstractCipherPreference.java
new file mode 100644
index 000000000..c9e92561f
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/AbstractCipherPreference.java
@@ -0,0 +1,279 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import javax.swing.*;
+import javax.swing.border.*;
+import javax.swing.plaf.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.util.*;
+import com.netscape.management.nmclf.*;
+
+/**
+ *
+ * Abstract cipher preference panel.
+ * Use with AbstractCipher and IAbstractCipherSet to customize server
+ * specific cipher preference dialog/panel.
+ *
+ * @version 1.0 98/07/10
+ * @author shihcm@netscape.com
+ *
+ * @see com.netscape.admin.certsrv.security.AbstractCipher
+ * @see com.netscape.admin.certsrv.security.IAbstractCipherSet
+ * @see com.netscape.admin.certsrv.security.AbstractCipher
+ */
+public class AbstractCipherPreference extends JPanel {
+
+ /**
+ * Main listener for all the cipher component under AbstractCipherPreference panel.
+ * This listener will catch all the cipher event(on/off) occures with in this panel.
+ */
+ CipherPrefActionListener listener = new CipherPrefActionListener();
+
+ /**
+ * Other listeners are stored in this vector, event catch in the "listener"(above) will
+ * also be routed to all the listener store in this vector
+ * Listener stored here are added by programmer via addActionListener(actionListener) call
+ */
+ Vector listenerList = new Vector();
+
+
+ /**
+ * This panel holds all the Ciper entry
+ */
+ JPanel cipherPane = new JPanel();
+
+ /**
+ * To determain whether if any cipher[s] changed status since last save.
+ */
+ boolean _ismodified = false;
+
+ /**
+ * Store the old setting, for reset purpose.
+ */
+ Hashtable oldValue = new Hashtable();
+
+ /**
+ * Create an abstract cipher preference
+ *
+ *
+ */
+ public AbstractCipherPreference() {}
+
+ /**
+ * Create an abstract cipher preference
+ *
+ * @param cipherList Interface to getCipherList()
+ *
+ *
+ */
+ public AbstractCipherPreference(IAbstractCipherSet cipherList) {
+ super();
+ initialize(cipherList);
+ }
+
+
+ class CipherPrefActionListener implements ActionListener {
+ public void actionPerformed(ActionEvent e) {
+ _ismodified = true;
+ Enumeration l = listenerList.elements();
+ while (l.hasMoreElements()) {
+ ((ActionListener)(l.nextElement())).actionPerformed(e);
+ }
+ }
+ }
+
+
+ /**
+ * Initializer for cipher preference.
+ * Cipher are obtain via getCipherList() from IAbstractCipherSet
+ *
+ * @param cipherList Interface to getCipherList()
+ *
+ *
+ */
+ protected void initialize(IAbstractCipherSet cipherList) {
+
+ setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
+
+ cipherPane.setLayout(new BoxLayout(cipherPane, BoxLayout.Y_AXIS));
+ add(cipherPane);
+
+ Vector ciphers = cipherList.getCipherList();
+ for (Enumeration e = ciphers.elements(); e.hasMoreElements();) {
+ addCipher((AbstractCipher)(e.nextElement()));
+ }
+ }
+
+ /**
+ *
+ * Adds an ActionListener to all the ciphers
+ *
+ * @param l
+ *
+ */
+ public void addActionListener(ActionListener l) {
+ if (!(listenerList.contains(l))) {
+ listenerList.addElement(l);
+ }
+ }
+
+
+ /**
+ *
+ * Adds cipher ui
+ *
+ * @param l
+ *
+ */
+ public void addCipher(AbstractCipher cipher) {
+ oldValue.put(cipher.getSymbolicName(),
+ cipher.isSelected() ? "1":"0");
+ cipherPane.add(cipher);
+ cipher.addActionListener(listener);
+ }
+
+
+ /**
+ *
+ * Call setEnable(enabled) on each cipher.
+ * This is different then set cipher selected state.
+ * if cipher selected state on all cipher is required try
+ * getCipherList() then setCipherEnabled(boolean) on each
+ * cipher.
+ *
+ * @param enabled enable/disable all ciphers
+ *
+ */
+ public void setEnableAll(boolean enabled) {
+ Component[] c = cipherPane.getComponents();
+ for (int i = c.length - 1; i >= 0; i--) {
+ c[i].setEnabled(enabled);
+ }
+ }
+
+
+
+ /**
+ *
+ * Get entire cipher list
+ *
+ *
+ */
+ public String[] getCipherList() {
+ Component[] c = cipherPane.getComponents();
+ String[] ciphers = new String[c.length];
+ for (int i = c.length - 1; i >= 0; i--) {
+ ciphers[i] = ((AbstractCipher) c[i]).getSymbolicName();
+ }
+ return ciphers;
+ }
+
+ private AbstractCipher findCipher(String symbolicName) {
+ Component[] c = cipherPane.getComponents();
+
+ AbstractCipher cipher = null;
+
+ for (int i = c.length - 1; i >= 0; i--) {
+ if (((AbstractCipher) c[i]).getSymbolicName().
+ equalsIgnoreCase(symbolicName)) {
+ cipher = (AbstractCipher) c[i];
+ }
+ }
+
+ return cipher;
+ }
+
+
+ /**
+ *
+ * Set cipher to selected state
+ *
+ * @param cipher Cipher to enable/disable
+ * @param enabled enable cipher if true
+ *
+ */
+ public void setCipherEnabled(String cipher, boolean enabled) {
+ AbstractCipher c = findCipher(cipher);
+ if (c != null) {
+ c.setSelected(enabled);
+ }
+ }
+
+ /**
+ *
+ * Check weather a cipher is enabled or disabled
+ *
+ * @param cipher Cipher to check
+ *
+ */
+ public boolean isCipherEnabled(String cipher) {
+ AbstractCipher c = findCipher(cipher);
+ if (c != null) {
+ return c.isSelected();
+ }
+ return false;
+ }
+
+ /**
+ * Check weather any ciphers has been modified
+ *
+ * @see #isModified
+ * @see #setSaved
+ *
+ */
+ public boolean isModified() {
+ return _ismodified;
+ }
+
+ /**
+ * Reset all changes since last save
+ *
+ * @see #setSaved
+ */
+ public void reset() {
+ Enumeration keys = oldValue.keys();
+ while (keys.hasMoreElements()) {
+ String cipherName = (String)(keys.nextElement());
+ setCipherEnabled(cipherName,
+ "1".equals(oldValue.get(cipherName)) ? true : false);
+ }
+ _ismodified = false;
+ }
+
+
+ /**
+ * Set the state to saved.
+ *
+ * @see #reset
+ */
+ public void setSaved() {
+ oldValue.clear();
+
+ Component[] c = cipherPane.getComponents();
+ for (int i = c.length - 1; i >= 0; i--) {
+ AbstractCipher cipher = (AbstractCipher)(c[i]);
+ oldValue.put(cipher.getSymbolicName(),
+ cipher.isSelected() ? "1":"0");
+ }
+
+ _ismodified = false;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/CRLAddCertDialog.java b/base/console/src/com/netscape/admin/certsrv/security/CRLAddCertDialog.java
new file mode 100644
index 000000000..7982d310d
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/CRLAddCertDialog.java
@@ -0,0 +1,226 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import javax.swing.*;
+import javax.swing.border.*;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+
+import com.netscape.management.client.console.ConsoleInfo;
+
+
+import com.netscape.management.client.util.*;
+import com.netscape.management.nmclf.*;
+
+class CRLAddCertDialog extends AbstractDialog implements SuiConstants {
+
+ ConsoleInfo _consoleInfo;
+
+ KeyCertTaskInfo _taskInfo;
+ static boolean modified = false;
+
+ String _sie;
+ String _filename;
+ String _listtype;
+
+ JButton bClose;
+ JButton bAction;
+ JButton bHelp;
+
+ CertInfo _certInfo;
+ ResourceSet _resource;
+
+
+ CRLCertInfoPane _crlCertInfoPane;
+
+
+ class CRLAddCertActionListener implements ActionListener {
+ public void actionPerformed(ActionEvent e) {
+ modified = false;
+ if (e.getActionCommand().equals("ACTION")) {
+ //call delete cert cgi
+ _taskInfo.clear();
+ _taskInfo.put("crl_file", _filename);
+ _taskInfo.put("sie", _sie);
+ _taskInfo.put(
+ (_certInstInfo.get("crl_action").equals("add"))
+ ? "addbutton":"repbutton", "1");
+ _taskInfo.put("list_type", _listtype);
+
+ Response response = null;
+ try {
+ response = _taskInfo.exec(_taskInfo.SEC_ICRL);
+ } catch (Exception error) {
+ SuiOptionPane.showMessageDialog(
+ UtilConsoleGlobals.getActivatedFrame(),
+ error.getMessage());
+ return;
+ }
+
+ if (!(((Message)(response.getMessages().elementAt(0))).
+ isFailure())) {
+ if (_certInstInfo.get("crl_action").equals("add") ||
+ _certInstInfo.get("crl_action").equals("replace")) {
+ modified = true;
+ }
+ setVisible(false);
+ } else {
+ try {
+ MessageDialog.messageDialog( (Message)
+ (response.getMessages().elementAt(0)));
+ } catch (Exception e2) {
+ //shouldn't even be here in the first place. if cgi fail or return nothing
+ //then it should be handle right after KeyCertTaskInfo.exec(...) is called
+ //If exception occure here here then something is really mess up.
+ Debug.println("Error in decoding server messages");
+ }
+ }
+ } else if (e.getActionCommand().equals("CLOSE")) {
+ setVisible(false);
+ } else if (e.getActionCommand().equals("HELP")) {
+ Help help = new Help(_resource);
+ help.help("CRLDeleteCertDialog", "help");
+ }
+
+ }
+ }
+
+
+ public boolean isModified() {
+ return modified;
+ }
+
+ public CertInfo getCertInfo() {
+ return _certInfo;
+ }
+
+ Hashtable _certInstInfo = new Hashtable();
+ public void show(String filename, String list_type) {
+ _filename = filename;
+ _listtype = list_type;
+
+ _taskInfo.clear();
+ _taskInfo.put("crl_file", filename);
+ _taskInfo.put("sie", _sie);
+ _taskInfo.put("list_type", list_type);
+
+ try {
+ _taskInfo.exec(_taskInfo.SEC_ICRL);
+ } catch (Exception error) {
+ SuiOptionPane.showMessageDialog(
+ UtilConsoleGlobals.getActivatedFrame(),
+ error.getMessage());
+ return;
+ }
+
+ if (_taskInfo.getResponse().hasCertInstInfo()) {
+ _certInstInfo = _taskInfo.getResponse().getCertInstInfo();
+ } else {
+ _certInstInfo.put("crl_action", "add");
+ _certInstInfo.put("crl_file", filename);
+ }
+ if (_taskInfo.getResponse().hasCertInfo()) {
+ setInfo(_taskInfo.getResponse().getCertInfo());
+ super.show();
+ } else {
+ try {
+ MessageDialog.messageDialog( (Message)
+ (_taskInfo.getResponse().getMessages().
+ elementAt(0)));
+ } catch (Exception e2) {
+ //shouldn't even be here in the first place. if cgi fail or return nothing
+ //then it should be handle right after KeyCertTaskInfo.exec(...) is called
+ //If exception occure here here then something is really mess up.
+ Debug.println("Error in decoding server messages");
+ }
+ }
+ }
+
+ private void setInfo(CertInfo certInfo) {
+ _certInfo = certInfo;
+ _crlCertInfoPane.setCertInfo(certInfo);
+
+ try {
+ if (((String)(_certInstInfo.get("crl_action"))).equals("add")) {
+ bAction.setText(
+ _resource.getString("CRLAddCertDialog", "add"));
+ } else {
+ bAction.setText(
+ _resource.getString("CRLAddCertDialog", "replace"));
+ }
+ JButtonFactory.resizeGroup(bHelp, bClose, bAction);
+ } catch (Exception e) {
+ }
+ }
+
+ public CRLAddCertDialog(ConsoleInfo consoleInfo, ResourceSet resource) {
+ super(null, "", true, NO_BUTTONS);
+
+ _consoleInfo = consoleInfo;
+ _sie = KeyCertUtility.createTokenName(_consoleInfo);
+ _resource = resource;
+ _taskInfo = new KeyCertTaskInfo(consoleInfo);
+
+ _crlCertInfoPane = new CRLCertInfoPane(resource);
+
+ Container mainPane = getContentPane();
+ mainPane.setLayout(new GridBagLayout());
+
+ GridBagUtil.constrain(mainPane, _crlCertInfoPane, 0, 0, 4, 1,
+ 1.0, 1.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0,
+ SuiConstants.DIFFERENT_COMPONENT_SPACE, 0);
+
+ CRLAddCertActionListener listener = new CRLAddCertActionListener();
+
+ bClose = JButtonFactory.createCloseButton(listener);
+ GridBagUtil.constrain(mainPane, bClose, 1, 1, 1, 1, 1.0, 0.0,
+ GridBagConstraints.SOUTHEAST, GridBagConstraints.NONE,
+ 0, 0, 0, SuiConstants.COMPONENT_SPACE);
+
+
+ bAction = JButtonFactory.create("");
+ bAction.addActionListener(listener);
+ bAction.setActionCommand("ACTION");
+ GridBagUtil.constrain(mainPane, bAction, 2, 1, 1, 1, 0.0, 0.0,
+ GridBagConstraints.SOUTHEAST, GridBagConstraints.NONE,
+ 0, 0, 0, SuiConstants.SEPARATED_COMPONENT_SPACE);
+
+
+ bHelp = JButtonFactory.createHelpButton(listener);
+ GridBagUtil.constrain(mainPane, bHelp, 3, 1, 1, 1, 0.0, 0.0,
+ GridBagConstraints.SOUTHEAST, GridBagConstraints.NONE,
+ 0, 0, 0, 0);
+
+ setMinimumSize(400, 225);
+ setResizable(false);
+ }
+
+ /*public static void main(String arg[]) {
+ JFrame f = new JFrame();
+ f.setSize(400,400);
+ f.show();
+
+ CRLAddCertDialog d = new CRLAddCertDialog(new ConsoleInfo(), new ResourceSet("com.netscape.admin.certsrv.security.CertManagementResource"), "buddha.txt");
+ d.show();
+ }*/
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/security/CRLCertInfoPane.java b/base/console/src/com/netscape/admin/certsrv/security/CRLCertInfoPane.java
new file mode 100644
index 000000000..8e1b99b22
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/CRLCertInfoPane.java
@@ -0,0 +1,112 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import javax.swing.*;
+import javax.swing.border.*;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+
+import com.netscape.management.client.console.ConsoleInfo;
+
+
+import com.netscape.management.client.util.*;
+import com.netscape.management.nmclf.*;
+
+class CRLCertInfoPane extends JPanel implements SuiConstants {
+
+
+ JLabel _certName;
+ MultilineLabel _issuer;
+ //MultilineLabel _subject;
+ MultilineLabel _valid;
+ ResourceSet _resource;
+
+ public void setCertInfo(CertInfo certInfo) {
+ _certName.setText(certInfo.getCertName());
+ _issuer.setText(certInfo.getIssuer());
+ //_subject.setText(certInfo.getSubject());
+ _valid.setText( KeyCertUtility.replace( KeyCertUtility.replace(
+ _resource.getString("CRLDetailInfoDialog",
+ "validFromTo"), "%FROM", certInfo.getValidFrom()), "%TO",
+ certInfo.getValidTo()));
+
+ }
+
+ public CRLCertInfoPane(ResourceSet resource) {
+ setLayout(new GridBagLayout());
+
+ _resource = resource;
+
+ _certName = new JLabel();
+ _issuer = new MultilineLabel();
+ //_subject = new MultilineLabel();
+ _valid = new MultilineLabel();
+
+
+ setBorder( new CompoundBorder(new EtchedBorder(),
+ new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE)));
+
+
+
+ GridBagUtil.constrain(this,
+ new JLabel(
+ _resource.getString("CRLInfoDialog", "issuer")), 0, 0,
+ 1, 1, 1.0, 1.0, GridBagConstraints.NORTH,
+ GridBagConstraints.HORIZONTAL, 0, 0, COMPONENT_SPACE, 0);
+
+ JScrollPane issuerScrollPane = new JScrollPane(_issuer,
+ JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+ JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
+ issuerScrollPane.setBorder(
+ new CompoundBorder(UITools.createLoweredBorder(),
+ new EmptyBorder(VERT_COMPONENT_INSET,
+ HORIZ_COMPONENT_INSET, VERT_COMPONENT_INSET,
+ HORIZ_COMPONENT_INSET)));
+ GridBagUtil.constrain(this, issuerScrollPane, 0, 1, 1, 1, 1.0,
+ 1.0, GridBagConstraints.NORTH,
+ GridBagConstraints.HORIZONTAL, 0, 0,
+ DIFFERENT_COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(this, _valid, 0, 2, 1, 1, 1.0, 1.0,
+ GridBagConstraints.NORTH,
+ GridBagConstraints.HORIZONTAL, 0, 0, 0, 0);
+
+ GridBagUtil.constrain(this, Box.createGlue(), 0, 3, 1, 1, 1.0,
+ 1.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+ }
+
+ public CRLCertInfoPane(CertInfo certInfo, ResourceSet resource) {
+ this(resource);
+
+ setCertInfo(certInfo);
+ }
+
+
+ /*public static void main(String arg[]) {
+ JFrame f = new JFrame();
+ f.setSize(400,400);
+ f.getContentPane().add(new CRLCertInfoPane(new CertInfo("Buddha", "Netscape", "Netscape", null, null, "Jan 1, 1998", "Jan 1, 2000", null, null, null, null), new ResourceSet("com.netscape.admin.certsrv.security.CertManagementResource")));
+ f.show();
+
+ }*/
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/CRLDeleteCertDialog.java b/base/console/src/com/netscape/admin/certsrv/security/CRLDeleteCertDialog.java
new file mode 100644
index 000000000..6b1132ced
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/CRLDeleteCertDialog.java
@@ -0,0 +1,201 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import javax.swing.*;
+import javax.swing.border.*;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+
+import com.netscape.management.client.console.ConsoleInfo;
+
+
+import com.netscape.management.client.util.*;
+import com.netscape.management.nmclf.*;
+
+class CRLDeleteCertDialog extends AbstractDialog implements SuiConstants {
+
+
+
+ ConsoleInfo _consoleInfo;
+
+ KeyCertTaskInfo _taskInfo;
+ static boolean delete = false;
+
+ String _sie;
+
+ JButton bClose;
+ JButton bDelete;
+ JButton bHelp;
+
+ CertInfo _certInfo;
+ ResourceSet _resource;
+ String _crlname;
+ String _listtype;
+
+ CRLCertInfoPane _crlCertInfoPane;
+
+
+ class CRLDeleteCertActionListener implements ActionListener {
+ public void actionPerformed(ActionEvent e) {
+ if (e.getActionCommand().equals("DELETE")) {
+ //call delete cert cgi
+ _taskInfo.clear();
+ _taskInfo.put("formop", "D");
+ _taskInfo.put("crlname", _crlname);
+ _taskInfo.put("sie", _sie);
+ _taskInfo.put("list_type", _listtype);
+
+ Response response = null;
+ try {
+ response = _taskInfo.exec(_taskInfo.SEC_ECRL);
+ } catch (Exception error) {
+ SuiOptionPane.showMessageDialog(
+ UtilConsoleGlobals.getActivatedFrame(),
+ error.getMessage());
+ return;
+ }
+ if (!(((Message)(response.getMessages().elementAt(0))).
+ isFailure())) {
+ delete = true;
+ setVisible(false);
+ } else {
+ try {
+ MessageDialog.messageDialog( (Message)
+ (response.getMessages().elementAt(0)));
+ } catch (Exception e2) {
+ //shouldn't even be here in the first place. if cgi fail or return nothing
+ //then it should be handle right after KeyCertTaskInfo.exec(...) is called
+ //If exception occure here here then something is really mess up.
+ Debug.println("Error in decoding server messages");
+ }
+ }
+ } else if (e.getActionCommand().equals("CLOSE")) {
+ setVisible(false);
+ } else if (e.getActionCommand().equals("HELP")) {
+ Help help = new Help(_resource);
+ help.help("CRLDeleteCertDialog", "help");
+ }
+ }
+ }
+
+ public boolean isDeleted() {
+ return delete;
+ }
+
+ protected void show(String crlname, String list_type) {
+ delete = false;
+ _crlname = crlname;
+ _listtype = list_type;
+
+ _taskInfo.clear();
+ _taskInfo.put("sie", _sie);
+ _taskInfo.put("crlname", crlname);
+ _taskInfo.put("list_type", list_type);
+ try {
+ _taskInfo.exec(_taskInfo.SEC_ECRL);
+ } catch (Exception e) {
+ SuiOptionPane.showMessageDialog(
+ UtilConsoleGlobals.getActivatedFrame(), e.getMessage());
+ return;
+ }
+
+ if (_taskInfo.getResponse().hasCertInfo()) {
+ setInfo(_taskInfo.getResponse().getCertInfo());
+ super.show();
+ } else {
+ Object[] message = new Object[2];
+ message[0] = _resource.getString("CRLDeleteCertDialog", "error");
+ SuiOptionPane.showMessageDialog(
+ UtilConsoleGlobals.getActivatedFrame(), message);
+ }
+ }
+
+ private void setInfo(CertInfo certInfo) {
+ _certInfo = certInfo;
+
+ _crlCertInfoPane.setCertInfo(certInfo);
+ }
+
+
+ public CRLDeleteCertDialog(ConsoleInfo consoleInfo,
+ ResourceSet resource) {
+ super(null, "", true, NO_BUTTONS);
+
+ _consoleInfo = consoleInfo;
+ _sie = KeyCertUtility.createTokenName(_consoleInfo);
+ _resource = resource;
+ _taskInfo = new KeyCertTaskInfo(consoleInfo);
+
+ _crlCertInfoPane = new CRLCertInfoPane(resource);
+
+ Container mainPane = getContentPane();
+ mainPane.setLayout(new GridBagLayout());
+
+ GridBagUtil.constrain(mainPane, _crlCertInfoPane, 0, 0, 4, 1,
+ 1.0, 1.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0,
+ SuiConstants.DIFFERENT_COMPONENT_SPACE, 0);
+
+
+ CRLDeleteCertActionListener listener =
+ new CRLDeleteCertActionListener();
+
+ bClose = JButtonFactory.createCloseButton(listener);
+ GridBagUtil.constrain(mainPane, bClose, 1, 1, 1, 1, 1.0, 0.0,
+ GridBagConstraints.SOUTHEAST, GridBagConstraints.NONE,
+ 0, 0, 0, SuiConstants.COMPONENT_SPACE);
+
+
+ bDelete = JButtonFactory.createDeleteButton(listener);
+ GridBagUtil.constrain(mainPane, bDelete, 2, 1, 1, 1, 0.0, 0.0,
+ GridBagConstraints.SOUTHEAST, GridBagConstraints.NONE,
+ 0, 0, 0, SuiConstants.SEPARATED_COMPONENT_SPACE);
+
+
+ bHelp = JButtonFactory.createHelpButton(listener);
+ GridBagUtil.constrain(mainPane, bHelp, 3, 1, 1, 1, 0.0, 0.0,
+ GridBagConstraints.SOUTHEAST, GridBagConstraints.NONE,
+ 0, 0, 0, 0);
+
+
+
+ JButtonFactory.resizeGroup(bHelp, bClose, bDelete);
+
+ setSize(400, 225);
+ setResizable(false);
+ }
+
+ /*public static void main(String arg[]) {
+ JFrame f = new JFrame();
+ f.setSize(400,400);
+ f.show();
+
+ try {
+ UIManager.setLookAndFeel("javax.swing.plaf.windows.WindowsLookAndFeel");
+ SwingUtilities.updateComponentTreeUI(f.getContentPane());
+ } catch (Exception e) {}
+
+
+ CRLDeleteCertDialog d = new CRLDeleteCertDialog(new ConsoleInfo(), new ResourceSet("com.netscape.admin.certsrv.security.CertManagementResource"));
+ d.show();
+ }*/
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/security/CRLManagementDialog.java b/base/console/src/com/netscape/admin/certsrv/security/CRLManagementDialog.java
new file mode 100644
index 000000000..f284fbb9c
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/CRLManagementDialog.java
@@ -0,0 +1,309 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import com.netscape.management.client.console.ConsoleInfo;
+import com.netscape.management.client.util.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import javax.swing.table.*;
+import javax.swing.event.*;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+
+import netscape.ldap.*;
+
+import com.netscape.management.nmclf.*;
+
+/**
+ *
+ * Certificate Revocation List management dialog.
+ * This is a self contain dialog, that allow use to
+ * add/remove certificate fron a certificate revocation
+ * list. This is only the front end, the actuall work
+ * of removing and adding certificate will be handled
+ * by the server
+ *
+ * @version 1.0 98/07/10
+ * @author <A HREF="mailto:shihcm@netscape.com">shihcm@netscape.com</A>
+ *
+ */
+public class CRLManagementDialog extends AbstractDialog {
+
+ JButton bClose;
+ JButton bView;
+ JButton bAdd;
+ JButton bHelp;
+
+ ConsoleInfo _consoleInfo;
+
+ ResourceSet resource = new ResourceSet("com.netscape.admin.certsrv.security.CertManagementResource");
+
+ AddCRLCertificateDialog addCRLCertificateDialog;
+
+ CRLTable _crlTable;
+
+
+ private void parseCRLInfo(String response) {
+ }
+
+ //since can't over load protected and I don't
+ //want the interface to show so...
+ private void privateHelpInvoked() {
+ Help help = new Help(resource);
+ help.help("CRLManagementDialog", "help");
+ }
+
+
+ //since can't over load protected and I don't
+ //want the interface to show so...
+ private void privateCloseInvoked() {
+ super.okInvoked();
+ }
+
+ class CertManagementActionListener implements ActionListener {
+ public void actionPerformed(ActionEvent e) {
+ if (e.getActionCommand().equals("CLOSE")) {
+ privateCloseInvoked();
+ } else if (e.getActionCommand().equals("HELP")) {
+ privateHelpInvoked();
+ } else if (e.getActionCommand().equals("VIEW")) {
+ _crlTable.showCert();
+ } else if (e.getActionCommand().equals("ADD")) {
+ addCRLCertificateDialog.show();
+ }
+ }
+ }
+
+
+ private JPanel getCertListPane() {
+ JPanel certListPane = new JPanel();
+ certListPane.setLayout(new GridBagLayout());
+ certListPane.setBorder( new TitledBorder(
+ new CompoundBorder(new EtchedBorder(),
+ new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE)),
+ resource.getString("CRLManagementDialog", "certificate")));
+
+
+ GridBagUtil.constrain(certListPane,
+ new JLabel(
+ resource.getString("CRLManagementDialog", "certDB")),
+ 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.NONE, 0, 0, COMPONENT_SPACE, 0);
+
+
+ GridBagUtil.constrain(certListPane,
+ new JLabel(
+ resource.getString("CRLManagementDialog", "defaultToken"),
+ JLabel.RIGHT), 1, 0, 1, 1, 1.0, 0.0,
+ GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0,
+ 0, COMPONENT_SPACE, 0);
+
+ _crlTable = new CRLTable(_consoleInfo, resource);
+ GridBagUtil.constrain(certListPane, _crlTable, 0, 1, 2, 1, 1.0,
+ 1.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+
+
+ return certListPane;
+ }
+
+ class AddCRLCertificateDialog extends AbstractDialog {
+ KeyCertTaskInfo _taskInfo;
+ JTextField _filename;
+ JRadioButton _ckl;
+ JRadioButton _crl;
+
+ public AddCRLCertificateDialog(ConsoleInfo consoleInfo) {
+ super(null,
+ CRLManagementDialog.this.resource.getString("AddCRLCertificateDialog",
+ "dialogTitle"), true, OK | CANCEL | HELP);
+ _taskInfo = new KeyCertTaskInfo(consoleInfo);
+
+ Container p = getContentPane();
+ p.setLayout(new GridBagLayout());
+
+ _crl = new JRadioButton(
+ resource.getString("AddCRLCertificateDialog",
+ "crlfiletype"), true);
+ _ckl = new JRadioButton(
+ resource.getString("AddCRLCertificateDialog",
+ "cklfiletype"), false);
+
+ ButtonGroup buttonGroup = new ButtonGroup();
+ buttonGroup.add(_crl);
+ buttonGroup.add(_ckl);
+
+ GridBagUtil.constrain(p,
+ new JLabel(
+ resource.getString("AddCRLCertificateDialog",
+ "filename")), 0, 0, 2, 1, 1.0, 0.0,
+ GridBagConstraints.NORTH, GridBagConstraints.BOTH,
+ 0, 0, SuiConstants.COMPONENT_SPACE, 0);
+
+ _filename = new JTextField(30);
+ GridBagUtil.constrain(p, _filename, 0, 1, 2, 1, 1.0, 0.0,
+ GridBagConstraints.NORTH, GridBagConstraints.BOTH,
+ 0, 0, 0, 0);
+
+ GridBagUtil.constrain(p, (Component)_crl, 0, 2, 2, 1, 1.0,
+ 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+
+ GridBagUtil.constrain(p, (Component)_ckl, 0, 3, 2, 1, 1.0,
+ 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+
+ pack();
+ setResizable(false);
+ }
+
+
+ CRLAddCertDialog _crlAddCertDialog =
+ new CRLAddCertDialog(_consoleInfo, resource);
+ protected void okInvoked() {
+ _crlAddCertDialog.show(_filename.getText(),
+ _ckl.isSelected() ? "CKL" : "CRL");
+ setVisible(false);
+ if (_crlAddCertDialog.isModified()) {
+ CertInfo certInfo = _crlAddCertDialog.getCertInfo();
+ //only need the first line where the issuer's name locate
+ String issuer = certInfo.getIssuer();
+ _crlTable.addCert(
+ issuer.substring(0, issuer.indexOf("\n")),
+ certInfo.getValidTo(),
+ _ckl.isSelected() ? "CKL" : "CRL");
+ UtilConsoleGlobals.getActivatedFrame().setCursor(
+ new Cursor(Cursor.WAIT_CURSOR));
+ _crlTable.update();
+ UtilConsoleGlobals.getActivatedFrame().setCursor(
+ new Cursor(Cursor.DEFAULT_CURSOR));
+ }
+ }
+
+ protected void helpInvoked() {
+ Help help = new Help(resource);
+ help.help("AddCRLCertificateDialog", "help");
+ }
+ }
+
+
+ private JPanel getControlButtons() {
+ JPanel controlPanel = new JPanel();
+ controlPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));
+ controlPanel.setBorder(
+ new EmptyBorder(SuiConstants.VERT_WINDOW_INSET, 0, 0, 0));
+
+ CertManagementActionListener listener =
+ new CertManagementActionListener();
+
+ bClose = JButtonFactory.createCloseButton(listener);
+ controlPanel.add(bClose);
+
+ controlPanel.add( Box.createRigidArea(
+ new Dimension(SuiConstants.COMPONENT_SPACE, 0)));
+
+ bView = JButtonFactory.create(
+ resource.getString("CRLManagementDialog", "view"));
+ bView.addActionListener(listener);
+ bView.setActionCommand("VIEW");
+ controlPanel.add(bView);
+
+ controlPanel.add( Box.createRigidArea(
+ new Dimension(SuiConstants.COMPONENT_SPACE, 0)));
+
+ bAdd = JButtonFactory.create(
+ resource.getString("CRLManagementDialog", "add"));
+ bAdd.addActionListener(listener);
+ bAdd.setActionCommand("ADD");
+ controlPanel.add(bAdd);
+
+ controlPanel.add( Box.createRigidArea(
+ new Dimension(SuiConstants.SEPARATED_COMPONENT_SPACE, 0)));
+
+ bHelp = JButtonFactory.createHelpButton(listener);
+ controlPanel.add(bHelp);
+
+ JButtonFactory.resizeGroup(bHelp, bClose, bView, bAdd);
+
+ return controlPanel;
+ }
+
+ /**
+ * Create a Certificate Revocation List Management dialog
+ *
+ * @param consoleInfo Console information
+ *
+ */
+ public CRLManagementDialog(ConsoleInfo consoleInfo) {
+ super(null, "", true, NO_BUTTONS);
+
+ _consoleInfo = consoleInfo;
+ addCRLCertificateDialog = new AddCRLCertificateDialog(_consoleInfo);
+
+
+ UtilConsoleGlobals.getActivatedFrame().setCursor(
+ new Cursor(Cursor.WAIT_CURSOR));
+
+ //_consoleInfo = consoleInfo;
+
+ setTitle(resource.getString("CRLManagementDialog", "title"));
+
+ JPanel mainPane = new JPanel();
+ mainPane.setLayout(new BorderLayout());
+
+
+ mainPane.add("Center", getCertListPane());
+
+ mainPane.add("South", getControlButtons());
+
+ getContentPane().add(mainPane);
+
+ //pack();
+ setMinimumSize(400, 400);
+ //setResizable(false);
+
+ UtilConsoleGlobals.getActivatedFrame().setCursor(
+ new Cursor(Cursor.DEFAULT_CURSOR));
+
+ if (!(_crlTable.isTableSetup())) {
+ return;
+ }
+
+ validate();
+ invalidate();
+ show();
+ }
+
+
+ /*public static void main(String arg[]) {
+ JFrame f = new JFrame();
+ f.setSize(200,200);
+ f.show();
+ UtilConsoleGlobals.setActivatedFrame(f);
+ try {
+ UIManager.setLookAndFeel("javax.swing.plaf.windows.WindowsLookAndFeel");
+ SwingUtilities.updateComponentTreeUI(f.getContentPane());
+ } catch (Exception e) {}
+
+ CRLManagementDialog d = new CRLManagementDialog(new ConsoleInfo());
+ }*/
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/CRLTable.java b/base/console/src/com/netscape/admin/certsrv/security/CRLTable.java
new file mode 100644
index 000000000..b56a3c585
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/CRLTable.java
@@ -0,0 +1,235 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import com.netscape.management.client.console.ConsoleInfo;
+import com.netscape.management.client.util.*;
+import com.netscape.management.nmclf.*;
+
+import javax.swing.*;
+import javax.swing.table.*;
+
+import java.awt.event.*;
+import java.util.*;
+import java.io.*;
+import java.awt.*;
+
+
+class CRLTable extends JPanel implements MouseListener {
+
+ ResourceSet _resource;
+ KeyCertTaskInfo _taskInfo;
+ String _sie;
+ ConsoleInfo _consoleInfo;
+
+ CRLDeleteCertDialog _crlDeleteCertDialog = null;
+
+ String startCRL = "-----BEGIN CRL LIST-----";
+ String endCRL = "-----END CRL LIST-----";
+ String startCKL = "-----BEGIN CKL LIST-----";
+ String endCKL = "-----END CKL LIST-----";
+
+ String certName;
+ boolean setupComplete;
+
+ private Vector getRowData(String data) {
+ Vector rowData = new Vector();
+ BufferedReader stream = new BufferedReader(new StringReader(data));
+
+ // First, read CRL's
+ try {
+ while (!(stream.readLine().equals(startCRL))) {
+ }
+
+ String line;
+ while (!((line = stream.readLine()).equals(endCRL))) {
+ StringTokenizer token =
+ new StringTokenizer(line, ";", false);
+ Vector row = new Vector();
+ //get cert name and expire date and setup a row
+ row.addElement(token.nextToken());
+ row.addElement(token.nextToken());
+ row.addElement((String)"CRL");
+ rowData.addElement(row);
+ }
+ } catch (IOException e) { /*error message here */
+ }
+
+ // Next, read CKL's
+ try {
+ while (!(stream.readLine().equals(startCKL))) {
+ }
+
+ String line;
+ while (!((line = stream.readLine()).equals(endCKL))) {
+ StringTokenizer token =
+ new StringTokenizer(line, ";", false);
+ Vector row = new Vector();
+ //get cert name and expire date and setup a row
+ row.addElement(token.nextToken());
+ row.addElement(token.nextToken());
+ row.addElement((String)"CKL");
+ rowData.addElement(row);
+ }
+ } catch (IOException e) { /*error message here */
+ }
+
+ return rowData;
+ }
+
+ private Vector getColumnHeader() {
+ Vector column = new Vector();
+ column.addElement(_resource.getString("CRLTable", "column1"));
+ column.addElement(_resource.getString("CRLTable", "column2"));
+ column.addElement(_resource.getString("CRLTable", "column3"));
+ return column;
+ }
+
+ public void showCert() {
+ if (_crlTable.getSelectedRow() != -1) {
+ _crlDeleteCertDialog.show( (String)
+ (_crlTable.getValueAt(_crlTable.getSelectedRow(),
+ 0)), (String)
+ (_crlTable.getValueAt(_crlTable.getSelectedRow(), 2)));
+ if (_crlDeleteCertDialog.isDeleted()) {
+ _crlTableModel.deleteRow(_crlTable.getSelectedRow());
+ repaint();
+ }
+ }
+
+ }
+
+ JTable _crlTable;
+ public void mouseClicked(MouseEvent e) {
+ int row = _crlTable.rowAtPoint(e.getPoint());
+
+ if (e.getClickCount() < 2)
+ return;
+ if (row == -1) {
+ _crlTable.clearSelection();
+ } else {
+ showCert();
+ }
+ }
+ public void mouseEntered(MouseEvent e) { }
+ public void mouseExited(MouseEvent e) { }
+ public void mousePressed(MouseEvent e) { }
+ public void mouseReleased(MouseEvent e) { }
+
+
+ public void update() {
+ _taskInfo = new KeyCertTaskInfo(_consoleInfo);
+ _sie = KeyCertUtility.createTokenName(_consoleInfo);
+ _crlDeleteCertDialog =
+ new CRLDeleteCertDialog(_consoleInfo, _resource);
+
+ _taskInfo.put("sie", _sie);
+ try {
+ _taskInfo.exec(_taskInfo.SEC_MGCRL);
+ } catch (Exception e) {
+ SuiOptionPane.showMessageDialog(
+ UtilConsoleGlobals.getActivatedFrame(), e.getMessage());
+ setupComplete = false;
+ return;
+ }
+
+ if (_crlTableModel == null) {
+ _crlTableModel = new CRLTableModel( getRowData(
+ _taskInfo.getResponse().getServerResponse()),
+ getColumnHeader());
+ } else {
+ _crlTableModel.update( getRowData(
+ _taskInfo.getResponse().getServerResponse()),
+ getColumnHeader());
+ }
+
+ }
+
+ public CRLTable(ConsoleInfo consoleInfo, ResourceSet resource) {
+ setLayout(new BorderLayout());
+
+ setupComplete = true;
+
+ _resource = resource;
+ _consoleInfo = consoleInfo;
+
+ update();
+
+ _crlTable = new SuiTable();
+ //_crlTableModel = new CRLTableModel(getRowData(_taskInfo.getResponse().getServerResponse()), getColumnHeader());
+ _crlTable.setModel(_crlTableModel);
+ _crlTable.setAutoResizeMode(_crlTable.AUTO_RESIZE_ALL_COLUMNS);
+ _crlTable.addMouseListener(this);
+ //_crlTable.setMultipleSelectionAllowed(false);
+ _crlTable.getSelectionModel().setSelectionMode(
+ DefaultListSelectionModel.SINGLE_SELECTION);
+ //_crlTable.setSelectionModel(new DefaultSingleSelectionModel());
+
+
+ // Put the table and header into a scrollPane
+ JScrollPane scrollPane = new JScrollPane(
+ JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+ JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ JTableHeader tableHeader = _crlTable.getTableHeader();
+
+ // create and add the column heading to the scrollpane's
+ // column header viewport
+ JViewport headerViewport = new JViewport();
+ headerViewport.setLayout(new BorderLayout()/*new BoxLayout(headerViewport, BoxLayout.X_AXIS)*/);
+ headerViewport.add(tableHeader);
+ scrollPane.setColumnHeader(headerViewport);
+
+ // add the table to the viewport
+ JViewport mainViewPort = scrollPane.getViewport();
+ mainViewPort.add(_crlTable);
+
+ // speed up resizing repaints by turning off live cell updates
+ tableHeader.setUpdateTableInRealTime(false);
+
+ add(scrollPane);
+
+ }
+
+ CRLTableModel _crlTableModel;
+
+ public void repaint() {
+ _crlTable.validate();
+ _crlTable.repaint();
+ super.repaint();
+ }
+
+ public void addCert(String issuer, String expires, String type) {
+ _crlTableModel.addRow(issuer, expires, type);
+ repaint();
+ }
+
+ public boolean isTableSetup() {
+ return setupComplete;
+
+ }
+
+ /*public static void main(String arg[]) {
+ JFrame f = new JFrame();
+ //f.setSize(400,400);
+ ResourceSet resource = new ResourceSet("com.netscape.admin.certsrv.security.CertManagementResource");
+ f.getContentPane().add(new CRLTable(new ConsoleInfo(), resource));
+ f.pack();
+ f.show();
+ }*/
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/security/CRLTableModel.java b/base/console/src/com/netscape/admin/certsrv/security/CRLTableModel.java
new file mode 100644
index 000000000..4fe7ded08
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/CRLTableModel.java
@@ -0,0 +1,94 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import java.util.*;
+import java.awt.event.*;
+
+import javax.swing.*;
+import javax.swing.table.*;
+import javax.swing.event.*;
+
+
+class CRLTableModel extends AbstractTableModel {
+
+ Vector _header;
+ Vector _rowData = new Vector();
+ Vector _tableModelListener = new Vector();
+
+ public CRLTableModel(Vector CRL, Vector columnIdentifier) {
+ update(CRL, columnIdentifier);
+ }
+
+ public void update(Vector CRL, Vector columnIdentifier) {
+ _header = columnIdentifier;
+ _rowData = CRL;
+ }
+
+ public void addRow(String issuer, String expires, String type) {
+ Vector row = new Vector();
+ row.addElement(issuer);
+ row.addElement(expires);
+ row.addElement(type);
+ _rowData.addElement(row);
+ }
+
+ public int getRowCount() {
+ return _rowData.size();
+ }
+
+ public int getColumnCount() {
+ return _header.size();
+ }
+
+ public String getColumnName(int columnIndex) {
+ return (columnIndex >= _header.size() ? "":
+ (String)(_header.elementAt(columnIndex)));
+ }
+
+ public Object getValueAt(int rowIndex, int columnIndex) {
+ Object o = null;
+
+ try {
+ o = ((Vector)(_rowData.elementAt(rowIndex))).elementAt(
+ columnIndex);
+ } catch (Exception e) {}
+
+ return o;
+ }
+
+
+ public void deleteRow(int rowIndex) {
+ try {
+ _rowData.removeElementAt(rowIndex);
+ } catch (Exception e) {}
+ }
+
+ public void deleteAllRows() {
+ _rowData.removeAllElements();
+ }
+
+ public void addTableModelListener(TableModelListener l) {
+ _tableModelListener.addElement(l);
+ }
+
+ public void removeTableModelListener(TableModelListener l) {
+ _tableModelListener.removeElement(l);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/security/CertBasicInfo.java b/base/console/src/com/netscape/admin/certsrv/security/CertBasicInfo.java
new file mode 100644
index 000000000..0d746324d
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/CertBasicInfo.java
@@ -0,0 +1,83 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import java.util.*;
+
+import com.netscape.management.client.util.ResourceSet;
+
+class CertBasicInfo {
+ String _certName;
+ String _certType;
+ String _certExpiration;
+
+ String _certNameLabel;
+ String _certTypeLabel;
+ String _certExpirationLabel;
+
+ public CertBasicInfo(String certName, String certType,
+ String certExpiration) {
+ _certName = certName;
+ _certType = certType;
+ _certExpiration = certExpiration;
+
+ ResourceSet resource = new ResourceSet("com.netscape.admin.certsrv.security.CertManagementResource");
+ _certNameLabel = resource.getString("CertBasicInfo", "labelName");
+ _certTypeLabel = resource.getString("CertBasicInfo", "lableType");
+ _certExpirationLabel = resource.getString("CertBasicInfo", "labelExpire");
+ }
+
+ public String getCertName() {
+ return _certName;
+ }
+
+ public String getCertType() {
+ return _certType;
+ }
+
+ public String getCertExpiration() {
+ return _certExpiration;
+ }
+
+
+ public String getCertInfo(String headerIndex) {
+ String nReturn = "";
+
+ if (headerIndex.equals(_certNameLabel)) {
+ nReturn = getCertName();
+ } else if (headerIndex.equals(_certTypeLabel)) {
+ nReturn = getCertType();
+ } else if (headerIndex.equals(_certExpirationLabel)) {
+ nReturn = getCertExpiration();
+ }
+
+ return nReturn;
+ }
+
+ static public Vector getCertTitleLabels() {
+ Vector title = new Vector();
+
+ ResourceSet resource = new ResourceSet("com.netscape.admin.certsrv.security.CertManagementResource");
+ title.addElement(resource.getString("CertBasicInfo", "labelName"));
+ title.addElement(resource.getString("CertBasicInfo", "lableType"));
+ title.addElement(resource.getString("CertBasicInfo", "labelExpire"));
+
+ return title;
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/security/CertDetailInfoDialog.java b/base/console/src/com/netscape/admin/certsrv/security/CertDetailInfoDialog.java
new file mode 100644
index 000000000..3c1e39821
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/CertDetailInfoDialog.java
@@ -0,0 +1,111 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import javax.swing.*;
+import javax.swing.border.*;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+
+import com.netscape.management.client.console.ConsoleInfo;
+
+import com.netscape.management.client.util.*;
+import com.netscape.management.nmclf.*;
+
+class CertDetailInfoDialog extends AbstractDialog implements SuiConstants {
+
+
+ JLabel serialNumber = new JLabel();
+ JLabel valid = new JLabel();
+ JLabel fingerprint = new JLabel();
+ JLabel trust = new JLabel();
+ JPanel mainPane = new JPanel();
+
+ ResourceSet resource = new ResourceSet("com.netscape.admin.certsrv.security.CertManagementResource");
+
+ void setCertInfo(CertInfo certInfo) {
+
+ serialNumber.setText(certInfo.getSerialNumber());
+ valid.setText( KeyCertUtility.replace( KeyCertUtility.replace(
+ resource.getString("CertDetailInfoDialog",
+ "validFromTo"), "%FROM", certInfo.getValidFrom()), "%TO",
+ certInfo.getValidTo()));
+ fingerprint.setText(certInfo.getFingerPrint());
+ trust.setText(certInfo.trusted() ?
+ resource.getString("CertDetailInfoDialog", "trustString") :
+ resource.getString("CertDetailInfoDialog", "notTrustString"));
+
+ mainPane.doLayout();
+ mainPane.repaint();
+
+ pack();
+ }
+
+ public CertDetailInfoDialog(JFrame parent, CertInfo certInfo) {
+ super(parent, "", true, CLOSE);
+
+ setTitle(resource.getString("CertDetailInfoDialog", "title"));
+
+ mainPane.setLayout(new GridBagLayout());
+ mainPane.setBorder( new CompoundBorder(new EtchedBorder(),
+ new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE)));
+
+ int y = 0;
+ GridBagUtil.constrain(mainPane,
+ new JLabel( resource.getString("CertDetailInfoDialog",
+ "serialNumberLabel")), 0, y, 1, 1, 1.0, 0.0,
+ GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0,
+ 0, COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(mainPane, serialNumber, 0, ++y, 1, 1,
+ 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, DIFFERENT_COMPONENT_SPACE,
+ COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(mainPane, valid, 0, ++y, 1, 1, 1.0, 0.0,
+ GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0,
+ 0, COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(mainPane,
+ new JLabel( resource.getString("CertDetailInfoDialog",
+ "fingerprintLabel")), 0, ++y, 1, 1, 1.0, 0.0,
+ GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0,
+ 0, COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(mainPane, fingerprint, 0, ++y, 1, 1, 1.0,
+ 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, DIFFERENT_COMPONENT_SPACE,
+ COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(mainPane, trust, 0, ++y, 1, 1, 1.0, 0.0,
+ GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0,
+ 0, COMPONENT_SPACE, 0);
+
+ getContentPane().add(mainPane);
+
+ setCertInfo(certInfo);
+
+ pack();
+ setMinimumSize(getSize());
+ setResizable(false);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/security/CertInfo.java b/base/console/src/com/netscape/admin/certsrv/security/CertInfo.java
new file mode 100644
index 000000000..40cd071d4
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/CertInfo.java
@@ -0,0 +1,87 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+
+class CertInfo {
+
+ String _certName;
+ String _issuer;
+ String _subject;
+ String _serialNumber;
+ String _version;
+ String _validFrom;
+ String _validTo;
+ String _fingerPrint;
+ boolean _trustCert;
+ boolean _certDeleted;
+ String _certTitle;
+
+
+ public CertInfo(String certName, String issuer, String subject,
+ String serialNumber, String version, String validFrom,
+ String validTo, String fingerPrint, String trustCert,
+ String certDeleted, String certTitle) {
+ _certName = certName;
+ _issuer = issuer;
+ _subject = subject;
+ _serialNumber = serialNumber;
+ _version = version;
+ _validFrom = validFrom;
+ _validTo = validTo;
+ _fingerPrint = fingerPrint;
+ _trustCert = (trustCert != null) ? trustCert.equals("1") : false;
+ _certDeleted =
+ (certDeleted != null) ? certDeleted.equals("1") : false;
+ _certTitle = certTitle;
+ }
+
+ public String getCertName() {
+ return _certName;
+ }
+ public String getIssuer() {
+ return _issuer;
+ }
+ public String getSubject() {
+ return _subject;
+ }
+ public String getSerialNumber() {
+ return _serialNumber;
+ }
+ public String getVersion() {
+ return _version;
+ }
+ public String getValidFrom() {
+ return _validFrom;
+ }
+ public String getValidTo() {
+ return _validTo;
+ }
+ public String getFingerPrint() {
+ return _fingerPrint;
+ }
+ public boolean trusted() {
+ return _trustCert;
+ }
+ public boolean getCertDeleted() {
+ return _certDeleted;
+ }
+ public String getCertTitle() {
+ return _certTitle;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/CertInfoDialog.java b/base/console/src/com/netscape/admin/certsrv/security/CertInfoDialog.java
new file mode 100644
index 000000000..910d38a9c
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/CertInfoDialog.java
@@ -0,0 +1,528 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import javax.swing.*;
+import javax.swing.border.*;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+
+import com.netscape.management.client.console.ConsoleInfo;
+
+
+import com.netscape.management.client.util.*;
+import com.netscape.management.nmclf.*;
+
+/**
+ *
+ * UI to display subject and issuer of the certificate, and
+ * allow user to change trust, delete, or view detail information
+ * of this certificate
+ *
+ * @version 1.0 98/07/10
+ * @author shihcm@netscape.com
+ * @see com.netscape.admin.certsrv.security.CertDetailInfoDialog
+ * @see com.netscape.admin.certsrv.security.CertInfo
+ *
+ */
+class CertInfoDialog extends AbstractDialog implements SuiConstants {
+
+
+ /**
+ * String for trust and none trusted status of the certificate
+ * String is localized and will be retrived from the properties file
+ */
+ String trustString, notTrustString;
+
+ /**
+ * Task info, the communication channel that calls the server to execute the cgi
+ */
+ KeyCertTaskInfo _taskInfo;
+
+
+ /**
+ * Certificate information, certificate info used to populate this gui
+ */
+ CertInfo _certInfo;
+
+ /**
+ * cn of the sie. ie. admin-serv-buddha
+ * Note that the key & cert db file are named using the sie.
+ */
+ String alias;
+
+ /**
+ * Properties file, contain all the localized string
+ */
+ ResourceSet resource = new ResourceSet("com.netscape.admin.certsrv.security.CertManagementResource");
+
+ /**
+ * After this dilaog is disposed, the routine(CertManagementDialog) that opens this ui will
+ * need to know whether the cert presented has been deleted and update it's gui accordingly.
+ */
+ static boolean delete = false;
+
+ /**
+ * Owner of this dialog
+ */
+ JFrame _parent;
+
+ JLabel certName = new JLabel();
+ MultilineLabel issuer = new MultilineLabel(6, 5);
+ MultilineLabel subject = new MultilineLabel(6, 5);
+
+ JButton bDetail;
+ JButton bDelete;
+ JButton bTrust;
+
+ JLabel _issuerLabel;
+ JLabel _subjectLabel;
+
+ /**
+ * Trust status of the cert that is presented
+ */
+ boolean trustedCert;
+
+
+ private boolean promptBeforeDelete() {
+ return SuiOptionPane.showConfirmDialog(this,
+ resource.getString("CertInfoDialog", "areYouSure"),
+ resource.getString("CertInfoDialog", "confirmTitle"),
+ SuiOptionPane.YES_NO_OPTION) == SuiOptionPane.YES_OPTION;
+ }
+
+ private void deleteSuccess() {
+ SuiOptionPane.showMessageDialog(this,
+ resource.getString("CertInfoDialog", "certDeleted"));
+ }
+
+ /**
+ *
+ * Inner class, where all the action will execute.
+ * 3 action can be taken on the certificate: Detail, Delete, [Trust|Reject]
+ *
+ * Detail: vew other certificate information that is not currently been
+ * displayed by this dialog
+ * Delete: Delete certificate from the certificate database
+ * Trust: Change the certificate's trust status to trust
+ * Reject: Change the certificate's trust status to do not trust
+ *
+ * @see com.netscape.admin.certsrv.security.CertDetailInfoDialog
+ */
+ class CertInfoActionListener implements ActionListener {
+ public void actionPerformed(ActionEvent e) {
+ delete = false;
+
+ if (_taskInfo == null) {
+ if (e.getActionCommand().equals("CLOSE")) {
+ CertInfoDialog.this.closeInvoked();
+ } else if (e.getActionCommand().equals("DELETE")) {
+ if (promptBeforeDelete()) {
+ deleteSuccess();
+ delete = true;
+ setVisible(false);
+ }
+ } else if (e.getActionCommand().equals("HELP")) {
+ helpInvoked();
+ }
+
+ } else {
+ if (e.getActionCommand().equals("DETAIL")) {
+ (new CertDetailInfoDialog(_parent, _certInfo)).show();
+ } else if (e.getActionCommand().equals("DELETE")) {
+ if (!promptBeforeDelete()) {
+ return;
+ }
+ //call delete cert cgi
+ _taskInfo.clear();
+ _taskInfo.put("certnn", _certInfo.getCertName());
+ _taskInfo.put("formop", "D");
+ _taskInfo.put("alias", alias);
+ Response response = null;
+ try {
+ response = _taskInfo.exec(_taskInfo.SEC_ECRT);
+ } catch (Exception error) {
+ SuiOptionPane.showMessageDialog(
+ UtilConsoleGlobals.getActivatedFrame(),
+ error.getMessage());
+ return;
+ }
+
+ //if (response.hasCertInfo()) {
+ if (!(((Message)(response.getMessages().elementAt(0))).
+ isFailure())) {
+ deleteSuccess();
+ delete = true;
+ setVisible(false);
+ } else {
+ try {
+ MessageDialog.messageDialog( (Message)
+ (response.getMessages().elementAt(0)));
+ } catch (Exception e2) {
+ //shouldn't even be here in the first place. if cgi fail or return nothing
+ //then it should be handle right after KeyCertTaskInfo.exec(...) is called
+ //If exception occure here here then something is really mess up
+ Debug.println("Error in decoding server messages");
+ }
+ }
+ }
+ else if (e.getActionCommand().equals("TRUST")) {
+ //call trust cert cgi
+ //need to display a warning message first
+ _taskInfo.clear();
+ _taskInfo.put("certnn", _certInfo.getCertName());
+ _taskInfo.put("formop", "C");
+ _taskInfo.put("alias", alias);
+ Response response = null;
+ try {
+ response = _taskInfo.exec(_taskInfo.SEC_ECRT);
+ } catch (Exception error2) {
+ SuiOptionPane.showMessageDialog(
+ UtilConsoleGlobals.getActivatedFrame(),
+ error2.getMessage());
+ return;
+ }
+ /*if (response.hasCertInfo()) {
+ setCertInfo(response.getCertInfo());
+ }*/
+
+ try {
+ if (!(((Message)
+ (response.getMessages().elementAt(0))).
+ isFailure())) {
+ trustedCert = !trustedCert;
+ bTrust.setText(trustedCert ?
+ resource.getString("CertInfoDialog",
+ "reject") :
+ resource.getString("CertInfoDialog",
+ "trust"));
+ }
+
+ MessageDialog.messageDialog( (Message)
+ (response.getMessages().elementAt(0)));
+ } catch (Exception e3) {
+ //shouldn't even be here in the first place. if cgi fail or return nothing
+ //then it should be handle right after KeyCertTaskInfo.exec(...) is called
+ //If exception occure here here then something is really mess up.
+ Debug.println("Error in decoding server messages");
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ *
+ * Update certificate information.
+ * Without disposing the dialog this method allows the reuse the the same dialog
+ * by repopulating it with new certificate information
+ *
+ * @param certInfo contain certificate information to be displayed
+ *
+ */
+ void setCertInfo(CertInfo certInfo) {
+ _certInfo = certInfo;
+
+ certName.setText(certInfo.getCertName());
+ issuer.setText(certInfo.getIssuer());
+ subject.setText(certInfo.getSubject());
+
+ if (_taskInfo != null) {
+ trustedCert = certInfo.trusted();
+ bTrust.setText(trustedCert ?
+ resource.getString("CertInfoDialog", "reject") :
+ resource.getString("CertInfoDialog", "trust"));
+ }
+ }
+
+
+ /**
+ *
+ * Invoke on-line help
+ *
+ */
+ protected void helpInvoked() {
+ Help help = new Help(resource);
+ help.help("CertInfoDialog", "help");
+ }
+
+ protected void closeInvoked() {
+ super.closeInvoked();
+ }
+
+
+ /**
+ *
+ * @return a panel contain subject and issuer
+ *
+ * [Panel]
+ * [Subject] [Issuer]
+ * [Panel]
+ *
+ */
+ private JPanel getSubjectIssuerPane() {
+ JPanel subjectIssuerPane = new JPanel();
+ subjectIssuerPane.setLayout(new GridBagLayout());
+
+ _issuerLabel =
+ new JLabel(resource.getString("CertInfoDialog", "issuer"));
+ _subjectLabel =
+ new JLabel(resource.getString("CertInfoDialog", "subject"));
+
+ //issuer.getCaret().setVisible(false);
+ //issuer.setSelectionColor(issuer.getBackground());
+ //issuer.setEditable(false);
+ //subject.getCaret().setVisible(false);
+ //subject.setSelectionColor(issuer.getBackground());
+ //subject.setEditable(false);
+
+ GridBagUtil.constrain(subjectIssuerPane, _subjectLabel, 0, 0,
+ 1, 1, 0.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+
+ GridBagUtil.constrain(subjectIssuerPane, _issuerLabel, 2, 0, 1,
+ 1, 0.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+
+ GridBagUtil.constrain(subjectIssuerPane,
+ Box.createRigidArea(new Dimension(COMPONENT_SPACE, 0))
+ , 1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.NONE, 0, 0, 0, 0);
+
+ JScrollPane subjectScrollPane = new JScrollPane(subject,
+ JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+ JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
+ subjectScrollPane.setBorder(
+ new CompoundBorder(UITools.createLoweredBorder(),
+ new EmptyBorder(VERT_COMPONENT_INSET,
+ HORIZ_COMPONENT_INSET, VERT_COMPONENT_INSET,
+ HORIZ_COMPONENT_INSET)));
+ GridBagUtil.constrain(subjectIssuerPane, subjectScrollPane, 0,
+ 1, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.HORIZONTAL, 0, 0,
+ DIFFERENT_COMPONENT_SPACE, 0);
+
+ JScrollPane issuerScrollPane = new JScrollPane(issuer,
+ JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+ JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
+ issuerScrollPane.setBorder(
+ new CompoundBorder(UITools.createLoweredBorder(),
+ new EmptyBorder(VERT_COMPONENT_INSET,
+ HORIZ_COMPONENT_INSET, VERT_COMPONENT_INSET,
+ HORIZ_COMPONENT_INSET)));
+ GridBagUtil.constrain(subjectIssuerPane, issuerScrollPane, 2,
+ 1, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.HORIZONTAL, 0, 0,
+ DIFFERENT_COMPONENT_SPACE, 0);
+
+ return subjectIssuerPane;
+ }
+
+ /**
+ *
+ * @return a panel contain certificate name and what ever was return by getSubjectIssuerPane()
+ * [PANEL]
+ * Certificate Name
+ * getSubjectIssuerPane()
+ * [PANEL]
+ *
+ * @see #getSubjectIssuerPane
+ */
+ private JPanel getInfoPane() {
+ JPanel infoPane = new JPanel();
+ infoPane.setLayout(new GridBagLayout());
+
+ int y = 0;
+
+
+ GridBagUtil.constrain(infoPane, certName, 0, y, 1, 1, 1.0, 0.0,
+ GridBagConstraints.NORTH, GridBagConstraints.BOTH,
+ COMPONENT_SPACE, 0, COMPONENT_SPACE, 0);
+
+
+ GridBagUtil.constrain(infoPane, getSubjectIssuerPane(), 0, ++y,
+ 1, 1, 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+
+ return infoPane;
+ }
+
+
+
+ /**
+ *
+ * @return Panel contain a row of button(Delete, View, [Trust|Reject])
+ * [PANEL]
+ * [bDetail] [bDelete] [bTrust|bReject]
+ * [PANEL]
+ *
+ */
+ private JPanel getControlPane() {
+
+ JPanel controlPane = new JPanel();
+ controlPane.setLayout(new GridBagLayout());
+ CertInfoActionListener listener = new CertInfoActionListener();
+
+ if (_taskInfo == null) {
+
+ GridBagUtil.constrain(controlPane,
+ JButtonFactory.createCloseButton(listener), 0, 0,
+ 1, 1, 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH,
+ DIFFERENT_COMPONENT_SPACE, 0, 0, COMPONENT_SPACE);
+
+ GridBagUtil.constrain(controlPane,
+ JButtonFactory.create(
+ resource.getString("CertInfoDialog", "delete"),
+ listener, "DELETE"), 1, 0, 1, 1, 1.0, 0.0,
+ GridBagConstraints.NORTH, GridBagConstraints.BOTH,
+ DIFFERENT_COMPONENT_SPACE, 0, 0, COMPONENT_SPACE);
+
+ GridBagUtil.constrain(controlPane,
+ JButtonFactory.createHelpButton(listener), 2, 0,
+ 1, 1, 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH,
+ DIFFERENT_COMPONENT_SPACE, 0, 0, 0);
+ } else {
+ JPanel certButtonPane = new JPanel();
+ //certButtonPane.setLayout(new BoxLayout(certButtonPane, BoxLayout.X_AXIS));
+ certButtonPane.setLayout(new GridBagLayout());
+
+ certButtonPane.setBorder( new TitledBorder(
+ new CompoundBorder(new EtchedBorder(),
+ new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE)),
+ resource.getString("CertInfoDialog", "certificate")));
+
+ bDetail = JButtonFactory.create(
+ resource.getString("CertInfoDialog", "detail"));
+ bDetail.addActionListener(listener);
+ bDetail.setActionCommand("DETAIL");
+
+ bDelete = JButtonFactory.create(
+ resource.getString("CertInfoDialog", "delete"));
+ bDelete.addActionListener(listener);
+ bDelete.setActionCommand("DELETE");
+
+ JButtonFactory.resizeGroup(bDetail, bDelete);
+
+ setTitle(resource.getString("CertInfoDialog", "certificate"));
+
+ //certButtonPane.add(bDetail);
+ //certButtonPane.add(Box.createRigidArea(new Dimension(COMPONENT_SPACE, 0)));
+ //certButtonPane.add(bDelete);
+ GridBagUtil.constrain(certButtonPane, bDetail, 0, 0, 1, 1,
+ 1.0, 0.0, GridBagConstraints.WEST,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+ GridBagUtil.constrain(certButtonPane, bDelete, 1, 0, 1, 1,
+ 1.0, 0.0, GridBagConstraints.EAST,
+ GridBagConstraints.BOTH, 0, COMPONENT_SPACE, 0, 0);
+
+ JPanel trustCAButtonPane = new JPanel();
+ trustCAButtonPane.setLayout(new GridBagLayout());
+ trustCAButtonPane.setBorder( new TitledBorder(
+ new CompoundBorder(new EtchedBorder(),
+ new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE)),
+ resource.getString("CertInfoDialog", "trustCA")));
+
+
+
+ bTrust = JButtonFactory.create(
+ resource.getString("CertInfoDialog", "reject"));
+ bTrust.addActionListener(listener);
+ bTrust.setActionCommand("TRUST");
+
+ JButtonFactory.resizeGroup(bTrust,
+ JButtonFactory.create(
+ resource.getString("CertInfoDialog", "reject")));
+
+ //trustCAButtonPane.add(bTrust);
+ GridBagUtil.constrain(trustCAButtonPane, bTrust, 0, 0, 1,
+ 1, 1.0, 0.0, GridBagConstraints.WEST,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+
+ GridBagUtil.constrain(controlPane, certButtonPane, 0, 0, 1,
+ 1, 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+
+ GridBagUtil.constrain(controlPane, trustCAButtonPane, 1, 0,
+ 1, 1, 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+ }
+
+ return controlPane;
+ }
+
+
+ void init(CertInfo certInfo) {
+ JPanel mainPane = new JPanel();
+ mainPane.setBorder( new CompoundBorder(new EtchedBorder(),
+ new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE)));
+ mainPane.setLayout(new BorderLayout());
+
+ mainPane.add("Center", getInfoPane());
+
+ if (_taskInfo == null) {
+ getContentPane().add("South", getControlPane());
+ } else {
+ mainPane.add("South", getControlPane());
+ }
+
+ getContentPane().add(mainPane);
+
+ setCertInfo(certInfo);
+
+ pack();
+ setMinimumSize(getSize());
+ setResizable(false);
+ }
+
+ /**
+ *
+ * Construct a certificate information dialog
+ *
+ * @param parent the owner of the dialog
+ * @param certInfo contain certificate information to be displayed
+ * @param taskInfo task module that carry out the action for change trust, delete, or get certificate information
+ *
+ */
+ public CertInfoDialog(JFrame parent, CertInfo certInfo,
+ KeyCertTaskInfo taskInfo) {
+ super(parent, "", true, CLOSE | HELP);
+
+ _taskInfo = taskInfo;
+ _parent = parent;
+
+ alias = (String)(taskInfo.get("alias"));
+
+ init(certInfo);
+ }
+
+ public CertInfoDialog(JFrame parent, CertInfo certInfo) {
+ super(parent, "", true/*, CLOSE | HELP*/);
+
+ _parent = parent;
+
+ init(certInfo);
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/security/CertInstallCertInfoPane.java b/base/console/src/com/netscape/admin/certsrv/security/CertInstallCertInfoPane.java
new file mode 100644
index 000000000..2f43e9f32
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/CertInstallCertInfoPane.java
@@ -0,0 +1,391 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import com.netscape.management.client.util.*;
+import com.netscape.management.nmclf.*;
+
+/**
+ *
+ * Step 3 of the certificate installation under Key & Cert wizard.
+ * This pane display to user the certificate taht is about to be installed.
+ *
+ * @version 1.0 98/07/10
+ * @author shihcm@netscape.com
+ *
+ */
+class CertInstallCertInfoPane extends JPanel implements SuiConstants,
+IKeyCertPage {
+
+
+ JLabel _subjectLabel;
+ JLabel _issuerLabel;
+
+ JLabel certName = new JLabel();
+ MultilineLabel issuer = new MultilineLabel(6, 5);
+ MultilineLabel subject = new MultilineLabel(6, 5);
+
+ MultilineLabel serialNum = new MultilineLabel();
+ MultilineLabel valid = new MultilineLabel();
+ MultilineLabel fingerprint = new MultilineLabel();
+ MultilineLabel addReplaceLabel = new MultilineLabel();
+ JButton addReplaceButton = new JButton();
+
+ String certNameLabel;
+
+ /**
+ * Reference to a copy of WizardObservable that was pass in via pageShow
+ * WizardObservable contain shared information between all the panels
+ * under Key & Cert Wizard.
+ */
+ WizardObservable obs;
+
+ /**
+ * Communication module that does the actually sends the cgi request to install
+ * the certificate.
+ */
+ KeyCertTaskInfo taskInfo;
+
+
+ /**
+ * Properties file, contain all the localized string
+ */
+ ResourceSet resource;
+
+ /**
+ * Get the panel that is going to be displayed
+ * @return a panel to be displayed by the key & cert wizard
+ */
+ public JPanel getPanel() {
+ return this;
+ }
+
+ /**
+ * Checks if this panel can be shown
+ * @return true if this page can be shown
+ */
+ public boolean pageShow(WizardObservable observable) {
+ obs = observable;
+ boolean show =
+ ((Boolean)(observable.get("installCert"))).booleanValue();
+ if (show) {
+
+ StatusPane statusPane = (StatusPane)(obs.get("statusPane"));
+ statusPane.setLastPage(false);
+
+ taskInfo = observable.getTaskInfo();
+
+ Hashtable certInstInfo = (Hashtable)(observable.get("certInstInfo"));
+ certInstInfo.put("tokenName", observable.get("tokenName"));
+
+ if (certInstInfo.get("repbutton") != null) {
+ try {
+ addReplaceLabel.setText(
+ resource.getString("CertInstallCertInfoPane",
+ "replaceCert"));
+ addReplaceButton.setText(
+ resource.getString("CertInstallCertInfoPane",
+ "replace"));
+ } catch (Exception e) {}
+ } else {
+ try {
+ addReplaceLabel.setText(
+ resource.getString("CertInstallCertInfoPane",
+ "addCert"));
+ addReplaceButton.setText(
+ resource.getString("CertInstallCertInfoPane",
+ "add"));
+ } catch (Exception e) {}
+ }
+ CertInfo certInfo = (CertInfo)(observable.get("certInfo"));
+
+ subject.setText(certInfo.getSubject());
+ issuer.setText(certInfo.getIssuer());
+ certName.setText(certNameLabel + certInfo.getCertName());
+ serialNum.setText(certInfo.getSerialNumber());
+ fingerprint.setText(certInfo.getFingerPrint());
+
+ String validFromToLabel = null;
+ try {
+ validFromToLabel =
+ resource.getString("CertInstallCertInfoPane",
+ "validFromTo");
+ } catch (Exception e) {}
+
+ valid.setText( KeyCertUtility.replace(
+ KeyCertUtility.replace(validFromToLabel, "%FROM",
+ certInfo.getValidFrom()), "%TO",
+ certInfo.getValidTo()));
+
+
+
+ }
+ return show;
+ }
+
+ /**
+ * Checks if this panel can be hidden
+ * @return true if this page can be hide
+ */
+ public boolean pageHide(WizardObservable observable) {
+ return true;
+ }
+
+
+ /**
+ *
+ * Inner class to handle add/replace certificate.
+ * If add/replace action occure method within this inner
+ * class will call the cgi to do the work.
+ *
+ */
+ class CertInfoActionListener implements ActionListener {
+ public void actionPerformed(ActionEvent event) {
+ if (event.getActionCommand().equals("add_replace")) {
+ Hashtable certInstInfo = (Hashtable)(obs.get("certInstInfo"));
+ Enumeration keys = certInstInfo.keys();
+ while (keys.hasMoreElements()) {
+ String key = (String)(keys.nextElement());
+ taskInfo.put(key, certInstInfo.get(key));
+ }
+
+ try {
+ taskInfo.put("keyfilepw", obs.get("keyfilepw"));
+ taskInfo.exec(taskInfo.SEC_ICRT);
+ taskInfo.clear();
+ } catch (Exception e) {
+ SuiOptionPane.showMessageDialog(
+ UtilConsoleGlobals.getActivatedFrame(),
+ e.getMessage());
+ //((IWizardControl)(obs.get("Wizard"))).cancelInvoked();
+ return;
+ }
+
+ Vector messages = taskInfo.getResponse().getMessages();
+ //int nMessages = messages.size();
+
+ StatusPane statusPane = (StatusPane)(obs.get("statusPane"));
+ statusPane.setMessage(messages);
+ statusPane.setShow(true);
+ statusPane.setLastPage(true);
+
+ ((IWizardControl)(obs.get("Wizard"))).setIsLastPage(false);
+ ((IWizardControl)(obs.get("Wizard"))).setCanGoForward(
+ false);
+ ;
+ ((IWizardControl)(obs.get("Wizard"))).nextInvoked();
+ }
+ }
+ }
+
+
+
+
+ /**
+ *
+ * @return a panel contain subject and issuer
+ *
+ * [Panel]
+ * [Subject] [Issuer]
+ * [Panel]
+ *
+ */
+ private JPanel getSubjectIssuerPane() {
+ JPanel subjectIssuerPane = new JPanel();
+ subjectIssuerPane.setLayout(new GridBagLayout());
+
+ addReplaceButton.setActionCommand("add_replace");
+ addReplaceButton.addActionListener(new CertInfoActionListener());
+
+ GridBagUtil.constrain(subjectIssuerPane, _subjectLabel, 0, 0,
+ 1, 1, 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+
+ GridBagUtil.constrain(subjectIssuerPane, _issuerLabel, 2, 0, 1,
+ 1, 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+
+ GridBagUtil.constrain(subjectIssuerPane,
+ Box.createRigidArea(new Dimension(COMPONENT_SPACE, 0))
+ , 1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.NONE, 0, 0, 0, 0);
+
+ JScrollPane subjectScrollPane = new JScrollPane(subject,
+ JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+ JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
+ subjectScrollPane.setBorder(
+ new CompoundBorder(UITools.createLoweredBorder(),
+ new EmptyBorder(VERT_COMPONENT_INSET,
+ HORIZ_COMPONENT_INSET, VERT_COMPONENT_INSET,
+ HORIZ_COMPONENT_INSET)));
+
+ GridBagUtil.constrain(subjectIssuerPane, subjectScrollPane, 0,
+ 1, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+
+ JScrollPane issuerScrollPane = new JScrollPane(issuer,
+ JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+ JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
+ issuerScrollPane.setBorder(
+ new CompoundBorder(UITools.createLoweredBorder(),
+ new EmptyBorder(VERT_COMPONENT_INSET,
+ HORIZ_COMPONENT_INSET, VERT_COMPONENT_INSET,
+ HORIZ_COMPONENT_INSET)));
+ GridBagUtil.constrain(subjectIssuerPane, issuerScrollPane, 2,
+ 1, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+
+ return subjectIssuerPane;
+ }
+
+
+ /**
+ *
+ * A panel contain a string telling user whether a add or a replace can
+ * take place for this certificate
+ * [panel]
+ * [string telling use if they can add or replace] [add|replace button]
+ * [panel]
+ *
+ */
+ private JPanel getAddReplacePane() {
+ JPanel addReplacePane = new JPanel();
+ addReplacePane.setLayout(new GridBagLayout());
+
+ GridBagUtil.constrain(addReplacePane, addReplaceLabel, 0, 0, 1,
+ 1, 1.0, 0.0, GridBagConstraints.WEST,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+
+ GridBagUtil.constrain(addReplacePane, addReplaceButton, 1, 0,
+ 1, 1, 1.0, 0.0, GridBagConstraints.EAST,
+ GridBagConstraints.NONE, 0, 0, 0, 0);
+
+ return addReplacePane;
+ }
+
+ /**
+ *
+ * This panel contain certificate informations, serial number, finger print,
+ * validation date. Also make a cal to getSubjectIssuerPanel() to obtain
+ * subject and issuer ui
+ * [panel]
+ * [subject] [issuer]
+ * [serial number[
+ * [finger print]
+ * [validation]
+ * [panel]
+ *
+ */
+ private JPanel getInfoPane() {
+ JPanel infoPane = new JPanel();
+ infoPane.setLayout(new GridBagLayout());
+
+ int y = 0;
+
+ GridBagUtil.constrain(infoPane, certName, 0, y, 1, 1, 1.0, 0.0,
+ GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0,
+ 0, COMPONENT_SPACE, 0);
+
+
+ GridBagUtil.constrain(infoPane, getSubjectIssuerPane(), 0, ++y,
+ 1, 1, 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0,
+ SEPARATED_COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(infoPane,
+ new JLabel( resource.getString("CertInstallCertInfoPane",
+ "serialLabel")), 0, ++y, 1, 1, 1.0, 0.0,
+ GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0,
+ 0, 0, 0);
+
+ GridBagUtil.constrain(infoPane, serialNum, 0, ++y, 1, 1, 1.0,
+ 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(infoPane,
+ new JLabel( resource.getString("CertInstallCertInfoPane",
+ "fingerprintLabel")), 0, ++y, 1, 1, 1.0, 0.0,
+ GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0,
+ 0, 0, 0);
+
+ GridBagUtil.constrain(infoPane, fingerprint, 0, ++y, 1, 1, 1.0,
+ 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(infoPane, valid, 0, ++y, 1, 1, 1.0, 0.0,
+ GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0,
+ 0, COMPONENT_SPACE, 0);
+
+ return infoPane;
+ }
+
+
+
+ /**
+ *
+ * Constructor, create a certificate information pane and a action button allow
+ * user to add or replace certificate.
+ *
+ */
+ public CertInstallCertInfoPane() {
+ super();
+ setLayout(new GridBagLayout());
+
+ resource = KeyCertUtility.getKeyCertWizardResourceSet();
+
+ certNameLabel = resource.getString("CertInstallCertInfoPane", "certNameLabel");
+
+ _subjectLabel = new JLabel(
+ resource.getString("CertInstallCertInfoPane", "subjectLabel"));
+ _issuerLabel = new JLabel(
+ resource.getString("CertInstallCertInfoPane", "issuerLabel"));
+
+
+ setBorder( new TitledBorder( new CompoundBorder(new EtchedBorder(),
+ new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE)),
+ resource.getString("CertInstallCertInfoPane", "title")));
+
+ int y = 0;
+
+ GridBagUtil.constrain(this, getInfoPane(), 0, ++y, 1, 1, 1.0,
+ 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+
+ GridBagUtil.constrain(this, Box.createVerticalGlue(), 0, ++y,
+ 1, 1, 1.0, 1.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+
+ GridBagUtil.constrain(this, getAddReplacePane(), 0, ++y, 1, 1,
+ 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+ }
+
+ /*public static void main(String arg[]) {
+ JFrame f = new JFrame();
+ f.getContentPane().add("North", new CertInstallCertInfoPane());
+ f.setSize(400,400);
+ f.show();
+ }*/
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/CertInstallCertPane.java b/base/console/src/com/netscape/admin/certsrv/security/CertInstallCertPane.java
new file mode 100644
index 000000000..210cfc9bf
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/CertInstallCertPane.java
@@ -0,0 +1,236 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import com.netscape.management.client.util.*;
+import com.netscape.management.nmclf.*;
+
+class CertInstallCertPane extends JPanel implements SuiConstants,
+IKeyCertPage {
+
+ JRadioButton certInFile;
+ JTextField certFilename = new JTextField(20);
+ JRadioButton certInText;
+ JTextArea certText = new JTextArea(7, 10);
+ JButton paste;
+
+ IWizardControl control = null;
+ boolean modified = false;
+
+ public JPanel getPanel() {
+ return this;
+ }
+
+ public boolean pageShow(WizardObservable observable) {
+
+ if (control == null) {
+ control = (IWizardControl)(observable.get("Wizard"));
+ setEnableNextButton();
+ }
+
+ return ((Boolean)(observable.get("installCert"))).booleanValue();
+ }
+
+ public boolean pageHide(WizardObservable observable) {
+ boolean hide = true;
+
+ if (modified) {
+ observable.put("CertInstModified", new Boolean(true));
+ modified = false;
+ }
+
+ if (((Boolean)(observable.get("CertInstModified"))).booleanValue()) {
+ CertInstallTypePane.param.put("inputtype" ,
+ certInFile.isSelected() ? "0":"1");
+ CertInstallTypePane.param.put("cert_file",
+ certFilename.getText());
+ CertInstallTypePane.param.put("cert_txt" , certText.getText());
+ CertInstallTypePane.param.put("tokenName", observable.get("tokenName"));
+
+ KeyCertTaskInfo taskInfo = observable.getTaskInfo();
+ Enumeration cgiParam = CertInstallTypePane.param.keys();
+ while (cgiParam.hasMoreElements()) {
+ String key = (String)(cgiParam.nextElement());
+ taskInfo.put(key, CertInstallTypePane.param.get(key));
+ }
+
+ Response response = null;
+ try {
+ response = taskInfo.exec(taskInfo.SEC_ICRT);
+ taskInfo.clear();
+ } catch (Exception e) {
+ SuiOptionPane.showMessageDialog(
+ UtilConsoleGlobals.getActivatedFrame(),
+ e.getMessage());
+ hide = false;
+ }
+
+ if (response.hasCertInstInfo() && response.hasCertInfo()) {
+ observable.put("certInstInfo", response.getCertInstInfo());
+ observable.put("certInfo", response.getCertInfo());
+ observable.put("CertInstModified", new Boolean(false));
+ } else {
+ //hide = false;
+ //MessageDialog.messageDialog((Message)(taskInfo.getResponse().getMessages().elementAt(0)));
+ StatusPane statusPane = (StatusPane)(observable.get("statusPane"));
+
+ statusPane.setMessage( (Message)
+ (taskInfo.getResponse().getMessages().
+ elementAt(0)));
+ statusPane.setShow(true);
+ }
+ }
+
+ return hide;
+ }
+
+
+ class CertPaneActionListener implements ActionListener, KeyListener {
+ public void keyTyped(KeyEvent e) {}
+ public void keyPressed(KeyEvent e) {}
+ public void keyReleased(KeyEvent e) {
+ setEnableNextButton();
+ }
+
+ public void actionPerformed(ActionEvent event) {
+ modified = true;
+
+ if (event.getActionCommand().equals("PASTE")) {
+ certText.paste();
+ }
+
+ setEnableNextButton();
+ }
+ }
+
+ void setEnableNextButton() {
+ if ((certInFile.isSelected() &&
+ (certFilename.getText().length() != 0)) ||
+ (certInText.isSelected() &&
+ (certText.getText().length() != 0))) {
+ control.setCanGoForward(true);
+ } else {
+ control.setCanGoForward(false);
+ }
+
+ if (certInFile.isSelected()) {
+ certText.setEnabled(false);
+ certFilename.setEnabled(true);
+ } else {
+ certText.setEnabled(true);
+ certFilename.setEnabled(false);
+ }
+ }
+
+
+ public CertInstallCertPane() {
+ super();
+ setLayout(new GridBagLayout());
+
+ ResourceSet resource = KeyCertUtility.getKeyCertWizardResourceSet();
+
+ certInFile = new JRadioButton(
+ resource.getString("CertInstallCertPane",
+ "certInFileLabel"), false);
+ certInText = new JRadioButton(
+ resource.getString("CertInstallCertPane",
+ "certInTextLabel"), true);
+ paste = new JButton(resource.getString("CertInstallCertPane", "pasteLabel"));
+
+ ButtonGroup buttonGroup = new ButtonGroup();
+ buttonGroup.add(certInFile);
+ buttonGroup.add(certInText);
+
+ int y = 0;
+
+ CertPaneActionListener listener = new CertPaneActionListener();
+ certFilename.addKeyListener(listener);
+
+ //certText.addActionListener(listener);
+ certText.addKeyListener(listener);
+
+ certInText.addActionListener(listener);
+ certInFile.addActionListener(listener);
+
+ paste.setActionCommand("PASTE");
+ paste.addActionListener(listener);
+
+
+ setBorder( new TitledBorder( new CompoundBorder(new EtchedBorder(),
+ new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE)),
+ resource.getString("CertInstallCertPane", "title")));
+
+
+ GridBagUtil.constrain(this, certInFile, 0, ++y, 1, 1, 1.0, 0.0,
+ GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0,
+ 0, COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(this, certFilename, 0, ++y, 1, 1, 1.0,
+ 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
+ 0, 0, DIFFERENT_COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(this, certInText, 0, ++y, 1, 1, 1.0, 0.0,
+ GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0,
+ 0, COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(this,
+ new MultilineLabel(
+ resource.getString("CertInstallCertPane",
+ "certTextExplain")), 0, ++y, 1, 1, 1.0, 0.0,
+ GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0,
+ 0, COMPONENT_SPACE, 0);
+
+
+ JScrollPane scrollPane = new JScrollPane(certText,
+ JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+ JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
+ scrollPane.setBorder(UITools.createLoweredBorder());
+ GridBagUtil.constrain(this, scrollPane, 0, ++y, 1, 1, 1.0, 0.0,
+ GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0,
+ 0, DIFFERENT_COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(this, paste, 0, ++y, 1, 1, 0.0, 0.0,
+ GridBagConstraints.WEST, GridBagConstraints.NONE, 0,
+ 0, DIFFERENT_COMPONENT_SPACE, 0);
+
+
+ GridBagUtil.constrain(this, Box.createVerticalGlue(), 0, ++y,
+ 1, 1, 1.0, 1.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+
+
+ JLabel _next = new JLabel(resource.getString(null, "clickNextToContinue"));
+ GridBagUtil.constrain(this, _next, 0, ++y, 1, 1, 1.0, 0.0,
+ GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0,
+ 0, 0, 0);
+ }
+
+ /*public static void main(String arg[]) {
+ JFrame f = new JFrame();
+ f.getContentPane().add("North", new CertInstallCertPane());
+ f.setSize(400,400);
+ f.show();
+ }*/
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/CertInstallTypePane.java b/base/console/src/com/netscape/admin/certsrv/security/CertInstallTypePane.java
new file mode 100644
index 000000000..a55fce2ec
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/CertInstallTypePane.java
@@ -0,0 +1,296 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import com.netscape.management.client.util.*;
+import com.netscape.management.nmclf.*;
+
+class CertInstallTypePane extends JPanel implements SuiConstants,
+IKeyCertPage {
+
+ JRadioButton thisServer;
+ JRadioButton certChain;
+ JRadioButton ca;
+
+ JLabel tokenName = new JLabel();
+ SingleBytePasswordField passwd = new SingleBytePasswordField(20);
+ JLabel certName = new JLabel();
+
+ JLabel _certnameLabel;
+ JLabel _tokenLabel;
+ JLabel _certType;
+ JLabel _passwordLabel;
+
+ public static Hashtable param = new Hashtable();
+
+ IWizardControl control;
+ boolean modified = true;
+
+ public JPanel getPanel() {
+ return this;
+ }
+
+ public boolean pageShow(WizardObservable observable) {
+ boolean show =
+ ((Boolean)(observable.get("installCert"))).booleanValue();
+
+ control = (IWizardControl)(observable.get("Wizard"));
+
+ passwd.setText((String)(observable.get("keyPasswd")));
+ if (passwd.getText().length() == 0) {
+ control = (IWizardControl)(observable.get("Wizard"));
+ setEnableNextButton();
+ }
+
+ if (show) {
+ tokenName.setText((String)(observable.get("tokenName")));
+ certName.setText((String)(observable.get("certName")));
+ }
+
+ return show;
+ }
+
+ public boolean pageHide(WizardObservable observable) {
+
+
+ if (modified) {
+ observable.put("keyfilepw", passwd.getText());
+
+ observable.put("CertInstModified", new Boolean(true));
+
+ param.put("certtype" ,
+ thisServer.isSelected() ? "0":
+ (certChain.isSelected() ? "1":"2"));
+ param.put("alias" , observable.get("sie"));
+ param.put("keyfilepw", passwd.getText());
+ observable.put("keyPasswd", passwd.getText());
+
+ if (thisServer.isSelected()) {
+ param.put("certname", (String)(observable.get("certName")));
+ } else {
+ param.remove("certname");
+ }
+
+ modified = false;
+ }
+
+ return true;
+ }
+
+ void setEnableNextButton() {
+ if (passwd.getText().length() == 0) {
+ control.setCanGoForward(false);
+ } else {
+ control.setCanGoForward(true);
+ }
+ }
+
+ class TypeActionListener implements ActionListener, KeyListener {
+ public void keyTyped(KeyEvent e) {}
+ public void keyPressed(KeyEvent e) {}
+ public void keyReleased(KeyEvent e) {
+ modified = true;
+ setEnableNextButton();
+ }
+
+ public void actionPerformed(ActionEvent event) {
+ modified = true;
+
+ if (thisServer.isSelected()) {
+ certName.setVisible(true);
+ _certnameLabel.setVisible(true);
+
+ _passwordLabel.setVisible(true);
+ passwd.setVisible(true);
+
+ setEnableNextButton();
+ } else {
+ certName.setVisible(false);
+ _certnameLabel.setVisible(false);
+
+ _passwordLabel.setVisible(false);
+ passwd.setVisible(false);
+
+ control.setCanGoForward(true);
+ }
+ }
+ }
+
+
+
+ private JPanel getCertTypePane() {
+ JPanel certTypePane = new JPanel();
+ certTypePane.setLayout(new GridBagLayout());
+ int y = 0, x = 0;
+
+ TypeActionListener listener = new TypeActionListener();
+ thisServer.addActionListener(listener);
+ certChain.addActionListener(listener);
+ ca.addActionListener(listener);
+ passwd.addKeyListener(listener);
+
+ GridBagUtil.constrain(certTypePane,
+ Box.createRigidArea(
+ new Dimension(DIFFERENT_COMPONENT_SPACE, 0)), x, y, 1,
+ 1, 0.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+
+ GridBagUtil.constrain(certTypePane, new JLabel("1. "), ++x,
+ ++y, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
+ GridBagConstraints.NONE, 0, 0, 0, 0);
+
+ GridBagUtil.constrain(certTypePane, _certType, ++x, y, 1, 1,
+ 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+
+ GridBagUtil.constrain(certTypePane, thisServer, x, ++y, 1, 1,
+ 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+
+ GridBagUtil.constrain(certTypePane, certChain, x, ++y, 1, 1,
+ 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+
+ GridBagUtil.constrain(certTypePane, ca, x, ++y, 1, 1, 1.0, 0.0,
+ GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0,
+ 0, 0, 0);
+
+ return certTypePane;
+ }
+
+
+
+ private JLabel createRightAlignLabel(String label) {
+ return new JLabel(label, JLabel.RIGHT);
+ }
+
+
+ private JPanel getTokenInfoPane() {
+ JPanel tokenInfoPane = new JPanel();
+ tokenInfoPane.setLayout(new GridBagLayout());
+ int y = 0;
+
+
+ GridBagUtil.constrain(tokenInfoPane, _tokenLabel, 0, y, 1, 1,
+ 0.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(tokenInfoPane, tokenName, 1, y, 1, 1,
+ 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, DIFFERENT_COMPONENT_SPACE,
+ COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(tokenInfoPane, _passwordLabel, 0, ++y, 1,
+ 1, 0.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(tokenInfoPane, passwd, 1, y, 1, 1, 1.0,
+ 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, DIFFERENT_COMPONENT_SPACE,
+ COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(tokenInfoPane, _certnameLabel, 0, ++y, 1,
+ 1, 0.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(tokenInfoPane, certName, 1, y, 1, 1, 1.0,
+ 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, COMPONENT_SPACE,
+ COMPONENT_SPACE, 0);
+
+ return tokenInfoPane;
+ }
+
+
+ public CertInstallTypePane() {
+ super();
+ setLayout(new GridBagLayout());
+
+ ResourceSet resource = KeyCertUtility.getKeyCertWizardResourceSet();
+ thisServer = new JRadioButton(
+ resource.getString("CertInstallTypePane",
+ "thisServerLabel"), true);
+ certChain = new JRadioButton(
+ resource.getString("CertInstallTypePane",
+ "certChainLabel"), false);
+ ca = new JRadioButton(
+ resource.getString("CertInstallTypePane", "caLabel"),
+ false);
+
+ ButtonGroup buttonGroup = new ButtonGroup();
+ buttonGroup.add(thisServer);
+ buttonGroup.add(certChain);
+ buttonGroup.add(ca);
+
+
+ _certnameLabel =
+ new JLabel(resource.getString("CertInstallTypePane", "certnameLabel"));
+ _tokenLabel = createRightAlignLabel(
+ resource.getString("CertInstallTypePane", "tokenLabel"));
+ _certType =
+ new JLabel(resource.getString("CertInstallTypePane", "certType"));
+ _passwordLabel = createRightAlignLabel(
+ resource.getString("CertInstallTypePane", "passwordLabel"));
+
+ setBorder( new TitledBorder( new CompoundBorder(new EtchedBorder(),
+ new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE)),
+ resource.getString("CertInstallTypePane", "title")));
+
+ int y = 0;
+
+ GridBagUtil.constrain(this, getCertTypePane(), 0, ++y, 1, 1,
+ 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0,
+ DIFFERENT_COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(this,
+ new JLabel(
+ resource.getString("CertInstallTypePane", "promptPasswd"))
+ , 0, ++y, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
+ GridBagConstraints.NONE, 0, 0, COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(this, getTokenInfoPane(), 0, ++y, 1, 1,
+ 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0,
+ DIFFERENT_COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(this, Box.createVerticalGlue(), 0, ++y,
+ 1, 1, 1.0, 1.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+
+ GridBagUtil.constrain(this,
+ new JLabel(
+ resource.getString(null, "clickNextToContinue")), 0,
+ ++y, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+ }
+
+ /*public static void main(String arg[]) {
+ JFrame f = new JFrame();
+ f.getContentPane().add("North", new CertInstallTypePane());
+ f.setSize(400,400);
+ f.show();
+ }*/
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/CertListTable.java b/base/console/src/com/netscape/admin/certsrv/security/CertListTable.java
new file mode 100644
index 000000000..62f58d9c2
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/CertListTable.java
@@ -0,0 +1,316 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+
+import com.netscape.management.client.console.*;
+import com.netscape.management.client.util.*;
+import com.netscape.management.nmclf.*;
+
+import java.util.*;
+import java.awt.*;
+import java.awt.event.*;
+
+import javax.swing.*;
+import javax.swing.table.*;
+import javax.swing.event.*;
+
+//import crysec.SSL.DBManager;
+//import crysec.X509;
+//import crysec.X500Name;
+//import crysec.Utils;
+
+class CertListTable extends JPanel implements MouseListener, Runnable {
+ JTable _table;
+ CertListTableModel _dataModel;
+ KeyCertTaskInfo _taskInfo;
+
+ String alias;
+ String _certName;
+ boolean local = false;
+ boolean setupComplete;
+ Vector certList;
+ // DBManager trustdb;
+
+ //IBackgroundLoaderCallback _callback;
+
+ ConsoleInfo _consoleInfo;
+
+ private String formatLineString(String val, String option,
+ boolean newLine) {
+ if (val != null) {
+ return val + (newLine ? option + "\n":option);
+ } else {
+ return "";
+ }
+ }
+
+ public void showCert() {
+// to get it compile
+/*
+ int row = _table.getSelectedRow();
+ if (row == -1)
+ return;
+
+ //show cert here
+
+ if (local) {
+ X509 cert = (X509)(certList.elementAt(row));
+ X500Name holder = (X500Name)(cert.getHolder());
+ X500Name issuer = (X500Name)(cert.getIssuer());
+
+ StringBuffer subjectString = new StringBuffer();
+ StringBuffer issuerString = new StringBuffer();
+
+ subjectString.append(
+ formatLineString(holder.getName(), "", true));
+ subjectString.append(
+ formatLineString(holder.getEmail(), "", true));
+ subjectString.append(
+ formatLineString(holder.getOrganizationName(), "",
+ true));
+ subjectString.append(
+ formatLineString(holder.getOrgUnitName(), "", true));
+ subjectString.append(
+ formatLineString(holder.getLocalityName(), "", true));
+ subjectString.append(
+ formatLineString(holder.getStateName(), ", ",
+ false) + holder.getCountryName());
+
+ issuerString.append(
+ formatLineString(issuer.getName(), "", true));
+ issuerString.append(
+ formatLineString(issuer.getEmail(), "", true));
+ issuerString.append(
+ formatLineString(issuer.getOrganizationName(), "",
+ true));
+ issuerString.append(
+ formatLineString(issuer.getOrgUnitName(), "", true));
+ issuerString.append(
+ formatLineString(issuer.getLocalityName(), "", true));
+ issuerString.append(
+ formatLineString(issuer.getStateName(), ", ",
+ false) + issuer.getCountryName());
+
+ CertInfo ci = new CertInfo(holder.getName(),
+ issuerString.toString(), subjectString.toString(),
+ "", "", cert.getNotBeforeDate().toString(),
+ cert.getNotAfterDate().toString(),
+ new String(cert.getFingerprint()), "1", "0",
+ holder.getOrganizationName());
+
+ CertInfoDialog infoDialog = new CertInfoDialog(null, ci);
+ infoDialog.show();
+
+ if (CertInfoDialog.delete) {
+ deleteRow(row);
+
+ trustdb.remove(Utils.toHexString(cert.getFingerprint()));
+ trustdb.save();
+ }
+ } else {
+ _taskInfo.clear();
+ _taskInfo.put("certnn", getRow(row).getCertName());
+ _taskInfo.put("alias", alias);
+ Response response = null;
+ try {
+ response = _taskInfo.exec(_taskInfo.SEC_ECRT);
+ } catch (Exception e) {
+ SuiOptionPane.showMessageDialog(
+ UtilConsoleGlobals.getActivatedFrame(),
+ e.getMessage());
+ return;
+ }
+
+ if (response.hasCertInfo()) {
+ CertInfoDialog infoDialog =
+ new CertInfoDialog(null,
+ response.getCertInfo(), _taskInfo);
+ ModalDialogUtil.setDialogLocation(infoDialog, this);
+ infoDialog.show();
+ //since CertInfoDialog is a modal dialog we will wait until it comes back to check wheather the cer
+ //has been deleted if it is deleted then we need to refresh the table
+ if (CertInfoDialog.delete) {
+ deleteRow(row);
+ }
+ }
+
+ //MessageDialog.messageDialog((Message)(response.getMessages().elementAt(0)));
+ }
+ */
+ }
+
+
+ public void mouseClicked(MouseEvent e) {
+ int row = _table.rowAtPoint(e.getPoint());
+
+ if (e.getClickCount() < 2)
+ return;
+
+ if (row == -1) {
+ _table.clearSelection();
+ } else {
+ showCert();
+ }
+ }
+
+ public void mouseEntered(MouseEvent e) {}
+ public void mouseExited(MouseEvent e) {}
+ public void mousePressed(MouseEvent e) {}
+ public void mouseReleased(MouseEvent e) {}
+
+ public boolean isTableSetup() {
+ return setupComplete;
+ }
+
+
+ public CertListTable() {
+ super(true);
+ local = true;
+
+ setLayout(new BorderLayout());
+
+ setupComplete = true;
+
+ // trustdb = new DBManager();
+ // Enumeration e = trustdb.elements();
+ Enumeration e = null;
+ certList = new Vector();
+ Vector v = new Vector();
+ // while (e.hasMoreElements()) {
+ // X509 cert = (X509)(e.nextElement());
+ // certList.addElement(cert);
+// v.addElement(
+ // new CertBasicInfo(cert.getHolder().getName(), "Trust Server Certificate",
+ // cert.getNotAfterDate().toString()));
+ // }
+
+ _dataModel = new CertListTableModel(
+ CertBasicInfo.getCertTitleLabels(), v);
+ setupTable(_dataModel);
+ }
+
+
+ public CertListTable(String certName, ConsoleInfo consoleInfo/*, IBackgroundLoaderCallback callback*/) {
+ super(true);
+ _consoleInfo = consoleInfo;
+ _certName = certName;
+ //_callback = callback;
+ setLayout(new BorderLayout());
+
+ setupComplete = true;
+
+ run();
+
+ /*setBackground( Color.white );*/
+ }
+
+
+
+ private void setupTable(CertListTableModel _tableModel) {
+ // Create the table
+ _table = new SuiTable(_tableModel);
+ _table.addMouseListener(this);
+ _table.setColumnSelectionAllowed(false);
+ /*_table.setMultipleSelectionAllowed(false);*/
+
+ // Put the table and header into a scrollPane
+ JScrollPane scrollpane = new JScrollPane();
+ JTableHeader tableHeader = _table.getTableHeader();
+
+ // create and add the column heading to the scrollpane's
+ // column header viewport
+ JViewport headerViewport = new JViewport();
+ headerViewport.setLayout(
+ new BoxLayout(headerViewport, BoxLayout.X_AXIS));
+ headerViewport.add(tableHeader);
+ scrollpane.setColumnHeader(headerViewport);
+
+ // add the table to the viewport
+ JViewport mainViewPort = scrollpane.getViewport();
+ mainViewPort.add(_table);
+
+ // speed up resizing repaints by turning off live cell updates
+ tableHeader.setUpdateTableInRealTime(false);
+
+ add("Center", scrollpane);
+
+ setPreferredSize(new Dimension(0, 0));
+ //_callback.classLoaded(this, "CertListTable");
+ }
+
+ //public void setCertList(String certName) {
+ public void run() {
+
+ _taskInfo = new KeyCertTaskInfo(_consoleInfo);
+ _dataModel = new CertListTableModel(
+ CertBasicInfo.getCertTitleLabels(), new Vector());
+ //setCertList(certName);
+
+ //_dataModel.deleteAllRows();
+ //call cgi here to get the cert information
+ _taskInfo.put("alias", _certName);
+ alias = _certName;
+ Response response = null;
+ try {
+ response = _taskInfo.exec(_taskInfo.SEC_MGCRT);
+ } catch (Exception e) {
+ SuiOptionPane.showMessageDialog(
+ UtilConsoleGlobals.getActivatedFrame(), e.getMessage());
+ setupComplete = false;
+ return;
+ }
+
+ if (response.hasCertList()) {
+ _dataModel.setRowData(response.getCertList());
+ //repaint();
+ }
+
+ setupTable(_dataModel);
+ }
+
+ /**
+ *
+ * @return LDAPEntry at specified index, null if index > number of rows
+ *
+ */
+ public CertBasicInfo getRow(int index) {
+ return _dataModel.getRow(index);
+ }
+
+ /**
+ *
+ * @return the number of rows in the table.
+ *
+ */
+ public int getRowCount() {
+ return _dataModel.getRowCount();
+ }
+
+ /**
+ *
+ * Removes the first occurrence of the LDAPEntry from this table. If the object is found.
+ *
+ * @param ldapEntry LDAPEntry to delete from this table.
+ *
+ */
+ public void deleteRow(int rowIndex) {
+ _dataModel.deleteRow(rowIndex);
+ repaint();
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/CertListTableModel.java b/base/console/src/com/netscape/admin/certsrv/security/CertListTableModel.java
new file mode 100644
index 000000000..fb9423093
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/CertListTableModel.java
@@ -0,0 +1,91 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import java.util.*;
+import java.awt.event.*;
+
+import javax.swing.*;
+import javax.swing.table.*;
+import javax.swing.event.*;
+
+
+class CertListTableModel extends AbstractTableModel {
+
+ Vector _header;
+
+ Vector _rowData = new Vector();
+
+ Vector _tableModelListener = new Vector();
+
+ public CertListTableModel(Vector columnIdentifier, Vector certList) {
+ _header = columnIdentifier;
+ _rowData = certList;
+ }
+
+ public void setRowData(Vector rowData) {
+ _rowData = rowData;
+ }
+
+ public int getRowCount() {
+ return _rowData.size();
+ }
+
+ public int getColumnCount() {
+ return _header.size();
+ }
+
+ public String getColumnName(int columnIndex) {
+ return (columnIndex >= _header.size() ? "":
+ (String)(_header.elementAt(columnIndex)));
+ }
+
+ public Object getValueAt(int rowIndex, int columnIndex) {
+ Object o = null;
+
+ try {
+ o = ((CertBasicInfo)(_rowData.elementAt(rowIndex))).
+ getCertInfo((String)(_header.elementAt(columnIndex)));
+ } catch (Exception e) {}
+
+ return o;
+ }
+
+ public void deleteRow(int rowIndex) {
+ try {
+ _rowData.removeElementAt(rowIndex);
+ } catch (Exception e) {}
+ }
+
+ public void deleteAllRows() {
+ _rowData.removeAllElements();
+ }
+
+ public CertBasicInfo getRow(int index) {
+ return index < _rowData.size() ?
+ (CertBasicInfo)(_rowData.elementAt(index)) : null;
+ }
+
+ public void addTableModelListener(TableModelListener l) {
+ _tableModelListener.addElement(l);
+ }
+
+ public void removeTableModelListener(TableModelListener l) {
+ _tableModelListener.removeElement(l);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/CertManagementDialog.java b/base/console/src/com/netscape/admin/certsrv/security/CertManagementDialog.java
new file mode 100644
index 000000000..f780314cd
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/CertManagementDialog.java
@@ -0,0 +1,220 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import com.netscape.management.client.console.ConsoleInfo;
+import com.netscape.management.client.util.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import javax.swing.table.*;
+import javax.swing.event.*;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+
+import com.netscape.management.nmclf.*;
+
+/**
+ *
+ * Certificate management dialog.
+ * This is a self contain dialog, that allow use to
+ * view, delete, and change the trut status of a certificate.
+ * This is only the front end, the actuall work
+ * of looking up, delete, and modified certificate are handled
+ * at the server side.
+ *
+ * @version 1.0 98/07/10
+ * @author <A HREF="mailto:shihcm@netscape.com">shihcm@netscape.com</A>
+ *
+ */
+public class CertManagementDialog extends AbstractDialog {
+
+ CertListTable certListTable;
+ KeyCertTaskInfo taskInfo;
+ ConsoleInfo _consoleInfo;
+
+ JButton bClose;
+ JButton bEdit;
+ JButton bHelp;
+
+ ResourceSet resource = new ResourceSet("com.netscape.admin.certsrv.security.CertManagementResource");
+
+ //since can't over load protected and I don't
+ //want the interface to show so...
+ private void privateHelpInvoked() {
+ Help help = new Help(resource);
+ help.help("CertManagementDialog", "help");
+ }
+
+
+ //since can't over load protected and I don't
+ //want the interface to show so...
+ private void privateCloseInvoked() {
+ super.okInvoked();
+ }
+
+ class CertManagementActionListener implements ActionListener {
+ public void actionPerformed(ActionEvent e) {
+ if (e.getActionCommand().equals("CLOSE")) {
+ privateCloseInvoked();
+ } else if (e.getActionCommand().equals("HELP")) {
+ privateHelpInvoked();
+ } else if (e.getActionCommand().equals("EDIT")) {
+ certListTable.showCert();
+ }
+ }
+ }
+
+
+ private JPanel getCertListPane() {
+ JPanel certListPane = new JPanel();
+ certListPane.setLayout(new GridBagLayout());
+ certListPane.setBorder( new TitledBorder(
+ new CompoundBorder(new EtchedBorder(),
+ new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE)),
+ resource.getString("CertManagementDialog", "certificate")));
+
+
+ GridBagUtil.constrain(certListPane,
+ new JLabel(
+ resource.getString("CertManagementDialog", "certDB")),
+ 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.NONE, 0, 0, COMPONENT_SPACE, 0);
+
+
+ GridBagUtil.constrain(certListPane,
+ new JLabel( resource.getString("CertManagementDialog",
+ "defaultToken"), JLabel.RIGHT), 1, 0, 1, 1, 1.0, 0.0,
+ GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0,
+ 0, COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(certListPane, certListTable, 0, 1, 2, 1,
+ 1.0, 1.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+
+
+ return certListPane;
+ }
+
+
+ private JPanel getControlButtons() {
+ JPanel controlPanel = new JPanel();
+ controlPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));
+ controlPanel.setBorder(
+ new EmptyBorder(SuiConstants.VERT_WINDOW_INSET, 0, 0, 0));
+
+ CertManagementActionListener listener =
+ new CertManagementActionListener();
+
+ bClose = JButtonFactory.createCloseButton(listener);
+ controlPanel.add(bClose);
+
+ controlPanel.add( Box.createRigidArea(
+ new Dimension(SuiConstants.COMPONENT_SPACE, 0)));
+
+ bEdit = JButtonFactory.create(
+ resource.getString("CertManagementDialog", "edit"));
+ bEdit.addActionListener(listener);
+ bEdit.setActionCommand("EDIT");
+ controlPanel.add(bEdit);
+
+ controlPanel.add( Box.createRigidArea(
+ new Dimension(SuiConstants.SEPARATED_COMPONENT_SPACE, 0)));
+
+ bHelp = JButtonFactory.createHelpButton(listener);
+ controlPanel.add(bHelp);
+
+ JButtonFactory.resizeGroup(bHelp, bClose, bEdit);
+
+ return controlPanel;
+ }
+
+
+
+ /**
+ * Create an certificate management dialog to
+ * manage remote certificate database
+ *
+ * @param consoleInfo Console information
+ *
+ */
+ public CertManagementDialog(ConsoleInfo consoleInfo) {
+ super(null, "", true, NO_BUTTONS);
+
+ UtilConsoleGlobals.getActivatedFrame().setCursor(
+ new Cursor(Cursor.WAIT_CURSOR));
+
+ _consoleInfo = consoleInfo;
+
+ setTitle(resource.getString("CertManagementDialog", "title"));
+
+ JPanel mainPane = new JPanel();
+ mainPane.setLayout(new BorderLayout());
+
+ certListTable = new CertListTable(
+ KeyCertUtility.createTokenName(_consoleInfo), consoleInfo);
+ mainPane.add("Center", getCertListPane());
+ mainPane.add("South", getControlButtons());
+
+ getContentPane().add(mainPane);
+
+ //pack();
+ setMinimumSize(400, 400);
+ //setResizable(false);
+
+ UtilConsoleGlobals.getActivatedFrame().setCursor(
+ new Cursor(Cursor.DEFAULT_CURSOR));
+
+ if (!(certListTable.isTableSetup())) {
+ return;
+ }
+
+ show();
+ }
+
+ /**
+ * Create an certificate management dialog to
+ * manage local trust database.
+ *
+ *
+ */
+ public CertManagementDialog() {
+ super(null, "", true, NO_BUTTONS);
+
+ setTitle(resource.getString("CertManagementDialog", "title"));
+
+ JPanel mainPane = new JPanel();
+ mainPane.setLayout(new BorderLayout());
+
+ certListTable = new CertListTable();
+ mainPane.add("Center", getCertListPane());
+ mainPane.add("South", getControlButtons());
+
+ getContentPane().add(mainPane);
+
+ setSize(400, 400);
+
+ if (!(certListTable.isTableSetup())) {
+ return;
+ }
+
+ show();
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/CertRequestCertPane.java b/base/console/src/com/netscape/admin/certsrv/security/CertRequestCertPane.java
new file mode 100644
index 000000000..46ae3852f
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/CertRequestCertPane.java
@@ -0,0 +1,197 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import java.awt.*;
+import java.util.*;
+import java.net.*;
+import java.io.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import javax.swing.text.*;
+import com.netscape.management.client.util.*;
+import com.netscape.management.nmclf.*;
+import com.netscape.management.client.comm.HttpChannel;
+
+class CertRequestCertPane extends JPanel implements SuiConstants,
+IKeyCertPage {
+
+ JTextArea certReq = new JTextArea(7, 10);
+ JScrollPane scrollPane = new JScrollPane(certReq,
+ JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+ JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
+ String explainEMail, explainURL;
+ JButton copy;
+ String oldUrl = "";
+
+
+
+ public JPanel getPanel() {
+ return this;
+ }
+
+
+
+ class CertPaneActionListener implements ActionListener {
+ public void actionPerformed(ActionEvent event) {
+ if (event.getActionCommand().equals("COPY")) {
+ certReq.selectAll();
+ certReq.copy();
+ certReq.setSelectionEnd(certReq.getSelectionEnd());
+ }
+ }
+ }
+
+ public boolean pageHide(WizardObservable observable) {
+ return true;
+ }
+
+ public boolean pageShow(WizardObservable observable) {
+ boolean show =
+ ((Boolean)(observable.get("requestCert"))).booleanValue();
+
+
+ Hashtable param = (Hashtable)(observable.get("CertReqCGIParam"));
+ if (show && param.get("xmt_select").equals("1")) {
+
+ Hashtable urlParam = new Hashtable();
+ urlParam.put("op" , "submitCSR");
+ urlParam.put("csrCertType" , "server");
+ urlParam.put("csrRequestorName" , param.get("requestor_name"));
+ urlParam.put("csrRequestorEmail" , param.get("email_address"));
+ urlParam.put("csrRequestorPhone" , param.get("telephone"));
+ urlParam.put("csrRequestorComments", "");
+ urlParam.put("pkcs10Request" , observable.get("CertReq"));
+
+ if (((Boolean)(observable.get("newCertReq"))).booleanValue()
+ && !(oldUrl.equals(param.get("url")))) {
+ try {
+ //attempt to contect cms
+ oldUrl = (String)(param.get("url"));
+ Comm cmsUrl = new Comm(oldUrl, /*null*/urlParam, true);
+ cmsUrl.run();
+ /*System.out.println(cmsUrl.getData());*/
+ //explain.setVisible(false);
+ explain.setText(explainURL);
+ if (cmsUrl.getError() != null) {
+ //cms didn't respond
+ certReq.setText(
+ resource.getString("CertRequestCertPane",
+ "cmsNotResponding"));
+ Debug.println("CertRequestCertPane:"+
+ cmsUrl.getError());
+ } else if ((cmsUrl.getData() != null) &&
+ (cmsUrl.getData().trim().length() != 0)) {
+ //cms return a message
+
+ JEditorPane editor = new JEditorPane();
+ editor.setBorder(new EmptyBorder(0, 0, 0, 0));
+ editor.setEditable(false);
+ //editor.setOpaque(false);
+
+ //display cms's message
+ Debug.println(cmsUrl.getData());
+ StringReader reader =
+ new StringReader(cmsUrl.getData());
+ editor.setEditorKit(
+ editor.createEditorKitForContentType("text/html"));
+ Document dstDoc = editor.getDocument();
+ editor.getEditorKit().read(reader, dstDoc, 0);
+
+ certReq.setText(editor.getText());
+ }
+
+ observable.put("newCertReq", new Boolean(false));
+ } catch (Exception e) {
+ certReq.setText(
+ resource.getString("CertRequestCertPane", "unableToParse"));
+ Debug.println("CertRequestCertPane:"+e);
+
+ }
+ }
+
+ } else if (show) {
+ //if request via e-mail
+ explain.setText(explainEMail);
+ certReq.setText((String)(observable.get("CertReq")));
+ explain.setVisible(true);
+ }
+
+ scrollPane.validate();
+
+ return show;
+ }
+
+ MultilineLabel explain;
+ ResourceSet resource = KeyCertUtility.getKeyCertWizardResourceSet();
+ public CertRequestCertPane() {
+ super();
+ setLayout(new GridBagLayout());
+
+
+ copy = JButtonFactory.create(
+ resource.getString("CertRequestCertPane", "copyLabel"));
+
+ setBorder( new TitledBorder( new CompoundBorder(new EtchedBorder(),
+ new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE)),
+ resource.getString("CertRequestCertPane", "title")));
+
+ int y = 0;
+
+ explainEMail = resource.getString("CertRequestCertPane", "explain");
+ explainURL = resource.getString("CertRequestCertPane", "explain2");
+
+
+ explain = new MultilineLabel(explainEMail);
+ GridBagUtil.constrain(this, explain, 0, ++y, 1, 1, 1.0, 1.0,
+ GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0,
+ 0, DIFFERENT_COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(this, scrollPane, 0, ++y, 1, 1, 0.0, 0.0,
+ GridBagConstraints.NORTH,
+ GridBagConstraints.HORIZONTAL, 0, 0,
+ DIFFERENT_COMPONENT_SPACE, 0);
+
+
+ copy.setActionCommand("COPY");
+ copy.addActionListener(new CertPaneActionListener());
+ GridBagUtil.constrain(this, copy, 0, ++y, 1, 1, 0.0, 0.0,
+ GridBagConstraints.WEST, GridBagConstraints.NONE, 0,
+ 0, DIFFERENT_COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(this, Box.createVerticalGlue(), 0, ++y,
+ 1, 1, 1.0, 1.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+
+ GridBagUtil.constrain(this,
+ new JLabel(
+ resource.getString(null, "clickNextToContinue")), 0,
+ ++y, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+ }
+
+ /*public static void main(String arg[]) {
+ JFrame f = new JFrame();
+ f.getContentPane().add("North", new CertRequestCertPane());
+ f.setSize(400,400);
+ f.show();
+ }*/
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/CertRequestEnterPasswordPane.java b/base/console/src/com/netscape/admin/certsrv/security/CertRequestEnterPasswordPane.java
new file mode 100644
index 000000000..d051ee167
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/CertRequestEnterPasswordPane.java
@@ -0,0 +1,217 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import java.awt.*;
+import java.util.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import com.netscape.management.client.util.*;
+import com.netscape.management.nmclf.*;
+
+class CertRequestEnterPasswordPane extends JPanel implements SuiConstants,
+IKeyCertPage {
+
+
+ JLabel _passwdLabel;
+ JLabel _tokenLabel;
+
+ JLabel _selectedToken = new JLabel();
+ SingleBytePasswordField _passwd = new SingleBytePasswordField(20);
+
+ IWizardControl control;
+ boolean modified = false;
+
+ public JPanel getPanel() {
+ return this;
+ }
+
+ public boolean pageShow(WizardObservable observable) {
+ boolean show =
+ ((Boolean)(observable.get("requestCert"))).booleanValue();
+ if (show) {
+ _passwd.setText((String)(observable.get("keyPasswd")));
+ control = (IWizardControl)(observable.get("Wizard"));
+ if (_passwd.getText().length() == 0) {
+ control.setCanGoForward(false);
+ }
+
+ boolean isInternal = ((Boolean)(observable.get("isInternal"))).
+ booleanValue();
+
+ _selectedToken.setText((String)(observable.get("tokenName")));
+ }
+
+ return show;
+ }
+
+ public boolean pageHide(WizardObservable observable) {
+ boolean hide = true;
+ KeyCertTaskInfo taskInfo = observable.getTaskInfo();
+
+ if (modified || ((Boolean)(observable.get("CertReqModified"))).
+ booleanValue()) {
+ observable.put("CertReqModified", new Boolean(true));
+ Hashtable param = (Hashtable)(observable.get("CertReqCGIParam"));
+ //param.put("alias" , ((Boolean)(observable.get("isInternal"))).booleanValue()?observable.get("sie"):observable.get("tokenName"));
+ param.put("alias" , observable.get("sie"));
+
+ param.put("keyfilepw" , _passwd.getText());
+ observable.put("keyPasswd", _passwd.getText());
+
+
+ Enumeration cgiParam = param.keys();
+ while (cgiParam.hasMoreElements()) {
+ String key = (String)(cgiParam.nextElement());
+ taskInfo.put(key, param.get(key));
+ }
+
+ Response response = null;
+
+ try {
+ response = taskInfo.exec(taskInfo.SEC_GCRT);
+ taskInfo.clear();
+ } catch (Exception e) {
+ SuiOptionPane.showMessageDialog(
+ UtilConsoleGlobals.getActivatedFrame(),
+ e.getMessage());
+ hide = false;
+ }
+
+ if (!(response.hasCert())) {
+ //MessageDialog.messageDialog((Message)(taskInfo.getResponse().getMessages().elementAt(0)));
+ StatusPane statusPane = (StatusPane)(observable.get("statusPane"));
+ statusPane.setMessage( (Message)
+ (taskInfo.getResponse().getMessages().
+ elementAt(0)));
+ statusPane.setShow(true);
+ modified = true;
+ } else {
+ observable.put("CertReq",
+ ((Message)(response.getMessages().elementAt(0))
+ ).getExtraMessage());
+ observable.put("CertReqModified", new Boolean(false));
+ modified = false;
+
+ //Need this inorder to know if a new request has been issued, so
+ //request via url can execute again
+ observable.put("newCertReq", new Boolean(true));
+ }
+
+
+ }
+ return hide;
+ }
+
+ class KeyActionListener implements KeyListener {
+ public void keyTyped(KeyEvent e) {}
+ public void keyPressed(KeyEvent e) {}
+ public void keyReleased(KeyEvent e) {
+ if (_passwd.getText().length() > 0) {
+ control.setCanGoForward(true);
+ } else {
+ control.setCanGoForward(false);
+ }
+ modified = true;
+ }
+ }
+
+ private JPanel getPasswdPane() {
+ JPanel passwdPane = new JPanel();
+ passwdPane.setLayout(new GridBagLayout());
+ int y = 0;
+
+
+ GridBagUtil.constrain(passwdPane, _tokenLabel, 0, ++y, 1, 1,
+ 0.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(passwdPane, _selectedToken, 1, y, 1, 1,
+ 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, DIFFERENT_COMPONENT_SPACE,
+ COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(passwdPane, _passwdLabel, 0, ++y, 1, 1,
+ 0.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, COMPONENT_SPACE, 0);
+
+ _passwd.addKeyListener(new KeyActionListener());
+ GridBagUtil.constrain(passwdPane, _passwd, 1, y, 1, 1, 1.0,
+ 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, DIFFERENT_COMPONENT_SPACE,
+ COMPONENT_SPACE, 0);
+
+
+ return passwdPane;
+ }
+
+ public CertRequestEnterPasswordPane() {
+ super();
+ setLayout(new GridBagLayout());
+
+ ResourceSet resource = KeyCertUtility.getKeyCertWizardResourceSet();
+
+ _passwdLabel = new JLabel(
+ resource.getString("CertRequestEnterPasswordPane",
+ "passwdLabel"), JLabel.RIGHT);
+ _tokenLabel = new JLabel(
+ resource.getString("CertRequestEnterPasswordPane",
+ "tokenLabel"), JLabel.RIGHT);
+
+
+ setBorder( new TitledBorder( new CompoundBorder(new EtchedBorder(),
+ new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE)),
+ resource.getString("CertRequestEnterPasswordPane", "title")));
+
+ int y = 0;
+
+
+ GridBagUtil.constrain(this,
+ new MultilineLabel(
+ resource.getString("CertRequestEnterPasswordPane",
+ "explain")), 0, ++y, 1, 1, 1.0, 0.0,
+ GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0,
+ 0, DIFFERENT_COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(this, getPasswdPane(), 0, ++y, 1, 1, 1.0,
+ 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0,
+ DIFFERENT_COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(this, Box.createVerticalGlue(), 0, ++y,
+ 1, 1, 1.0, 1.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+
+ GridBagUtil.constrain(this,
+ new JLabel(
+ resource.getString(null, "clickNextToContinue")), 0,
+ ++y, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+ }
+
+ /*public static void main(String arg[]) {
+ JFrame f = new JFrame();
+ f.getContentPane().setLayout(new BorderLayout());
+ f.getContentPane().add("Center", new CertRequestEnterPasswordPane());
+ f.setSize(400,400);
+ f.show();
+ }*/
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/CertRequestInfoPane.java b/base/console/src/com/netscape/admin/certsrv/security/CertRequestInfoPane.java
new file mode 100644
index 000000000..0bc25ea1a
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/CertRequestInfoPane.java
@@ -0,0 +1,403 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import javax.swing.*;
+import com.netscape.management.client.util.*;
+import com.netscape.management.nmclf.*;
+
+class CertRequestInfoPane extends JPanel implements SuiConstants,
+IKeyCertPage {
+
+ boolean modified = false;
+
+ JTextField name = new JTextField();
+ JTextField phone = new JTextField();
+ SingleByteTextField dn = new SingleByteTextField();
+ SingleByteTextField email = new SingleByteTextField();
+ JTextField o = new JTextField();
+ JTextField ou = new JTextField();
+ JTextField l = new JTextField();
+ JComboBox st;
+ JComboBox c;
+
+
+ JLabel _nameLabel;
+ JLabel _phoneLabel;
+ JLabel _dnLabel;
+ JLabel _emailLabel;
+ JLabel _oLabel;
+ JLabel _ouLabel;
+ JLabel _lLabel;
+ JLabel _stLabel;
+ JLabel _cLabel;
+ JLabel _requiredLabel;
+
+ JLabel _dnExample;
+
+ IWizardControl control;
+
+ ResourceSet resource;
+
+ JPanel statePanel = new JPanel();
+
+ public JPanel getPanel() {
+ return this;
+ }
+
+ public boolean pageShow(WizardObservable observable) {
+ boolean show =
+ ((Boolean)(observable.get("requestCert"))).booleanValue();
+
+ if (show) {
+ control = (IWizardControl)(observable.get("Wizard"));
+ setEnableNextButton();
+ }
+ return show;
+ }
+
+ public boolean pageHide(WizardObservable observable) {
+
+ KeyCertTaskInfo taskInfo = observable.getTaskInfo();
+
+ if (modified) {
+ observable.put("CertReqModified", new Boolean(true));
+
+ Hashtable param = (Hashtable)(observable.get("CertReqCGIParam"));
+ param.put("requestor_name", name.getText());
+ param.put("telephone" , phone.getText());
+ param.put("common_name" , dn.getText());
+ param.put("email_address" , email.getText());
+ param.put("organization" , o.getText());
+ param.put("org_unit" , ou.getText());
+ param.put("locality" , l.getText());
+ param.put("state" ,
+ st.getSelectedItem() == null ? "":
+ st.getSelectedItem());
+ param.put("country" ,
+ ((String)(c.getSelectedItem())).substring(0, 2));
+ param.put("tokenName" , observable.get("tokenName"));
+ }
+
+ return true;
+ }
+
+ void setEnableNextButton() {
+ if ((name.getText().length() == 0) ||
+ (dn.getText().length() == 0) ||
+ (phone.getText().length() == 0) ||
+ (email.getText().length() == 0) ||
+ (o.getText().length() == 0) ||
+ (((String)(c.getSelectedItem())).length() < 2) ||
+ (dn.getText().indexOf(".") == -1)) {
+ control.setCanGoForward(false);
+ } else {
+ control.setCanGoForward(true);
+ }
+ }
+
+ class InfoPaneActionListener implements ActionListener, KeyListener, FocusListener{
+ public void actionPerformed(ActionEvent e) {
+ modified = true;
+ setEnableNextButton();
+
+ if (e.getSource() == c) {
+ setupState(c.getSelectedItem().toString());
+ }
+ }
+ public void keyTyped(KeyEvent e) {}
+ public void keyPressed(KeyEvent e) {}
+ public void keyReleased(KeyEvent e) {
+ modified = true;
+ setEnableNextButton();
+
+ if (e.getSource() == c) {
+ setupState(c.getSelectedItem().toString());
+ }
+ }
+
+ public void focusGained(FocusEvent e) {}
+ public void focusLost(FocusEvent e) {
+ if (!(e.isTemporary()) && (e.getComponent() == dn) &&
+ (dn.getText().indexOf(".") == -1)) {
+ JOptionPane.showMessageDialog(
+ UtilConsoleGlobals.getActivatedFrame(),
+ resource.getString("CertRequestInfoPane", "invalidFQDN"),
+ resource.getString("CertRequestInfoPane",
+ "invalidFQDNDialogTitle"),
+ JOptionPane.ERROR_MESSAGE);
+ control.setCanGoForward(false);
+ }
+ }
+ }
+
+ private JLabel rightAlignLabel(String label) {
+ return new JLabel(label, JLabel.RIGHT);
+ }
+
+ private JPanel getInfoPane() {
+ JPanel infoPane = new JPanel();
+ infoPane.setLayout(new GridBagLayout());
+
+ InfoPaneActionListener listener = new InfoPaneActionListener();
+ name.addActionListener(listener);
+ phone.addActionListener(listener);
+ dn.addActionListener(listener);
+ email.addActionListener(listener);
+ o.addActionListener(listener);
+ ou.addActionListener(listener);
+ l.addActionListener(listener);
+ st.addActionListener(listener);
+ c.addActionListener(listener);
+
+ name.addKeyListener(listener);
+ phone.addKeyListener(listener);
+ dn.addKeyListener(listener);
+ email.addKeyListener(listener);
+ o.addKeyListener(listener);
+ ou.addKeyListener(listener);
+ l.addKeyListener(listener);
+ st.addKeyListener(listener);
+ c.addKeyListener(listener);
+
+ dn.addFocusListener(listener);
+
+ st.setEditable(true);
+ c.setEditable(true);
+
+
+
+ int y = 0;
+
+ GridBagUtil.constrain(infoPane, _nameLabel, 0, y, 1, 1, 1.0,
+ 0.0, GridBagConstraints.WEST, GridBagConstraints.BOTH,
+ 0, 0, COMPONENT_SPACE, DIFFERENT_COMPONENT_SPACE);
+
+ GridBagUtil.constrain(infoPane, name, 1, y, 1, 1, 0.0, 0.0,
+ GridBagConstraints.EAST, GridBagConstraints.BOTH, 0,
+ 0, COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(infoPane, _phoneLabel, 0, ++y, 1, 1, 1.0,
+ 0.0, GridBagConstraints.WEST, GridBagConstraints.BOTH,
+ 0, 0, COMPONENT_SPACE, DIFFERENT_COMPONENT_SPACE);
+
+ GridBagUtil.constrain(infoPane, phone, 1, y, 1, 1, 0.0, 0.0,
+ GridBagConstraints.EAST, GridBagConstraints.BOTH, 0,
+ 0, COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(infoPane, _dnLabel, 0, ++y, 1, 1, 1.0,
+ 0.0, GridBagConstraints.WEST, GridBagConstraints.BOTH,
+ 0, 0, 0, DIFFERENT_COMPONENT_SPACE);
+
+ GridBagUtil.constrain(infoPane, dn, 1, y, 1, 1, 0.0, 0.0,
+ GridBagConstraints.EAST, GridBagConstraints.BOTH, 0,
+ 0, 0, 0);
+
+ GridBagUtil.constrain(infoPane, _dnExample, 0, ++y, 1, 1, 1.0,
+ 0.0, GridBagConstraints.EAST, GridBagConstraints.BOTH,
+ 0, 0, COMPONENT_SPACE, DIFFERENT_COMPONENT_SPACE);
+
+ GridBagUtil.constrain(infoPane, _emailLabel, 0, ++y, 1, 1, 1.0,
+ 0.0, GridBagConstraints.WEST, GridBagConstraints.BOTH,
+ 0, 0, COMPONENT_SPACE, DIFFERENT_COMPONENT_SPACE);
+
+ GridBagUtil.constrain(infoPane, email, 1, y, 1, 1, 0.0, 0.0,
+ GridBagConstraints.EAST, GridBagConstraints.BOTH, 0,
+ 0, COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(infoPane, _oLabel, 0, ++y, 1, 1, 1.0,
+ 0.0, GridBagConstraints.WEST, GridBagConstraints.BOTH,
+ 0, 0, COMPONENT_SPACE, DIFFERENT_COMPONENT_SPACE);
+
+ GridBagUtil.constrain(infoPane, o, 1, y, 1, 1, 0.0, 0.0,
+ GridBagConstraints.EAST, GridBagConstraints.BOTH, 0,
+ 0, COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(infoPane, _ouLabel, 0, ++y, 1, 1, 1.0,
+ 0.0, GridBagConstraints.WEST, GridBagConstraints.BOTH,
+ 0, 0, COMPONENT_SPACE, DIFFERENT_COMPONENT_SPACE);
+
+ GridBagUtil.constrain(infoPane, ou, 1, y, 1, 1, 0.0, 0.0,
+ GridBagConstraints.EAST, GridBagConstraints.BOTH, 0,
+ 0, COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(infoPane, _lLabel, 0, ++y, 1, 1, 1.0,
+ 0.0, GridBagConstraints.WEST, GridBagConstraints.BOTH,
+ 0, 0, COMPONENT_SPACE, DIFFERENT_COMPONENT_SPACE);
+
+ GridBagUtil.constrain(infoPane, l, 1, y, 1, 1, 0.0, 0.0,
+ GridBagConstraints.EAST, GridBagConstraints.BOTH, 0,
+ 0, COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(infoPane, _stLabel, 0, ++y, 1, 1, 1.0,
+ 0.0, GridBagConstraints.WEST, GridBagConstraints.BOTH,
+ 0, 0, COMPONENT_SPACE, DIFFERENT_COMPONENT_SPACE);
+
+
+ GridBagUtil.constrain(infoPane, statePanel/*st*/, 1, y, 1, 1,
+ 0.0, 0.0, GridBagConstraints.EAST,
+ GridBagConstraints.BOTH, 0, 0, COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(infoPane, _cLabel, 0, ++y, 1, 1, 1.0,
+ 0.0, GridBagConstraints.WEST, GridBagConstraints.BOTH,
+ 0, 0, COMPONENT_SPACE, DIFFERENT_COMPONENT_SPACE);
+
+ GridBagUtil.constrain(infoPane, c, 1, y, 1, 1, 0.0, 0.0,
+ GridBagConstraints.EAST, GridBagConstraints.BOTH, 0,
+ 0, COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(infoPane, _requiredLabel, 1, ++y, 1, 1,
+ 1.0, 0.0, GridBagConstraints.WEST,
+ GridBagConstraints.BOTH, 0, 0, COMPONENT_SPACE,
+ DIFFERENT_COMPONENT_SPACE);
+
+
+ return infoPane;
+ }
+
+ private void setupState(String country) {
+ String stList;
+ statePanel.remove(st);
+ try {
+ stList = resource.getString("CertRequestInfoPane",
+ "state-"+country.substring(0, 2).toUpperCase());
+ if (stList != null && !(stList.equals(""))) {
+
+ StringTokenizer stateTokens =
+ new StringTokenizer(stList, ",", false);
+ Vector states = new Vector();
+ while (stateTokens.hasMoreTokens()) {
+ states.addElement(stateTokens.nextToken());
+ }
+ //this will make it load faster.
+ //It will do some extra work if we call addItem() one at a time
+
+ st = new JComboBox(states);
+ }
+ else {
+ st.removeAllItems();
+ }
+ }
+ catch (Exception e) {
+ st.removeAllItems();
+ }
+
+ GridBagUtil.constrain(statePanel, st, 0, 0, 1, 1, 1.0, 1.0,
+ GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0,
+ 0, 0, 0);
+
+ statePanel.validate();
+ statePanel.repaint();
+
+ try {
+ st.setSelectedItem( resource.getString("CertRequestInfoPane",
+ "defaultState-"+
+ country.substring(0, 1).toUpperCase()));
+ } catch (Exception e) {}
+
+ }
+
+ public CertRequestInfoPane() {
+ super();
+ setLayout(new GridBagLayout());
+ statePanel.setLayout(new GridBagLayout());
+
+ resource = KeyCertUtility.getKeyCertWizardResourceSet();
+
+ _nameLabel = rightAlignLabel(
+ resource.getString("CertRequestInfoPane", "nameLabel"));
+ _phoneLabel = rightAlignLabel(
+ resource.getString("CertRequestInfoPane", "phoneLabel"));
+ _dnLabel = rightAlignLabel(
+ resource.getString("CertRequestInfoPane", "dnLabel"));
+ _emailLabel = rightAlignLabel(
+ resource.getString("CertRequestInfoPane", "emailLabel"));
+ _oLabel = rightAlignLabel(
+ resource.getString("CertRequestInfoPane", "oLabel"));
+ _ouLabel = rightAlignLabel(
+ resource.getString("CertRequestInfoPane", "ouLabel"));
+ _lLabel = rightAlignLabel(
+ resource.getString("CertRequestInfoPane", "lLabel"));
+ _stLabel = rightAlignLabel(
+ resource.getString("CertRequestInfoPane", "stLabel"));
+ _cLabel = rightAlignLabel(
+ resource.getString("CertRequestInfoPane", "cLabel"));
+
+
+ _dnExample = rightAlignLabel(
+ resource.getString("CertRequestInfoPane", "dnExample"));
+
+ _requiredLabel =
+ new JLabel(resource.getString("CertRequestInfoPane", "requiredLabel"));
+
+
+ String cList = resource.getString("CertRequestInfoPane", "country");
+ StringTokenizer countryTokens =
+ new StringTokenizer(cList, ",", false);
+ Vector countries = new Vector();
+ while (countryTokens.hasMoreTokens()) {
+ countries.addElement(countryTokens.nextToken());
+ }
+
+ st = new JComboBox();
+ c = new JComboBox(countries);
+
+ try {
+ c.setSelectedItem(
+ resource.getString("CertRequestInfoPane", "defaultCountry"));
+ } catch (Exception e) {}
+
+ setupState(c.getSelectedItem().toString());
+
+
+ setBorder( new TitledBorder( new CompoundBorder(new EtchedBorder(),
+ new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE)),
+ resource.getString("CertRequestInfoPane", "title")));
+
+ int y = 0;
+
+ GridBagUtil.constrain(this, getInfoPane(), 0, ++y, 1, 1, 1.0,
+ 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(this, Box.createVerticalGlue(), 0, ++y,
+ 1, 1, 1.0, 1.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+
+ GridBagUtil.constrain(this,
+ new JLabel(
+ resource.getString(null, "clickNextToContinue")), 0,
+ ++y, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+ }
+
+ /*public static void main(String arg[]) {
+ JFrame f = new JFrame();
+ f.getContentPane().add("North", new CertRequestInfoPane());
+ f.setSize(400,400);
+ //f.pack();
+ f.show();
+ }*/
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/CertRequestSelectTokenPane.java b/base/console/src/com/netscape/admin/certsrv/security/CertRequestSelectTokenPane.java
new file mode 100644
index 000000000..cab38e8d3
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/CertRequestSelectTokenPane.java
@@ -0,0 +1,302 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import com.netscape.management.client.util.*;
+import com.netscape.management.nmclf.*;
+
+/**
+ *
+ * Prompt user to see which token they want to use, and weather or not
+ * certificate has been installed or not.
+ *
+ * @version 1.0 98/07/10
+ * @author <A HREF="mailto:shihcm@netscape.com">shihcm@netscape.com</A>
+ *
+ */
+class CertRequestSelectTokenPane extends JPanel implements SuiConstants,
+IKeyCertPage {
+
+ JComboBox tokenSelection = new JComboBox();
+ JRadioButton _no;
+ JRadioButton _yes;
+ JRadioButton _noneed;
+
+ String _defaultToken;
+ String _internal;
+
+ /**
+ * Determain whether a cgi need to be call again
+ */
+ boolean modified = true;
+
+
+ /**
+ * Get the panel that is going to be displayed
+ * @return a panel to be displayed by the key & cert wizard
+ */
+ public JPanel getPanel() {
+ return this;
+ }
+
+ /**
+ * Checks if this panel can be shown
+ * @return true if this page can be shown
+ */
+ public boolean pageShow(WizardObservable observable) {
+ //might have to call cgi that loadmodule...
+ observable.put("sie",
+ KeyCertUtility.createTokenName(
+ observable.getConsoleInfo()));
+
+ if (tokenSelection.getItemCount() == 0) {
+ observable.put("createTrust" , new Boolean(true));
+
+ KeyCertTaskInfo taskInfo = observable.getTaskInfo();
+ taskInfo.put("sie", observable.get("sie"));
+
+ try {
+ taskInfo.exec(taskInfo.SEC_LSTOKEN);
+ } catch (Exception e) {
+ SuiOptionPane.showMessageDialog(
+ UtilConsoleGlobals.getActivatedFrame(),
+ e.getMessage());
+ return true;
+ }
+
+ Vector cipherList = taskInfo.getResponse().getFamilyList();
+ for (int i = 0; i < cipherList.size(); i++) {
+ CipherEntry cipher = (CipherEntry)(cipherList.elementAt(i));
+ JComboBox tokenNames = cipher.getTokenComboBox();
+ for (int j = 0; j < cipher.getTokenCount(); j++) {
+ tokenSelection.addItem(tokenNames.getItemAt(j));
+ }
+ if (tokenSelection.getItemCount() > 0) {
+ observable.put("createTrust" , new Boolean(false));
+ }
+ }
+
+
+ boolean noDefaultToken = true;
+ for (int i = tokenSelection.getItemCount() - 1; i >= 0; i--) {
+ if (tokenSelection.getItemAt(i).equals(_defaultToken)) {
+ noDefaultToken = false;
+ }
+ }
+ if (noDefaultToken) {
+ tokenSelection.addItem(_defaultToken);
+ observable.put("createTrust" , new Boolean(true));
+ }
+
+ try {
+ tokenSelection.setSelectedIndex(0);
+ } catch (Exception e) {}
+ }
+
+ return true;
+ }
+
+
+ /**
+ * Checks if this panel can be hidden
+ * @return true if this page can be hide
+ */
+ public boolean pageHide(WizardObservable observable) {
+ /*observable.put("isInternal" , ((TOGGLEPANEeditor)(questionPane.getCtrlByName("isInternal"))).getValue());*/
+
+ try {
+ observable.put("isInternal" , new Boolean(true));
+ if (!(((String)(tokenSelection.getSelectedItem())).
+ toLowerCase()).startsWith(_internal.toLowerCase())) {
+ observable.put("isInternal" , new Boolean(false));
+ }
+ } catch (Exception e) {}
+ if (modified) {
+ observable.put("CertReqModified", new Boolean(true));
+ observable.put("tokenName" , tokenSelection.getSelectedItem());
+ observable.put("requestCert" , new Boolean(_no.isSelected()));
+ observable.put("installCert" ,
+ new Boolean(!(_noneed.isSelected())));
+ observable.put("noneed" , new Boolean(_noneed.isSelected()));
+ modified = false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Listen to changes to determain if cgi need to be called again
+ *
+ */
+ class ModifiedActionListener implements ActionListener {
+ public void actionPerformed(ActionEvent e) {
+ modified = true;
+ }
+ }
+
+
+
+ /**
+ *
+ * Convinent method for create a numbered component:
+ * [panel]
+ * 1. bla bla bla
+ * 2. bla bla bla
+ * [panel]
+ *
+ */
+ private void addNumberedComponent(JPanel p, int count, Component c,
+ Vector components) {
+ //JPanel entry = new JPanel();
+ //entry.setLayout(new GridBagLayout());
+ GridBagUtil.constrain(p,
+ Box.createRigidArea(
+ new Dimension(SEPARATED_COMPONENT_SPACE, 0)), 0,
+ count - 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+ GridBagUtil.constrain(p,
+ new JLabel(Integer.toString(count) + ". "), 1,
+ count - 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.NONE, 0, 0, 0, 0);
+ GridBagUtil.constrain(p, c, 2, count - 1, 1, 1, 0.0, 0.0,
+ GridBagConstraints.NORTH,
+ GridBagConstraints.HORIZONTAL, 0, 0,
+ DIFFERENT_COMPONENT_SPACE, 0);
+
+
+ for (int i = 0; i < components.size(); i++) {
+ GridBagUtil.constrain(p,
+ (Component)(components.elementAt(i)), 2,
+ count + i, 1, 1, 1.0, 0.0,
+ GridBagConstraints.WEST, GridBagConstraints.NONE,
+ 0, 0, 0, 0);
+ }
+
+ //p.add(entry);
+ }
+
+ /**
+ *
+ * Create a token selection panel for Key & Cert wizard.
+ *
+ */
+ public CertRequestSelectTokenPane() {
+ super();
+ setLayout(new GridBagLayout());
+
+ ResourceSet resource = KeyCertUtility.getKeyCertWizardResourceSet();
+
+ _internal = resource.getString("SelectToken", "internal");
+ _defaultToken = resource.getString("SelectToken", "defaultToken");
+
+ _no = new JRadioButton(resource.getString("SelectToken", "no"),
+ true);
+ _yes = new JRadioButton(resource.getString("SelectToken", "yes"),
+ false);
+ _noneed =
+ new JRadioButton(resource.getString("SelectToken", "noNeed"),
+ false);
+
+ JLabel useExt_noneed =
+ new JLabel(resource.getString("SelectToken", "noNeed_ext"));
+ Insets b = _noneed.getMargin();
+ useExt_noneed.setBorder( new EmptyBorder( new Insets(0,
+ 12 + b.right + _noneed.getHorizontalTextPosition(),
+ b.bottom, b.right)));
+
+
+
+ ModifiedActionListener listener = new ModifiedActionListener();
+ _no.addActionListener(listener);
+ _yes.addActionListener(listener);
+ _noneed.addActionListener(listener);
+ tokenSelection.addActionListener(listener);
+
+
+ ButtonGroup buttonGroup = new ButtonGroup();
+ buttonGroup.add(_no);
+ buttonGroup.add(_yes);
+ buttonGroup.add(_noneed);
+
+
+ int y = 0;
+
+ setBorder( new TitledBorder( new CompoundBorder(new EtchedBorder(),
+ new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE)),
+ resource.getString("SelectToken", "title")));
+
+
+ JPanel tokenSelectPane = new JPanel();
+ //tokenSelectPane.setLayout(new BoxLayout(tokenSelectPane, BoxLayout.Y_AXIS));
+ tokenSelectPane.setLayout(new GridBagLayout());
+
+ JLabel _pickToken =
+ new JLabel(resource.getString("SelectToken", "pickToken"));
+ Vector components = new Vector();
+ components.addElement(tokenSelection);
+ addNumberedComponent(tokenSelectPane, ++y, _pickToken, components);
+ GridBagUtil.constrain(this, tokenSelectPane, 0, y, 1, 1, 0.0,
+ 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0,
+ DIFFERENT_COMPONENT_SPACE, 0);
+
+
+ JPanel certInstPane = new JPanel();
+ //certInstPane.setLayout(new BoxLayout(certInstPane, BoxLayout.Y_AXIS));
+ certInstPane.setLayout(new GridBagLayout());
+
+ components = new Vector();
+ components.addElement(_no);
+ components.addElement(_yes);
+ //need a radio button that can wrap the string.
+ components.addElement(_noneed);
+ components.addElement(useExt_noneed);
+ addNumberedComponent(certInstPane, ++y,
+ new MultilineLabel(
+ resource.getString("SelectToken", "certReadyForInst")),
+ components);
+ GridBagUtil.constrain(this, certInstPane, 0, y, 1, 1, 0.0, 0.0,
+ GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0,
+ 0, DIFFERENT_COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(this, Box.createVerticalGlue(), 0, ++y,
+ 1, 1, 1.0, 1.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+
+ GridBagUtil.constrain(this,
+ new JLabel(
+ resource.getString(null, "clickNextToContinue")), 0,
+ ++y, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+ }
+
+ /*public static void main(String arg[]) {
+ JFrame f = new JFrame();
+ CertRequestSelectTokenPane c = new CertRequestSelectTokenPane();
+ f.getContentPane().add("North",c );
+ f.setSize(400,400);
+ f.show();
+ }*/
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/CertRequestTypePane.java b/base/console/src/com/netscape/admin/certsrv/security/CertRequestTypePane.java
new file mode 100644
index 000000000..cc36771a6
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/CertRequestTypePane.java
@@ -0,0 +1,390 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import com.netscape.management.client.util.*;
+import com.netscape.management.nmclf.*;
+
+/**
+ *
+ * Step 2 of the certificate request under Key & Cert wizard.
+ * Pompt user to enter which type of certificate they want to request
+ * and the email address of the CA the request will be sent to.
+ *
+ * @version 1.0 98/07/10
+ * @author <A HREF="mailto:shihcm@netscape.com">shihcm@netscape.com</A>
+ *
+ */
+class CertRequestTypePane extends JPanel implements SuiConstants,
+IKeyCertPage {
+
+ JRadioButton _email;
+ SingleByteTextField _emailAddr = new SingleByteTextField();
+ JRadioButton _url;
+ SingleByteTextField _urlAddr = new SingleByteTextField();
+
+ JLabel _caEmailAddr;
+
+ JRadioButton _new;
+ JRadioButton _renew;
+
+ /**
+ * Get the panel that is going to be displayed
+ * @return a panel to be displayed by the key & cert wizard
+ */
+ IWizardControl control;
+ JButton _caButton;
+
+ MultilineLabel _showCALabel;
+
+ /**
+ * Determain whether a cgi need to be call again to decode
+ */
+ boolean modified = false;
+
+ public static Hashtable param = new Hashtable();
+
+ /**
+ * Get the panel that is going to be displayed
+ * @return a panel to be displayed by the key & cert wizard
+ */
+ public JPanel getPanel() {
+ return this;
+ }
+
+
+ /**
+ * Checks if this panel can be shown
+ * @return true if this page can be shown
+ */
+ public boolean pageShow(WizardObservable observable) {
+
+ boolean show =
+ ((Boolean)(observable.get("requestCert"))).booleanValue();
+
+ if (show) {
+ control = (IWizardControl)(observable.get("Wizard"));
+ setEnableNextButton();
+ }
+
+ if (observable.get("CertReqCGIParam") == null) {
+ observable.put("CertReqCGIParam", param);
+ }
+
+ return show;
+ }
+
+
+ /**
+ * Checks if this panel can be hidden
+ * @return true if this page can be hide
+ */
+ public boolean pageHide(WizardObservable observable) {
+ KeyCertTaskInfo taskInfo = observable.getTaskInfo();
+
+ //see if this page has been modified.
+ if (modified) {
+ observable.put("CertReqModified", new Boolean(true));
+
+ //radio button in a group will called twice one for the component that is loosing the focus
+ //and one for the component that is getting the focus
+ param.put("cert_type" , _new.isSelected() ? "0":"1");
+
+ //remove url support
+ param.put("xmt_select" , _email.isSelected() ? "0":"1");
+ param.put("url" , _urlAddr.getText());
+ param.put("cert_auth" , _emailAddr.getText());
+
+ //support only e-mail at this moment
+ //param.put("xmt_select" , "0");
+ //param.put("cert_auth" , _emailAddr.getText());
+
+ modified = false;
+ }
+
+ return true;
+ }
+
+
+ /**
+ * Listen to changes (key strokes or change in text area or text field)
+ * then determain (call setEnableNextButton()) if wizard can proceed
+ */
+ class TypeActionListener implements KeyListener, ActionListener {
+ public void keyTyped(KeyEvent e) {}
+ public void keyPressed(KeyEvent e) {}
+ public void keyReleased(KeyEvent e) {
+ setEnableNextButton();
+ modified = true;
+ }
+ public void actionPerformed(ActionEvent e) {
+
+ if (e.getActionCommand().equals("SHOWCA")) {
+ Browser browser = new Browser();
+ browser.open("https://certs.netscape.com/server.html",
+ browser.NEW_WINDOW);
+ } else {
+ if (_email.isSelected()) {
+ _urlAddr.setEnabled(false);
+ _emailAddr.setEnabled(true);
+ } else {
+ _urlAddr.setEnabled(true);
+ _emailAddr.setEnabled(false);
+ }
+ setEnableNextButton();
+ modified = true;
+ }
+ }
+ }
+
+ /**
+ * Detarmain all the require field has been fill in, if true the
+ * enable the "Next >" button.
+ */
+ void setEnableNextButton() {
+ if ((_email.isSelected() && (_emailAddr.getText().length() > 0)) ||
+ (_url.isSelected() && (_urlAddr.getText().length() > 0))) {
+ control.setCanGoForward(true);
+ } else {
+ control.setCanGoForward(false);
+ }
+ }
+
+ /**
+ *
+ * Convinent method for create a numbered component:
+ * [panel]
+ * 1. bla bla bla
+ * 2. bla bla bla
+ * [panel]
+ *
+ */
+ private void addNumberedComponent(JPanel p, int count, Component c,
+ Vector components) {
+ //JPanel entry = new JPanel();
+ //entry.setLayout(new GridBagLayout());
+ GridBagUtil.constrain(p,
+ Box.createRigidArea(
+ new Dimension(DIFFERENT_COMPONENT_SPACE, 0)), 0,
+ count - 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.NONE, 0, 0, 0, 0);
+
+ GridBagUtil.constrain(p,
+ new JLabel(Integer.toString(count) + ". "), 1,
+ count - 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.NONE, 0, 0, 0, 0);
+
+ GridBagUtil.constrain(p, c, 2, count - 1, 1, 1, 0.0, 0.0,
+ GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0,
+ 0, COMPONENT_SPACE, 0);
+
+ for (int i = 0; i < components.size(); i++) {
+ GridBagUtil.constrain(p,
+ (Component)(components.elementAt(i)), 2,
+ count + i, 1, 1, 1.0, 0.0,
+ GridBagConstraints.NORTH, GridBagConstraints.BOTH,
+ 0, 0, 0, 0);
+ }
+
+ //p.add(entry);
+ }
+
+
+
+ TypeActionListener listener = new TypeActionListener();
+
+
+ /**
+ * Prompt user to enter e-mail address of the CA where the
+ * cert request will submit.
+ *
+ * Comment out submit by url, will not support in 4.0 but will
+ * after 4.1 with agree upon standard between kingpin and cert
+ * server.
+ *
+ */
+ private JPanel getRequestViaPane() {
+ JPanel requestViaPane = new JPanel();
+ requestViaPane.setLayout(new GridBagLayout());
+
+ ButtonGroup buttonTypeGroup = new ButtonGroup();
+ buttonTypeGroup.add(_new);
+ buttonTypeGroup.add(_renew);
+
+ ButtonGroup buttonViaGroup = new ButtonGroup();
+ buttonViaGroup.add(_email);
+ buttonViaGroup.add(_url);
+
+ int y = 0;
+
+ _email.addActionListener(listener);
+ GridBagUtil.constrain(requestViaPane, _email, 0, y, 1, 1, 0.0,
+ 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, COMPONENT_SPACE, 0);
+
+ /*GridBagUtil.constrain(requestViaPane, _caEmailAddr,
+ 0, y, 1, 1,
+ 0.0, 0.0,
+ GridBagConstraints.NORTH, GridBagConstraints.BOTH,
+ 0, 0, COMPONENT_SPACE, 0);*/
+
+ _emailAddr.addKeyListener(listener);
+ GridBagUtil.constrain(requestViaPane, _emailAddr, 1, y, 1, 1,
+ 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.HORIZONTAL, 0,
+ DIFFERENT_COMPONENT_SPACE, COMPONENT_SPACE, 0);
+
+ _url.addActionListener(listener);
+ GridBagUtil.constrain(requestViaPane, _url, 0, ++y, 1, 1, 0.0,
+ 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, COMPONENT_SPACE, 0);
+
+ _urlAddr.addKeyListener(listener);
+ GridBagUtil.constrain(requestViaPane, _urlAddr, 1, y, 1, 1,
+ 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.HORIZONTAL, 0,
+ DIFFERENT_COMPONENT_SPACE, COMPONENT_SPACE, 0);
+ _urlAddr.setEnabled(false);
+
+ return requestViaPane;
+ }
+
+
+
+ /**
+ *
+ * return a panel contain a button which if clicked will lunch browser
+ * and connect to netscape's cert server site.
+ * The site contain links and information regarding CAs and certificate.
+ *
+ */
+ private JPanel getCAButtonPane() {
+ JPanel caButtonPane = new JPanel();
+ caButtonPane.setLayout(new GridBagLayout());
+
+ GridBagUtil.constrain(caButtonPane, _showCALabel, 0, 0, 1, 1,
+ 1.0, 0.0, GridBagConstraints.WEST,
+ GridBagConstraints.BOTH, 0, 0, COMPONENT_SPACE, 0);
+
+ _caButton.addActionListener(listener);
+ _caButton.setActionCommand("SHOWCA");
+ GridBagUtil.constrain(caButtonPane, _caButton, 1, 0, 1, 1, 1.0,
+ 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE,
+ 0, DIFFERENT_COMPONENT_SPACE, COMPONENT_SPACE, 0);
+
+ return caButtonPane;
+ }
+
+ /**
+ *
+ * Create a certificate request type selection pane for key & cert wizard
+ *
+ *
+ */
+ public CertRequestTypePane() {
+ super();
+ setLayout(new GridBagLayout());
+
+ ResourceSet resource = KeyCertUtility.getKeyCertWizardResourceSet();
+
+ _caButton = JButtonFactory.create(
+ resource.getString("CertRequestTypePane", "showCAButtonLabel"));
+ _email = new JRadioButton( resource.getString("CertRequestTypePane",
+ "emailLabel"), true);
+ _url = new JRadioButton(
+ resource.getString("CertRequestTypePane", "urlLabel"),
+ false);
+ _new = new JRadioButton( resource.getString("CertRequestTypePane",
+ "newcertLabel"), true);
+ _renew = new JRadioButton( resource.getString("CertRequestTypePane",
+ "renewcertLabel"), false);
+
+ _caEmailAddr =
+ new JLabel(resource.getString("CertRequestTypePane", "caEmailLabel"));
+
+ _showCALabel = new MultilineLabel(
+ resource.getString("CertRequestTypePane", "showCALabel"));
+
+ setBorder( new TitledBorder( new CompoundBorder(new EtchedBorder(),
+ new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE)),
+ resource.getString("CertRequestTypePane", "title")));
+
+ int y = 0;
+
+ JPanel requestTypePane = new JPanel();
+ //requestTypePane.setLayout(new BoxLayout(requestTypePane, BoxLayout.Y_AXIS));
+ requestTypePane.setLayout(new GridBagLayout());
+ Vector components = new Vector();
+ _new.addActionListener(listener);
+ _renew.addActionListener(listener);
+ components.addElement(_new);
+ components.addElement(_renew);
+ addNumberedComponent(requestTypePane, ++y,
+ new MultilineLabel(
+ resource.getString("CertRequestTypePane",
+ "requestType")), components);
+ GridBagUtil.constrain(this, requestTypePane, 0, y, 1, 1, 0.0,
+ 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0,
+ DIFFERENT_COMPONENT_SPACE, 0);
+
+ JPanel requestViaPane = new JPanel();
+ //requestViaPane.setLayout(new BoxLayout(requestViaPane, BoxLayout.Y_AXIS));
+ requestViaPane.setLayout(new GridBagLayout());
+ components = new Vector();
+ components.addElement(getRequestViaPane());
+ addNumberedComponent(requestViaPane, ++y,
+ new MultilineLabel(
+ resource.getString("CertRequestTypePane",
+ "requestVia")), components);
+ //addNumberedComponent(requestViaPane, ++y, new MultilineLabel(resource.getString("CertRequestTypePane", "requestViaEmail")), components);
+ GridBagUtil.constrain(this, requestViaPane, 0, y, 1, 1, 0.0,
+ 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0,
+ DIFFERENT_COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(this, getCAButtonPane(), 0, ++y, 1, 1,
+ 0.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0,
+ DIFFERENT_COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(this, Box.createVerticalGlue(), 0, ++y,
+ 1, 1, 1.0, 1.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+
+ GridBagUtil.constrain(this,
+ new JLabel(
+ resource.getString(null, "clickNextToContinue")), 0,
+ ++y, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+ }
+
+ /*public static void main(String arg[]) {
+ JFrame f = new JFrame();
+ f.getContentPane().add("North", new CertRequestTypePane());
+ f.setSize(400,400);
+ f.show();
+ }*/
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/ChangeKeyPasswordDialog.java b/base/console/src/com/netscape/admin/certsrv/security/ChangeKeyPasswordDialog.java
new file mode 100644
index 000000000..f939dfc89
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/ChangeKeyPasswordDialog.java
@@ -0,0 +1,175 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import com.netscape.management.client.console.ConsoleInfo;
+import com.netscape.management.client.util.*;
+import com.netscape.management.nmclf.*;
+import javax.swing.*;
+import java.awt.*;
+
+/**
+ *
+ * Change A Key Pair File Password
+ *
+ * @version 1.0 98/07/10
+ * @author <A HREF="mailto:shihcm@netscape.com">shihcm@netscape.com</A>
+ *
+ */
+public class ChangeKeyPasswordDialog extends AbstractDialog {
+
+ KeyCertTaskInfo taskInfo;
+ ConsoleInfo _consoleInfo;
+
+ String oldPasswdLabel;
+ String newPasswdLabel;
+ String confirmPasswdLabel;
+
+ //create password field with default width of 20 characters
+ SingleBytePasswordField oldPasswd = new SingleBytePasswordField(20);
+ SingleBytePasswordField newPasswd = new SingleBytePasswordField(20);
+ SingleBytePasswordField confirmPasswd = new SingleBytePasswordField(20);
+
+ ResourceSet resource = new ResourceSet("com.netscape.admin.certsrv.security.ChangeKeyPasswordDialogResource");
+
+ /**
+ * Called when OK button is pressed, and start the password change process
+ *
+ */
+ protected void okInvoked() {
+
+ taskInfo = new KeyCertTaskInfo(_consoleInfo);
+ taskInfo.clear();
+ taskInfo.put("sie", KeyCertUtility.createTokenName(_consoleInfo));
+ taskInfo.put("oldkfpw", oldPasswd.getText());
+ taskInfo.put("keyfilepw", newPasswd.getText());
+ taskInfo.put("keyfilepwv", confirmPasswd.getText());
+
+ if (!KeyCertUtility.validPassword(newPasswd.getText(),
+ confirmPasswd.getText(), _consoleInfo)) {
+ return;
+ }
+ Response response = null;
+ try {
+ response = taskInfo.exec(taskInfo.SEC_CHANGEPW);
+ } catch (Exception e) {
+ SuiOptionPane.showMessageDialog(
+ UtilConsoleGlobals.getActivatedFrame(), e.getMessage());
+ return;
+ }
+
+ try {
+ MessageDialog.messageDialog(
+ (Message)(response.getMessages().elementAt(0)));
+ } catch (Exception ex) {}
+
+ if (((Message)(response.getMessages().elementAt(0))).getStatus()
+ == Message.NMC_SUCCESS)
+ super.okInvoked();
+ }
+
+ /**
+ * Called when HELP button is pressed, invoke online help
+ */
+ protected void helpInvoked() {
+ Help help = new Help(resource);
+ help.help("ChangeKeyPasswordDialog", "help");
+ }
+
+
+ private JLabel createRightAlignLabel(String label) {
+ return new JLabel(label, JLabel.RIGHT);
+ }
+
+ private JPanel getPasswdPane() {
+ JPanel passwdPane = new JPanel();
+ passwdPane.setLayout(new GridBagLayout());
+ int y = 0;
+
+ GridBagUtil.constrain(passwdPane,
+ createRightAlignLabel(
+ resource.getString("ChangeKeyPasswordDialog",
+ "oldPasswdLabel")), 0, y, 1, 1, 0.0, 0.0,
+ GridBagConstraints.NORTH, GridBagConstraints.BOTH,
+ SEPARATED_COMPONENT_SPACE, 0, COMPONENT_SPACE,
+ COMPONENT_SPACE);
+
+ GridBagUtil.constrain(passwdPane, oldPasswd, 1, y, 1, 1, 1.0,
+ 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, SEPARATED_COMPONENT_SPACE, 0,
+ COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(passwdPane,
+ createRightAlignLabel(
+ resource.getString("ChangeKeyPasswordDialog",
+ "newPasswdLabel")), 0, ++y, 1, 1, 0.0, 0.0,
+ GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0,
+ 0, COMPONENT_SPACE, COMPONENT_SPACE);
+
+ GridBagUtil.constrain(passwdPane, newPasswd, 1, y, 1, 1, 1.0,
+ 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(passwdPane,
+ createRightAlignLabel(
+ resource.getString("ChangeKeyPasswordDialog",
+ "confirmPasswdLabel")), 0, ++y, 1, 1, 0.0, 0.0,
+ GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0,
+ 0, COMPONENT_SPACE, COMPONENT_SPACE);
+
+ GridBagUtil.constrain(passwdPane, confirmPasswd, 1, y, 1, 1,
+ 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, COMPONENT_SPACE, 0);
+
+ return passwdPane;
+ }
+
+
+ /**
+ * Create a dialog with 3 password field, for changing
+ * trust db password.
+ *
+ * @param consoleInfo Console information
+ *
+ */
+ public ChangeKeyPasswordDialog(ConsoleInfo consoleInfo) {
+ super(null, "", true, OK | CANCEL | HELP);
+
+ _consoleInfo = consoleInfo;
+
+ JPanel pane = new JPanel();
+ pane.setLayout(new BorderLayout());
+
+ //add some space between the explain text and the password prompt
+ //pane.add(Box.createRigidArea(new Dimension(0, SEPARATED_COMPONENT_SPACE)));
+
+ //add the password pane
+ pane.add("Center", getPasswdPane());
+
+ getContentPane().add(pane);
+ setTitle(resource.getString("ChangeKeyPasswordDialog", "explainText"));
+
+ pack();
+ show();
+ }
+
+ /*public static void main(String arg[]) {
+ ChangeKeyPasswordDialog c = (new ChangeKeyPasswordDialog(new ConsoleInfo()));
+ }*/
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/CipherEntry.java b/base/console/src/com/netscape/admin/certsrv/security/CipherEntry.java
new file mode 100644
index 000000000..52f23ad4b
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/CipherEntry.java
@@ -0,0 +1,190 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import java.util.*;
+import javax.swing.*;
+import java.awt.event.*;
+import com.netscape.management.client.util.*;
+
+class CipherEntry {
+ private JCheckBox _cipherEnable;
+ private JComboBox _tokenList;
+ private JComboBox _certList;
+
+
+ ResourceSet resource = new ResourceSet("com.netscape.admin.certsrv.security.EncryptionPaneResource");
+
+ private Hashtable _tokenCertList;
+ public CipherEntry(String cipherName, Hashtable tokenCertList) {
+ _cipherEnable = new JCheckBox(cipherName);
+
+ Vector tokenList = new Vector();
+ Enumeration tokens = tokenCertList.keys();
+ while (tokens.hasMoreElements()) {
+ tokenList.addElement(tokens.nextElement());
+ }
+
+ if (tokenList.size() == 0) {
+ tokenList.addElement(resource.getString("CipherEntry", "noToken"));
+ }
+
+ _tokenList = new JComboBox(tokenList);
+ _tokenCertList = tokenCertList;
+ _tokenList.addItemListener(new TokenListListener());
+
+ _certList = new JComboBox();
+
+ try {
+ _tokenList.setSelectedIndex(0);
+ } catch (Exception e) {}
+
+ }
+
+
+ public int getTokenCount() {
+ return _tokenCertList.size();
+ }
+
+ class TokenListListener implements ItemListener {
+ public void itemStateChanged(ItemEvent e) {
+ if (e.getStateChange() == e.SELECTED) {
+ //code here to swap in/out cert list
+ _certList.removeAllItems();
+ _certList.setEditable(false);
+ if (_tokenCertList.get(e.getItem()) != null) {
+ Vector certList =
+ (Vector)(_tokenCertList.get(e.getItem()));
+ if (certList.size() != 0) {
+ if (((String)(certList.elementAt(0))).
+ toLowerCase().indexOf("unknown") != -1) {
+ _certList.addItem(
+ resource.getString("CipherEntry", "enterCert"));
+ _certList.setEditable(true);
+ } else {
+ for (int i = 0; i < certList.size(); i++) {
+ _certList.addItem(certList.elementAt(i));
+ }
+ }
+ } else {
+ _certList.addItem(
+ resource.getString("CipherEntry", "noCert"));
+ }
+ } else {
+ _certList.addItem(
+ resource.getString("CipherEntry", "noCert"));
+ }
+ try {
+ _certList.setSelectedIndex(0);
+ _certList.validate();
+ _certList.repaint();
+ } catch (Exception exception) {}
+ }
+ }
+ }
+
+ public JCheckBox getCipherCheckBox() {
+ return _cipherEnable;
+ }
+ public JComboBox getTokenComboBox() {
+ return _tokenList;
+ }
+ public JComboBox getCertComboBox() {
+ return _certList;
+ }
+ public String getCipherName() {
+ return _cipherEnable.getText();
+ }
+
+ public String getSelectedToken() {
+ String selected = (String)(_tokenList.getSelectedItem());
+ if (selected.equalsIgnoreCase(
+ resource.getString("CipherEntry", "noToken"))) {
+ selected = "";
+ }
+ return selected;
+ }
+
+ public String getSelectedCertName() {
+ String selected = (String)(_certList.getSelectedItem());
+ if (selected == null || selected.equalsIgnoreCase(
+ resource.getString("CipherEntry", "noCert")) ||
+ selected.equalsIgnoreCase(
+ resource.getString("CipherEntry", "enterCert"))) {
+ selected = "";
+ }
+
+ return selected;
+ }
+
+ public boolean isEnabled() {
+ return _cipherEnable.isSelected();
+ }
+
+ public void setSelectedToken(String token) {
+ _tokenList.setSelectedItem(token);
+ }
+
+ public void setSelectedCert(String cert) {
+ //if (_certList.getModel().contains(java.lang.Object elem) ) {
+ _certList.setSelectedItem(cert);
+ //}
+ }
+
+ public void setSelected(boolean enabled) {
+ _cipherEnable.setSelected(enabled);
+ }
+
+ public void setEnabledAll(boolean enabled) {
+ _cipherEnable.setEnabled(enabled);
+ _tokenList.setEnabled(enabled);
+ _certList.setEnabled(enabled);
+ }
+
+
+ /*public static void main(String arg[]) {
+ JFrame f = new JFrame();
+
+ Hashtable h = new Hashtable();
+ Vector v1 = new Vector();
+ Vector v2 = new Vector();
+ v1.addElement("v1.1");
+ v1.addElement("v1.2");
+ v1.addElement("v1.3");
+ v1.addElement("v1.4");
+ v2.addElement("v2.1");
+ v2.addElement("v2.2");
+ v2.addElement("v2.3");
+ v2.addElement("v2.4");
+ h.put("v1", v1);
+ h.put("v2", v2);
+
+ CipherEntry my = new CipherEntry("my", h);
+
+ JPanel p = new JPanel();
+ p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
+ p.add(my.getCipherCheckBox());
+ p.add(my.getTokenComboBox());
+ p.add(my.getCertComboBox());
+
+ f.getContentPane().add(p);
+ f.setSize(400,400);
+ f.show();
+ }*/
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/security/CipherPreferenceDialog.java b/base/console/src/com/netscape/admin/certsrv/security/CipherPreferenceDialog.java
new file mode 100644
index 000000000..8a3564de0
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/CipherPreferenceDialog.java
@@ -0,0 +1,332 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import java.awt.*;
+import javax.swing.*;
+import com.netscape.management.client.util.*;
+import com.netscape.management.nmclf.*;
+
+/**
+ * General dialog which display the ciper preference.
+ *
+ * @author <a href=mailto:shihcm@netscape.com>Chih Ming Shih</a>
+ * @version 0.2 9/3/97
+ */
+
+public class CipherPreferenceDialog extends AbstractDialog implements ICipherConstants {
+ SSL2CipherPreference ssl2CipherPref = null;
+ SSL3CipherPreference ssl3CipherPref = null;
+
+ /**SSL Version 2*/
+ public final static int SSL2 = 1;
+ /**SSL Version 3*/
+ public final static int SSL3 = 2;
+
+ private JPanel cipherPreferencePane;
+
+ boolean modified = true;
+ Help help;
+
+
+ /**
+ * Constructor, ciphers will default to SSL2 and SSL3
+ *
+ * @param parent The owner of the dialog
+ * @param isDomestic Software built domestic(allow stonger cipher) or export use
+ *
+ */
+ public CipherPreferenceDialog(JFrame parent, boolean isDomestic) {
+ this(parent, isDomestic, false);
+ }
+
+ /**
+ * Constructor, ciphers will default to SSL2 and SSL3
+ *
+ * @param parent The owner of the dialog
+ * @param isDomestic Software built domestic(allow stonger cipher) or export use
+ * @param hasFortezza Fortezza enabled server
+ *
+ */
+ public CipherPreferenceDialog(JFrame parent, boolean isDomestic,
+ boolean hasFortezza) {
+ this(parent, isDomestic, hasFortezza, SSL2 | SSL3);
+ }
+
+
+ /**
+ * Constructor
+ *
+ * @param parent The owner of the dialog
+ * @param isDomestic Software built domestic(allow stonger cipher) or export use
+ * @param hasFortezza Fortezza enabled server
+ * @param SSLVersion SSL version ciphers to display, SSL2 and/or SSL3
+ *
+ */
+ public CipherPreferenceDialog(JFrame parent, boolean isDomestic,
+ boolean hasFortezza, int SSLVersion) {
+ super(parent, "", true, OK | CANCEL | HELP);
+
+ ResourceSet r = new CipherResourceSet();
+ help = new Help(r);
+
+
+ cipherPreferencePane = new JPanel();
+ cipherPreferencePane.setLayout(
+ new BoxLayout(cipherPreferencePane, BoxLayout.Y_AXIS));
+ if ((SSL2 & SSLVersion) == SSL2) {
+ ssl2CipherPref = new SSL2CipherPreference(isDomestic);
+ cipherPreferencePane.add(ssl2CipherPref);
+ }
+
+ if ((SSL3 & SSLVersion) == SSL3) {
+ ssl3CipherPref =
+ new SSL3CipherPreference(isDomestic, hasFortezza);
+ cipherPreferencePane.add(ssl3CipherPref);
+ }
+
+ cipherPreferencePane.add(Box.createRigidArea(new Dimension(0, 4)));
+
+ getContentPane().add(cipherPreferencePane);
+
+ pack();
+ }
+
+ /**
+ * Remove SSL preference pane, currently only support SSL2 and SSL3.
+ * Will support Fortezza if only Phaos will support it.
+ *
+ * @param sslVersion SSL version to be removed
+ *
+ */
+ public void removeSSLVersion(int sslVersion) {
+ switch (sslVersion) {
+ case SSL2:
+ cipherPreferencePane.remove(ssl2CipherPref);
+ break;
+ case SSL3:
+ cipherPreferencePane.remove(ssl3CipherPref);
+ break;
+ }
+ pack();
+ }
+
+ /**
+ * Determines whether a cipher is enabled.
+ * @param cipher Cipher name
+ *
+ * @see #getSSLPreference
+ * @see #setCipherEnabled
+ *
+ * @return True if a cipher is enabled
+ */
+ public boolean isCipherEnabled(String cipher) {
+ return ( ((ssl2CipherPref == null) ? false :
+ ssl2CipherPref.isCipherEnabled(cipher)) ||
+ ((ssl3CipherPref == null) ? false :
+ ssl3CipherPref.isCipherEnabled(cipher)));
+ }
+
+ /**
+ * Enable or disable a cipher.
+ * @param cipher Cipher name
+ * @param enable Enable the cipher
+ *
+ * @see #isCipherEnabled
+ * @see #getSSLPreference
+ */
+ public void setCipherEnabled(String cipher, boolean enable) {
+ if (ssl2CipherPref != null) {
+ ssl2CipherPref.setCipherEnabled(cipher, enable);
+ }
+ if (ssl3CipherPref != null) {
+ ssl3CipherPref.setCipherEnabled(cipher, enable);
+ }
+ }
+
+ /**
+ * Get a list of supported ciphers.
+ * @param sslVersion SSL version
+ *
+ * @see #isCipherEnabled
+ * @see #setCipherEnabled
+ *
+ * @return An array that contains the name of supported ciphers under SSL version
+ */
+ public String[] getSSLPreference(int sslVersion) {
+ String[] ciphers = null;
+
+ switch (sslVersion) {
+ case SSL2:
+ ciphers = ssl2CipherPref.getCipherList();
+ break;
+ case SSL3:
+ ciphers = ssl3CipherPref.getCipherList();
+ break;
+ default :
+ //programmer's fault, do nothing here
+ Debug.println("Cipher Preference : Invalid ssl version "+
+ sslVersion);
+ break;
+ }
+ return ciphers;
+ }
+
+
+ /**
+ * Determines whether a cipher group(ssl version) is enabled.
+ * @param sslVersion SSL version
+ *
+ * @see #setSSLEnabled
+ *
+ * @return True if the speicified SSL version is enabled
+ */
+ public boolean isSSLEnabled(int sslVersion) {
+ boolean enable = false;
+ switch (sslVersion) {
+ case SSL2:
+ enable = ssl2CipherPref.isEnabled();
+ break;
+ case SSL3:
+ enable = ssl3CipherPref.isEnabled();
+ break;
+ default:
+ //programmer's fault, do nothing here
+ Debug.println("Cipher Preference : Invalid ssl version "+
+ sslVersion);
+ break;
+ }
+ return enable;
+ }
+
+ /**
+ * Enable or disable a cipher group.
+ * @param sslVersion SSL Version
+ * @param enable Enable the SSL version
+ *
+ * @see #isSSLEnabled
+ */
+ public void setSSLEnabled(int sslVersion, boolean enable) {
+ switch (sslVersion) {
+ case SSL2:
+ ssl2CipherPref.setEnabled(enable);
+ break;
+ case SSL3:
+ ssl3CipherPref.setEnabled(enable);
+ break;
+ default:
+ //programmer's fault, do nothing here
+ Debug.println("Cipher Preference : Invalid ssl version "+
+ sslVersion);
+ break;
+ }
+ }
+
+
+
+ /**
+ * Check weather any ciphers has been modified
+ *
+ */
+ public boolean isModified() {
+ return modified;
+ }
+
+ /**
+ * Reset all changes since last save
+ *
+ * @see #setSaved
+ */
+ public void reset() {
+ if (ssl2CipherPref != null) {
+ ssl2CipherPref.reset();
+ }
+ if (ssl3CipherPref != null) {
+ ssl3CipherPref.reset();
+ }
+ }
+
+
+
+ /**
+ * Set the state to save.
+ *
+ * @see #reset
+ */
+ public void setSaved() {
+ if (ssl2CipherPref != null) {
+ ssl2CipherPref.setSaved();
+ }
+
+ if (ssl3CipherPref != null) {
+ ssl3CipherPref.setSaved();
+ }
+ }
+
+ /**
+ * Set the state to save.
+ *
+ * @see #reset
+ * @derprecated replaced by setSaved()
+ */
+ public void setSaved(boolean saved) {
+
+ if (saved) {
+ if (ssl2CipherPref != null) {
+ ssl2CipherPref.setSaved();
+ }
+
+ if (ssl3CipherPref != null) {
+ ssl3CipherPref.setSaved();
+ }
+ }
+ }
+
+ protected void cancelInvoked() {
+ reset();
+ modified = false;
+ super.cancelInvoked();
+ }
+
+ protected void okInvoked() {
+ modified = (((ssl2CipherPref == null) ? false :
+ ssl2CipherPref.isModified()) ||
+ ((ssl3CipherPref == null) ? false :
+ ssl3CipherPref.isModified()));
+ setSaved();
+ super.okInvoked();
+ }
+
+
+ protected void helpInvoked() {
+ help.help("SSL", "Preference");
+ }
+
+ /*public static void main(String arg[]) {
+ JFrame f = new JFrame();
+
+ try {
+ UIManager.setLookAndFeel("javax.swing.plaf.windows.WindowsLookAndFeel");
+ SwingUtilities.updateComponentTreeUI(f.getContentPane());
+ } catch (Exception e) {}
+
+ CipherPreferenceDialog c = new CipherPreferenceDialog(f, true, false, SSL3);
+
+ c.show();
+ }*/
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/CipherResourceSet.java b/base/console/src/com/netscape/admin/certsrv/security/CipherResourceSet.java
new file mode 100644
index 000000000..3adf50548
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/CipherResourceSet.java
@@ -0,0 +1,26 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import com.netscape.management.client.util.ResourceSet;
+
+class CipherResourceSet extends ResourceSet {
+ public CipherResourceSet() {
+ super("com.netscape.admin.certsrv.security.CipherResource");
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/Comm.java b/base/console/src/com/netscape/admin/certsrv/security/Comm.java
new file mode 100644
index 000000000..1bbd022bf
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/Comm.java
@@ -0,0 +1,158 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+import com.netscape.management.client.comm.*;
+import com.netscape.management.client.util.*;
+
+/**
+ *
+ * Extends dt's comm package to do some communication with backend.
+ * eventually this will be phase out, and key cert related tasks that
+ * require cgi call will use AdmTask.java instead of this one.
+ *
+ * @version 1.0 98/07/10
+ * @author <A HREF="mailto:shihcm@netscape.com">shihcm@netscape.com</A>
+ *
+ */
+class Comm implements CommClient, Runnable {
+ public static final int DEFAULT_TIMEOUT_PERIOD = 30000; // 30 seconds
+ public boolean finished = false;
+ public String value = null;
+
+
+ static String server_response = null;
+
+ String url_cgi;
+ Hashtable cgi_arg;
+ boolean waitForResponse;
+
+ String id = "Admin";
+ String pw = "Admin";
+
+ Exception error = null;
+
+ public Comm(String url_cgi, Hashtable cgi_arg,
+ boolean waitForResponse) {
+ this.url_cgi = url_cgi;
+ this.cgi_arg = cgi_arg;
+ this.waitForResponse = waitForResponse;
+ }
+
+
+ public void setAuth(String userName, String password) {
+ this.id = userName;
+ this.pw = password;
+ }
+
+ public Exception getError() {
+ return error;
+ }
+
+ public static String getData() {
+ return server_response;
+ }
+
+ public void run() {
+ HttpManager h = new HttpManager();
+
+ try {
+ ByteArrayInputStream value = HttpChannel.encode(cgi_arg);
+ h.post(new URL(url_cgi), this, null, value,
+ value == null ? 0 : value.available(),
+ CommManager.FORCE_BASIC_AUTH);
+ awaitValue();
+ } catch (InterruptedIOException timeout) {
+ error = timeout;
+ }
+ catch (ConnectException connectError) {
+ error = connectError;
+ }
+ catch (IOException ioError) {
+ error = ioError;
+ }
+ catch (Exception e) {
+ error = e;
+ }
+ }
+
+ public synchronized void awaitValue() {
+ try {
+ wait(DEFAULT_TIMEOUT_PERIOD);
+ } catch (Exception e) {
+ error = e;
+ }
+ if (value == null) {
+ error = new InterruptedIOException("HTTP response timeout");
+ }
+ }
+
+
+ public synchronized void finish() {
+ finished = true;
+ notifyAll();
+ }
+
+ public synchronized void setValue(String s) {
+ value = s;
+
+ server_response = s;
+
+ notifyAll();
+ }
+
+ public void replyHandler(InputStream response, CommRecord cr) {
+ try {
+ InputStreamReader reader =
+ new InputStreamReader(response, "UTF8");
+ int c = reader.read();
+
+ if (c == 'S') {
+ finish();
+ return;
+ }
+ String s = (char) c + "";
+
+ while ((c = reader.read()) != -1) {
+ s += (char) c + "";
+ }
+
+ setValue(s);
+ } catch (Exception e) {
+ error = e;
+ }
+ }
+
+ public void errorHandler(Exception exception, CommRecord cr) {
+ error = exception;
+ Debug.println("errorHandler: " + exception);
+ finish();
+ }
+
+ public String username(Object auth, CommRecord cr) {
+ return id;
+ }
+
+ public String password(Object auth, CommRecord cr) {
+ return pw;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/CreateTrustPane.java b/base/console/src/com/netscape/admin/certsrv/security/CreateTrustPane.java
new file mode 100644
index 000000000..03b5c32d6
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/CreateTrustPane.java
@@ -0,0 +1,231 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import com.netscape.management.client.util.*;
+import com.netscape.management.nmclf.*;
+
+class CreateTrustPane extends JPanel implements SuiConstants, IKeyCertPage {
+
+ SingleBytePasswordField _passwd = new SingleBytePasswordField(20);
+ SingleBytePasswordField _confirmPasswd =
+ new SingleBytePasswordField(20);
+ JLabel _selectedToken = new JLabel();
+
+ JLabel _passwdLabel;
+ JLabel _tokenLabel;
+ JLabel _confirmPasswdLabel;
+
+ IWizardControl control;
+
+ String _noNeedToRequestInstallCert;
+
+ public JPanel getPanel() {
+ return this;
+ }
+
+ public boolean pageShow(WizardObservable observable) {
+ boolean show = false;
+
+ ((StatusPane)(observable.get("statusPane"))).setShow(false);
+ if (((Boolean)(observable.get("createTrust"))).booleanValue()) {
+ show = true;
+
+ if ((_passwd.getText().length() == 0) ||
+ (_confirmPasswd.getText().length() == 0)) {
+ control = (IWizardControl)(observable.get("Wizard"));
+ control.setCanGoForward(false);
+ }
+
+ _selectedToken.setText((String)(observable.get("sie")));
+ } else if (((Boolean)(observable.get("noneed"))).booleanValue()) {
+ StatusPane statusPane = (StatusPane)(observable.get("statusPane"));
+ statusPane.setMessage(_noNeedToRequestInstallCert);
+ statusPane.setShow(true);
+ statusPane.setLastPage(true);
+
+ ((IWizardControl)(observable.get("Wizard"))).setIsLastPage(
+ true);
+ }
+
+ return show;
+ }
+
+ public boolean pageHide(WizardObservable observable) {
+ boolean hide = false;
+
+ String dbName = (String)(observable.get("sie"));
+
+ if (!KeyCertUtility.validPassword(_passwd.getText(),
+ _confirmPasswd.getText(), (observable.getConsoleInfo()))) {
+ hide = false;
+ } else if ( (_passwd.getText().equals(_confirmPasswd.getText())) &&
+ (!(dbName.equals("")))) {
+ KeyCertTaskInfo taskInfo =
+ ((WizardObservable) observable).getTaskInfo();
+ taskInfo.put("alias", dbName);
+ taskInfo.put("keyfilepw", _confirmPasswd.getText());
+ observable.put("keyPasswd", _confirmPasswd.getText());
+ try {
+ taskInfo.exec(taskInfo.SEC_TRUST);
+ } catch (Exception e) {
+ SuiOptionPane.showMessageDialog(
+ UtilConsoleGlobals.getActivatedFrame(),
+ e.getMessage());
+ return false;
+ }
+
+
+ //MessageDialog.messageDialog((Message)(taskInfo.getResponse().getMessages().elementAt(0)));
+ StatusPane statusPane = (StatusPane)(observable.get("statusPane"));
+ statusPane.setMessage( (Message)
+ (taskInfo.getResponse().getMessages().elementAt(0)));
+ statusPane.setShow(true);
+
+ if (((Message)
+ (taskInfo.getResponse().getMessages().elementAt(0))
+ ).getStatus() == Message.NMC_SUCCESS) {
+ hide = true;
+ observable.put("createTrust", new Boolean(false));
+
+ if (((Boolean)(observable.get("noneed"))).booleanValue()) {
+ statusPane.appendMessage("\n\n"+
+ _noNeedToRequestInstallCert);
+ statusPane.setLastPage(true);
+ ((IWizardControl)(observable.get("Wizard"))).
+ setIsLastPage(true);
+ }
+ }
+ }
+
+ return hide;
+ }
+
+
+ class KeyActionListener implements KeyListener {
+ public void keyTyped(KeyEvent e) {}
+ public void keyPressed(KeyEvent e) {}
+ public void keyReleased(KeyEvent e) {
+ if (_passwd.getText().length() > 0) {
+ control.setCanGoForward(true);
+ } else {
+ control.setCanGoForward(false);
+ }
+ }
+ }
+
+ private JPanel getPasswdPane() {
+ JPanel passwdPane = new JPanel();
+ passwdPane.setLayout(new GridBagLayout());
+ int y = 0;
+
+
+ GridBagUtil.constrain(passwdPane, _tokenLabel, 0, ++y, 1, 1,
+ 0.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, COMPONENT_SPACE, 0);
+
+
+ GridBagUtil.constrain(passwdPane, _selectedToken, 1, y, 1, 1,
+ 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, DIFFERENT_COMPONENT_SPACE,
+ COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(passwdPane, _passwdLabel, 0, ++y, 1, 1,
+ 0.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, COMPONENT_SPACE, 0);
+
+ _passwd.addKeyListener(new KeyActionListener());
+ GridBagUtil.constrain(passwdPane, _passwd, 1, y, 1, 1, 1.0,
+ 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, DIFFERENT_COMPONENT_SPACE,
+ COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(passwdPane, _confirmPasswdLabel, 0, ++y,
+ 1, 1, 0.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, COMPONENT_SPACE, 0);
+
+ _confirmPasswd.addKeyListener(new KeyActionListener());
+ GridBagUtil.constrain(passwdPane, _confirmPasswd, 1, y, 1, 1,
+ 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, DIFFERENT_COMPONENT_SPACE,
+ COMPONENT_SPACE, 0);
+
+ return passwdPane;
+ }
+
+ public CreateTrustPane() {
+ super();
+ setLayout(new GridBagLayout());
+
+ ResourceSet resource = KeyCertUtility.getKeyCertWizardResourceSet();
+ _passwdLabel = new JLabel(
+ resource.getString("CreateTrustPane", "passwdLabel"),
+ JLabel.RIGHT);
+ _tokenLabel = new JLabel(
+ resource.getString("CreateTrustPane", "tokenLabel"),
+ JLabel.RIGHT);
+ _confirmPasswdLabel = new JLabel(
+ resource.getString("CreateTrustPane", "confirmPasswdLabel"),
+ JLabel.RIGHT);
+
+ _noNeedToRequestInstallCert =
+ resource.getString("CreateTrustPane", "noNeedToRequestInstallCert");
+
+
+ setBorder( new TitledBorder( new CompoundBorder(new EtchedBorder(),
+ new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE)),
+ resource.getString("CreateTrustPane", "title")));
+
+ int y = 0;
+
+ GridBagUtil.constrain(this,
+ new MultilineLabel(
+ resource.getString("CreateTrustPane", "explain")), 0,
+ ++y, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0,
+ DIFFERENT_COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(this, getPasswdPane(), 0, ++y, 1, 1, 1.0,
+ 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0,
+ DIFFERENT_COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(this, Box.createVerticalGlue(), 0, ++y,
+ 1, 1, 1.0, 1.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+
+ GridBagUtil.constrain(this,
+ new JLabel(
+ resource.getString(null, "clickNextToContinue")), 0,
+ ++y, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+ }
+
+ /*public static void main(String arg[]) {
+ JFrame f = new JFrame();
+ f.getContentPane().add("North", new CreateTrustPane());
+ f.setSize(400,400);
+ f.show();
+ }*/
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/EncryptionPane.java b/base/console/src/com/netscape/admin/certsrv/security/EncryptionPane.java
new file mode 100644
index 000000000..1a472ca76
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/EncryptionPane.java
@@ -0,0 +1,639 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import java.awt.*;
+import java.util.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import com.netscape.management.client.util.*;
+import com.netscape.management.nmclf.*;
+import com.netscape.management.client.console.*;
+import javax.swing.plaf.*;
+
+import java.io.*;
+
+/**
+ *
+ * Encryption panel used for server configuration.
+ *
+ *
+ * @version 1.0 98/07/10
+ * @author <A HREF="mailto:shihcm@netscape.com">shihcm@netscape.com</A>
+ *
+ */
+public class EncryptionPane extends JPanel implements ActionListener {
+
+ private JCheckBox on;
+ String title;
+
+ JPanel top;
+ JPanel cipherPane;
+
+ private Vector cipherList = new Vector();
+
+ boolean isFortezza = false;
+ boolean isDomestic = false;
+
+ ConsoleInfo _consoleInfo;
+ String certdbName;
+
+ JButton bCipherPref;
+ JButton wizardButton;
+
+ JLabel cipherTitle;
+ JLabel tokenTitle;
+ JLabel certTitle;
+
+
+ Vector encryptionPaneListeners = new Vector();
+
+ EncryptionPaneActionListener actionListener =
+ new EncryptionPaneActionListener();
+
+ KeyCertTaskInfo taskInfo;
+
+ ResourceSet resource;
+
+ /**
+ *
+ * @deprecated implement IEncryptionPaneListener instead
+ */
+ public void actionPerformed(ActionEvent e) {
+ }
+
+
+ class EncryptionPaneActionListener implements ActionListener {
+ public void actionPerformed(ActionEvent e) {
+ if (e.getActionCommand().equals(".doCipherSetting")) {
+ for (int i = 0; i < encryptionPaneListeners.size(); i++) {
+ ((IEncryptionPaneListener)
+ (encryptionPaneListeners.elementAt(i))).
+ showCipherPreferenceDialog();
+ }
+ } else if (e.getActionCommand().equals("ENABLED")) {
+ for (int i = 0; i < encryptionPaneListeners.size(); i++) {
+ ((IEncryptionPaneListener)
+ (encryptionPaneListeners.elementAt(i))).
+ sslStateChanged(on.isSelected());
+ }
+ } else {
+ for (int i = 0; i < encryptionPaneListeners.size(); i++) {
+ Object cipher = getCipher(e.getActionCommand());
+ ((IEncryptionPaneListener)
+ (encryptionPaneListeners.elementAt(i))).
+ cipherStateChanged(isEnabled(cipher),
+ getCipherName(cipher), getToken(cipher),
+ getCertificateName(cipher));
+ }
+ }
+ }
+ }
+
+ /**
+ * Add a listener to the list that's notified each time a change to the selection occurs.
+ *
+ */
+ public void addEncryptionPaneListener(
+ IEncryptionPaneListener listener) {
+ encryptionPaneListeners.addElement(listener);
+ }
+
+
+
+ /**
+ *
+ * Create an encryption panel
+ *
+ * @param consoleInfo server sepcific information
+ */
+ public EncryptionPane(ConsoleInfo consoleInfo) {
+ this(consoleInfo, null);
+ }
+
+ /**
+ *
+ * Create an encryption panel
+ *
+ * @param consoleInfo server sepcific information
+ * @param addPanel add customized panel into encryption panel
+ */
+ public EncryptionPane(ConsoleInfo consoleInfo, JPanel addPanel) {
+ super();
+
+ //actionListener
+
+ _consoleInfo = consoleInfo;
+ certdbName = KeyCertUtility.createTokenName(consoleInfo);
+
+
+ setLayout(new BorderLayout());
+
+ //setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
+ JPanel mainPane = new JPanel();
+ //mainPane.setLayout(new BorderLayout());
+ mainPane.setLayout(new GridBagLayout());
+
+
+ resource = new ResourceSet("com.netscape.admin.certsrv.security.EncryptionPaneResource");
+
+ on = new JCheckBox(resource.getString("EncryptionPane", "enableSSL"),
+ false);
+ on.setActionCommand("ENABLED");
+ on.addActionListener(new CipherPaneToggleListener());
+
+ on.addActionListener(actionListener);
+
+
+ top = new JPanel();
+ top.setAlignmentX(0.0f);
+ top.setLayout(new BoxLayout(top, BoxLayout.X_AXIS));
+ top.add(on);
+
+ //mainPane.setBorder(new ToggleBorder(top, SwingConstants.TOP));
+ mainPane.setBorder( new CompoundBorder(
+ new ToggleBorder(top, SwingConstants.TOP),
+ new EmptyBorder(0, SuiConstants.COMPONENT_SPACE,
+ SuiConstants.COMPONENT_SPACE, 0)));
+
+ GridBagUtil.constrain(mainPane, top, 0, 0, 1, 1, 0.0, 0.0,
+ GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
+ 0, 0, 0, 0);
+
+
+ cipherPane = new JPanel();
+ cipherPane.setLayout(new BorderLayout());
+
+ GridBagUtil.constrain(mainPane, cipherPane, 0, 1, 2, 1, 1.0,
+ 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0,
+ SuiConstants.COMPONENT_SPACE, 0);
+
+ bCipherPref = JButtonFactory.create(
+ resource.getString("EncryptionPane", "cipherPrefTitle"));
+ wizardButton = JButtonFactory.create(
+ resource.getString("EncryptionPane", "wizardTitle"));
+
+ bCipherPref.setActionCommand(".doCipherSetting");
+ bCipherPref.addActionListener(this);
+
+ bCipherPref.addActionListener(actionListener);
+
+ wizardButton.setActionCommand("WIZARD");
+ wizardButton.addActionListener(new wizardButtonActionListener());
+
+
+ updateEncryptionUI();
+
+ add("North", mainPane);
+
+
+ //other pane contain server specific pane and a wizrad button.
+ JPanel otherPane = new JPanel();
+ otherPane.setLayout(new BoxLayout(otherPane, BoxLayout.Y_AXIS));
+ //otherPane.setLayout(new GridBagLayout());
+
+ if (addPanel != null) {
+ otherPane.add(addPanel);
+ }
+
+ otherPane.add( Box.createRigidArea(
+ new Dimension(0, SuiConstants.COMPONENT_SPACE)));
+
+ add("Center", otherPane);
+
+ JPanel buttonPane = new JPanel();
+ buttonPane.setLayout(new GridBagLayout());
+ GridBagUtil.constrain(buttonPane, wizardButton, 0, 0, 1, 1,
+ 0.0, 0.0, GridBagConstraints.SOUTHWEST,
+ GridBagConstraints.NONE, 0, 0, 0, 0);
+
+ GridBagUtil.constrain(buttonPane, Box.createHorizontalGlue(),
+ 1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.SOUTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+
+ //add("South", wizardButton);
+ add("South", buttonPane);
+
+ }
+
+ /**
+ * Returns a vector containing cipher objects
+ * @see #getCipherCount
+ * @see #getCipherAt
+ *
+ * @return a vector contains cipher object as element
+ */
+ public Vector getCipherList() {
+ return cipherList;
+ }
+
+
+ /**
+ * Returns the number of cipher objects in encryption pane
+ *
+ * @see #getCipherList
+ * @see #getCipherAt
+ *
+ * @return the number of cipher object in encryption pane
+ */
+ public int getCipherCount() {
+ return cipherList.size();
+ }
+
+ /**
+ * Returns the cipher object at the specified index.
+ *
+ * @param index an index into cipher list.
+ *
+ * @see #getCipherList
+ * @see #getCipherCount
+ *
+ * @return the number of cipher object in encryption pane
+ */
+ public Object getCipherAt(int index) {
+ return cipherList.elementAt(index);
+ }
+
+ private CipherEntry getCipher(String cipherName) {
+ int count = getCipherCount();
+ for (int i = count - 1; i >= 0; i--) {
+ Object cipher = getCipherAt(i);
+ if (cipherName.equals(getCipherName(cipher))) {
+ return ((CipherEntry) cipher);
+ }
+ }
+ return null;
+ }
+
+
+ /**
+ * Return cipher name
+ *
+ * @param cipher cipher object
+ *
+ * @return cipher name
+ */
+ public String getCipherName(Object cipher) {
+ return ((CipherEntry) cipher).getCipherName();
+ }
+
+
+ /**
+ * Return selected token name
+ *
+ * @param cipher cipher object
+ *
+ * @return selected token
+ */
+ public String getToken(Object cipher) {
+ return ((CipherEntry) cipher).getSelectedToken();
+ }
+
+
+ /**
+ * Set token selection. Default will be taken if no selection
+ * match the token user specified.
+ *
+ * @param cipher cipher object
+ *
+ */
+ public void setToken(Object cipher, String token) {
+ ((CipherEntry) cipher).setSelectedToken(token);
+ }
+
+
+
+ /**
+ * Return certificate name
+ *
+ * @param cipher cipher object
+ *
+ * @return certificate name
+ *
+ */
+ public String getCertificateName(Object cipher) {
+ return ((CipherEntry) cipher).getSelectedCertName();
+
+ }
+
+ /**
+ * Set the certificate field to the specified certificate name
+ *
+ * @param cipher cipher object
+ * @param certificateName certificate name
+ *
+ */
+ public void setCertificateName(Object cipher, String certificateName) {
+ ((CipherEntry) cipher).setSelectedCert(certificateName);
+ }
+
+ /**
+ * Return cipher state, true a cipher is enabled
+ *
+ * @param cipher cipher object
+ *
+ * @return true if a cipher is enabled false other wise
+ */
+ public boolean isEnabled(Object cipher) {
+ return ((CipherEntry) cipher).isEnabled();
+ }
+
+ /**
+ * Set cipher state
+ *
+ * @param cipher cipher object
+ * @param on cipher state
+ *
+ */
+ public void setEnabled(Object cipher, boolean on) {
+ ((CipherEntry) cipher).setSelected(on);
+ }
+
+
+ /**
+ * Return encryption setting
+ *
+ * @return true if SSL on/off is on.
+ */
+ public boolean isEncryptionEnabled() {
+ return on.isSelected();
+ //return ((Boolean)(encryptionOnOff.getValue())).booleanValue();
+ }
+
+ /**
+ * Set encryption on/off
+ *
+ */
+ public void setEncryption(boolean on) {
+ setEnableAll(on);
+ this.on.setSelected(on);
+ //encryptionOnOff.setValue(new Boolean(on));
+ }
+
+ /**
+ * Return certificate database file name
+ *
+ * @param certificate database file name
+ */
+ public String getCertificateDBName() {
+ return certdbName;
+ }
+
+ /**
+ * A convenience function to setup an cipher.
+ * If no matching cipherName found in the encryption
+ * pane, this function will do nothing.
+ *
+ * @param on cipher state
+ * @param cipherName cipher name
+ * @param token token name
+ * @param personality personality name
+ *
+ * @see #setEnabled
+ */
+ public void setCipherSetting(boolean on, String cipherName,
+ String token, String personality) {
+ int count = getCipherCount();
+ for (int i = count - 1; i >= 0; i--) {
+ Object cipher = getCipherAt(i);
+ if (cipherName.equals(getCipherName(cipher))) {
+ setEnabled(cipher, on);
+ setToken(cipher, token);
+ setCertificateName(cipher, personality);
+ }
+ }
+ }
+
+ /**
+ *
+ * @return true if fortezza is detected on the server
+ */
+ public boolean hasFortezza() {
+ return isFortezza;
+ }
+
+
+ /**
+ *
+ * @return true if a domestic server is detected
+ */
+ public boolean isSecurityDomestic() {
+ return isDomestic;
+ }
+
+ /**
+ *
+ * @return encryption pane
+ */
+ public JPanel getPanel() {
+ return this;
+ }
+
+
+
+ private JLabel leftAlignLabel(String label) {
+ return new JLabel(label, JLabel.LEFT);
+ }
+
+ private void updateCipherEntry() {
+ }
+
+
+ /**
+ * Update ui
+ *
+ */
+ public void refresh() {
+ updateEncryptionUI();
+ }
+
+ JPanel cPane = new JPanel();
+ private void updateEncryptionUI() {
+ cPane.removeAll();
+
+ cPane.setLayout(new GridBagLayout());
+
+ int y = 0;
+
+ cipherTitle =
+ leftAlignLabel(resource.getString("EncryptionPane", "cipherTitle"));
+ tokenTitle =
+ leftAlignLabel(resource.getString("EncryptionPane", "tokenTitle"));
+ certTitle =
+ leftAlignLabel(resource.getString("EncryptionPane", "certTitle"));
+
+ GridBagUtil.constrain(cPane, cipherTitle, 0, y, 1, 1, 1.0, 0.0,
+ GridBagConstraints.NORTH, GridBagConstraints.BOTH,
+ SuiConstants.HORIZ_COMPONENT_INSET, 0,
+ SuiConstants.COMPONENT_SPACE,
+ SuiConstants.SEPARATED_COMPONENT_SPACE);
+ GridBagUtil.constrain(cPane, tokenTitle, 1, y, 1, 1, 1.0, 0.0,
+ GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0,
+ 0, SuiConstants.COMPONENT_SPACE,
+ SuiConstants.SEPARATED_COMPONENT_SPACE);
+ GridBagUtil.constrain(cPane, certTitle, 2, y, 1, 1, 1.0, 0.0,
+ GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0,
+ 0, SuiConstants.COMPONENT_SPACE, 0);
+
+ taskInfo = new KeyCertTaskInfo(_consoleInfo);
+ taskInfo.clear();
+
+ taskInfo.put("sie", certdbName);
+
+ try {
+ taskInfo.exec(taskInfo.SEC_LSTOKEN);
+ } catch (Exception e) {
+ SuiOptionPane.showMessageDialog(
+ UtilConsoleGlobals.getActivatedFrame(), e.getMessage());
+ return;
+ }
+
+ cipherList = taskInfo.getResponse().getFamilyList();
+
+ isFortezza = taskInfo.getResponse().isSecurityFortezza();
+ isDomestic = taskInfo.getResponse().isSecurityDomestic();
+
+
+ for (int index = cipherList.size() - 1; index >= 0; index--) {
+ CipherEntry cipher = (CipherEntry)(cipherList.elementAt(index));
+ cipher.getCipherCheckBox().addActionListener(this);
+ cipher.getTokenComboBox().addActionListener(this);
+ cipher.getCertComboBox().addActionListener(this);
+
+ String name = cipher.getCipherCheckBox().getText();
+ cipher.getCipherCheckBox().setActionCommand(name);
+ cipher.getTokenComboBox().setActionCommand(name);
+ cipher.getCertComboBox().setActionCommand(name);
+
+ cipher.getCipherCheckBox().addActionListener(actionListener);
+ cipher.getTokenComboBox().addActionListener(actionListener);
+ cipher.getCertComboBox().addActionListener(actionListener);
+
+ GridBagUtil.constrain(cPane, cipher.getCipherCheckBox(), 0,
+ ++y, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0,
+ SuiConstants.COMPONENT_SPACE,
+ SuiConstants.COMPONENT_SPACE);
+ GridBagUtil.constrain(cPane, cipher.getTokenComboBox(), 1,
+ y, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0,
+ SuiConstants.COMPONENT_SPACE,
+ SuiConstants.COMPONENT_SPACE);
+ GridBagUtil.constrain(cPane, cipher.getCertComboBox(), 2,
+ y, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0,
+ SuiConstants.COMPONENT_SPACE,
+ SuiConstants.COMPONENT_SPACE);
+ }
+
+ GridBagUtil.constrain(cPane, bCipherPref, 1, ++y, 2, 1, 1.0,
+ 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0,
+ SuiConstants.COMPONENT_SPACE);
+
+
+ setEnableAll(false);
+ cipherPane.add("North", cPane);
+ cPane.validate();
+ cPane.repaint();
+ }
+
+ class wizardButtonActionListener implements ActionListener {
+ public void actionPerformed(ActionEvent e) {
+ if (e.getActionCommand().equals("WIZARD")) {
+ //save the old setting
+ Vector oldEntry = getCipherList();
+
+ //lunch the wizard
+ KeyCertWizard wizard = new KeyCertWizard(_consoleInfo);
+
+ UtilConsoleGlobals.getActivatedFrame().setCursor(
+ new Cursor(Cursor.WAIT_CURSOR));
+
+ //update the cipher entries
+ //well it is inefficient, but unless more api
+ //is added to wizard it self we can't tell if
+ //a new cert is been added or not
+ updateEncryptionUI();
+
+ //restore the setting
+ for (int i = oldEntry.size() - 1; i >= 0; i--) {
+ Object cipher = oldEntry.elementAt(i);
+ setCipherSetting(isEnabled(cipher),
+ getCipherName(cipher), getToken(cipher),
+ getCertificateName(cipher));
+ }
+
+ setEnableAll(isEncryptionEnabled());
+
+ UtilConsoleGlobals.getActivatedFrame().setCursor(
+ new Cursor(Cursor.DEFAULT_CURSOR));
+
+ }
+ }
+ }
+
+
+ private void setEnableAll(boolean enable) {
+ int count = getCipherCount();
+ for (int i = 0; i < count; i++) {
+ ((CipherEntry) cipherList.elementAt(i)).setEnabledAll(enable);
+ }
+ bCipherPref.setEnabled(enable);
+ cipherTitle.setEnabled(enable);
+ tokenTitle.setEnabled(enable);
+ certTitle.setEnabled(enable);
+ invalidate();
+ repaint();
+ }
+
+ class CipherPaneToggleListener implements ActionListener {
+ public void actionPerformed(ActionEvent e) {
+ if (e.getActionCommand().equals("ENABLED")) {
+ setEnableAll(on.isSelected());
+ EncryptionPane.this.actionPerformed(e);
+ validate();
+ repaint();
+ }
+ }
+ }
+
+ class ToggleBorder extends EtchedBorder {
+ private JComponent _switchPanel;
+ private int _switchAlign;
+
+ public ToggleBorder(JComponent sp, int align) {
+ _switchPanel = sp;
+ _switchAlign = align;
+ }
+
+ public void paintBorder(Component c, Graphics g, int x, int y,
+ int width, int height) {
+ Color save = g.getColor();
+
+ int top = y + (_switchPanel.getHeight() >> 1);
+ int new_height = height - top;
+
+ BorderUIResource.getEtchedBorderUIResource().paintBorder(c,
+ g, x, top, width, new_height);
+ }
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/GuideCertInstallPane.java b/base/console/src/com/netscape/admin/certsrv/security/GuideCertInstallPane.java
new file mode 100644
index 000000000..76580ecf0
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/GuideCertInstallPane.java
@@ -0,0 +1,82 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import java.awt.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import com.netscape.management.client.util.*;
+import com.netscape.management.nmclf.*;
+
+class GuideCertInstallPane extends JPanel implements SuiConstants,
+IKeyCertPage {
+
+ public JPanel getPanel() {
+ return this;
+ }
+
+ public boolean pageShow(WizardObservable observable) {
+ return ((Boolean)(observable.get("installCert"))).booleanValue();
+ }
+
+ public boolean pageHide(WizardObservable observable) {
+ return true;
+ }
+
+
+ public GuideCertInstallPane() {
+ super();
+ setLayout(new GridBagLayout());
+
+ ResourceSet resource = KeyCertUtility.getKeyCertWizardResourceSet();
+
+ setBorder( new TitledBorder( new CompoundBorder(new EtchedBorder(),
+ new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE)),
+ resource.getString("GuideCertInstallPane", "title")));
+
+ int y = 0;
+
+
+ GridBagUtil.constrain(this,
+ new MultilineLabel(
+ resource.getString("GuideCertInstallPane", "explain")),
+ 0, ++y, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0,
+ SEPARATED_COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(this, Box.createVerticalGlue(), 0, ++y,
+ 1, 1, 1.0, 1.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+
+ GridBagUtil.constrain(this,
+ new JLabel(
+ resource.getString(null, "clickNextToContinue")), 0,
+ ++y, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+
+ }
+
+ /*public static void main(String arg[]) {
+ JFrame f = new JFrame();
+ f.getContentPane().add("North", new GuideCertInstallPane());
+ f.setSize(400,400);
+ f.show();
+ }*/
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/GuideCertRequestPane.java b/base/console/src/com/netscape/admin/certsrv/security/GuideCertRequestPane.java
new file mode 100644
index 000000000..51ae0959e
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/GuideCertRequestPane.java
@@ -0,0 +1,81 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import java.awt.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import com.netscape.management.client.util.*;
+import com.netscape.management.nmclf.*;
+
+class GuideCertRequestPane extends JPanel implements SuiConstants,
+IKeyCertPage {
+
+ public JPanel getPanel() {
+ return this;
+ }
+
+ public boolean pageShow(WizardObservable observable) {
+ return ((Boolean)(observable.get("requestCert"))).booleanValue();
+ }
+
+ public boolean pageHide(WizardObservable observable) {
+ return true;
+ }
+
+
+
+ public GuideCertRequestPane() {
+ super();
+ setLayout(new GridBagLayout());
+
+ ResourceSet resource = KeyCertUtility.getKeyCertWizardResourceSet();
+
+ setBorder( new TitledBorder( new CompoundBorder(new EtchedBorder(),
+ new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE)),
+ resource.getString("GuideCertRequestPane", "title")));
+
+ int y = 0;
+ GridBagUtil.constrain(this,
+ new MultilineLabel(
+ resource.getString("GuideCertRequestPane", "explain")),
+ 0, ++y, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0,
+ SEPARATED_COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(this, Box.createVerticalGlue(), 0, ++y,
+ 1, 1, 1.0, 1.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+
+ GridBagUtil.constrain(this,
+ new JLabel(
+ resource.getString(null, "clickNextToContinue")), 0,
+ ++y, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+ }
+
+ /*public static void main(String arg[]) {
+ JFrame f = new JFrame();
+ f.getContentPane().add("North", new GuideCertRequestPane());
+ f.setSize(400,400);
+ f.show();
+ }*/
+
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/security/GuideCreateTrustPane.java b/base/console/src/com/netscape/admin/certsrv/security/GuideCreateTrustPane.java
new file mode 100644
index 000000000..9eaf3607f
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/GuideCreateTrustPane.java
@@ -0,0 +1,79 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import java.awt.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import com.netscape.management.client.util.*;
+import com.netscape.management.nmclf.*;
+
+class GuideCreateTrustPane extends JPanel implements SuiConstants,
+IKeyCertPage {
+
+ public JPanel getPanel() {
+ return this;
+ }
+
+ public boolean pageShow(WizardObservable observable) {
+ return ((Boolean)(observable.get("createTrust"))).booleanValue();
+ }
+
+ public boolean pageHide(WizardObservable observable) {
+ return true;
+ }
+
+ public GuideCreateTrustPane() {
+ super();
+ setLayout(new GridBagLayout());
+
+ ResourceSet resource = KeyCertUtility.getKeyCertWizardResourceSet();
+
+ setBorder( new TitledBorder( new CompoundBorder(new EtchedBorder(),
+ new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE)),
+ resource.getString("GuideCreateTrustPane", "title")));
+
+ int y = 0;
+ GridBagUtil.constrain(this,
+ new MultilineLabel(
+ resource.getString("GuideCreateTrustPane", "explain")),
+ 0, ++y, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0,
+ SEPARATED_COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(this, Box.createVerticalGlue(), 0, ++y,
+ 1, 1, 1.0, 1.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+
+
+ GridBagUtil.constrain(this,
+ new JLabel(
+ resource.getString(null, "clickNextToContinue")), 0,
+ ++y, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+ }
+
+ /*public static void main(String arg[]) {
+ JFrame f = new JFrame();
+ f.getContentPane().add("North", new GuideCreateTrustPane());
+ f.setSize(400,400);
+ f.show();
+ }*/
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/GuideIntroPane.java b/base/console/src/com/netscape/admin/certsrv/security/GuideIntroPane.java
new file mode 100644
index 000000000..30bc92200
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/GuideIntroPane.java
@@ -0,0 +1,119 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import java.awt.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import com.netscape.management.client.util.*;
+import com.netscape.management.nmclf.*;
+
+class GuideIntroPane extends JPanel implements SuiConstants, IKeyCertPage {
+
+ public JPanel getPanel() {
+ return this;
+ }
+
+ public boolean pageShow(WizardObservable observable) {
+ return true;
+ }
+
+ public boolean pageHide(WizardObservable observable) {
+ return true;
+ }
+
+ private void addNumberedComponent(JPanel p, int count, Component c) {
+ //JPanel entry = new JPanel();
+ //entry.setLayout(new GridBagLayout());
+
+ GridBagUtil.constrain(p,
+ Box.createRigidArea(
+ new Dimension(SEPARATED_COMPONENT_SPACE, 0)), 0,
+ count - 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.NONE, 0, 0, 0, 0);
+ GridBagUtil.constrain(p,
+ new JLabel(Integer.toString(count) + ". "), 1,
+ count - 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.NONE, 0, 0, 0, 0);
+ GridBagUtil.constrain(p, c, 2, count - 1, 1, 1, 1.0, 0.0,
+ GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0,
+ 0, COMPONENT_SPACE, 0);
+ //p.add(entry);
+ }
+
+
+ public GuideIntroPane() {
+ super();
+ setLayout(new GridBagLayout());
+
+ int y = 0;
+
+
+ ResourceSet resource = KeyCertUtility.getKeyCertWizardResourceSet();
+
+
+ setBorder( new TitledBorder( new CompoundBorder(new EtchedBorder(),
+ new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE)),
+ resource.getString("GuideIntroPane", "title")));
+
+ GridBagUtil.constrain(this,
+ new MultilineLabel(
+ resource.getString("GuideIntroPane", "explain")), 0,
+ ++y, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0,
+ SEPARATED_COMPONENT_SPACE, 0);
+
+ JPanel p = new JPanel();
+ //p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
+ p.setLayout(new GridBagLayout());
+ int count = 0;
+
+ MultilineLabel _step1 = new MultilineLabel(
+ resource.getString("GuideIntroPane", "step1"));
+ MultilineLabel _step2 = new MultilineLabel(
+ resource.getString("GuideIntroPane", "step2"));
+ MultilineLabel _step3 = new MultilineLabel(
+ resource.getString("GuideIntroPane", "step3"));
+ addNumberedComponent(p, ++count, _step1);
+ addNumberedComponent(p, ++count, _step2);
+ addNumberedComponent(p, ++count, _step3);
+ GridBagUtil.constrain(this, p, 0, ++y, 1, 1, 0.0, 0.0,
+ GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0,
+ 0, COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(this, Box.createVerticalGlue(), 0, ++y,
+ 1, 1, 1.0, 1.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+
+ GridBagUtil.constrain(this,
+ new JLabel(
+ resource.getString(null, "clickNextToContinue")), 0,
+ ++y, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+ }
+
+ /*public static void main(String arg[]) {
+ JFrame f = new JFrame();
+ f.getContentPane().add(new GuideIntroPane());
+ //f.getContentPane().add(new MultilineLabel("adsf;klj a;sldkj ;alskj ;alsj f;alsdjf ;lakjfd ;asdjf ;aldsjf "));
+ f.setSize(400,400);
+ f.show();
+ }*/
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/IAbstractCipherSet.java b/base/console/src/com/netscape/admin/certsrv/security/IAbstractCipherSet.java
new file mode 100644
index 000000000..77ff5072b
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/IAbstractCipherSet.java
@@ -0,0 +1,44 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import java.util.Vector;
+
+/**
+ *
+ * The interface for abstract cipher preference
+ *
+ * @version 1.0 98/07/10
+ * @author <A HREF="mailto:shihcm@netscape.com">shihcm@netscape.com</A>
+ *
+ */
+public abstract interface IAbstractCipherSet {
+
+ /**
+ * Return cipher list
+ *
+ */
+ public Vector getCipherList();
+
+ /**
+ * Return title.
+ * For purpose of setting title if cipher is placed in a dialog or TitleBorder
+ *
+ */
+ public String getTitle();
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/ICipherConstants.java b/base/console/src/com/netscape/admin/certsrv/security/ICipherConstants.java
new file mode 100644
index 000000000..42a43c7d5
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/ICipherConstants.java
@@ -0,0 +1,76 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+/**
+ * This interface contains all the internal string constants for each
+ * cipher encrytion methods.
+ *
+ * @version 1.0 98/07/10
+ * @author <A HREF="mailto:shihcm@netscape.com">shihcm@netscape.com</A>
+ *
+ */
+public interface ICipherConstants {
+ // export ssl2 cipher
+ /**SSL2 Export - RC4 with 40 bit encryption and MD5 message authentication*/
+ public final static String RC4EXPORT = "rc4export";
+ /**SSL2 Export - RC2 with 40 bit encryption and MD5 message authentication*/
+ public final static String RC2EXPORT = "rc2export";
+
+ // domestic ssl2 cipher
+ /**SSL2 Domestic - RC4 with 128 bit encryption and MD5 message authentication*/
+ public final static String RC4 = "rc4";
+ /**SSL2 Domestic - RC2 with 128 bit encryption and MD5 message authentication*/
+ public final static String RC2 = "rc2";
+ /**SSL2 Domestic - DES with 56 bit encryption and MD5 message authentication*/
+ public final static String DES = "des";
+ /**SSL2 Domestic - Triple DES with 168 bit encryption and MD5 message authentication*/
+ public final static String DES3 = "desede3";
+
+ // export ssl3 cipher
+ /**SSL3 Export - RC4 with 40 bit encryption and MD5 message authentication*/
+ public final static String RSA_RC4_40_MD5 = "rsa_rc4_40_md5";
+ /**SSL3 Export - RC2 with 40 bit encryption and MD5 message authentication*/
+ public final static String RSA_RC2_40_MD5 = "rsa_rc2_40_md5";
+ /**SSL3 Export - No encryption, only MD5 message authentication*/
+ public final static String RSA_NULL_MD5 = "rsa_null_md5";
+ /**SSL3 Export - TLS_RSA_EXPORT1024_WITH_DES_CBC_SHA */
+ public final static String TLS_RSA_DES_SHA = "tls_rsa_export1024_with_des_cbc_sha";
+ /**SSL3 Export - TLS_RSA_EXPORT1024_WITH_RC4_56_SHA */
+ public final static String TLS_RSA_RC4_SHA = "tls_rsa_export1024_with_rc4_56_sha";
+
+ // domestic ssl3 cipher
+ /**SSL3 Domestic - DES with 56 bit encryption and SHA message authentication*/
+ public final static String RSA_DES_SHA = "rsa_des_sha";
+ /**SSL3 Domestic - RC4 with 128 bit encryption and MD5 message authentication*/
+ public final static String RSA_RC4_128_MD5 = "rsa_rc4_128_md5";
+ /**SSL3 Domestic - Triple DES with 168 bit encryption and SHA message authentication*/
+ public final static String RSA_3DES_SHA = "rsa_3des_sha";
+
+ // fortezza ciphers
+ /**SSL3 Domestic - Fortezza with 80 bit encryption and SHA message authentication */
+ public final static String FORTEZZA = "fortezza";
+ /**SSL3 Domestic - RC4 with 128 bit encryption and Fortezza/SHA message authentication */
+ public final static String FORTEZZA_RC4_128_SHA = "fortezza_rc4_128_sha";
+ /**SSL3 Domestic - No encryption, only Fortezza and SHA message authentication */
+ public final static String FORTEZZA_NULL = "fortezza_null";
+
+ // FIPS ciphers
+ public final static String RSA_FIPS_DES_SHA = "rsa_fips_des_sha";
+ public final static String RSA_FIPS_3DES_SHA = "rsa_fips_3des_sha";
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/IEncryptionPaneListener.java b/base/console/src/com/netscape/admin/certsrv/security/IEncryptionPaneListener.java
new file mode 100644
index 000000000..96d1b4077
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/IEncryptionPaneListener.java
@@ -0,0 +1,52 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+/**
+ * Interface which specify the encryption panel listen method.
+ *
+ * @author <a href=mailto:dshihcm@netscape.com>Chih Ming Shih</a>
+ * @version 0.2 9/3/97
+ */
+
+public interface IEncryptionPaneListener {
+
+ /**
+ * called when cipher change state(on/off, token name change, cert name change)
+ *
+ * @param cipherEnbled enable cipher
+ * @param cipherName cipher name
+ * @param tokenName token name
+ * @param certName certificate name
+ */
+ public void cipherStateChanged(boolean cipherEnabled,
+ String cipherName, String tokenName, String certName);
+
+ /**
+ * called when ssl change state
+ *
+ * @param sslEnabled enable ssl
+ */
+ public void sslStateChanged(boolean sslEnabled);
+
+ /**
+ * called to invoke cipher preference dialog
+ *
+ */
+ public void showCipherPreferenceDialog();
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/IKeyCertPage.java b/base/console/src/com/netscape/admin/certsrv/security/IKeyCertPage.java
new file mode 100644
index 000000000..02ec98d9d
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/IKeyCertPage.java
@@ -0,0 +1,26 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import javax.swing.JPanel;
+
+interface IKeyCertPage {
+ public abstract JPanel getPanel();
+ public abstract boolean pageShow(WizardObservable observable);
+ public abstract boolean pageHide(WizardObservable observable);
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/KeyCertTaskInfo.java b/base/console/src/com/netscape/admin/certsrv/security/KeyCertTaskInfo.java
new file mode 100644
index 000000000..9ffe7b2b5
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/KeyCertTaskInfo.java
@@ -0,0 +1,116 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import com.netscape.management.client.console.ConsoleInfo;
+import com.netscape.management.client.util.*;
+
+import javax.swing.*;
+
+import java.awt.event.*;
+import java.util.*;
+import java.io.*;
+import java.net.*;
+
+import netscape.ldap.*;
+
+/*-----IMPLEMENTATION-----*/
+//need to implementation timer...if server don't response in 30 sec then
+//we will pop up a message telling the user that server side cgi
+//has not response in a resonable amount of time...and should check
+//the server or call the cgi again.
+
+class KeyCertTaskInfo extends Hashtable {
+
+ //need to replace this by useful name later since the name will
+ //be map and no need to use real name.
+ //So a more descriptive name will probably be more useful.
+ public static final String SEC_LSALIAS = "ListAlias"; //"sec-lsalias";
+ public static final String SEC_GCRT = "CertRequest"; //""sec-gcrt";
+ public static final String SEC_ICRT = "CertInstall"; //"sec-icrt";
+ public static final String SEC_MGCRT = "CertListing"; //"sec-mgcrt"
+ public static final String SEC_ECRT = "GetCertInfo"; //"sec-ecrt";
+ public static final String SEC_TRUST = "CreateTrustDB"; //"sec-trust";
+ public static final String SSL_ON_OFF = "SSLActivate"; //"sec-activate"
+ public static final String SEC_LSTOKEN = "ListToken"; //"sec-lstoken"
+ public static final String SEC_LSMODULE = "ListModule"; //"sec-lsmodule"
+ public static final String SEC_MIGRATE = "KeyCertMigration"; //"sec-migrate"
+ public static final String SEC_ADDMOD = "AddModule"; //"sec-addmod"
+ public static final String SEC_CHANGEPW = "ChangeTrustPW"; //"sec-passwd"
+ public static final String SEC_MGCRL = "CRLListing"; //"sec-mgcrl"
+ public static final String SEC_ICRL = "CRLInstall"; //"sec-icrl"
+ public static final String SEC_ECRL = "GetCRLInfo"; //"sec-ecrl"
+
+ String _URL;
+ ConsoleInfo _consoleInfo;
+
+ //contains the last response from the cgi
+ Response _response = null;
+
+ private static ResourceSet resource = new ResourceSet("com.netscape.admin.certsrv.security.KeyCertTaskInfoResource");
+
+ //Call's the appropriate cgi and pass in the appropriate arguments
+ public Response exec(String operation) throws Exception {
+ String operationURL = _URL + operation;
+
+ Debug.println(operationURL + "\n"+this);
+
+ Comm kComm = null;
+
+ try {
+ kComm = new Comm(operationURL, this, true);
+
+ kComm.setAuth(_consoleInfo.getAuthenticationDN(),
+ _consoleInfo.getAuthenticationPassword());
+ kComm.run();
+ if (kComm.getError() instanceof Exception) {
+ if (kComm.getError() instanceof InterruptedIOException) {
+ throw (new Exception(
+ resource.getString("KeyCertTaskInfo", "timeoutError")));
+ } else if (kComm.getError() instanceof ConnectException) {
+ throw (new Exception(
+ resource.getString("KeyCertTaskInfo", "connectionError")));
+ } else if (kComm.getError() instanceof IOException) {
+ throw (new Exception(
+ resource.getString("KeyCertTaskInfo", "ioError")));
+ } else {
+ throw kComm.getError();
+ }
+ }
+ } catch (Exception e) {
+ throw (new Exception(resource.getString("KeyCertTaskInfo", "serverError")));
+ }
+ Debug.println(kComm.getData());
+ _response = new Response(kComm.getData());
+
+ return (_response);
+ }
+
+ public Response getResponse() {
+ return _response;
+ }
+
+ public KeyCertTaskInfo(ConsoleInfo consoleInfo) {
+ super();
+
+ _consoleInfo = consoleInfo;
+ _URL = consoleInfo.getAdminURL() + "admin-serv/tasks/configuration/";
+ }
+
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/security/KeyCertUtility.java b/base/console/src/com/netscape/admin/certsrv/security/KeyCertUtility.java
new file mode 100644
index 000000000..26032fc0f
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/KeyCertUtility.java
@@ -0,0 +1,113 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import com.netscape.management.nmclf.*;
+import com.netscape.management.client.console.ConsoleInfo;
+import com.netscape.management.client.util.*;
+import javax.swing.*;
+
+import java.awt.SystemColor;
+import java.util.*;
+import java.io.*;
+
+class KeyCertUtility {
+
+ static ResourceSet _resource = null;
+ public static ResourceSet getKeyCertWizardResourceSet() {
+ if (_resource == null) {
+ _resource = new ResourceSet("com.netscape.admin.certsrv.security.KeyCertWizardResource");
+ }
+
+ return _resource;
+ }
+
+ public static String createTokenName(ConsoleInfo consoleInfo) {
+ String tokenName = "";
+
+ tokenName = (String)(consoleInfo.get("SIE"));
+ if (tokenName == null) {
+ Debug.println("SIE entry was not set in the ConsoleInfo...");
+ try {
+ String currentDN = consoleInfo.getCurrentDN().toLowerCase();
+ tokenName = currentDN.substring(currentDN.indexOf("cn=") +
+ 3, currentDN.indexOf(","));
+ } catch (Exception e2) {
+ tokenName = "Unknow-Server";
+ }
+ }
+
+
+ return (tokenName);
+ }
+
+ //replace any occurance of 'val' in 'oldStr' with 'replacement'
+ public static String replace(String oldStr, String val,
+ String replacement) {
+ String output = new String(oldStr);
+
+ int index;
+
+ while ((index = output.indexOf(val)) != -1) {
+ output = output.substring(0, index) + replacement +
+ output.substring(index + val.length());
+ }
+
+ return output;
+ }
+
+ //a valid is a password that has more then 8 character and contain one or more
+ //none alphabetic character
+ public static boolean validPassword(String passwd,
+ String confirmPasswd, ConsoleInfo consoleInfo) {
+ boolean valid = true;
+ if (!(passwd.equals(confirmPasswd))) {
+ valid = false;
+ SuiOptionPane.showMessageDialog(consoleInfo.getFrame(),
+ getKeyCertWizardResourceSet().getString("KeyCertUtility",
+ "passwdMissMatch"));
+ ModalDialogUtil.sleep();
+ } else if (passwd.length() < 8) {
+ valid = false;
+ SuiOptionPane.showMessageDialog(consoleInfo.getFrame(),
+ getKeyCertWizardResourceSet().getString("KeyCertUtility",
+ "lessThen8Char"));
+ ModalDialogUtil.sleep();
+ } else {
+ boolean allChar = true;
+ int length = confirmPasswd.length();
+ for (int i = 0; i < length; i++) {
+ char ch = confirmPasswd.charAt(i);
+ if (!((ch >= 'A') && (ch <= 'Z')) &&
+ !((ch >= 'a') && (ch <= 'z'))) {
+ allChar = false;
+ break;
+ }
+ }
+ if (allChar) {
+ valid = false;
+ SuiOptionPane.showMessageDialog(consoleInfo.getFrame(),
+ getKeyCertWizardResourceSet().getString("KeyCertUtility",
+ "noNumericChar"));
+ ModalDialogUtil.sleep();
+ }
+ }
+
+ return valid;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/KeyCertWizard.java b/base/console/src/com/netscape/admin/certsrv/security/KeyCertWizard.java
new file mode 100644
index 000000000..017647488
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/KeyCertWizard.java
@@ -0,0 +1,328 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import java.io.*;
+
+import javax.swing.*;
+
+import com.netscape.management.client.util.Help;
+import com.netscape.management.client.util.Debug;
+import com.netscape.management.client.console.ConsoleInfo;
+import netscape.ldap.*;
+
+import com.netscape.management.client.util.*;
+
+/**
+ *
+ * Key and certificate setup wizard
+ *
+ * @version 1.0 98/07/10
+ * @author <A HREF="mailto:shihcm@netscape.com">shihcm@netscape.com</A>
+ *
+ */
+public class KeyCertWizard {
+
+ final int FIRSTPAGE = 0;
+
+ WizardObservable wizardObservable;
+ IWizardControl owner;
+ Wizard wizard;
+
+ Vector pages;
+ int thisPage = 0;
+
+ ConsoleInfo _consoleInfo;
+
+ ResourceSet resource;
+ Help help;
+
+ void init(ConsoleInfo consoleInfo, String certName) {
+ UtilConsoleGlobals.getActivatedFrame().setCursor(
+ new Cursor(Cursor.WAIT_CURSOR));
+
+ resource = KeyCertUtility.getKeyCertWizardResourceSet();
+ help = new Help(resource);
+
+ wizardObservable = new WizardObservable(consoleInfo);
+ _consoleInfo = consoleInfo;
+
+ pages = new Vector();
+ pages.addElement(new GuideIntroPane());
+ //((IKeyCertPage)(pages.elementAt(thisPage))).pageShow(wizardObservable);
+ pages.addElement(new CertRequestSelectTokenPane());
+ pages.addElement(new GuideCreateTrustPane());
+ pages.addElement(new CreateTrustPane());
+ StatusPane statusPane = new StatusPane();
+ pages.addElement(statusPane);
+ pages.addElement(new GuideCertRequestPane());
+ pages.addElement(new CertRequestTypePane());
+ pages.addElement(new CertRequestInfoPane());
+ pages.addElement(new CertRequestEnterPasswordPane());
+ pages.addElement(statusPane);
+ pages.addElement(new CertRequestCertPane());
+ pages.addElement(new GuideCertInstallPane());
+ pages.addElement(new CertInstallTypePane());
+ pages.addElement(new CertInstallCertPane());
+ pages.addElement(statusPane);
+ pages.addElement(new CertInstallCertInfoPane());
+ pages.addElement(statusPane);
+
+ wizardObservable.put("statusPane", statusPane);
+
+ try {
+ wizard = new Wizard(null,
+ resource.getString("KeyCertWizard", "title"),
+ new WizardControlListener());
+ } catch (Exception e) {
+ wizard = new Wizard(null, "", new WizardControlListener());
+ }
+
+ if ((certName == null) || (certName.length() == 0)) {
+ wizardObservable.put("certName", "Server-Cert");
+ } else {
+ wizardObservable.put("certName", certName);
+ }
+
+ wizard.setMinimumSize(425, 425);
+ wizard.start();
+ }
+
+
+ /**
+ * Create a key and certificate setup wizard
+ *
+ * @param consoleInfo
+ *
+ */
+ public KeyCertWizard(ConsoleInfo consoleInfo, String certName) {
+ super();
+ init(consoleInfo, certName);
+ }
+
+ /**
+ * Create a key and certificate setup wizard
+ *
+ *
+ *
+ */
+ public KeyCertWizard(ConsoleInfo consoleInfo) {
+ super();
+ init(consoleInfo, null);
+ }
+
+
+ class WizardControlListener implements IWizardPageControl {
+ public JPanel getCurrentPage() {
+ try {
+ return ( (IKeyCertPage)(pages.elementAt(thisPage))).
+ getPanel();
+ } catch (Exception e) {
+ return new JPanel();
+ }
+ }
+
+ public JPanel getNextPage() {
+ IKeyCertPage ipage = (IKeyCertPage)(pages.elementAt(thisPage));
+ UtilConsoleGlobals.getActivatedFrame().setCursor(
+ new Cursor(Cursor.WAIT_CURSOR));
+ try {
+ if (!(ipage.pageHide(wizardObservable))) {
+ //check to see if we need to display some error message
+ //from cgi
+ } else {
+
+
+
+ while (true) {
+ ipage = (IKeyCertPage)(pages.elementAt(++thisPage));
+ if (ipage.pageShow(wizardObservable)) {
+ break;
+ }
+ }
+ if ((ipage instanceof StatusPane) &&
+ ((StatusPane) ipage).hasError()) {
+ owner.setCanGoForward(false);
+ }
+
+ //-2 because we don't want to count the last status page as one of the normal
+ //page. Also it's only managed by the certinfo page.
+ if (thisPage == (pages.size() - 2)) {
+ //owner.setIsLastPage(true);
+ owner.setCanGoForward(false);
+ } else if (thisPage == (pages.size() - 1)) {
+ owner.setCanGoForward(true);
+ owner.setIsLastPage(true);
+ }
+
+ owner.setCanGoBackword(true);
+
+ }
+ }
+ catch (Exception e) {
+ Debug.println(e + ":next page");
+ }
+
+ UtilConsoleGlobals.getActivatedFrame().setCursor(
+ new Cursor(Cursor.DEFAULT_CURSOR));
+ return ipage.getPanel();
+ }
+
+
+ public JPanel getPrevPage() {
+ IKeyCertPage page = null;
+ UtilConsoleGlobals.getActivatedFrame().setCursor(
+ new Cursor(Cursor.WAIT_CURSOR));
+ try {
+ while (true) {
+ page = (IKeyCertPage)(pages.elementAt(--thisPage));
+ if ((page != null) && page.pageShow(wizardObservable)) {
+ break;
+ }
+ }
+
+ owner.setIsLastPage(false);
+ owner.setCanGoForward(true);
+
+ if (thisPage == FIRSTPAGE) {
+ owner.setCanGoBackword(false);
+ }
+
+ if (thisPage == ((pages.size()) - 1)) {
+ owner.setIsLastPage(true);
+ } else if (thisPage == (pages.size() - 2)) {
+ owner.setCanGoForward(false);
+ }
+ } catch (Exception e) {
+ Debug.println(e + ":prev page");
+ }
+
+ UtilConsoleGlobals.getActivatedFrame().setCursor(
+ new Cursor(Cursor.DEFAULT_CURSOR));
+ return page.getPanel();
+ }
+
+
+ public void wizardCompleted() {
+ //do clean up
+ cleanUp();
+ }
+ public void wizardCanceled() {
+ //do clean up
+ cleanUp();
+ }
+
+ public void cleanUp() {
+ wizardObservable = null;
+ owner = null;
+ wizard = null;
+
+ pages = null;
+
+ _consoleInfo = null;
+
+ help = null;
+ }
+
+ public void helpInvoked() {
+ Object currentPage = pages.elementAt(thisPage);
+ if (currentPage instanceof GuideIntroPane) {
+ help.help("GuideIntroPane", "help");
+ } else if (currentPage instanceof CertRequestSelectTokenPane) {
+ help.help("SelectToken", "help");
+ } else if (currentPage instanceof GuideCreateTrustPane) {
+ help.help("GuideCreateTrustPane", "help");
+ } else if (currentPage instanceof CreateTrustPane) {
+ help.help("CreateTrustPane", "help");
+ } else if ((currentPage instanceof StatusPane) &&
+ (pages.elementAt(thisPage -
+ 1) instanceof CreateTrustPane)) {
+ help.help("CreateTrustPane", "help");
+ } else if (currentPage instanceof GuideCertRequestPane) {
+ help.help("GuideCertRequestPane", "help");
+ } else if (
+ currentPage instanceof CertRequestEnterPasswordPane) {
+ help.help("CertRequestEnterPasswordPane", "help");
+ } else if (currentPage instanceof CertRequestTypePane) {
+ help.help("CertRequestTypePane", "help");
+ } else if ((currentPage instanceof StatusPane) &&
+ (pages.elementAt(thisPage -
+ 1) instanceof CertRequestTypePane)) {
+ help.help("CertRequestTypePane", "help");
+ } else if (currentPage instanceof CertRequestInfoPane) {
+ help.help("CertRequestInfoPane", "help");
+ } else if (currentPage instanceof CertRequestCertPane) {
+ help.help("CertRequestCertPane", "help");
+ } else if (currentPage instanceof GuideCertInstallPane) {
+ help.help("GuideCertInstallPane", "help");
+ } else if (currentPage instanceof CertInstallTypePane) {
+ help.help("CertInstallTypePane", "help");
+ } else if (currentPage instanceof CertInstallCertPane) {
+ help.help("CertInstallCertPane", "help");
+ } else if ((currentPage instanceof StatusPane) &&
+ (pages.elementAt(thisPage -
+ 1) instanceof CertInstallCertPane)) {
+ help.help("CertInstallCertPane", "help");
+ } else if (currentPage instanceof CertInstallCertInfoPane) {
+ help.help("CertInstallCertInfoPane", "help");
+ } else if ((currentPage instanceof StatusPane) &&
+ (pages.elementAt(thisPage -
+ 1) instanceof CertInstallCertInfoPane)) {
+ help.help("CertInstallCertInfoPane", "help");
+ }
+ }
+
+ public void setOwner(IWizardControl wizardControl) {
+ wizardObservable.put("Wizard", wizardControl);
+
+ owner = wizardControl;
+ }
+ }
+
+
+ /*public static void main(String arg[]) {
+ JFrame f = new JFrame();
+ ConsoleInfo consoleInfo = null;
+ UtilConsoleGlobals.setActivatedFrame(f);
+ f.setSize(400,400);
+
+ try {
+ UIManager.setLookAndFeel("javax.swing.plaf.windows.WindowsLookAndFeel");
+ SwingUtilities.updateComponentTreeUI(f.getContentPane());
+ } catch (Exception e) {}
+
+ f.show();
+ String host = "buddha";
+ try {
+ consoleInfo = new ConsoleInfo(host+".mcom.com", 389, "admin", "admin", "o=airius.com");
+ LDAPConnection connection = new LDAPConnection();
+ consoleInfo.setAdminURL("https://"+host+".mcom.com:8081/");
+ consoleInfo.setBaseDN("cn=admin-serv-"+host+", ou=Netscape SuiteSpot, o=Airius.com");
+ consoleInfo.setCurrentDN("cn=admin-serv-"+host+", ou=Netscape SuiteSpot, o=Airius.com");
+ } catch (Exception e) {System.out.println(e);}
+
+
+ KeyCertWizard kc = new KeyCertWizard(consoleInfo);
+
+ // f.setIconImage((new RemoteImage("com/netscape/management/client/images/AdminServer.gif")).getImage());
+ //f.show();
+ }*/
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/Message.java b/base/console/src/com/netscape/admin/certsrv/security/Message.java
new file mode 100644
index 000000000..96f6bc9f7
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/Message.java
@@ -0,0 +1,241 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import java.util.*;
+import java.io.*;
+import com.netscape.management.client.util.Debug;
+
+class Index {
+ String _indexValue;
+ int _pos;
+
+ public Index(String indexValue, int pos) {
+ _indexValue = indexValue;
+ _pos = pos;
+ }
+
+ public String getIndexValue() {
+ return _indexValue;
+ }
+
+ public int getPos() {
+ return _pos;
+ }
+}
+class Message {
+
+ public final static int NMC_SUCCESS = 0;
+ public final static int NMC_FAILURE = 1;
+ public final static int NMC_WARNING = 2;
+ public final static int NMC_UNKNOWN = 3;
+
+ /* final static int FILE_ERROR = 0;
+ final static int MEMORY_ERROR = 1;
+ final static int SYSTEM_ERROR = 2;
+ final static int INCORRECT_USAGE = 3;
+ final static int ELEM_MISSING = 4;
+ final static int REGISTRY_DATABASE_ERROR = 5;
+ final static int NETWORK_ERROR = 6;
+ final static int GENERAL_FAILURE = 7;
+ final static int APP_ERROR = 8;
+ final static int WARNING = 9;*/
+
+ final static int DEFAULT_ERROR = 3;
+
+ final static String NMC_STATUS = "NMC_Status:";
+ final static String NMC_ERRTYPE = "NMC_ErrType:";
+ final static String NMC_ERRINFO = "NMC_ErrInfo:";
+ final static String NMC_ERRDETAIL = "NMC_ErrDetail:";
+ final static String NMC_DESCRIPTION = "NMC_Description:";
+ final static String NMC_EXTRA = "NMC_EXTRA:";
+
+ int NMC_Status = -1;
+ //int NMC_ErrType = -1;
+ String NMC_ErrType = "";
+ String NMC_ErrInfo = "";
+ String NMC_ErrDetail = "";
+ String NMC_Description = "";
+ String NMC_Extra = "";
+
+ public Message(String message) {
+ Vector indexes = new Vector();
+ int pos1 = message.indexOf(NMC_STATUS);
+ if (pos1 != -1) {
+ indexes.addElement(new Index(NMC_STATUS, pos1));
+ }
+
+ int pos2 = message.indexOf(NMC_ERRTYPE);
+ if (pos2 != -1) {
+ indexes.addElement(new Index(NMC_ERRTYPE, pos2));
+ }
+
+ int pos3 = message.indexOf(NMC_ERRINFO);
+ if (pos3 != -1) {
+ indexes.addElement(new Index(NMC_ERRINFO, pos3));
+ }
+
+ int pos4 = message.indexOf(NMC_ERRDETAIL);
+ if (pos4 != -1) {
+ indexes.addElement(new Index(NMC_ERRDETAIL, pos4));
+ }
+
+ int pos5 = message.indexOf(NMC_DESCRIPTION);
+ if (pos5 != -1) {
+ indexes.addElement(new Index(NMC_DESCRIPTION, pos5));
+ }
+
+ int extraIndex = message.indexOf('\n',
+ Math.max(
+ Math.max(Math.max(pos1, pos2), Math.max(pos3, pos4)),
+ pos5));
+ if (extraIndex != -1) {
+ NMC_Extra = message.substring(extraIndex + 1, message.length());
+
+ /* temp solution until Yu-Jen can think up another header schema */
+ NMC_Extra =
+ KeyCertUtility.replace(NMC_Extra, "Content-type: text/html", "");
+ }
+ indexes.addElement(new Index(NMC_EXTRA, extraIndex + 1));
+
+ int size = indexes.size();
+ for (int i = 0; i < size - 1; i++) {
+ Index beginIndex = (Index)(indexes.elementAt(i));
+ Index endIndex = (Index)(indexes.elementAt(i + 1));
+ if (beginIndex.getIndexValue().equals(NMC_STATUS)) {
+ String val = message.substring(beginIndex.getPos() +
+ NMC_STATUS.length(), endIndex.getPos());
+ NMC_Status = Integer.parseInt(val.trim());
+ } else if (
+ beginIndex.getIndexValue().equals(NMC_DESCRIPTION)) {
+ NMC_Description = message.substring(beginIndex.getPos() +
+ NMC_DESCRIPTION.length(), endIndex.getPos());
+ } else if (beginIndex.getIndexValue().equals(NMC_ERRTYPE)) {
+ NMC_ErrType = message.substring(beginIndex.getPos() +
+ NMC_ERRTYPE.length(), endIndex.getPos());
+ } else if (beginIndex.getIndexValue().equals(NMC_ERRINFO)) {
+ NMC_ErrInfo = message.substring(beginIndex.getPos() +
+ NMC_ERRINFO.length(), endIndex.getPos());
+ } else if (beginIndex.getIndexValue().equals(NMC_ERRDETAIL)) {
+ NMC_ErrDetail = message.substring(beginIndex.getPos() +
+ NMC_ERRDETAIL.length(), endIndex.getPos());
+ }
+ }
+
+ }
+
+ public int getStatus() {
+ return NMC_Status;
+ }
+
+ public boolean isSuccess() {
+ return (getStatus() == NMC_SUCCESS);
+ }
+ public boolean isFailure() {
+ return (getStatus() == NMC_FAILURE);
+ }
+ public boolean isWarning() {
+ return (getStatus() == NMC_WARNING);
+ }
+ public boolean isUnknown() {
+ return (getStatus() == NMC_UNKNOWN);
+ }
+
+ public String getStatusString() {
+ String status = "";
+ switch (NMC_Status) {
+ case NMC_SUCCESS:
+ status = "Success";
+ break;
+ case NMC_FAILURE:
+ status = "Failure";
+ break;
+ case NMC_WARNING:
+ status = "Warning";
+ break;
+ case NMC_UNKNOWN:
+ status = "Unknown";
+ break;
+ }
+ return status;
+ }
+
+ public String getErrorType() {
+ return NMC_ErrType;
+ }
+
+ /*int getErrorType(String errorType) {
+ int errVal = -1;
+ if (errorType.indexOf("FILE ERROR") != -1) {
+ errVal = FILE_ERROR;
+ } else if (errorType.indexOf("MEMORY ERROR") != -1) {
+ errVal = MEMORY_ERROR;
+ } else if (errorType.indexOf("SYSTEM ERROR") != -1) {
+ errVal = SYSTEM_ERROR;
+ } else if (errorType.indexOf("INCORRECT USAGE") != -1) {
+ errVal = INCORRECT_USAGE;
+ } else if (errorType.indexOf("ELEMENT MISSING") != -1) {
+ errVal = ELEM_MISSING;
+ } else if (errorType.indexOf("REGISTRY DATABASE ERROR") != -1) {
+ errVal = REGISTRY_DATABASE_ERROR;
+ } else if (errorType.indexOf("NETWORK ERROR") != -1) {
+ errVal = NETWORK_ERROR;
+ } else if (errorType.indexOf("GENERAL FAILURE") != -1) {
+ errVal = GENERAL_FAILURE;
+ } else if (errorType.indexOf("APPLICATION ERROR") != -1) {
+ errVal = APP_ERROR;
+ } else if (errorType.indexOf("WARNING") != -1) {
+ errVal = WARNING;
+ }
+ return errVal;
+ }
+
+ public String getErrorTypeString() {
+ String type = "";
+ switch (NMC_ErrType) {
+ case FILE_ERROR : type = "FILE ERROR"; break;
+ case MEMORY_ERROR : type = "MEMORY ERROR"; break;
+ case SYSTEM_ERROR : type = "SYSTEM ERROR"; break;
+ case INCORRECT_USAGE : type = "INCORRECT USAGE"; break;
+ case ELEM_MISSING : type = "ELEMENT MISSING"; break;
+ case REGISTRY_DATABASE_ERROR : type = "REGISTRY DATABASE ERROR"; break;
+ case NETWORK_ERROR : type = "NETWORK ERROR"; break;
+ case GENERAL_FAILURE : type = "GENERAL FAILURE"; break;
+ case APP_ERROR : type = "APPLICATION ERROR"; break;
+ case WARNING : type = "WARNING"; break;
+ default : type = "UNKNOW ERROR"; break;
+ }
+ return type;
+ }*/
+
+ public String getErrorInfo() {
+ return NMC_ErrInfo;
+ }
+
+ public String getErrorDetail() {
+ return NMC_ErrDetail;
+ }
+
+ public String getDescription() {
+ return NMC_Description;
+ }
+
+ public String getExtraMessage() {
+ return NMC_Extra;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/MessageDialog.java b/base/console/src/com/netscape/admin/certsrv/security/MessageDialog.java
new file mode 100644
index 000000000..d303de839
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/MessageDialog.java
@@ -0,0 +1,66 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import javax.swing.*;
+
+import java.awt.SystemColor;
+import java.util.*;
+import com.netscape.management.client.util.UtilConsoleGlobals;
+import com.netscape.management.nmclf.*;
+
+class MessageDialog {
+
+ public static void rpt_success(Message message) {
+ SuiOptionPane.showMessageDialog(
+ UtilConsoleGlobals.getActivatedFrame(),
+ message.getDescription());
+ }
+
+ public static void rpt_error(Message message) {
+ Object m[] = new Object[6];
+ m[0] = message.getErrorType();
+ m[2] = " ";
+ m[1] = message.getErrorInfo();
+ m[3] = message.getErrorDetail();
+ if (message.getExtraMessage().length() != 0) {
+ m[4] = " ";
+ m[5] = message.getExtraMessage();
+ }
+ SuiOptionPane.showMessageDialog((new JFrame()), m);
+ }
+
+ public static void messageDialog(Message cgiMessage) {
+ switch (cgiMessage.getStatus()) {
+ case Message.NMC_SUCCESS:
+ rpt_success(cgiMessage);
+ break;
+ case Message.NMC_FAILURE:
+ rpt_error(cgiMessage);
+ break;
+ case Message.NMC_WARNING:
+ rpt_error(cgiMessage);
+ break;
+ case Message.NMC_UNKNOWN:
+ rpt_success(cgiMessage);
+ break;
+ default :
+ break;
+ }
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/PKCS11AddModuleDialog.java b/base/console/src/com/netscape/admin/certsrv/security/PKCS11AddModuleDialog.java
new file mode 100644
index 000000000..7b5fe12a6
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/PKCS11AddModuleDialog.java
@@ -0,0 +1,165 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import com.netscape.management.client.console.ConsoleInfo;
+
+import javax.swing.*;
+import javax.swing.JFileChooser;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.management.nmclf.*;
+
+
+class PKCS11AddModuleDialog extends AbstractDialog {
+
+ KeyCertTaskInfo taskInfo;
+
+ ResourceSet resource = new ResourceSet("com.netscape.admin.certsrv.security.PKCS11ManagementResource");
+
+ JRadioButton _isDLL;
+ JRadioButton _isJAR;
+ JTextField _dllname = new JTextField(10);
+ JTextField _filename = new JTextField(10);
+
+ boolean moduleAdded;
+
+ protected boolean isAdded() {
+ return moduleAdded;
+ }
+
+ protected void okInvoked() {
+ moduleAdded = false;
+ taskInfo.clear();
+
+ taskInfo.put("filename", _filename.getText());
+ taskInfo.put("format", _isDLL.isSelected() ? "dll" : "jar");
+ if (_isDLL.isSelected())
+ taskInfo.put("dllname", _dllname.getText());
+
+ Response response = null;
+ try {
+ response = taskInfo.exec(taskInfo.SEC_ADDMOD);
+ } catch (Exception e) {
+ SuiOptionPane.showMessageDialog(
+ UtilConsoleGlobals.getActivatedFrame(), e.getMessage());
+ return;
+ }
+
+ try {
+ Message m = (Message)(response.getMessages().elementAt(0));
+ MessageDialog.messageDialog(m);
+ moduleAdded = m.isSuccess();
+ } catch (Exception ex) {}
+
+ if (((Message) response.getMessages().elementAt(0)).getStatus()
+ == Message.NMC_SUCCESS)
+ super.okInvoked();
+ }
+
+ protected void helpInvoked() {
+ Help help = new Help(resource);
+ help.help("PKCS11AddModuleDialog", "help");
+ }
+
+
+ /**
+ * Listen to changes (key strokes or change in text area or text field)
+ * then determain (call setEnableNextButton()) if wizard can proceed
+ */
+ class MyActionListener implements KeyListener, ActionListener {
+ public void keyTyped(KeyEvent e) {}
+ public void keyPressed(KeyEvent e) {}
+ public void keyReleased(KeyEvent e) {}
+ public void actionPerformed(ActionEvent e) {
+ if (e.getActionCommand().equals("ENABLED"))
+ _dllname.setEnabled(_isDLL.isSelected());
+ }
+ }
+
+ public PKCS11AddModuleDialog(ConsoleInfo consoleInfo) {
+ super(null, "", true, OK | CANCEL | HELP);
+
+ setTitle(resource.getString("PKCS11AddModuleDialog", "dialogTitle"));
+
+
+ taskInfo = new KeyCertTaskInfo(consoleInfo);
+
+ Container mainPane = getContentPane();
+ mainPane.setLayout(new GridBagLayout());
+
+ _isDLL = new JRadioButton(
+ resource.getString("PKCS11AddModuleDialog", "DLL"), true);
+ _isJAR = new JRadioButton(
+ resource.getString("PKCS11AddModuleDialog", "JAR"), false);
+
+ ButtonGroup buttonGroup = new ButtonGroup();
+ buttonGroup.add(_isDLL);
+ buttonGroup.add(_isJAR);
+
+ _isDLL.setActionCommand("ENABLED");
+ _isDLL.addActionListener(new MyActionListener());
+ _isJAR.setActionCommand("ENABLED");
+ _isJAR.addActionListener(new MyActionListener());
+
+ GridBagUtil.constrain(mainPane,
+ new JLabel( resource.getString("PKCS11AddModuleDialog",
+ "fileType")), 0, 0, 1, 1, 1.0, 1.0,
+ GridBagConstraints.NORTH,
+ GridBagConstraints.HORIZONTAL, 0, 0,
+ DIFFERENT_COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(mainPane, _isDLL, 0, 1, 1, 1, 1.0, 1.0,
+ GridBagConstraints.NORTH,
+ GridBagConstraints.HORIZONTAL, 0, 0, COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(mainPane, _dllname, 1, 1, 1, 1, 1.0, 1.0,
+ GridBagConstraints.NORTH,
+ GridBagConstraints.HORIZONTAL, 0, 0, COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(mainPane, _isJAR, 0, 2, 1, 1, 1.0, 1.0,
+ GridBagConstraints.NORTH,
+ GridBagConstraints.HORIZONTAL, 0, 0, COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(mainPane, Box.createVerticalGlue(), 0, 3,
+ 1, 1, 1.0, 1.0, GridBagConstraints.NORTH,
+ GridBagConstraints.HORIZONTAL, 0, 0, 0, 0);
+
+ GridBagUtil.constrain(mainPane,
+ new JLabel( resource.getString("PKCS11AddModuleDialog",
+ "fileName")), 0, 4, 1, 1, 1.0, 1.0,
+ GridBagConstraints.NORTH,
+ GridBagConstraints.HORIZONTAL, 0, 0,
+ DIFFERENT_COMPONENT_SPACE, 0);
+
+ GridBagUtil.constrain(mainPane, _filename, 0, 5, 1, 1, 1.0,
+ 1.0, GridBagConstraints.NORTH,
+ GridBagConstraints.HORIZONTAL, 0, 0, COMPONENT_SPACE, 0);
+
+ //getContentPane().add(mainPane);
+
+ pack();
+ setMinimumSize(getSize());
+ }
+
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/security/PKCS11ManagementDialog.java b/base/console/src/com/netscape/admin/certsrv/security/PKCS11ManagementDialog.java
new file mode 100644
index 000000000..277605fc8
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/PKCS11ManagementDialog.java
@@ -0,0 +1,242 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import com.netscape.management.client.console.ConsoleInfo;
+
+import javax.swing.*;
+import javax.swing.border.*;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.management.nmclf.*;
+import netscape.ldap.*;
+
+/**
+ *
+ * Public-Key Cryptography Standards #11 (PKCS#11) Management dialog
+ *
+ * @version 1.0 98/07/10
+ * @author <A HREF="mailto:shihcm@netscape.com">shihcm@netscape.com</A>
+ *
+ */
+public class PKCS11ManagementDialog extends AbstractDialog {
+
+ KeyCertTaskInfo taskInfo;
+ ConsoleInfo _consoleInfo;
+ boolean setupComplete;
+
+ ResourceSet resource = new ResourceSet("com.netscape.admin.certsrv.security.PKCS11ManagementResource");
+
+ JPanel moduleList = new JPanel();
+ JButton bClose;
+ JButton bAdd;
+ JButton bHelp;
+
+ //since can't over load protected and I don't
+ //want the interface to show so...
+
+ private void privateHelpInvoked() {
+ Help help = new Help(resource);
+ help.help("PKCS11ManagementDialog", "help");
+ }
+
+ //since can't over load protected and I don't
+ //want the interface to show so...
+ private void privateCloseInvoked() {
+ super.okInvoked();
+ }
+
+ private JPanel getModuleListPanel() {
+ JPanel moduleListPanel = new JPanel();
+ moduleListPanel.setLayout(new GridBagLayout());
+
+ moduleListPanel.setBorder( new TitledBorder(
+ new CompoundBorder(new EtchedBorder(),
+ new EmptyBorder(SuiConstants.COMPONENT_SPACE,
+ SuiConstants.COMPONENT_SPACE, SuiConstants.COMPONENT_SPACE,
+ SuiConstants.COMPONENT_SPACE)),
+ resource.getString("PKCS11ManagementDialog", "title")));
+
+ JScrollPane scrollPane = new JScrollPane(moduleList,
+ JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+ JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
+ scrollPane.setBorder(
+ new CompoundBorder(UITools.createLoweredBorder(),
+ new EmptyBorder(VERT_COMPONENT_INSET,
+ HORIZ_COMPONENT_INSET, VERT_COMPONENT_INSET,
+ HORIZ_COMPONENT_INSET)));
+ GridBagUtil.constrain(moduleListPanel, scrollPane, 0, 0, 1, 1,
+ 1.0, 1.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+
+
+ return moduleListPanel;
+ }
+
+
+ private PKCS11AddModuleDialog addDialog;
+ private void addInvoked() {
+ addDialog.show();
+ if (addDialog.isAdded()) {
+ setupModules();
+ }
+ }
+
+ class PKCS11ActionListener implements ActionListener {
+ public void actionPerformed(ActionEvent e) {
+ if (e.getActionCommand().equals("CLOSE")) {
+ privateCloseInvoked();
+ } else if (e.getActionCommand().equals("ADD")) {
+ addInvoked();
+
+ } else if (e.getActionCommand().equals("HELP")) {
+ privateHelpInvoked();
+ }
+ }
+ }
+
+ private JPanel getControlPanel() {
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));
+ buttonPanel.setBorder(
+ new EmptyBorder(SuiConstants.VERT_WINDOW_INSET, 0, 0, 0));
+
+
+ PKCS11ActionListener listener = new PKCS11ActionListener();
+
+ bClose = JButtonFactory.createCloseButton(listener);
+ buttonPanel.add(bClose);
+ buttonPanel.add( Box.createRigidArea(
+ new Dimension(SuiConstants.COMPONENT_SPACE, 0)));
+
+ bAdd = JButtonFactory.create(
+ resource.getString("PKCS11ManagementDialog", "add"));
+ buttonPanel.add(bAdd);
+ bAdd.setActionCommand("ADD");
+ bAdd.addActionListener(listener);
+ buttonPanel.add( Box.createRigidArea(
+ new Dimension(SuiConstants.SEPARATED_COMPONENT_SPACE, 0)));
+
+ bHelp = JButtonFactory.createHelpButton(listener);
+ buttonPanel.add(bHelp);
+
+ JButtonFactory.resizeGroup(bHelp, bClose, bAdd);
+
+ return buttonPanel;
+ }
+
+
+ private void setupModules() {
+ taskInfo = new KeyCertTaskInfo(_consoleInfo);
+ taskInfo.put("sie", KeyCertUtility.createTokenName(_consoleInfo));
+ try {
+ taskInfo.exec(taskInfo.SEC_LSMODULE);
+ } catch (Exception e) {
+ SuiOptionPane.showMessageDialog(
+ UtilConsoleGlobals.getActivatedFrame(), e.getMessage());
+ setupComplete = false;
+ return;
+ }
+
+ setModal(true);
+
+ moduleList.removeAll();
+ Vector modules = taskInfo.getResponse().getModuleList();
+ for (int i = 0; i < modules.size(); i++) {
+ moduleList.add(new JLabel((String) modules.elementAt(i)));
+ }
+
+ moduleList.doLayout();
+ moduleList.repaint();
+ }
+
+ /**
+ * Create a PKCS#11 managemnt dialog
+ *
+ * @param consoleInfo Console information
+ *
+ */
+ public PKCS11ManagementDialog(ConsoleInfo consoleInfo) {
+ super(null, "", true, NO_BUTTONS);
+
+ setupComplete = true;
+
+ setTitle(resource.getString("PKCS11ManagementDialog", "dialogTitle"));
+
+
+ //Cursor oldCursor = UtilConsoleGlobals.getRootFrame().getCursor();
+ UtilConsoleGlobals.getActivatedFrame().setCursor(
+ new Cursor(Cursor.WAIT_CURSOR));
+
+ _consoleInfo = consoleInfo;
+ addDialog = new PKCS11AddModuleDialog(_consoleInfo);
+
+ JPanel mainPanel = new JPanel();
+ mainPanel.setLayout(new BorderLayout());
+ mainPanel.add("Center", getModuleListPanel());
+ mainPanel.add("South", getControlPanel());
+
+ getContentPane().add(mainPanel);
+
+ setMinimumSize(400, 275);
+ //setResizable(false);
+
+ moduleList.setLayout(new BoxLayout(moduleList, BoxLayout.Y_AXIS));
+
+ setupModules();
+
+ UtilConsoleGlobals.getActivatedFrame().setCursor(
+ new Cursor(Cursor.DEFAULT_CURSOR));
+
+ if (!setupComplete) {
+ return;
+ }
+
+ show();
+ }
+
+ /*public static void main(String arg[]) {
+ ConsoleInfo consoleInfo = null;
+ String host = "buddha";
+
+ JFrame f = new JFrame();
+ f.setSize(500,500);
+ f.show();
+ UtilConsoleGlobals.setRootFrame(f);
+
+ try {
+ UIManager.setLookAndFeel("javax.swing.plaf.windows.WindowsLookAndFeel");
+ SwingUtilities.updateComponentTreeUI(f.getContentPane());
+ } catch (Exception e) {}
+
+ try {
+ consoleInfo = new ConsoleInfo("awing.mcom.com", 3890, "admin", "admin", "o=mcom.com");
+ LDAPConnection connection = new LDAPConnection();
+ consoleInfo.setAdminURL("http://"+host+".mcom.com:8081/");
+ consoleInfo.setBaseDN("cn=admin-serv-"+host+", ou=Netscape SuiteSpot, o=Airius.com");
+ consoleInfo.setCurrentDN("cn=admin-serv-"+host+", ou=Netscape SuiteSpot, o=Airius.com");
+ } catch (Exception e) {System.out.println(e);}
+
+ PKCS11ManagementDialog d = new PKCS11ManagementDialog(consoleInfo);
+ }*/
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/security/Response.java b/base/console/src/com/netscape/admin/certsrv/security/Response.java
new file mode 100644
index 000000000..5d311d33b
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/Response.java
@@ -0,0 +1,407 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+/**
+ *
+ * Parse the response that was sent back by the cgi
+ *
+ */
+
+import java.util.*;
+import java.io.*;
+import com.netscape.management.client.util.Debug;
+
+//this class need some optimization....
+
+class Response {
+
+ String _response;
+ String _cert = "";
+ Vector _messages = new Vector();
+ Vector _certList = null;
+ CertInfo _certInfo = null;
+ Hashtable _certInstInfo = null;
+
+ Hashtable _ssl2Preference = null;
+ Hashtable _ssl3Preference = null;
+
+ String startCert = "-----BEGIN NEW CERTIFICATE REQUEST-----";
+ String endCert = "-----END NEW CERTIFICATE REQUEST-----";
+ String startCertList = "-----BEGIN CERT LIST-----";
+ String endCertList = "-----END CERT LIST-----";
+ String startCertInfo = "-----BEGIN CERTIFICATE INFO-----";
+ String endCertInfo = "-----END CERTIFICATE INFO-----";
+ String startCRLCertInfo = "-----BEGIN CRL INFO-----";
+ String endCRLCertInfo = "-----END CRL INFO-----";
+
+ String startCertInstInfo = "-----BEGIN CERTIFICATE INSTALL INFO-----";
+ String endCertInstInfo = "-----END CERTIFICATE INSTALL INFO-----";
+ String startCRLCertInstInfo = "-----BEGIN CRL INSTALL INFO-----";
+ String endCRLCertInstInfo = "-----END CRL INSTALL INFO-----";
+
+ boolean _fCert = false, _fCertList = false, _fCertInfo = false,
+ _fCertInstInfo = false;
+ boolean _fsecurityDomestic = false, _fsecurityFortezza = false;
+
+ void parseCertificate(String response) {
+ if (response.indexOf(startCert) != -1) {
+ _cert = response.substring(response.indexOf(startCert),
+ response.indexOf(endCert) + endCert.length());
+ _fCert = true;
+ }
+ }
+
+ void parseCertificateList(String response) {
+ if (response.indexOf(startCertList) != -1) {
+ _certList = new Vector();
+
+ try {
+ BufferedReader stream =
+ new BufferedReader(new StringReader(response));
+ while (!(stream.readLine().equals(startCertList))) {
+ }
+
+ String line;
+ while (!((line = stream.readLine()).equals(endCertList))) {
+ //need to hack the string that return by the NS secutiry code.
+ //it assumes we are working with html
+ line = urlDecode(line);
+ StringTokenizer token =
+ new StringTokenizer(line, "=;\n", false);
+ Debug.print(line);
+
+ String certName = "", certType = "", certExpire = "";
+ try {
+ certName = token.nextToken();
+ certType = token.nextToken();
+ certExpire = token.nextToken();
+ } catch (NoSuchElementException noToken) { }
+
+ _certList.addElement(
+ new CertBasicInfo(certName, certType,
+ certExpire));
+ }
+ } catch (IOException e) {
+ Debug.println(e.getMessage());
+ }
+
+ _fCertList = true;
+ }
+
+ }
+
+ void parseCertificateInfo(String response) {
+ if ((response.indexOf(startCertInfo) != -1) ||
+ (response.indexOf(startCRLCertInfo) != -1)) {
+
+ try {
+ BufferedReader stream =
+ new BufferedReader(new StringReader(response));
+ String line;
+ while (! (((line =
+ stream.readLine()).equals(startCertInfo)) ||
+ (line.equals(startCRLCertInfo)))) {
+ }
+
+ String issuer = "", subject = "", serialNumber = "",
+ version = "", validFrom = "", validTo = "";
+ String fingerPrint = "", trustCert = "", certName = "",
+ certDeleted = "0", certTitle = "";
+
+ while (!((line = stream.readLine()).equals(endCertInfo))
+ && !(line.equals(endCRLCertInfo))) {
+
+ //need to hack the string that was returned by the NS secutiry code.
+ //it assumes we are working with html
+ line = urlDecode(line);
+ StringTokenizer token =
+ new StringTokenizer(line, "=\n", false);
+ Debug.print(line);
+
+
+ try {
+ String keyWord = token.nextToken();
+ if (keyWord.equals("ISSUER")) {
+ //have to hack again because of the stupid html in the data
+ issuer = KeyCertUtility.replace(
+ token.nextToken(), "<br>", "\n");
+ ;
+ } else if (keyWord.equals("SUBJECT")) {
+ subject = KeyCertUtility.replace(
+ token.nextToken(), "<br>", "\n");
+ ;
+ } else if (keyWord.equals("SERIALNUMBER")) {
+ serialNumber = token.nextToken();
+ } else if (keyWord.equals("VERSION")) {
+ version = token.nextToken();
+ } else if (keyWord.equals("NOTBEFORE")) {
+ validFrom = token.nextToken();
+ } else if (keyWord.equals("NOTAFTER")) {
+ validTo = token.nextToken();
+ } else if (keyWord.equals("FINGERPRINT")) {
+ fingerPrint = token.nextToken();
+ } else if (keyWord.equals("TRUSTED")) {
+ trustCert = token.nextToken();
+ } else if (keyWord.equals("CERTNAME")) {
+ certName = token.nextToken();
+ } else if (keyWord.equals("CERTDELETED")) {
+ certDeleted = token.nextToken();
+ } else if (keyWord.equals("CERTTITLE")) {
+ certTitle = token.nextToken();
+ }
+ } catch (NoSuchElementException noToken) {
+ Debug.print(noToken.getMessage());
+ }
+
+ }
+
+ _certInfo = new CertInfo(certName, issuer, subject,
+ serialNumber, version, validFrom, validTo,
+ fingerPrint, trustCert, certDeleted, certTitle);
+ } catch (IOException e) {
+ Debug.println(e.getMessage());
+ }
+
+ _fCertInfo = true;
+ }
+
+ }
+
+ void parseCertificateInstInfo(String response) {
+ if ((response.indexOf(startCertInstInfo) != -1) ||
+ (response.indexOf(startCRLCertInstInfo) != -1)) {
+ _certInstInfo = new Hashtable();
+
+ try {
+ BufferedReader stream =
+ new BufferedReader(new StringReader(response));
+ String line;
+
+ while (! (((line =
+ stream.readLine()).equals(startCertInstInfo))
+ || (line.equals(startCRLCertInstInfo)))) {
+ }
+
+
+ while (! ((line =
+ stream.readLine()).equals(endCertInstInfo)) &&
+ !(line.equals(endCRLCertInstInfo))) {
+ StringTokenizer token =
+ new StringTokenizer(line, "=\n", false);
+ Debug.print(line);
+ try {
+ String key = token.nextToken();
+ String val = token.nextToken();
+ _certInstInfo.put(key, val);
+ } catch (NoSuchElementException noToken) {
+ Debug.print(noToken.getMessage());
+ }
+ }
+ } catch (IOException e) {
+ Debug.println(e.getMessage());
+ }
+ _fCertInstInfo = true;
+ }
+ }
+
+ public static String urlDecode(String urlString) {
+ ByteArrayOutputStream out =
+ new ByteArrayOutputStream(urlString.length());
+
+ for (int i = 0; i < urlString.length(); i++) {
+ int c = (int) urlString.charAt(i);
+ if (c == '+') {
+ out.write(' ');
+ } else if (c == '%') {
+ int c1 = Character.digit(urlString.charAt(++i), 16);
+ int c2 = Character.digit(urlString.charAt(++i), 16);
+ out.write((char)(c1 * 16 + c2));
+ } else {
+ out.write(c);
+ }
+ }
+
+ return out.toString();
+ }
+
+ Vector familyList;
+ public Vector parseFamilyList(String response) {
+ familyList = new Vector();
+ _fsecurityFortezza = false;
+ _fsecurityDomestic = false;
+ try {
+ BufferedReader stream =
+ new BufferedReader(new StringReader(response));
+ String line = null;
+
+ while (!(((line = stream.readLine()).startsWith("NULL")))) {
+ String cipherName = line.substring(0, line.indexOf("="));
+
+ StringTokenizer st = new StringTokenizer(
+ line.substring(line.indexOf("=") + 1,
+ line.length()), ",\n", false);
+ Vector tokenList = new Vector();
+ Hashtable tokenCertList = new Hashtable();
+ while (st.hasMoreTokens()) {
+ String token = st.nextToken();
+ tokenList.addElement(token);
+ tokenCertList.put(token, "");
+ }
+
+ Enumeration e = tokenList.elements();
+ while (e.hasMoreElements()) {
+ String token = (String)(e.nextElement());
+ line = stream.readLine();
+ String certListString = line.substring(
+ (token + "-certs=").length(), line.length());
+ StringTokenizer certNames =
+ new StringTokenizer(certListString, ",\n",
+ false);
+ Vector certList = new Vector();
+ while (certNames.hasMoreTokens()) {
+ certList.addElement(certNames.nextToken());
+ }
+ tokenCertList.put(token, certList);
+ }
+
+ familyList.addElement(
+ new CipherEntry(cipherName, tokenCertList));
+ }
+ if ((line = stream.readLine()).startsWith("security")) {
+ if (line.endsWith("fortezza")) {
+ _fsecurityFortezza = true;
+ _fsecurityDomestic = true;
+ }
+ if (line.endsWith("domestic")) {
+ _fsecurityDomestic = true;
+ }
+ }
+ } catch (Exception e) {
+ Debug.println("com.netscape.admin.certsrv.security.response:"+
+ e.toString());
+ }
+ return familyList;
+ }
+
+
+ Vector moduleList;
+ public Vector parseModuleList(String response) {
+
+ moduleList = new Vector();
+
+ try {
+ BufferedReader stream =
+ new BufferedReader(new StringReader(response));
+ String line = stream.readLine();
+
+ StringTokenizer st = new StringTokenizer(
+ line.substring(line.indexOf("=") + 1,
+ line.length()), ",\n", false);
+ while (st.hasMoreTokens())
+ moduleList.addElement(st.nextToken());
+ } catch (Exception e) {/*System.out.println(e);*/
+ }
+ return moduleList;
+ }
+
+
+ public Response(String response) {
+
+ //Debug.print(response);
+ if (response == null) {
+ return;
+ }
+
+ _response = response;
+
+ int beginIndex = 0, endIndex = 0;
+ while (true) {
+ beginIndex = response.indexOf(Message.NMC_STATUS, endIndex);
+ endIndex = response.indexOf(Message.NMC_STATUS,
+ beginIndex + Message.NMC_STATUS.length());
+ if ((endIndex == -1) && (beginIndex == -1)) {
+ break;
+ }
+ if (endIndex != -1) {
+ _messages.addElement( new Message( KeyCertUtility.replace(
+ response.substring(beginIndex, endIndex), "\r",
+ "")));
+ } else {
+ _messages.addElement( new Message( KeyCertUtility.replace(
+ response.substring(beginIndex,
+ response.length()), "\r", "")));
+ break;
+ }
+ }
+ }
+
+ public Vector getFamilyList() {
+ return parseFamilyList(_response);
+ }
+
+ public Vector getModuleList() {
+ return parseModuleList(_response);
+ }
+
+ public boolean isSecurityDomestic() {
+ return _fsecurityDomestic;
+ }
+
+ public boolean isSecurityFortezza() {
+ return _fsecurityFortezza;
+ }
+ public boolean hasCert() {
+ parseCertificate(_response);
+ return _fCert;
+ }
+ public boolean hasMessage() {
+ return (_messages.size() > 0);
+ }
+
+ public boolean hasCertList() {
+ parseCertificateList(_response);
+ return _fCertList;
+ }
+ public boolean hasCertInfo() {
+ parseCertificateInfo(_response);
+ return _fCertInfo;
+ }
+ public boolean hasCertInstInfo() {
+ parseCertificateInstInfo(_response);
+ return _fCertInstInfo;
+ }
+ public String getCert() {
+ return _fCert ? _cert : "";
+ }
+ public Vector getMessages() {
+ return _messages;
+ }
+ public Vector getCertList() {
+ return _fCertList ? _certList : (new Vector());
+ }
+ public CertInfo getCertInfo() {
+ return _certInfo;
+ }
+ public Hashtable getCertInstInfo() {
+ return _certInstInfo;
+ }
+ public String getServerResponse() {
+ return _response;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/SSL2CipherPreference.java b/base/console/src/com/netscape/admin/certsrv/security/SSL2CipherPreference.java
new file mode 100644
index 000000000..4625a11d5
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/SSL2CipherPreference.java
@@ -0,0 +1,56 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import javax.swing.*;
+
+/**
+ *
+ * Convenient class to construct SSL2 cipher preference toggle pane
+ *
+ * @version 1.0 98/07/10
+ * @author <A HREF="mailto:shihcm@netscape.com">shihcm@netscape.com</A>
+ *
+ *
+ * @see com.netscape.admin.certsrv.security.SSL2CipherSet
+ * @see com.netscape.admin.certsrv.security.ToggleCipherPreferencePane
+ * @see com.netscape.admin.certsrv.security.SSL3CipherPreference
+ */
+public class SSL2CipherPreference extends ToggleCipherPreferencePane implements ICipherConstants {
+
+ //private static final String sslVersion = "SSL 2.0 Ciphers";
+
+ /**
+ * Create a SSL2 cipher preference toggle pane
+ *
+ * @param isDomestic show domestic ssl2 ciphers if true
+ *
+ */
+ public SSL2CipherPreference(boolean isDomestic) {
+ super(new SSL2CipherSet(isDomestic), true);
+ }
+
+ /*public static void main(String arg[]) {
+ JFrame f = new JFrame();
+ f.getContentPane().add(new SSL2CipherPreference(true));
+ f.getContentPane().add(new AbstractCipherPreference(new SSL2CipherSet(true)));
+ f.pack();
+ f.show();
+ }*/
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/SSL2CipherSet.java b/base/console/src/com/netscape/admin/certsrv/security/SSL2CipherSet.java
new file mode 100644
index 000000000..0bdf7684f
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/SSL2CipherSet.java
@@ -0,0 +1,85 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import java.util.Vector;
+
+/**
+ *
+ * Convenient class to construct a SSL2 cipher list.
+ *
+ * @version 1.0 98/07/10
+ * @author <A HREF="mailto:shihcm@netscape.com">shihcm@netscape.com</A>
+ *
+ * @see com.netscape.admin.certsrv.security.SSL2CipherPreference
+ */
+public final class SSL2CipherSet implements ICipherConstants,
+IAbstractCipherSet {
+
+
+ Vector abstractCipherList = new Vector();
+ String title;
+
+ final boolean defaultOn = true;
+
+ /**
+ * Create a SSL2 cipher set
+ *
+ * @param isDomestic show domestic ssl2 ciphers if true
+ *
+ */
+ public SSL2CipherSet(boolean isDomestic) {
+ CipherResourceSet resource = new CipherResourceSet();
+
+ abstractCipherList.addElement( new AbstractCipher(
+ resource.getString("ssl2", "RC4EXPORT"), RC4EXPORT,
+ defaultOn));
+ abstractCipherList.addElement( new AbstractCipher(
+ resource.getString("ssl2", "RC2EXPORT"), RC2EXPORT,
+ defaultOn));
+ if (isDomestic) {
+ abstractCipherList.addElement( new AbstractCipher(
+ resource.getString("ssl2", "RC4"), RC4 , defaultOn));
+ abstractCipherList.addElement( new AbstractCipher(
+ resource.getString("ssl2", "RC2"), RC2 , defaultOn));
+ abstractCipherList.addElement( new AbstractCipher(
+ resource.getString("ssl2", "DES"), DES , defaultOn));
+ abstractCipherList.addElement( new AbstractCipher(
+ resource.getString("ssl2", "DES3"), DES3 , defaultOn));
+ }
+
+ title = resource.getString("ssl2", "CipherTitle");
+ }
+
+ /**
+ * Return title.
+ * For purpose of setting title if cipher is placed in a dialog or TitleBorder
+ *
+ */
+ public String getTitle() {
+ return title;
+ }
+
+ /**
+ * Return cipher list
+ *
+ */
+ public Vector getCipherList() {
+ return abstractCipherList;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/SSL3CipherPreference.java b/base/console/src/com/netscape/admin/certsrv/security/SSL3CipherPreference.java
new file mode 100644
index 000000000..e6773a27e
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/SSL3CipherPreference.java
@@ -0,0 +1,64 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import javax.swing.*;
+
+/**
+ *
+ * Convenient class to construct SSL3 cipher preference toggle pane
+ *
+ * @version 1.0 98/07/10
+ * @author <A HREF="mailto:shihcm@netscape.com">shihcm@netscape.com</A>
+ *
+ *
+ * @see com.netscape.admin.certsrv.security.SSL3CipherSet
+ * @see com.netscape.admin.certsrv.security.ToggleCipherPreferencePane
+ * @see com.netscape.admin.certsrv.security.SSL2CipherPreference
+ */
+public class SSL3CipherPreference extends ToggleCipherPreferencePane implements ICipherConstants {
+
+
+ /**
+ * Create a SSL3 cipher preference toggle pane
+ *
+ * @param isDomestic show domestic ssl3 ciphers if true
+ * @param hasFortezza show fortezza ciphers if true
+ *
+ */
+ public SSL3CipherPreference(boolean isDomestic, boolean hasFortezza) {
+ super(new SSL3CipherSet(isDomestic, hasFortezza), true);
+ }
+
+ /*public static void main(String arg[]) {
+ JFrame f = new JFrame();
+ SSL3CipherPreference s = new SSL3CipherPreference(false, false);
+ f.getContentPane().add(s);
+ f.pack();
+ f.show();
+ String[] my = s.getCipherList();
+ for (int i=0; i <my.length; i++) {
+ System.out.println(my[i]);
+ }
+
+ System.out.println(s.isCipherEnabled(SSL3CipherPreference.FORTEZZA));
+ s.setCipherEnabled(SSL3CipherPreference.FORTEZZA, false);
+ System.out.println(s.isCipherEnabled(SSL3CipherPreference.FORTEZZA));
+ }*/
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/SSL3CipherSet.java b/base/console/src/com/netscape/admin/certsrv/security/SSL3CipherSet.java
new file mode 100644
index 000000000..417ce5d49
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/SSL3CipherSet.java
@@ -0,0 +1,119 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import java.util.Vector;
+
+/**
+ *
+ * Convenient class to construct a SSL3 cipher list.
+ *
+ * @version 1.0 98/07/10
+ * @author <A HREF="mailto:shihcm@netscape.com">shihcm@netscape.com</A>
+ *
+ * @see com.netscape.admin.certsrv.security.SSL3CipherPreference
+ */
+public final class SSL3CipherSet implements ICipherConstants,
+IAbstractCipherSet {
+
+ Vector abstractCipherList = new Vector();
+ String title;
+
+ final boolean defaultOn = true;
+
+ /**
+ * Create a SSL2 cipher set
+ *
+ * @param isDomestic show domestic ssl3 ciphers if true
+ * @param hasFortezza show fortezza ciphers if true
+ *
+ */
+ public SSL3CipherSet(boolean isDomestic, boolean hasFortezza) {
+ CipherResourceSet resource = new CipherResourceSet();
+
+ abstractCipherList.addElement( new AbstractCipher(
+ resource.getString("ssl3", "RSA_RC4_40_MD5"),
+ RSA_RC4_40_MD5 , defaultOn));
+ abstractCipherList.addElement( new AbstractCipher(
+ resource.getString("ssl3", "RSA_RC2_40_MD5"),
+ RSA_RC2_40_MD5 , defaultOn));
+
+ abstractCipherList.addElement( new AbstractCipher(
+ resource.getString("ssl3", "TLS_RSA_DES_SHA"),
+ TLS_RSA_DES_SHA, defaultOn));
+
+ abstractCipherList.addElement( new AbstractCipher(
+ resource.getString("ssl3", "TLS_RSA_RC4_SHA"),
+ TLS_RSA_RC4_SHA, defaultOn));
+
+ if (isDomestic) {
+ abstractCipherList.addElement( new AbstractCipher(
+ resource.getString("ssl3", "RSA_DES_SHA"),
+ RSA_DES_SHA , defaultOn));
+ abstractCipherList.addElement( new AbstractCipher(
+ resource.getString("ssl3", "RSA_RC4_128_MD5"),
+ RSA_RC4_128_MD5 , defaultOn));
+ abstractCipherList.addElement( new AbstractCipher(
+ resource.getString("ssl3", "RSA_3DES_SHA"),
+ RSA_3DES_SHA , defaultOn));
+
+ abstractCipherList.addElement( new AbstractCipher(
+ resource.getString("ssl3", "RSA_FIPS_DES_SHA"),
+ RSA_FIPS_DES_SHA , !defaultOn));
+ abstractCipherList.addElement( new AbstractCipher(
+ resource.getString("ssl3", "RSA_FIPS_3DES_SHA"),
+ RSA_FIPS_3DES_SHA , !defaultOn));
+
+ if (hasFortezza) {
+ abstractCipherList.addElement( new AbstractCipher(
+ resource.getString("ssl3", "FORTEZZA"),
+ FORTEZZA , defaultOn));
+ abstractCipherList.addElement( new AbstractCipher(
+ resource.getString("ssl3", "FORTEZZA_RC4_128_SHA"),
+ FORTEZZA_RC4_128_SHA, defaultOn));
+ abstractCipherList.addElement( new AbstractCipher(
+ resource.getString("ssl3", "FORTEZZA_NULL"),
+ FORTEZZA_NULL , !defaultOn));
+ }
+
+ }
+
+ abstractCipherList.addElement( new AbstractCipher(
+ resource.getString("ssl3", "RSA_NULL_MD5"),
+ RSA_NULL_MD5 , !defaultOn));
+
+ title = resource.getString("ssl3", "CipherTitle");
+ }
+
+ /**
+ * Return title.
+ * For purpose of setting title if cipher is placed in a dialog or TitleBorder
+ *
+ */
+ public String getTitle() {
+ return title;
+ }
+
+ /**
+ * Return cipher list
+ *
+ */
+ public Vector getCipherList() {
+ return abstractCipherList;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/StatusPane.java b/base/console/src/com/netscape/admin/certsrv/security/StatusPane.java
new file mode 100644
index 000000000..9eb5b1ba2
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/StatusPane.java
@@ -0,0 +1,153 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import javax.swing.*;
+import javax.swing.border.*;
+
+import java.util.*;
+import java.awt.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.management.nmclf.*;
+
+class StatusPane extends JPanel implements IKeyCertPage, SuiConstants {
+
+ boolean show = false;
+ boolean error = false;
+
+ MultilineLabel statusText = new MultilineLabel();
+
+ public JPanel getPanel() {
+ show = false;
+ return this;
+ }
+
+ public boolean pageShow(WizardObservable observable) {
+ return show;
+ }
+
+ public boolean pageHide(WizardObservable observable) {
+ show = false;
+ error = false;
+ return true;
+ }
+
+ public void setShow(boolean show) {
+ this.show = show;
+ }
+
+
+ public boolean hasError() {
+ return error;
+ }
+
+ public void setMessage(Vector messages) {
+ String status = "";
+ int nMessage = messages.size();
+ for (int i = 0; i < nMessage; i++) {
+ if (getMessage((Message)(messages.elementAt(i))).length() !=
+ 0) {
+ status += getMessage((Message)(messages.elementAt(i))) +
+ "\n\n";
+ }
+ }
+
+ //((LABELeditor)(statusPane.getCtrlByName("statusText"))).setValueS(status);
+ statusText.setText(status);
+
+ }
+
+ public void setMessage(String message) {
+ statusText.setText(message);
+ }
+
+ public void appendMessage(String message) {
+ StringBuffer sb = new StringBuffer(statusText.getText().trim());
+ sb.append(message);
+ statusText.setText(sb.toString());
+ }
+
+
+ String getMessage(Message message) {
+ String status = "";
+
+ if (message.getStatus() == message.NMC_SUCCESS) {
+ status = message.getDescription() + message.getExtraMessage();
+ } else if (message.getStatus() == message.NMC_FAILURE) {
+ status += message.getErrorType() + "\n";
+ status += message.getErrorInfo() + "\n";
+ status += message.getErrorDetail();
+ error = true;
+ } else if (message.getStatus() == message.NMC_WARNING) {
+ status += message.getDescription();
+ } else if (message.getStatus() == message.NMC_UNKNOWN) {
+ status += message.getDescription();
+ error = true;
+ }
+
+ return status;
+ }
+
+ public void setMessage(Message message) {
+ //((LABELeditor)(statusPane.getCtrlByName("statusText"))).setValueS(getMessage(message));
+ statusText.setText(getMessage(message));
+ }
+
+ public void setLastPage(boolean isLastpage) {
+ if (isLastpage) {
+ next.setText("");
+ } else {
+ next.setText(resource.getString(null, "clickNextToContinue"));
+ }
+ }
+
+
+ ResourceSet resource = KeyCertUtility.getKeyCertWizardResourceSet();
+ JLabel next = new JLabel();
+
+ public StatusPane() {
+ //set up layout here;
+ super();
+
+ //setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
+ setLayout(new GridBagLayout());
+
+ setBorder( new TitledBorder( new CompoundBorder(new EtchedBorder(),
+ new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE,
+ COMPONENT_SPACE, COMPONENT_SPACE)),
+ resource.getString("StatusPane", "title")));
+
+ GridBagUtil.constrain(this, statusText, 0, 0, 1, 1, 1.0, 1.0,
+ GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0,
+ 0, 0, 0);
+
+ GridBagUtil.constrain(this, Box.createVerticalGlue(), 0, 1, 1,
+ 1, 1.0, 1.0, GridBagConstraints.NORTH,
+ GridBagConstraints.BOTH, 0, 0, 0, 0);
+
+ next.setText(resource.getString(null, "clickNextToContinue"));
+
+ GridBagUtil.constrain(this, next, 0, 2, 1, 1, 1.0, 0.0,
+ GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0,
+ 0, 0, 0);
+
+
+ //add(statusText);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/security/ToggleCipherPreferencePane.java b/base/console/src/com/netscape/admin/certsrv/security/ToggleCipherPreferencePane.java
new file mode 100644
index 000000000..eca1e0b02
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/ToggleCipherPreferencePane.java
@@ -0,0 +1,181 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+import javax.swing.*;
+import javax.swing.border.*;
+import javax.swing.plaf.*;
+import java.awt.event.*;
+import java.awt.*;
+
+import com.netscape.management.nmclf.*;
+
+/**
+ *
+ * Convenient class to create a toggle cipher preference pane
+ *
+ * @version 1.0 98/07/10
+ * @author <A HREF="mailto:shihcm@netscape.com">shihcm@netscape.com</A>
+ *
+ * @see com.netscape.admin.certsrv.security.SSL2CipherPreference
+ * @see com.netscape.admin.certsrv.security.SSL3CipherPreference
+ */
+public class ToggleCipherPreferencePane extends AbstractCipherPreference implements ICipherConstants {
+ private JCheckBox on;
+ private JPanel top = new JPanel();
+ boolean _ismodified;
+
+ boolean oldValue;
+
+ /**
+ * Create a toggle cipher preference pane
+ *
+ * @param cipherSet Interface to obtain cipher preference list, and title for toggle pane
+ *
+ */
+ public ToggleCipherPreferencePane(IAbstractCipherSet cipherSet) {
+ this(cipherSet, true);
+ }
+
+ /**
+ * Create a toggle cipher preference pane
+ *
+ *
+ * @param cipherSet Interface to obtain cipher preference list, and title for toggle pane
+ * @param enabled enable/disable toggle pane
+ *
+ */
+ public ToggleCipherPreferencePane(IAbstractCipherSet cipherSet,
+ boolean enabled) {
+ oldValue = enabled;
+
+ on = new JCheckBox(cipherSet.getTitle(), enabled);
+ on.setActionCommand("ENABLED");
+ on.addActionListener(new actionListener());
+
+ top.setAlignmentX(0.0f);
+ top.setLayout(new BoxLayout(top, BoxLayout.Y_AXIS));
+ top.add(on);
+ setBorder( new CompoundBorder(
+ new ToggleBorder(top, SwingConstants.TOP),
+ new EmptyBorder(0, SuiConstants.COMPONENT_SPACE,
+ SuiConstants.COMPONENT_SPACE, 0)));
+ add(top);
+
+ initialize(cipherSet);
+
+ add(Box.createHorizontalGlue());
+ }
+
+ class actionListener implements ActionListener {
+ public void actionPerformed(ActionEvent e) {
+ if (e.getActionCommand().equals("ENABLED")) {
+ _ismodified = true;
+ setEnableAll(on.isSelected());
+ }
+ }
+ }
+
+
+ /**
+ * Enable or disable toggle pane
+ *
+ * @param enable
+ *
+ */
+ public void setEnabled(boolean enable) {
+ on.setSelected(enable);
+ super.setEnableAll(enable);
+ }
+
+ /**
+ * Check weather toggle pane is enabled
+ *
+ */
+ public boolean isEnabled() {
+ return on.isSelected();
+ }
+
+
+ //steal from Mac's layout manager
+ class ToggleBorder extends EtchedBorder {
+ private JComponent _switchPanel;
+ private int _switchAlign;
+
+ public ToggleBorder(JComponent sp, int align) {
+ _switchPanel = sp;
+ _switchAlign = align;
+ }
+
+ public void paintBorder(Component c, Graphics g, int x, int y,
+ int width, int height) {
+ Color save = g.getColor();
+
+ int top = y + (_switchPanel.getHeight() >> 1);
+ int new_height = height - top;
+
+ BorderUIResource.getEtchedBorderUIResource().paintBorder(c,
+ g, x, top, width, new_height);
+ }
+ }
+
+ /**
+ * Check weather any ciphers has been modified
+ *
+ * @see #isModified
+ * @see #setSaved
+ *
+ */
+ public boolean isModified() {
+ return (_ismodified | super.isModified());
+ }
+
+ /**
+ * Reset all changes since last save
+ *
+ * @see #setSaved
+ */
+ public void reset() {
+ setEnabled(oldValue);
+ _ismodified = false;
+ super.reset();
+ }
+
+
+ /**
+ * Set the state to save.
+ *
+ * @see #reset
+ */
+ public void setSaved() {
+ oldValue = isEnabled();
+ _ismodified = false;
+ super.setSaved();
+ }
+
+ /*public static void main(String arg[]) {
+ JFrame f = new JFrame();
+ f.getContentPane().add(new ToggleCipherPreferencePane(new SSL3CipherSet(true, true)));
+ f.pack();
+ f.show();
+ }*/
+
+}
+
+
+
diff --git a/base/console/src/com/netscape/admin/certsrv/security/WizardObservable.java b/base/console/src/com/netscape/admin/certsrv/security/WizardObservable.java
new file mode 100644
index 000000000..ca36816af
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/security/WizardObservable.java
@@ -0,0 +1,48 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.security;
+
+
+import com.netscape.management.client.console.ConsoleInfo;
+
+
+import javax.swing.*;
+import java.awt.event.*;
+import java.util.*;
+
+class WizardObservable extends Hashtable {
+
+
+ KeyCertTaskInfo taskInfo;
+ ConsoleInfo consoleInfo;
+
+ public WizardObservable(ConsoleInfo consoleInfo) {
+ taskInfo = new KeyCertTaskInfo(consoleInfo);
+ this.consoleInfo = consoleInfo;
+ }
+
+ public KeyCertTaskInfo getTaskInfo() {
+ return taskInfo;
+ }
+
+ public ConsoleInfo getConsoleInfo() {
+ return consoleInfo;
+ }
+
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/status/AccessLogDataModel.java b/base/console/src/com/netscape/admin/certsrv/status/AccessLogDataModel.java
new file mode 100644
index 000000000..c0edc5270
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/status/AccessLogDataModel.java
@@ -0,0 +1,43 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.status;
+
+/**
+ * AccessLogDataModel
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.status
+ */
+public class AccessLogDataModel extends LogDataModel {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ //protected String[] mColumns = {DATE, TIME, DETAILS}; //overwrites the default
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public AccessLogDataModel() {
+ //XXX SET CORRECT PARSER HERE
+ super();
+ }
+
+ //parser here
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/status/AuditLogDataModel.java b/base/console/src/com/netscape/admin/certsrv/status/AuditLogDataModel.java
new file mode 100644
index 000000000..39bdffc0e
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/status/AuditLogDataModel.java
@@ -0,0 +1,43 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.status;
+
+/**
+ * AuditLogDataModel
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.status
+ */
+public class AuditLogDataModel extends LogDataModel {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ //protected String[] mColumns = {DATE, TIME, DETAILS}; //overwrites the default
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public AuditLogDataModel() {
+ //XXX SET CORRECT PARSER HERE
+ super();
+ }
+
+ //parser here
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/status/CMSLogPanel.java b/base/console/src/com/netscape/admin/certsrv/status/CMSLogPanel.java
new file mode 100644
index 000000000..5329b1148
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/status/CMSLogPanel.java
@@ -0,0 +1,360 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.status;
+
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.table.*;
+import javax.swing.border.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Log Panel to be displayed at the right hand side
+ * <pre>
+ * Top Panel with filter input:
+ * Number of entries: default 25
+ * Source: default all
+ * Log Level: default warning
+ * </pre>
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.status
+ */
+public abstract class CMSLogPanel extends CMSBasePanel
+ implements IResourceSelectionListener, IRefreshTab, IRefreshTabPanel, MouseListener
+{
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static String PANELNAME = "LOGCONTENT";
+
+ public static int DEFAULT_LOG_ENTRY = 25;
+
+ protected JPanel mFilterPanel, mListPanel, mActionPanel; //panels
+ protected boolean mInit = false; // true if this panel is initialized
+ protected CMSBaseResourceModel mModel;
+ protected LogDataModel mDataModel; //table data model
+
+ protected JScrollPane mScrollPane;
+ protected JTable mTable; //table
+ protected JButton mView, mRefresh, mHelp; //action buttons
+ protected JTextField mNoRecord;
+ protected JComboBox mSource, mLevel, mFile;
+ protected String mHelpToken;
+ protected LogEntryViewDialog mViewer;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSLogPanel( CMSBaseResourceModel model,LogDataModel dataModel) {
+ super(PANELNAME);
+ model.addIResourceSelectionListener(this);
+ mModel = model;
+ mDataModel = dataModel;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * Actual construction of the panel
+ */
+ public void init() {
+ setLayout(new BorderLayout());
+
+ //======== filter panel ======================
+ mFilterPanel = createFilterPanel();
+ add("North",mFilterPanel);
+
+ //======== list panel ========================
+ mListPanel = createListPanel();
+ mListPanel.setBorder(new EmptyBorder(SEPARATED_COMPONENT_SPACE,
+ DIFFERENT_COMPONENT_SPACE - COMPONENT_SPACE,
+ COMPONENT_SPACE,
+ DIFFERENT_COMPONENT_SPACE - COMPONENT_SPACE));
+ add("Center",mListPanel);
+
+ //====== action panel ===========================
+ mActionPanel = createActionPanel();
+ add("South",mActionPanel);
+ updateArchive();
+ refresh();
+ }
+
+ //== IResourceListener ===
+
+ public void select(IResourceObject parent, Object viewInstance) {
+ if (!mInit) {
+ init();
+ mInit = true;
+ }
+
+ //refresh the screen
+ invalidate();
+ validate();
+ repaint(1);
+ }
+
+ public boolean unselect(IResourceObject parent, Object viewInstance) {
+ return true;
+ }
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mRefresh)) {
+ Debug.println("AccessLogPanel: Refresh Log");
+ refresh();
+ }else if (e.getSource().equals(mView)) {
+ if (mDataModel.getRowCount() == 0) {
+ refresh();
+ } else {
+ viewDetail();
+ }
+ }else if (e.getSource().equals(mHelp)) {
+ CMSAdminUtil.help(mHelpToken);
+ } else if (e.getSource().equals(mLevel) || e.getSource().equals(mSource)
+ || e.getSource().equals(mFile)) {
+ Debug.println("AccessLogPanel: Changed Log Level or Source or File");
+ refresh();
+ }
+ }
+
+ public CMSBasePanel getSelectedTab() {
+ return this;
+ }
+
+ //==== MOUSELISTENER ======================
+ public void mouseClicked(MouseEvent e) {
+ //Debug.println("CertRepositoryPanel: mouseClicked() -"+e.toString());
+
+ //we track the double click action on the table entry - View op
+ if(e.getClickCount() == 2) {
+ //Debug.println("View Detail");
+ viewDetail();
+ }
+ }
+
+ public void mousePressed(MouseEvent e) { }
+ public void mouseReleased(MouseEvent e) { }
+ public void mouseEntered(MouseEvent e) { }
+ public void mouseExited(MouseEvent e) { }
+
+ /**
+ * refresh the table data
+ */
+ public void refresh() {
+ mDataModel.removeAllRows();
+ Debug.println("CMSLogPanel: refresh()");
+
+ update();
+
+ mTable.invalidate();
+ mTable.validate();
+ mTable.repaint(1);
+ mScrollPane.invalidate();
+ mScrollPane.validate();
+ mScrollPane.repaint(1);
+ if (mDataModel.getRowCount() > 0) {
+ mTable.setRowSelectionInterval(0,0);
+ }
+ }
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+
+ /**
+ * View the log entry in a dialog box
+ * (no assumption of validity)
+ */
+ protected void viewDetail() {
+ //check item selected
+ if (mTable.getSelectedRow()>= 0) {
+ if (mViewer == null)
+ mViewer = new LogEntryViewDialog(mModel.getFrame());
+ mViewer.showDialog(
+ (String)mDataModel.getValueAt(mTable.getSelectedRow(),0),
+ (String)mDataModel.getValueAt(mTable.getSelectedRow(),1),
+ (String)mDataModel.getValueAt(mTable.getSelectedRow(),2),
+ (String)mDataModel.getValueAt(mTable.getSelectedRow(),3),
+ ((JLabel)mDataModel.getValueAt(mTable.getSelectedRow(),4)).getText());
+ }
+ }
+
+
+ /**
+ * create action button panel
+ */
+ protected JPanel createActionPanel() {
+ //actionlister to this object
+ mView = makeJButton("VIEW");
+ mRefresh = makeJButton("REFRESH");
+ mHelp = makeJButton("HELP");
+ //JButton[] buttons = { mView,mRefresh,mHelp };
+ JButton[] buttons = { mView,mRefresh };
+ return makeJButtonPanel(buttons,true,true);
+ }
+
+ /**
+ * create log listing panel
+ */
+ protected JPanel createListPanel() {
+ mListPanel = new JPanel();
+ mListPanel.setLayout(new BorderLayout());
+
+ //center table
+ mTable = new JTable(mDataModel);
+ mScrollPane = JTable.createScrollPaneForTable(mTable);
+ mScrollPane.setHorizontalScrollBarPolicy(mScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
+ mScrollPane.setVerticalScrollBarPolicy(mScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
+ mTable.setAutoscrolls(true);
+ mTable.addMouseListener(this);
+ //setColumnWidth(mTable);
+ mTable.setAutoResizeMode(mTable.AUTO_RESIZE_OFF);
+ setColumnWidth(mTable);
+ mTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ mListPanel.add("Center",mScrollPane);
+ setLabelCellRenderer(mTable,4);
+ mScrollPane.setBackground(Color.white);
+ return mListPanel;
+ }
+
+
+ protected void setColumnWidth(JTable table) {
+ int i = table.getColumnModel().getColumnCount();
+ for (int x=0; x< i-1; x++) {
+ TableColumn col = table.getColumnModel().getColumn(x);
+ col.setMinWidth(50);
+ col.setResizable( true );
+ }
+ TableColumn col = table.getColumnModel().getColumn(i-1);
+ col.setMinWidth(400);
+ col.setResizable( true );
+ }
+
+ /**
+ * create filter criteria panel
+ */
+ protected JPanel createFilterPanel() {
+ JPanel panel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ panel.setBorder(makeTitledBorder("OPTIONS"));
+ panel.setLayout(gb);
+
+ //entry
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel noRec = makeJLabel("NUMBERREC");
+ mNoRecord = makeJTextField(10);
+ mNoRecord.setText(Integer.toString(DEFAULT_LOG_ENTRY));
+ addEntryField(panel, noRec, mNoRecord, gbc);
+
+ //source and level
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label1 = makeJLabel("SOURCE");
+ mSource = makeJComboBox("SOURCE");
+ JLabel label2 = makeJLabel("LOGLEVEL");
+ mLevel = makeJComboBox("LOGLEVEL");
+ CMSAdminUtil.addEntryField(panel, label1, mSource, label2, mLevel, gbc);
+ mLevel.addActionListener(this);
+ mSource.addActionListener(this);
+
+
+ //file
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.gridheight = gbc.REMAINDER;
+ JLabel label3 = makeJLabel("FILE");
+ mFile = new JComboBox();
+ CMSAdminUtil.addEntryField(panel, label3, mFile, gbc);
+ mFile.addActionListener(this);
+
+ return panel;
+ }
+
+ /**
+ * retrieve log entries from the server side and
+ * populate the data model.
+ */
+ protected abstract void update();
+
+ /**
+ * retrieve archieve log file listing from the server
+ * side and poupulate the combobox
+ */
+ protected abstract void updateArchive();
+
+ //Set the first column's cellrender as label cell
+ protected void setLabelCellRenderer(JTable table, int index) {
+ table.getColumnModel().getColumn(index).setCellRenderer(new LabelCellRenderer(new JLabel()));
+ }
+
+ //=== OVERWRITE DIALOG MESSAGE =====================
+
+ protected void showMessageDialog(String keyword, int messageType ) {
+ CMSAdminUtil.showMessageDialog(mModel.getFrame(), mResource, mPanelName, keyword, messageType);
+ }
+
+ protected void showMessageDialog(String keyword) {
+ showMessageDialog(keyword, ERROR_MESSAGE);
+ }
+
+ protected int showConfirmDialog(String keyword, int messageType ) {
+ return CMSAdminUtil.showConfirmDialog(mModel.getFrame(), mResource, mPanelName, keyword, messageType);
+ }
+
+ protected int showConfirmDialog(String keyword) {
+ return showConfirmDialog(keyword, WARNING_MESSAGE);
+ }
+
+ protected void showErrorDialog(String message) {
+ CMSAdminUtil.showErrorDialog(mModel.getFrame(), mResource, message, ERROR_MESSAGE);
+ }
+
+
+ private static void addEntryField(JPanel panel, JComponent label,
+ JComponent field, GridBagConstraints gbc) {
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.gridx = 0;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,0,0);
+ panel.add( label, gbc );
+
+ gbc.gridx++;
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ 0,DIFFERENT_COMPONENT_SPACE);
+ panel.add( field, gbc );
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/status/DefaultLogParser.java b/base/console/src/com/netscape/admin/certsrv/status/DefaultLogParser.java
new file mode 100644
index 000000000..b69eac3a6
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/status/DefaultLogParser.java
@@ -0,0 +1,118 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.status;
+
+import java.awt.*;
+import java.util.*;
+import java.text.*;
+import java.io.*;
+import java.awt.event.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Parse the log in the following default format:
+ * pid.thread - [SIMPLEDATEFORMAT][resource][level][message]
+ *
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.status
+ */
+class DefaultLogParser implements ILogParser {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private final String SOURCE_PROPERTY = "LOGCONTENT_COMBOBOX_SOURCE_VALUE_";
+ private final String LEVEL_PROPERTY = "LOGCONTENT_COMBOBOX_LOGLEVEL_VALUE_";
+
+ private final String DATE_PATTERN = "dd/MMM/yyyy:hh:mm:ss z";
+ protected ResourceBundle mResource;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public DefaultLogParser() {
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public Vector parse(Object entry) throws ParseException {
+ String logEntry = (String)entry;
+ //parsing the log Entry and return segments
+ //Debug.println("LogDataModel: DefaultLogParser: parse() -" +logEntry);
+ int x = logEntry.indexOf("[");
+ if (x == -1)
+ throw new ParseException(logEntry,0);
+ String temp = logEntry.substring(x+1);
+ x = temp.indexOf("]");
+ if (x == -1)
+ throw new ParseException(logEntry,0);
+
+ String dateStr = temp.substring(0,x);
+ //Debug.println("LogDataModel: DefaultLogParser: parse() -"+dateStr+" "+temp);
+ SimpleDateFormat format = new SimpleDateFormat(DATE_PATTERN);
+ Date date = format.parse(dateStr);
+ String dateColumn = DateFormat.getDateInstance().format(date);
+ String timeColumn = DateFormat.getTimeInstance().format(date);
+
+ //Debug.println("LogDataModel: DefaultLogParser: parse() -"+dateColumn+" "+timeColumn);
+ temp = temp.substring(x+2);
+ x = temp.indexOf("]");
+ if (x == -1)
+ throw new ParseException(logEntry,0);
+ String source = temp.substring(1,x);
+ temp = temp.substring(x+2);
+ x = temp.indexOf("]");
+ if (x == -1)
+ throw new ParseException(logEntry,0);
+ String level = temp.substring(1,x);
+ temp = temp.substring(x+2);
+ Vector row = new Vector();
+ row.addElement(getSourceString(source));
+ row.addElement(getLevelString(level));
+ row.addElement(dateColumn);
+ row.addElement(timeColumn);
+ JLabel detail = new JLabel(temp);
+ detail.setToolTipText(temp);
+ row.addElement(detail);
+ return row;
+ }
+
+ public String getSourceString(String code) {
+ try {
+ return mResource.getString(SOURCE_PROPERTY+code);
+ } catch (MissingResourceException e) {
+ return code;
+ }
+ }
+
+ public String getLevelString(String code) {
+ try {
+ return mResource.getString(LEVEL_PROPERTY+code);
+ } catch (MissingResourceException e) {
+ return code;
+ }
+ }
+
+} \ No newline at end of file
diff --git a/base/console/src/com/netscape/admin/certsrv/status/ErrorLogDataModel.java b/base/console/src/com/netscape/admin/certsrv/status/ErrorLogDataModel.java
new file mode 100644
index 000000000..df97978b5
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/status/ErrorLogDataModel.java
@@ -0,0 +1,43 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.status;
+
+/**
+ * ErrorLogDataModel
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.status
+ */
+public class ErrorLogDataModel extends LogDataModel {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ //protected String[] mColumns = {DATE, TIME, DETAILS}; //overwrites the default
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public ErrorLogDataModel() {
+ //XXX SET CORRECT PARSER HERE
+ super();
+ }
+
+ //parser here
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/status/ILogParser.java b/base/console/src/com/netscape/admin/certsrv/status/ILogParser.java
new file mode 100644
index 000000000..c0defd681
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/status/ILogParser.java
@@ -0,0 +1,38 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.status;
+
+import java.text.*;
+import java.util.*;
+
+/**
+ * Interface for the log parser
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @date 02/04/97
+ */
+public interface ILogParser {
+
+ /**
+ * Parse the log entry into logical data display segments to be displayed
+ * in the table.
+ * Currently, only String object is supported by the log viewer.
+ */
+ public Vector parse(Object logEntry) throws ParseException;
+} \ No newline at end of file
diff --git a/base/console/src/com/netscape/admin/certsrv/status/LogDataModel.java b/base/console/src/com/netscape/admin/certsrv/status/LogDataModel.java
new file mode 100644
index 000000000..61d127524
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/status/LogDataModel.java
@@ -0,0 +1,107 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.status;
+
+import java.awt.*;
+import java.util.*;
+import java.text.*;
+import java.io.*;
+import java.awt.event.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.*;
+
+/**
+ * LogDataModel to be displayed at the right hand side
+ *
+ * We need the log order in REVERSE.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.status
+ */
+public class LogDataModel extends CMSTableModel
+ implements IDataProcessor
+{
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ public static String ILOGENTRY = "ILOGENTRY";
+
+ protected String[] mColumns = {SOURCE, SEVERITY, DATE, TIME, DETAILS};
+ protected ILogParser mParser = null;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public LogDataModel() {
+ super();
+ init(mColumns);
+ }
+
+ public LogDataModel(ILogParser parser) {
+ this();
+ mParser = parser;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * set the log parser
+ */
+ public void setParser(ILogParser parser) {
+ mParser = parser;
+ }
+
+
+ /**
+ * Process data called back
+ */
+ public void processData(Object data) {
+ Vector row;
+ if (mParser == null)
+ mParser = new DefaultLogParser();
+ try {
+ row = mParser.parse((String) data);
+ } catch (ParseException e) {
+ //Debug.println("LogDataModel: processData()");
+ return;
+ }
+ addRow(row);
+ }
+
+ /**
+ * NEED TO OVERWRITE THE TABLE MODEL ADD FUNCTION
+ * SINCE WE ARE PROVIDING REVERSE ORDER ENTRIES IN
+ * LOG FILES
+ */
+ public synchronized void addRow(Vector values) {
+ int row = 0;
+ for (int i=0; i < values.size(); i++) {
+ Vector v = (Vector)_tableColumns.elementAt(i);
+ v.insertElementAt(values.elementAt(i),0);
+ if (i == 0)
+ row = v.size() - 1;
+ }
+ fireTableDataChanged();
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/status/LogEntryViewDialog.java b/base/console/src/com/netscape/admin/certsrv/status/LogEntryViewDialog.java
new file mode 100644
index 000000000..c86ff02ff
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/status/LogEntryViewDialog.java
@@ -0,0 +1,202 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.status;
+
+import com.netscape.admin.certsrv.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import javax.swing.table.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Policy Implementation Information viewer
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class LogEntryViewDialog extends JDialog
+ implements ActionListener
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private String PREFIX = "LOGENTRYVIEWDIALOG";
+
+ private JFrame mParentFrame;
+ private ResourceBundle mResource;
+ private JTextArea mTextArea;
+ private JLabel mSource, mLevel, mDate, mTime;
+
+ private JButton mOK;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public LogEntryViewDialog(JFrame parent) {
+ super(parent,true);
+ mParentFrame = parent;
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ setSize(600, 400);
+ setTitle(mResource.getString(PREFIX+"_TITLE"));
+ setLocationRelativeTo(parent);
+ getRootPane().setDoubleBuffered(true);
+ setDisplay();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * show the windows
+ */
+ public void showDialog(String source, String level,
+ String date, String time, String desc) {
+ //initialize and setup
+ mSource.setText(source);
+ mLevel.setText(level);
+ mDate.setText(date);
+ mTime.setText(time);
+ mTextArea.setText(desc);
+ mTextArea.setCaretPosition(0);
+ this.show();
+ }
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent evt) {
+ if (evt.getSource().equals(mOK)) {
+ this.hide();
+ }
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+ private void setDisplay() {
+ getContentPane().setLayout(new BorderLayout());
+ JPanel center = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ center.setLayout(gb);
+
+ //content panel
+ JPanel content = makeContentPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(content, gbc);
+ center.add(content);
+
+ //action panel
+ JPanel action = makeActionPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints(action, gbc);
+ center.add(action);
+
+ getContentPane().add("Center",center);
+ }
+
+ private JPanel makeActionPane() {
+ mOK = CMSAdminUtil.makeJButton(mResource, PREFIX, "OK", null, this);
+ Dimension d = mOK.getMinimumSize();
+ if (d.width < CMSAdminUtil.DEFAULT_BUTTON_SIZE) {
+ d.width = CMSAdminUtil.DEFAULT_BUTTON_SIZE;
+ mOK.setMinimumSize(d);
+ }
+ JButton[] buttons = {mOK};
+ return CMSAdminUtil.makeJButtonPanel( buttons );
+ }
+
+ private JPanel makeContentPane() {
+ JPanel content = new JPanel();
+ GridBagLayout gb3 = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ content.setLayout(gb3);
+ //content.setBorder(CMSAdminUtil.makeEtchedBorder());
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label1 = CMSAdminUtil.makeJLabel(mResource, PREFIX, "SOURCE", null);
+ mSource = new JLabel();
+ CMSAdminUtil.addEntryField(content, label1, mSource, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label2 = CMSAdminUtil.makeJLabel(mResource, PREFIX, "LEVEL", null);
+ mLevel = new JLabel();
+ CMSAdminUtil.addEntryField(content, label2, mLevel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label3 = CMSAdminUtil.makeJLabel(mResource, PREFIX, "DATE", null);
+ mDate = new JLabel();
+ CMSAdminUtil.addEntryField(content, label3, mDate, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label4 = CMSAdminUtil.makeJLabel(mResource, PREFIX, "TIME", null);
+ mTime = new JLabel();
+ CMSAdminUtil.addEntryField(content, label4, mTime, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label5 = CMSAdminUtil.makeJLabel(mResource, PREFIX, "DESC", null);
+ label5.setHorizontalAlignment(JLabel.RIGHT);
+ gbc.anchor = gbc.NORTHEAST;
+ gbc. insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ gb3.setConstraints(label5, gbc);
+ content.add(label5);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mTextArea = new JTextArea("",40,500);
+ mTextArea.setLineWrap(true);
+ mTextArea.setFont(mSource.getFont());
+ mTextArea.setEditable(false);
+ mTextArea.setBackground(getBackground());
+ JScrollPane scrollPanel = new JScrollPane(mTextArea,
+ JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+ JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ scrollPanel.setAlignmentX(LEFT_ALIGNMENT);
+ scrollPanel.setAlignmentY(TOP_ALIGNMENT);
+ scrollPanel.setBackground(getBackground());
+ scrollPanel.setBorder(BorderFactory.createEmptyBorder());
+ scrollPanel.setPreferredSize(new Dimension(500, 200));
+ //gbc.fill = gbc.VERTICAL;
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx=1.0;
+ gbc.weighty=1.0;
+ gb3.setConstraints(scrollPanel, gbc);
+ content.add(scrollPanel);
+
+ return content;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/status/LogInstancePanel.java b/base/console/src/com/netscape/admin/certsrv/status/LogInstancePanel.java
new file mode 100644
index 000000000..dc6a8da27
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/status/LogInstancePanel.java
@@ -0,0 +1,157 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.status;
+
+
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.*;
+
+import java.awt.event.*;
+
+/**
+ * Transactions Log Panel to be displayed at the right hand side
+ *
+ * @author Jack Pan-Chen
+ * @author Michelle Zhao
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.status
+ */
+public class LogInstancePanel extends CMSLogPanel {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private String mSelectedFile;
+ private String mInstanceName;
+ private static final String HELPINDEX = "status-logs-help";
+ private static final String AUDITHELPINDEX = "status-logs-audit-help";
+ private static final String SYSTEMHELPINDEX = "status-logs-system-help";
+ private static final String ERRORHELPINDEX = "status-logs-error-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public LogInstancePanel(CMSBaseResourceModel model) {
+ super(model, new LogDataModel());
+ mHelpToken = HELPINDEX;
+ }
+
+ public LogInstancePanel(String name, CMSBaseResourceModel model) {
+ super(model, new LogDataModel());
+ mInstanceName = name;
+ // xxx this is temperary
+ if (name.equals("transactions"))
+ mHelpToken = AUDITHELPINDEX;
+ else if (name.equals("system"))
+ mHelpToken = SYSTEMHELPINDEX;
+ else if (name.equals("error"))
+ mHelpToken = ERRORHELPINDEX;
+ else
+ mHelpToken = HELPINDEX;
+ }
+
+ /**
+ * retrieve data and process it
+ */
+ protected void update() {
+ AdminConnection connection = mModel.getServerInfo().getAdmin();
+
+ //construct NVP
+ NameValuePairs config = new NameValuePairs();
+ config.put(Constants.PR_LOG_INSTANCE, mInstanceName);
+ config.put(Constants.PR_LOG_ENTRY, mNoRecord.getText().trim());
+ config.put(Constants.PR_LOG_SOURCE, Integer.toString(mSource.getSelectedIndex()));
+ config.put(Constants.PR_LOG_LEVEL, Integer.toString(mLevel.getSelectedIndex()));
+ if ((mFile.getSelectedIndex()< 0) || (mFile.getSelectedIndex()< 0)) {
+ config.put(Constants.PR_LOG_NAME, Constants.PR_CURRENT_LOG);
+ mSelectedFile = mResource.getString("LOGCONTENT_COMBOBOX_FILE_DEFAULT");
+ } else {
+ String filename = (String) mFile.getSelectedItem();
+ if (filename.equalsIgnoreCase(Constants.PR_CURRENT_LOG))
+ filename = Constants.PR_CURRENT_LOG;
+ config.put(Constants.PR_LOG_NAME, filename);
+ mSelectedFile = (String) mFile.getSelectedItem();
+ }
+ NameValuePairs response;
+ mModel.progressStart();
+ try {
+ response = connection.search(DestDef.DEST_LOG_ADMIN,
+ ScopeDef.SC_LOG_CONTENT,
+ config);
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ mModel.progressStop();
+ return;
+ }
+
+ mModel.progressStop();
+ Debug.println(response.toString());
+
+ //update the table
+ for (String entry : response.keySet()) {
+ mDataModel.processData(entry);
+ }
+
+ updateArchive();
+ }
+
+ /**
+ * retrieve archieve log file listing from the server
+ * side and poupulate the combobox
+ */
+ protected void updateArchive() {
+ AdminConnection connection = mModel.getServerInfo().getAdmin();
+ String value = mResource.getString("LOGCONTENT_COMBOBOX_FILE_DEFAULT");
+ mFile.removeAllItems();
+ mFile.addItem(value);
+
+ //get stuff
+ NameValuePairs response;
+ mModel.progressStart();
+ //construct NVP
+ NameValuePairs config = new NameValuePairs();
+ config.put(Constants.PR_LOG_INSTANCE, mInstanceName);
+ try {
+ response = connection.search(DestDef.DEST_LOG_ADMIN,
+ ScopeDef.SC_LOG_ARCH,
+ config);
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ mModel.progressStop();
+ return;
+ }
+
+ //update the combo
+ for (String entry : response.keySet()) {
+ mFile.addItem(entry);
+ }
+ mModel.progressStop();
+ mFile.setSelectedItem(mSelectedFile);
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ super.actionPerformed(e);
+ if (e.getSource().equals(mHelp)) {
+ CMSAdminUtil.help(mHelpToken);
+ }
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/status/StatusPanel.java b/base/console/src/com/netscape/admin/certsrv/status/StatusPanel.java
new file mode 100644
index 000000000..431d0d61f
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/status/StatusPanel.java
@@ -0,0 +1,246 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.status;
+
+import java.awt.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import com.netscape.admin.certsrv.*;
+
+import java.awt.event.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Status to be placed at the right hand side
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.status
+ */
+public class StatusPanel extends CMSBasePanel
+ implements IResourceSelectionListener, IRefreshTab, IRefreshTabPanel
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static String PANEL_NAME = "STATUSPANEL";
+
+ protected boolean mInit = false; // true if this panel is initialized
+ protected JPanel mStatPanel, mActionPanel; //panels
+ protected JButton mRefresh, mHelp; //action buttons
+ protected JLabel mServerName, mServerVersion, mInstallDate, mServerStart, mServerTime;
+
+ protected CMSBaseResourceModel mModel;
+ private AdminConnection mConnection;
+ private static final String HELPINDEX = "status-certsrv-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public StatusPanel(CMSBaseResourceModel model) {
+ super(PANEL_NAME);
+ model.addIResourceSelectionListener(this);
+ mModel = model;
+ mConnection = model.getServerInfo().getAdmin();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * Actual Instanciation of the UI components
+ */
+ public void init() {
+ setLayout(new BorderLayout());
+
+ //======== stat panel ========================
+ mStatPanel = createStatPanel();
+ mStatPanel.setBorder(new EmptyBorder(DIFFERENT_COMPONENT_SPACE,COMPONENT_SPACE,COMPONENT_SPACE,COMPONENT_SPACE));
+ add("Center",mStatPanel);
+
+ //====== action panel ========================
+ mActionPanel = createActionPanel();
+ add("South",mActionPanel);
+ refresh();
+ }
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //== IResourceListener ===
+
+ public void select(IResourceObject parent, Object viewInstance) {
+ if (!mInit) {
+ init();
+ mInit = true;
+ }
+
+ //refresh the screen
+ invalidate();
+ validate();
+ repaint(1);
+ }
+
+ public boolean unselect(IResourceObject parent, Object viewInstance) {
+ return true;
+ }
+
+ public CMSBasePanel getSelectedTab() {
+ return this;
+ }
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mRefresh)) {
+ Debug.println("StatusPanel: Refresh");
+ refresh();
+ }
+ if (e.getSource().equals(mHelp)) {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+ }
+
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+
+ /**
+ * create action button panel
+ */
+ protected JPanel createActionPanel() {
+ //actionlister to this object
+ mRefresh = makeJButton("REFRESH");
+ mHelp = makeJButton("HELP");
+ //JButton[] buttons = { mRefresh,mHelp };
+ JButton[] buttons = { mRefresh };
+ return makeJButtonPanel(buttons,true,true);
+ }
+
+ /**
+ * create log listing panel
+ */
+ protected JPanel createStatPanel() {
+ JPanel outPanel = new JPanel();
+ GridBagLayout gb2 = new GridBagLayout();
+ GridBagConstraints gbc2 = new GridBagConstraints();
+ outPanel.setLayout(gb2);
+
+ JPanel panel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ panel.setLayout(gb);
+ panel.setBorder(CMSAdminUtil.makeTitledBorder(mResource, PANEL_NAME, "GENERALINFO"));
+
+ CMSAdminUtil.resetGBC(gbc2);
+ gbc2.anchor = gbc2.NORTH;
+ gbc2.weightx = 1.0;
+ gbc2.weighty = 1.0;
+ gbc2.gridwidth = gbc2.REMAINDER;
+ gbc2.gridheight = gbc2.REMAINDER;
+ outPanel.add(panel, gbc2);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label1 = makeJLabel("SERVERNAME");
+ mServerName = new JLabel();
+ CMSAdminUtil.addEntryField(panel, label1, mServerName, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label2 = makeJLabel("SERVERVERSION");
+ mServerVersion = new JLabel();
+ CMSAdminUtil.addEntryField(panel, label2, mServerVersion, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label5 = makeJLabel("INSTALLDATE");
+ mInstallDate = new JLabel();
+ CMSAdminUtil.addEntryField(panel, label5, mInstallDate, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label3 = makeJLabel("SERVERSTARTUP");
+ mServerStart = new JLabel();
+ CMSAdminUtil.addEntryField(panel, label3, mServerStart, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ JLabel label4 = makeJLabel("SERVERTIME");
+ mServerTime = new JLabel();
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.gridx = 0;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,COMPONENT_SPACE,0);
+ panel.add( label4, gbc );
+
+ gbc.gridx++;
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ panel.add( mServerTime, gbc );
+
+ return outPanel;
+ }
+
+
+ //=============================================
+ // SEND REQUESTS TO THE SERVER SIDE
+ //=============================================
+
+ //retrieve stat from server
+ public void refresh() {
+
+ NameValuePairs params = new NameValuePairs();
+ params.put(Constants.PR_STAT_STARTUP, "");
+ params.put(Constants.PR_STAT_TIME, "");
+
+ NameValuePairs response;
+ mModel.progressStart();
+ try {
+ response = mConnection.read(DestDef.DEST_SERVER_ADMIN,
+ ScopeDef.SC_STAT,
+ Constants.RS_ID_CONFIG,
+ params);
+ } catch (EAdminException e) {
+ //display error dialog
+ CMSAdminUtil.showErrorDialog(mModel.getFrame(), mResource,
+ e.toString(), ERROR_MESSAGE);
+ mModel.progressStop();
+ return;
+ }
+
+ mModel.progressStop();
+ Debug.println("StatusPanel: refresh() "+ response.toString());
+
+ //populate data
+ mServerName.setText(response.get(Constants.PR_STAT_INSTANCEID));
+ mServerVersion.setText(response.get(Constants.PR_STAT_VERSION));
+ mInstallDate.setText(response.get(Constants.PR_STAT_INSTALLDATE));
+ mServerStart.setText(response.get(Constants.PR_STAT_STARTUP));
+ mServerTime.setText(response.get(Constants.PR_STAT_TIME));
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/task/AuthDialog.java b/base/console/src/com/netscape/admin/certsrv/task/AuthDialog.java
new file mode 100644
index 000000000..f4d305096
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/task/AuthDialog.java
@@ -0,0 +1,244 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.task;
+
+import java.awt.*;
+import java.util.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import javax.swing.border.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Display this dialog to get the instance name and password.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ */
+public class AuthDialog extends JDialog
+ implements ActionListener, DocumentListener, MouseListener
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PREFIX = "AUTHDIALOG";
+
+ private static final int WIDTH = 300;
+ private static final int HEIGHT = 150;
+ private JPasswordField mPasswordField;
+ private boolean mCanceled = true; // exit state of the dialog
+ private String mPassword;
+ private JFrame mParentFrame;
+ private ResourceBundle mResource;
+ private JButton mOK, mCancel;
+ private KeyListener mTextFieldKeyListener;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+
+ /**
+ * @param parent parent frame
+ */
+ public AuthDialog(JFrame parent) {
+ super(parent, true);
+ mParentFrame = parent;
+ mResource =
+ ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ mTextFieldKeyListener = new TextFieldKeyListener();
+ setTitle(mResource.getString(PREFIX+"_TITLE"));
+ setLocationRelativeTo(parent);
+
+ JPanel center = new JPanel();
+ getContentPane().setLayout(new BorderLayout());
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ center.setLayout(gb);
+
+ JPanel contentPanel = new JPanel();
+ GridBagLayout gb1 = new GridBagLayout();
+ contentPanel.setLayout(gb1);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(contentPanel, gbc);
+ center.add(contentPanel);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel lPassword =
+ new JLabel(mResource.getString(PREFIX+"_LABEL_PASSWORD_LABEL"));
+ mPasswordField = new JPasswordField();
+ mPasswordField.addKeyListener(mTextFieldKeyListener);
+ mPasswordField.getDocument().addDocumentListener(this);
+ mPasswordField.addMouseListener(this);
+
+ CMSAdminUtil.addEntryField(contentPanel, lPassword, mPasswordField,
+ gbc);
+
+ JPanel actionPanel = makeActionPane();
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints(actionPanel, gbc);
+ center.add(actionPanel);
+
+ getContentPane().add("Center",center);
+
+ mCanceled=false;
+ mPassword = "";
+
+ setSize( WIDTH, HEIGHT );
+
+ addWindowListener(
+ new WindowAdapter() {
+ public void windowOpened(WindowEvent e) {
+ mPasswordField.requestFocus();
+ }
+ }
+ );
+
+ addWindowListener(
+ new WindowAdapter() {
+ public void windowClosing(WindowEvent e) {
+ //setVisible(false);
+ dispose();
+ mCanceled = true;
+ }
+ }
+ );
+
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * return the exit status of the dialog
+ *
+ * @return true if the user hits the cancel button.
+ */
+ public boolean isCancel() {
+ return mCanceled;
+ }
+
+ public String getPassword() {
+ return mPassword;
+ }
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+ public void actionPerformed(ActionEvent evt) {
+ if (evt.getSource().equals(mOK)) {
+ mPassword = mPasswordField.getText().trim();
+ mCanceled = false;
+ //setVisible(false);
+ this.dispose();
+ return;
+
+ }
+ if (evt.getSource().equals(mCancel)) {
+ //setVisible(false);
+ mCanceled = true;
+ this.dispose();
+ return;
+ }
+ }
+
+ //== DocumentListener ==
+ public void insertUpdate(DocumentEvent e) {
+ setButtons();
+ }
+
+ public void removeUpdate(DocumentEvent e){
+ setButtons();
+ }
+
+ public void changedUpdate(DocumentEvent e){
+ setButtons();
+ }
+
+ //==== MOUSELISTENER ======================
+ public void mouseClicked(MouseEvent e) {
+ setButtons();
+ }
+
+ public void mousePressed(MouseEvent e) {}
+ public void mouseReleased(MouseEvent e) {}
+ public void mouseEntered(MouseEvent e) {}
+ public void mouseExited(MouseEvent e) {
+ setButtons();
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+
+ private JPanel makeActionPane() {
+ mOK = CMSAdminUtil.makeJButton(mResource, PREFIX, "OK", null,
+ this);
+ mOK.setEnabled(false);
+ mCancel = CMSAdminUtil.makeJButton(mResource, PREFIX, "CANCEL",
+ null, this);
+
+ JButton[] buttons = { mOK, mCancel};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonPanel(buttons, false);
+ }
+
+ //set buttons
+ private void setButtons() {
+ if (mPasswordField.getText().trim().equals("")){
+ mOK.setEnabled(false);
+ } else {
+ mOK.setEnabled(true);
+ getRootPane().setDefaultButton(mOK);
+ }
+ }
+
+ /**
+ * Inner class which handles key events for JTextField components.
+ */
+ class TextFieldKeyListener implements KeyListener
+ {
+ public void keyTyped(KeyEvent e) {
+ }
+
+ public void keyPressed(KeyEvent e) {
+ }
+
+ public void keyReleased(KeyEvent e) {
+ if(e.getKeyCode() == KeyEvent.VK_ENTER) {
+ if (!mPasswordField.getText().trim().equals("")) {
+ mOK.doClick();
+ }
+ }
+ }
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/task/CGITask.java b/base/console/src/com/netscape/admin/certsrv/task/CGITask.java
new file mode 100644
index 000000000..8406e1005
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/task/CGITask.java
@@ -0,0 +1,400 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.task;
+
+import com.netscape.admin.certsrv.*;
+import java.util.*;
+import java.io.*;
+import java.net.URL;
+import javax.swing.JFrame;
+import com.netscape.management.client.TaskObject;
+import com.netscape.management.client.IPage;
+import com.netscape.management.client.console.ConsoleInfo;
+import com.netscape.management.client.comm.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Netscape Certificate Server 4.0 CGI base task
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public class CGITask extends CMSTaskObject
+ implements CommClient
+{
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PREFIX = "CGITASK";
+
+ protected boolean mFinished = false;
+ protected String mCmd = null;
+ protected String mAdminURL = null;
+ protected boolean mSuccess = false;
+ private String mReply = null;
+ protected String mSection = "";
+ protected String mErrorMsg = "";
+ protected String mWarnMsg = "";
+
+ private boolean mForceBasicAuth = false;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CGITask() {
+ super();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * Force the operation to complete with basic auth, instead
+ * of the default option, which is to first try a non
+ * authenticated request, then an authenticated one.
+ */
+
+ public void setForceBasicAuth(boolean value) {
+ mForceBasicAuth = value;
+ }
+
+ /**
+ * Send an http request to the server and then popup a dialog if the
+ * operation is successful.
+ *
+ * @param viewInstance The calling page
+ */
+ public boolean run(IPage viewInstance) {
+ if ( mCmd == null ) {
+ Debug.println( "Could not get execref for " + getDN() );
+ return false;
+ }
+
+ return run( viewInstance, mCmd );
+ }
+
+ /**
+ * Send an http request to the server. Return true if we're sure it
+ * succeeded, otherwise false.
+ *
+ * @param viewInstance The calling page
+ * @param cmd Command to execute
+ */
+ boolean run(IPage viewInstance, String cmd) {
+
+ // get the admin URL location first
+ mAdminURL = _consoleInfo.getAdminURL();
+ if ( mAdminURL == null ) {
+ Debug.println( "Could not get adminURL for " + getDN() );
+ return false;
+ }
+
+ // Allow specifying e.g. "slapd-install" for instance
+ String instance = (String)_consoleInfo.get( cmd );
+
+ if ( instance == null )
+ instance = (String)_consoleInfo.get( "ServerInstance" );
+ String fullCmd = mAdminURL + instance + "/" + cmd;
+
+ HttpManager h = new HttpManager();
+ // tell the http manager to use UTF8 encoding
+ h.setResponseTimeout(60000);
+ h.setSendUTF8(true);
+
+ try {
+ mSuccess = false;
+ mFinished = false;
+
+ // _consoleInfo.get("arguments") is a hashtable of key/value pairs
+ // to use as the arguments to the CGI
+ Hashtable args = (Hashtable)_consoleInfo.get("arguments");
+ ByteArrayInputStream data = null;
+ if (args != null && !args.isEmpty())
+ data = encode(args);
+ Debug.println( "Posting " + fullCmd );
+ // tell the http manager to notify us immediately of replies
+ // if we're using async mode
+ int flags = 0;
+
+ if (mForceBasicAuth) {
+ flags |= CommManager.FORCE_BASIC_AUTH;
+ }
+
+ if (data == null)
+ h.post(new URL(fullCmd), this, null, null, 0,
+ flags);
+ else
+ h.post(new URL(fullCmd), this, null, data, data.available(),
+ flags);
+ awaitSuccess();
+ Debug.println( "Command executed: " + fullCmd );
+ } catch (Exception e) {
+ if ( e instanceof java.net.ConnectException ) {
+ CMSAdminUtil.showMessageDialog(mResource,
+ PREFIX, "SERVERDOWN", CMSAdminUtil.ERROR_MESSAGE);
+ }
+ Debug.println( "Command " + fullCmd + " failed: " + e );
+ }
+ return mSuccess;
+ }
+
+ /**
+ * waiting for the http transaction to be finished.
+ */
+ public synchronized void awaitSuccess() {
+ while (!mFinished) {
+ try {wait();}
+ catch (Exception e) { }
+ }
+ }
+
+ /**
+ * http transaction finished, notify the process
+ */
+ public synchronized void finish() {
+ mFinished = true;
+ notifyAll();
+ }
+
+ /**
+ * the operation is finished after we receive the http stream
+ */
+ public void replyHandler(InputStream response, CommRecord cr) {
+/*
+ try {
+ int nBytes = response.available();
+ if ( nBytes > 0 ) {
+ // the response from the DS CGIs will typically be in
+ // UTF8 encoding
+ byte[] data = new byte[nBytes];
+ nBytes = response.read( data );
+ mReply = new String( data, 0, nBytes, "UTF8" );
+ Debug.println( "CGITask.replyHandler: Response (" + nBytes +
+ " bytes) = " + mReply );
+ int index = 0;
+ if ((mReply.indexOf("NMC_") != -1) &&
+ ((index = mReply.indexOf(":")) != -1)) {
+ String sName = mReply.substring(0, index).trim();
+ String sValue = mReply.substring(index+1).trim();
+ if (sName.equalsIgnoreCase("NMC_Status")) {
+ int code = Integer.parseInt(sValue);
+ mSuccess = (code == 0);
+ } else if (sName.equalsIgnoreCase("NMC_ERRINFO")) {
+ mErrorMsg = sValue;
+ } else if (sName.equalsIgnoreCase("NMC_WARNINFO")) {
+ mWarnMsg = sValue;
+ }
+ }
+ }
+ } catch ( Exception e ) {
+ Debug.println( "CGITask.replyHandler: " + e.toString() );
+ mSuccess = false;
+ }
+ finish();
+*/
+
+ try {
+ BufferedReader rspStream =
+ new BufferedReader(new InputStreamReader(response, "UTF8"));
+ String rspStr;
+
+ Debug.println("replyHandler() - start");
+ while ((rspStr = rspStream.readLine()) != null)
+ {
+ Debug.println("replyHandler() - read [" + rspStr + "]");
+ // NMC_ messages are parsed, but not shown to the user
+ /*
+ if (_statusText != null && !rspStr.startsWith("NMC_")) {
+ _statusText.append(rspStr + "\n");
+ Thread.yield(); // allow graphics repaints
+ }
+ */
+ Debug.println("Start parsing");
+ parse(rspStr);
+ }
+ } catch (Exception e) {
+ Debug.println("ConfigCert.Exception : " + e.toString());
+ }
+
+ Debug.println("ConfigCert.replyHandler: finished, mSuccess=" +
+ mSuccess);
+
+ finish();
+ }
+
+ /**
+ * return the value for the given keyword in the reply
+ */
+ private void parse(String s) {
+ String sName;
+ String sValue;
+ int iIndex;
+
+ Debug.println("Parse input: " + s);
+
+ if ((iIndex=s.indexOf(":")) != (-1))
+ {
+ sName = s.substring(0, iIndex).trim();
+ sValue = s.substring(iIndex+1).trim();
+ Debug.println("Parse input: name=" + sName + " value=" + sValue);
+ //mWizardInfo.put(sName, sValue);
+/*
+ if (mCgiResponse == null)
+ mCgiResponse = new Hashtable();
+ mCgiResponse.put(sName, sValue);
+*/
+ if (sName.equalsIgnoreCase("NMC_Status"))
+ {
+ int code = Integer.parseInt(sValue);
+ mSuccess = (code == 0);
+ Debug.println("Parse input: code=" + code + " mSuccess=" +
+ mSuccess);
+ } else if (sName.equalsIgnoreCase("NMC_ERRINFO")) {
+ mErrorMsg = sValue;
+ } else if (sName.equalsIgnoreCase("NMC_WARNINFO")) {
+ mWarnMsg = sValue;
+ }
+ }
+
+ Debug.println("Parse finished");
+ }
+
+ public String getErrorMessage() {
+ return mErrorMsg;
+ }
+
+ /**
+ * this function will be called if error occurs
+ */
+ public void errorHandler(Exception error, CommRecord cr) {
+ Debug.println("CGITask.errorHandler: " + error );
+
+ mSuccess = false;
+ finish();
+ }
+
+
+ public String getDN() {
+ return _consoleInfo.getCurrentDN();
+ }
+
+ public String getReply() {
+ return mReply;
+ }
+
+ /**
+ * Return the command, which should have been stored in the info.
+ */
+ private String getCommand() {
+ String s = (String)_consoleInfo.get( "execref" );
+ if ( s != null )
+ return "bin/" + s;
+ return null;
+ }
+
+ /**
+ * pass the username to the admin server
+ */
+ public String username(Object authObject, CommRecord cr) {
+ Debug.println( "username = " +
+ (String)_consoleInfo.getAuthenticationDN());
+ return _consoleInfo.getAuthenticationDN();
+ }
+
+ /**
+ * pass the user password to the admin server
+ */
+ public String password(Object authObject, CommRecord cr) {
+ Debug.println( "password = " +
+ (String)_consoleInfo.get( "AdminUserPassword" ) );
+ return (String)_consoleInfo.get( "AdminUserPassword" );
+ }
+
+/*
+ protected void showDialog( JFrame frame, String msg, String item,
+ boolean error ) {
+ // display a message
+ if ( error ) {
+ DSUtil.showErrorDialog( frame, msg, item, "dirtask" );
+ } else {
+ DSUtil.showInformationDialog( frame, msg, item, "dirtask" );
+ }
+ }
+
+ protected void showResultDialog( boolean success ) {
+ // popup a dialog
+ if ( success ) {
+ showDialog( new JFrame(), mSection+"-success", "",
+ false );
+ } else {
+ showDialog( new JFrame(), mSection+"-failed", "",
+ true );
+ }
+ }
+
+ protected void showResultDialog( int errorCode, String arg ) {
+ // popup a dialog
+ String error = "error-" + Integer.toString( errorCode ) + "-msg";
+ String title = mSection + "-failed-title";
+ DSUtil.showErrorDialog( null,
+ title,
+ error,
+ arg, "dirtask" );
+ }
+
+ protected void showResultDialog( CGIThread thread ) {
+ CGIReportTask task = thread.getTask();
+ if ( task.getStatus() != 0 ) {
+ showResultDialog( task.getStatus(),
+ (String)task.getResult("NMC_ErrInfo") );
+ } else {
+ showResultDialog( task.getStatus() == 0 );
+ }
+ }
+ */
+
+ /**
+ * Translates a hashtable into <code>x-www-form-urlencoded</code> format.
+ * Values are converted from Unicode to UTF8 before URL encoding.
+ *
+ * @param args <code>Hashtable</code> containing name/value pairs to be translated.
+ * @return a ByteArrayInputStream to the translated <code>Hashtable</code> contents.
+ */
+ public static ByteArrayInputStream encode(Hashtable args)
+ {
+ if ((args == null) || (args.size() == 0))
+ return (null);
+
+ String p = "";
+ Enumeration e = args.keys();
+
+ while (e.hasMoreElements())
+ {
+ String name = (String)e.nextElement();
+ String value = URLByteEncoder.encodeUTF8(args.get(name).toString());
+ Debug.println("********** Encoding name --> "+name+" value --> "+value);
+ p += URLByteEncoder.encodeUTF8(name) + "=" +
+ value + (e.hasMoreElements()?"&":"");
+ }
+
+ return new ByteArrayInputStream(p.getBytes());
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/task/CMSCertRequest.java b/base/console/src/com/netscape/admin/certsrv/task/CMSCertRequest.java
new file mode 100644
index 000000000..bf391c4e4
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/task/CMSCertRequest.java
@@ -0,0 +1,418 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.task;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.management.client.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.keycert.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.*;
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import com.netscape.management.client.console.*;
+import com.netscape.management.client.topology.*;
+import com.netscape.management.client.comm.*;
+import java.net.*;
+import java.io.*;
+import netscape.ldap.*;
+import netscape.ldap.util.*;
+
+/**
+ * Perform certificate request in certificate setup wizard.
+ *
+ * @author Michelle Zhao
+ * @version $Revision$, $Date$
+ */
+public class CMSCertRequest extends CGITask {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PREFIX = "CGITASK";
+ private String mCgiTask = null; // CGI task to call
+ private CertSetupWizardInfo mWizardInfo;
+ private String mPolicyMsg = null;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSCertRequest() {
+ super();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public void initialize(CertSetupWizardInfo info) {
+ Debug.println("CMSRequestCert: initialize()");
+ _consoleInfo = info.getAdminConsoleInfo();
+
+ // the results coming back from the daemon will be added to the
+ // wizard information.
+ mWizardInfo = info;
+ }
+
+ /**
+ * Collect the data in name value pairs format and then send them to the
+ * cgi process.
+ */
+ public boolean requestCert(Hashtable data) {
+ boolean status = false; // return value
+
+ try {
+ status = run(data);
+ } catch (Exception e) {
+ Debug.println("Unexpected Error"+e.toString());
+ status = false;
+ }
+ Debug.println("CMSRequestCert: requestCert() after run status=" +
+ status + " mSuccess=" + mSuccess);
+
+ return mSuccess;
+ }
+
+ /**
+ * the operation is finished after we receive the http stream
+ */
+ public void replyHandler(InputStream response, CommRecord cr) {
+ mSuccess = false;
+
+ try {
+ BufferedReader rspStream =
+ new BufferedReader(new InputStreamReader(response, "UTF8"));
+ String rspStr;
+
+ Debug.println("CMSRequestCert: replyHandler() - start");
+ mErrorMsg = mResource.getString("REQUESTRESULTWIZARD_TEXT_ERRORDESC_LABEL");
+ while ((rspStr = rspStream.readLine()) != null && !mSuccess)
+ {
+ Debug.println("RequestCert: replyHandler() - read [" + rspStr + "]");
+ // NMC_ messages are parsed, but not shown to the user
+ parse2(rspStr);
+ }
+ mErrorMsg = mErrorMsg +
+ mResource.getString("REQUESTRESULTWIZARD_TEXT_ERROREND_LABEL");
+ String requestStatus =mWizardInfo.getRequestStatus();
+ if ((mWizardInfo.getRequestError() != null) &&
+ mWizardInfo.getRequestError().equals("true")) {
+ mWizardInfo.setRequestError(mErrorMsg);
+ mErrorMsg = null;
+ mSuccess = true;
+ } else if (requestStatus == null) {
+ // agent port, Unauthorizied access
+ mErrorMsg = mResource.getString("CGITASK_DIALOG_WRONGSERVER_MESSAGE");
+ } else if (requestStatus.equals("5")) {
+ // rejected
+ if (mPolicyMsg == null) {
+ mWizardInfo.setRequestError(mResource.getString("REQUESTRESULTWIZARD_TEXT_NODETAIL_LABEL"));
+ } else {
+ mWizardInfo.setRequestError(mPolicyMsg);
+ mPolicyMsg = null;
+ }
+ mSuccess = true;
+ }
+ // Use the same format for other status:success,pending,svcPending
+ } catch (Exception e) {
+ Debug.println("RequestCert.Exception : " + e.toString());
+ }
+
+ Debug.println("RequestCert.replyHandler: finished, mSuccess=" +
+ mSuccess);
+
+ finish();
+ }
+
+ private void parse2(String s)
+ {
+ int iIndex;
+ Debug.println("Parse2 input: " + s);
+ if ((iIndex=s.indexOf("errorCode")) != (-1))
+ {
+ String errorCode = s.substring(s.indexOf("\"") + 1,
+ s.lastIndexOf("\""));
+ Debug.println("errorCode: " + errorCode);
+ if (errorCode.equals("2")) { // pending
+ mWizardInfo.setRequestError("false");
+ mSuccess = true;
+ mWizardInfo.setRequestStatus("0");
+ } else if (errorCode.equals("1")) { // error
+ mWizardInfo.setRequestError("true");
+ mWizardInfo.setRequestStatus("5");
+ mSuccess = false;
+ } else {
+ mWizardInfo.setRequestError("true");
+ mWizardInfo.setRequestStatus("0");
+ mSuccess = false;
+ }
+ }
+ else if ((iIndex=s.indexOf("requestList.requestId")) != (-1))
+ {
+ String requestId = s.substring(s.indexOf("\"") + 1,
+ s.lastIndexOf("\""));
+ Debug.println("requestId: " + requestId);
+ mWizardInfo.setRequestID(requestId);
+ }
+ else if ((iIndex=s.indexOf("errorReason")) != (-1))
+ {
+ String errorReason = s.substring(s.indexOf("\"") + 1,
+ s.lastIndexOf("\""));
+ Debug.println("errorReason: " + errorReason);
+ mErrorMsg = mErrorMsg + "\n " + errorReason;
+ }
+ }
+
+ /**
+ * return the value for the given keyword in the reply
+ */
+ private void parse(String s) {
+ String sName;
+ String sValue = null;
+ int iIndex;
+
+ Debug.println("Parse input: " + s);
+
+ // XXXX We need to know all possible response.
+ // If cmsgateway changes, this will be broken.
+ if ((iIndex=s.indexOf("requestStatus = ")) != (-1))
+ {
+ sName = s.substring(iIndex + 17).trim();
+ if ((iIndex = sName.indexOf("\"")) != (-1))
+ sValue = sName.substring(0,iIndex);
+
+ Debug.println("Parse input: name=" + sName + " output="
+ + sValue + " index=" + iIndex);
+ if (sValue != null && !sValue.equals("")) {
+ mWizardInfo.setRequestStatus(sValue);
+ if (sValue.equals("2") || sValue.equals("3")
+ || sValue.equals("4"))
+ // success, pending, svcPending
+ mSuccess = true;
+ }
+ }
+ else if ((iIndex=s.indexOf("requestId = ")) != (-1))
+ {
+ sName = s.substring(iIndex + 13).trim();
+ if ((iIndex = sName.indexOf("\"")) != (-1))
+ sValue = sName.substring(0,iIndex);
+
+ Debug.println("Parse input: name=" + sName + " output="
+ + sValue + " index=" + iIndex);
+ if (sValue != null && !sValue.equals("")) {
+ mWizardInfo.setRequestID(sValue);
+ //mSuccess = true;
+ }
+ }
+ else if ((iIndex=s.indexOf("unexpectedError = ")) != (-1))
+ {
+ sName = s.substring(iIndex + 19).trim();
+ if ((iIndex = sName.indexOf("\"")) != (-1))
+ sValue = sName.substring(0,iIndex);
+
+ Debug.println("Parse input: name=" + sName + " output="
+ + sValue + " index=" + iIndex);
+ if (sValue != null && !sValue.equals("")) {
+ mErrorMsg = mErrorMsg + "\n " + sValue;
+ mWizardInfo.setRequestError("true");
+ }
+ }
+ else if ((iIndex=s.indexOf("errorDetails = ")) != (-1))
+ {
+ sName = s.substring(iIndex + 16).trim();
+ if ((iIndex = sName.indexOf("\"")) != (-1))
+ sValue = sName.substring(0,iIndex);
+
+ Debug.println("Parse input: name=" + sName + " output="
+ + sValue + " index=" + iIndex);
+ if (sValue != null && !sValue.equals("")) {
+ mErrorMsg = mErrorMsg + "\n " + sValue;
+ mWizardInfo.setRequestError("true");
+ }
+ }
+ else if ((iIndex=s.indexOf("result.recordSet.length = ")) != (-1))
+ {
+ sName = s.substring(iIndex + 27).trim();
+ if ((iIndex = sName.indexOf("\"")) != (-1))
+ sValue = sName.substring(0,iIndex);
+
+ Debug.println("Parse input: name=" + sName + " output="
+ + sValue + " index=" + iIndex);
+ if (sValue != null && !sValue.equals("") && !sValue.equals("0")) {
+ mErrorMsg = mErrorMsg + mResource.getString("REQUESTRESULTWIZARD_TEXT_DETAIL_LABEL");;
+ }
+ }
+ else if ((iIndex=s.indexOf("errorDescription = ")) != (-1))
+ {
+ sName = s.substring(iIndex + 20).trim();
+ if ((iIndex = sName.indexOf("\"")) != (-1))
+ sValue = sName.substring(0,iIndex);
+
+ Debug.println("Parse input: name=" + sName + " output="
+ + sValue + " index=" + iIndex);
+ if (sValue != null && !sValue.equals("")) {
+ mErrorMsg = mErrorMsg + "\n " + sValue;
+ }
+ }
+ else if ((iIndex=s.indexOf("record.policyMessage=")) != (-1))
+ {
+ sName = s.substring(iIndex + 22).trim();
+ if ((iIndex = sName.indexOf("\"")) != (-1))
+ sValue = sName.substring(0,iIndex);
+
+ Debug.println("Parse input: name=" + sName + " output="
+ + sValue + " index=" + iIndex);
+ if (sValue != null && !sValue.equals("")) {
+ if (mPolicyMsg == null)
+ mPolicyMsg = " " + sValue;
+ else
+ mPolicyMsg = mPolicyMsg + "\n " + sValue;
+ }
+ }
+
+ Debug.println("Parse finished");
+ }
+
+ /**
+ * Send an http request to the server. Return true if we're sure it
+ * succeeded, otherwise false.
+ */
+ boolean run(Hashtable args) {
+
+ String fullCmd = mWizardInfo.getCMEEType() + "://" +
+ mWizardInfo.getCMHost() + ":" +
+ mWizardInfo.getCMEEPort() + "/ca/ee/ca/profileSubmit";
+
+ HttpManager h = new HttpManager();
+ // tell the http manager to use UTF8 encoding
+ h.setSendUTF8(true);
+
+ try {
+ mSuccess = false;
+ mFinished = false;
+
+ ByteArrayInputStream data = null;
+ if (args != null && !args.isEmpty())
+ data = encode(args);
+ Debug.println( "Posting " + fullCmd );
+ // tell the http manager to notify us immediately of replies
+ // if we're using async mode
+ int flags = 0;
+ CommRecord postResult = null;
+ if (data == null)
+ postResult = h.post(new URL(fullCmd), this, null, null, 0,
+ flags);
+ else
+ postResult = h.post(new URL(fullCmd), this, null, data, data.available(),
+ flags);
+
+ /*
+ AdmTask admTask = new AdmTask(new URL(fullCmd),null,null);
+ admTask.setArguments(args);
+ admTask.exec(h);
+ */
+
+ awaitSuccess();
+
+ Object postStatus = postResult.getStatus();
+ //Debug.println("status: " + postStatus);
+ if (postStatus != null &&
+ postStatus.toString().equals(CommRecord.ERROR)) {
+ // If it happens to be it's not CMS server who is listening
+ // e.g. the cms agent port or yahoo server
+ // you may get here
+ mErrorMsg = mResource.getString("CGITASK_DIALOG_WRONGSERVER_MESSAGE");
+ }
+
+ Debug.println( "Command executed: " + fullCmd );
+ } catch (Exception e) {
+ // This is very fragile. We have to handle it case by case.
+ // Handled the ones that I know of properly, but there may
+ // be other cases that I don't know, display the exception
+ // detail.
+ String detail = e.toString();
+ if (detail == null || detail.trim().equals(""))
+ detail = "No detail of the exception provided.";
+ if ( e instanceof java.net.ConnectException ) {
+ mErrorMsg = mResource.getString("CGITASK_DIALOG_CMSDOWN_MESSAGE");
+ //CMSAdminUtil.showMessageDialog(mResource,
+ // PREFIX, "CMSDOWN", CMSAdminUtil.ERROR_MESSAGE);
+ } else if ( e instanceof java.net.NoRouteToHostException ) {
+ // java.net.NoRouteToHostException: Connection timed out
+ // It takes 3-4 mins to time out, looks like hang to impatient
+ // ones. https://www.netscape.com:443
+ mErrorMsg =
+ mResource.getString("CGITASK_DIALOG_CMSDOWN_MESSAGE")
+;
+ } else if ( e instanceof java.net.SocketException ) {
+ if (detail.indexOf("Socket write failed") > -1){
+ // retry
+ run(args);
+ } else if ((detail.indexOf("Connection shutdown") > -1) ||
+ (detail.indexOf("Connection timed out") > -1) ) {
+ // java.net.NoRouteToHostException: Connection timed out
+ // double insurance
+ mErrorMsg =
+ mResource.getString("CGITASK_DIALOG_CMSDOWN_MESSAGE");
+ } else {
+ // need to determine case by case
+ mErrorMsg =
+ mResource.getString("CGITASK_DIALOG_CMSDOWN_MESSAGE")+ " java.net.SocketException: " + detail;
+ }
+
+ } else if ( e instanceof java.io.IOException ) {
+ if (e.toString().indexOf("Broken pipe") > -1){
+ // broken pipe, retry
+ run(args);
+ } else if (detail.indexOf("Unknown public-key algorithm")
+> -1) {
+ mErrorMsg =
+ mResource.getString("CGITASK_DIALOG_UNKNOWNALG_MESSAGE")
+;
+ } else if (detail.indexOf("End of input") > -1) {
+ // http://www.netscape.com:80/enrollment
+ mErrorMsg =
+ mResource.getString("CGITASK_DIALOG_CMSDOWN_MESSAGE")
+;
+ } else if (detail.indexOf("Certificate fingerprint =") > -1) {
+ // reject the cms certificate
+ mErrorMsg =
+ mResource.getString("CGITASK_DIALOG_REJECTCERT_MESSAGE");
+ } else {
+ // need to determine case by case
+ mErrorMsg =
+ mResource.getString("CGITASK_DIALOG_CMSDOWN_MESSAGE"
+) + " java.io.IOException: " + detail;
+ }
+ } else {
+ // need to determine case by case
+ mErrorMsg =
+ mResource.getString("CGITASK_DIALOG_CMSDOWN_MESSAGE")
++ " Exception: " + detail;
+ }
+ Debug.println( "Command " + fullCmd + " failed: " + e );
+ }
+ return mSuccess;
+ }
+
+}
+
+
+
diff --git a/base/console/src/com/netscape/admin/certsrv/task/CMSConfigCert.java b/base/console/src/com/netscape/admin/certsrv/task/CMSConfigCert.java
new file mode 100644
index 000000000..7d85d161f
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/task/CMSConfigCert.java
@@ -0,0 +1,207 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.task;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.management.client.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.config.install.*;
+import com.netscape.admin.certsrv.wizard.WizardBasePanel;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.*;
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import com.netscape.management.client.console.*;
+import com.netscape.management.client.topology.*;
+import com.netscape.management.client.comm.*;
+import java.net.*;
+import java.io.*;
+import netscape.ldap.*;
+import netscape.ldap.util.*;
+
+/**
+ * Perform certificate server configuration.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ */
+public class CMSConfigCert extends CGITask {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PREFIX = "CMSCONFIGCERT";
+
+ public static final String CONFIG_CERT_CGI = "Tasks/Operation/config-cert";
+
+ //private boolean mSuccess = false; // status of last executed CGI
+ //private Hashtable mCgiResponse = null; // holds parsed contents of CGI return
+ private String mCgiTask = null; // CGI task to call
+ private InstallWizardInfo mWizardInfo;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSConfigCert() {
+ super();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public void initialize(InstallWizardInfo info) {
+ _consoleInfo = info.getAdminConsoleInfo();
+
+ // the results coming back from the daemon will be added to the
+ // wizard information.
+ mWizardInfo = info;
+
+ setForceBasicAuth(true);
+ }
+
+ /**
+ * Collect the data in name value pairs format and then send them to the
+ * cgi process.
+ */
+ public boolean configCert(Hashtable data) {
+ JFrame mActiveFrame = UtilConsoleGlobals.getActivatedFrame();
+ if (_consoleInfo.get("AdminUsername") == null)
+ _consoleInfo.put("AdminUsername", _consoleInfo.getAuthenticationDN());
+ Debug.println("AdminUsername = " + _consoleInfo.get("AdminUsername"));
+
+ if (_consoleInfo.get("AdminUserPassword") == null)
+ _consoleInfo.put("AdminUserPassword",
+ _consoleInfo.getAuthenticationPassword());
+ Debug.println("AdminUserPassword = " + _consoleInfo.get("AdminUserPassword"));
+ data.put("AdminUserPassword", _consoleInfo.getAuthenticationPassword());
+ _consoleInfo.put("arguments", data);
+
+ // Send Random value for RNG entropy
+ data.put(ConfigConstants.PR_CMS_SEED, new Long(WizardBasePanel.mSeed).toString());
+
+ boolean status = false; // return value
+
+ Cursor cursor = mActiveFrame.getCursor();
+ int type = cursor.getType();
+ cursor = new Cursor(Cursor.WAIT_CURSOR);
+ mActiveFrame.setCursor(cursor);
+
+ try {
+ status = super.run(null, CONFIG_CERT_CGI);
+ } catch (Exception e) {
+ Debug.println("Unexpected Error"+e.toString());
+ status = false;
+ }
+ Debug.println("CMSConfigCert: configCert() after run status=" +
+ status + " mSuccess=" + mSuccess);
+
+ if (!mSuccess) {
+ Debug.println("Show error dialog");
+ String errorMsg = getErrorMessage();
+/*
+ if (errorMsg == null || errorMsg.equals(""))
+ CMSAdminUtil.showMessageDialog(mActiveFrame, mResource, PREFIX,
+ "SYSTEMERROR", CMSAdminUtil.ERROR_MESSAGE);
+ else
+ JOptionPane.showMessageDialog(mActiveFrame, errorMsg,
+ "Error", CMSAdminUtil.ERROR_MESSAGE,
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_ERROR_ICON));
+*/
+ }
+
+ cursor = new Cursor(type);
+ mActiveFrame.setCursor(cursor);
+
+ return mSuccess;
+ }
+
+ /**
+ * the operation is finished after we receive the http stream
+ */
+ public void replyHandler(InputStream response, CommRecord cr) {
+ mSuccess = false;
+/*
+ if (mCgiResponse != null)
+ mCgiResponse.clear();
+*/
+
+ try {
+ BufferedReader rspStream =
+ new BufferedReader(new InputStreamReader(response, "UTF8"));
+ String rspStr;
+
+ Debug.println("CMSConfigCert: replyHandler() - start");
+ while ((rspStr = rspStream.readLine()) != null)
+ {
+ Debug.println("ConfigCert: replyHandler() - read [" + rspStr + "]");
+ // NMC_ messages are parsed, but not shown to the user
+ /*
+ if (_statusText != null && !rspStr.startsWith("NMC_")) {
+ _statusText.append(rspStr + "\n");
+ Thread.yield(); // allow graphics repaints
+ }
+ */
+ parse(rspStr);
+ }
+ } catch (Exception e) {
+ Debug.println("ConfigCert.Exception : " + e.toString());
+ }
+
+ Debug.println("ConfigCert.replyHandler: finished, mSuccess=" +
+ mSuccess);
+
+ finish();
+ }
+
+ /**
+ * return the value for the given keyword in the reply
+ */
+ private void parse(String s) {
+ String sName;
+ String sValue;
+ int iIndex;
+
+ Debug.println("Parse input: " + s);
+
+ if ((iIndex=s.indexOf(":")) != (-1))
+ {
+ sName = s.substring(0, iIndex).trim();
+ sValue = s.substring(iIndex+1).trim();
+ Debug.println("Parse input: name=" + sName + " value=" + sValue);
+ mWizardInfo.put(sName, sValue);
+/*
+ if (mCgiResponse == null)
+ mCgiResponse = new Hashtable();
+ mCgiResponse.put(sName, sValue);
+*/
+ if (sName.equalsIgnoreCase("NMC_Status"))
+ {
+ int code = Integer.parseInt(sValue);
+ mSuccess = (code == 0);
+ Debug.println("Parse input: code=" + code + " mSuccess=" + mSuccess);
+ } else if (sName.equalsIgnoreCase("NMC_ERRINFO"))
+ mErrorMsg = sValue;
+ Debug.println("ErrorMsg : " + mErrorMsg);
+ }
+
+ Debug.println("Parse finished");
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/task/CMSImportCert.java b/base/console/src/com/netscape/admin/certsrv/task/CMSImportCert.java
new file mode 100644
index 000000000..b285b2284
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/task/CMSImportCert.java
@@ -0,0 +1,429 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.task;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.management.client.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.config.install.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.*;
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import com.netscape.management.client.console.*;
+import com.netscape.management.client.topology.*;
+import com.netscape.management.client.comm.*;
+import java.net.*;
+import java.io.*;
+import netscape.ldap.*;
+import netscape.ldap.util.*;
+
+/**
+ * Perform certificate import.
+ *
+ * @author Michelle Zhao
+ * @version $Revision$, $Date$
+ */
+public class CMSImportCert extends CGITask {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PREFIX = "CGITASK";
+ private String mCgiTask = null; // CGI task to call
+ private InstallWizardInfo mWizardInfo;
+ private String mPolicyMsg = null;
+
+ // To support Thawte's header and footer
+ public static final String BEGIN_PKCS7_HEADER =
+ "-----BEGIN PKCS #7 SIGNED DATA-----";
+ public static final String END_PKCS7_HEADER =
+ "-----END PKCS #7 SIGNED DATA-----";
+ public static final String BEGIN_HEADER = "-----BEGIN CERTIFICATE-----";
+ public static final String END_HEADER = "-----END CERTIFICATE-----";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSImportCert() {
+ super();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public void initialize(InstallWizardInfo info) {
+ Debug.println("CMSImportCert: initialize()");
+ _consoleInfo = info.getAdminConsoleInfo();
+
+ // the results coming back from the daemon will be added to the
+ // wizard information.
+ mWizardInfo = info;
+ }
+
+ /**
+ * Collect the data in name value pairs format and then send them to the
+ * cgi process.
+ */
+ public boolean importCert(Hashtable data) {
+ boolean status = false; // return value
+
+ try {
+ status = run(data);
+ } catch (Exception e) {
+ Debug.println("Unexpected Error"+e.toString());
+ status = false;
+ }
+ Debug.println("CMSImportCert: ImportCert() after run status=" +
+ status + " mSuccess=" + mSuccess);
+
+ return mSuccess;
+ }
+
+ /**
+ * the operation is finished after we receive the http stream
+ */
+ public void replyHandler(InputStream response, CommRecord cr) {
+ mSuccess = false;
+
+ try {
+ BufferedReader rspStream =
+ new BufferedReader(new InputStreamReader(response, "UTF8"));
+ String rspStr;
+
+ Debug.println("CMSImportCert: replyHandler() - start");
+
+ mWizardInfo.setImportError("");
+ while ((rspStr = rspStream.readLine()) != null && !mSuccess)
+ {
+ Debug.println("ImportCert: replyHandler() - read [" + rspStr + "]");
+ // NMC_ messages are parsed, but not shown to the user
+ parse(rspStr);
+ }
+
+ String importError = mWizardInfo.getImportError();
+ if (importError != null && !importError.equals("")) {
+ mErrorMsg = importError;
+ mSuccess = false;
+ } else if (!mSuccess) {
+ // agent port, Unauthorizied access
+ mErrorMsg = mResource.getString("CGITASK_DIALOG_WRONGSERVER_MESSAGE");
+ }
+ } catch (Exception e) {
+ Debug.println("ImportCert.Exception : " + e.toString());
+ }
+
+ Debug.println("ImportCert.replyHandler: finished, mSuccess=" +
+ mSuccess);
+
+ finish();
+ }
+
+ /**
+ * return the value for the given keyword in the reply
+ */
+ private void parse(String s) {
+ String sName;
+ String sValue = null;
+ int iIndex;
+
+ Debug.println("Parse input: " + s);
+
+ if ((iIndex=s.indexOf("status = ")) != (-1))
+ {
+ sName = s.substring(iIndex + 10).trim();
+ if ((iIndex = sName.indexOf("\"")) != (-1))
+ sValue = sName.substring(0,iIndex);
+
+ Debug.println("Parse input: name=" + sName + " output="
+ + sValue + " index=" + iIndex);
+ if (sValue != null && !sValue.equals("")) {
+ if (sValue.equals(ConfigConstants.PENDING_STRING) ||
+ sValue.equals(ConfigConstants.APPROVED_STRING) ||
+ sValue.equals(ConfigConstants.SVC_PENDING_STRING)) {
+ mWizardInfo.setImportError("Request " +
+ mWizardInfo.getRequestID() +
+ " is " + sValue +
+ ".\nYou can contact an authorized agent or local administrator for further assistance by referring to the request ID.");
+ mSuccess = true;
+ } else if (sValue.equals(ConfigConstants.CANCELED_STRING) ||
+ sValue.equals(ConfigConstants.REJECTED_STRING) ) {
+ String stage =
+ getStage(mWizardInfo.getCertType());
+ if (stage != null)
+ mWizardInfo.put(stage, ConfigConstants.FALSE);
+ mWizardInfo.setImportError("Request " +
+ mWizardInfo.getRequestID() +
+ " is " + sValue +
+ ".\nYou can contact an authorized agent or local administrator for further assistance by referring to the request ID." + "\nYou will be able to regenerate a new request if you click back." );
+ mSuccess = true;
+ }
+ }
+ }
+ else if ((iIndex=s.indexOf("pkcs7ChainBase64 = ")) != (-1))
+ {
+ sName = s.substring(iIndex + 20).trim();
+ if ((iIndex = sName.indexOf("\"")) != (-1))
+ sValue = sName.substring(0,iIndex);
+
+ Debug.println("Parse input: name=" + sName + " output="
+ + sValue + " index=" + iIndex);
+ if (sValue != null && !sValue.equals("")) {
+ String val = sValue.trim();
+ String result = normalizeCertStr(val);
+ Debug.println("After removing all the carriage returns:");
+ Debug.println(result);
+ mWizardInfo.setPKCS10(result);
+ mSuccess = true;
+
+ }
+ }
+ else if ((iIndex=s.indexOf("unexpectedError = ")) != (-1))
+ {
+ sName = s.substring(iIndex + 19).trim();
+ if ((iIndex = sName.indexOf("\"")) != (-1))
+ sValue = sName.substring(0,iIndex);
+
+ Debug.println("Parse input: name=" + sName + " output="
+ + sValue + " index=" + iIndex);
+ if (sValue != null && !sValue.equals("")) {
+ mErrorMsg = mErrorMsg + "\n " + sValue;
+ mWizardInfo.setRequestError("true");
+ }
+ }
+ else if ((iIndex=s.indexOf("errorDetails = ")) != (-1))
+ {
+ sName = s.substring(iIndex + 16).trim();
+ if ((iIndex = sName.indexOf("\"")) != (-1))
+ sValue = sName.substring(0,iIndex);
+
+ Debug.println("Parse input: name=" + sName + " output="
+ + sValue + " index=" + iIndex);
+ if (sValue != null && !sValue.equals("")) {
+ mErrorMsg = mErrorMsg + "\n " + sValue;
+ mWizardInfo.setRequestError("true");
+ }
+ }
+ else if ((iIndex=s.indexOf("result.recordSet.length = ")) != (-1))
+ {
+ sName = s.substring(iIndex + 27).trim();
+ if ((iIndex = sName.indexOf("\"")) != (-1))
+ sValue = sName.substring(0,iIndex);
+
+ Debug.println("Parse input: name=" + sName + " output="
+ + sValue + " index=" + iIndex);
+ if (sValue != null && !sValue.equals("") && !sValue.equals("0")) {
+ mErrorMsg = mErrorMsg + mResource.getString("REQUESTRESULTWIZARD_TEXT_DETAIL_LABEL");;
+ }
+ }
+ else if ((iIndex=s.indexOf("errorDescription = ")) != (-1))
+ {
+ sName = s.substring(iIndex + 20).trim();
+ if ((iIndex = sName.indexOf("\"")) != (-1))
+ sValue = sName.substring(0,iIndex);
+
+ Debug.println("Parse input: name=" + sName + " output="
+ + sValue + " index=" + iIndex);
+ if (sValue != null && !sValue.equals("")) {
+ mErrorMsg = mErrorMsg + "\n " + sValue;
+ }
+ }
+ else if ((iIndex=s.indexOf("record.policyMessage=")) != (-1))
+ {
+ sName = s.substring(iIndex + 22).trim();
+ if ((iIndex = sName.indexOf("\"")) != (-1))
+ sValue = sName.substring(0,iIndex);
+
+ Debug.println("Parse input: name=" + sName + " output="
+ + sValue + " index=" + iIndex);
+ if (sValue != null && !sValue.equals("")) {
+ if (mPolicyMsg == null)
+ mPolicyMsg = " " + sValue;
+ else
+ mPolicyMsg = mPolicyMsg + "\n " + sValue;
+ }
+ }
+
+ Debug.println("Parse finished");
+ }
+
+ /**
+ * Send an http request to the server. Return true if we're sure it
+ * succeeded, otherwise false.
+ */
+ boolean run(Hashtable args) {
+
+ String fullCmd = mWizardInfo.getCMEEType() + "://" +
+ mWizardInfo.getCMHost() + ":" +
+ mWizardInfo.getCMEEPort() + "/checkRequest";
+
+ HttpManager h = new HttpManager();
+ // tell the http manager to use UTF8 encoding
+ h.setSendUTF8(true);
+
+ try {
+ mSuccess = false;
+ mFinished = false;
+
+ ByteArrayInputStream data = null;
+ if (args != null && !args.isEmpty())
+ data = encode(args);
+ Debug.println( "Posting " + fullCmd );
+ // tell the http manager to notify us immediately of replies
+ // if we're using async mode
+ int flags = 0;
+ CommRecord postResult = null;
+ if (data == null)
+ postResult = h.post(new URL(fullCmd), this, null, null, 0,
+ flags);
+ else
+ postResult = h.post(new URL(fullCmd), this, null, data, data.available(),
+ flags);
+
+ /*
+ AdmTask admTask = new AdmTask(new URL(fullCmd),null,null);
+ admTask.setArguments(args);
+ admTask.exec(h);
+ */
+
+ awaitSuccess();
+
+ Object postStatus = postResult.getStatus();
+ //Debug.println("status: " + postStatus);
+ if (postStatus != null &&
+ postStatus.toString().equals(CommRecord.ERROR)) {
+ // If it happens to be it's not CMS server who is listening
+ // e.g. the cms agent port or yahoo server
+ // you may get here
+ mErrorMsg = mResource.getString("CGITASK_DIALOG_WRONGSERVER_MESSAGE");
+ }
+
+ Debug.println( "Command executed: " + fullCmd );
+ } catch (Exception e) {
+ // This is very fragile. We have to handle it case by case.
+ // Handled the ones that I know of properly, but there may
+ // be other cases that I don't know, display the exception
+ // detail.
+ String detail = e.toString();
+ if (detail == null || detail.trim().equals(""))
+ detail = "No detail of the exception provided.";
+ if ( e instanceof java.net.ConnectException ) {
+ mErrorMsg = mResource.getString("CGITASK_DIALOG_CMSDOWN_MESSAGE");
+ //CMSAdminUtil.showMessageDialog(mResource,
+ // PREFIX, "CMSDOWN", CMSAdminUtil.ERROR_MESSAGE);
+ } else if ( e instanceof java.net.NoRouteToHostException ) {
+ // java.net.NoRouteToHostException: Connection timed out
+ // It takes 3-4 mins to time out, looks like hang to impatient
+ // ones. https://www.netscape.com:443
+ mErrorMsg =
+ mResource.getString("CGITASK_DIALOG_CMSDOWN_MESSAGE")
+;
+ } else if ( e instanceof java.net.SocketException ) {
+ if (detail.indexOf("Socket write failed") > -1){
+ // retry
+ run(args);
+ } else if ((detail.indexOf("Connection shutdown") > -1) ||
+ (detail.indexOf("Connection timed out") > -1) ) {
+ // java.net.NoRouteToHostException: Connection timed out
+ // double insurance
+ mErrorMsg =
+ mResource.getString("CGITASK_DIALOG_CMSDOWN_MESSAGE");
+ } else {
+ // need to determine case by case
+ mErrorMsg =
+ mResource.getString("CGITASK_DIALOG_CMSDOWN_MESSAGE")+ " java.net.SocketException: " + detail;
+ }
+
+ } else if ( e instanceof java.io.IOException ) {
+ if (e.toString().indexOf("Broken pipe") > -1){
+ // broken pipe, retry
+ run(args);
+ } else if (detail.indexOf("Unknown public-key algorithm")
+> -1) {
+ mErrorMsg =
+ mResource.getString("CGITASK_DIALOG_UNKNOWNALG_MESSAGE")
+;
+ } else if (detail.indexOf("End of input") > -1) {
+ // http://www.netscape.com:80/enrollment
+ mErrorMsg =
+ mResource.getString("CGITASK_DIALOG_CMSDOWN_MESSAGE")
+;
+ } else if (detail.indexOf("Certificate fingerprint =") > -1) {
+ // reject the cms certificate
+ mErrorMsg =
+ mResource.getString("CGITASK_DIALOG_REJECTCERT_MESSAGE");
+ } else {
+ // need to determine case by case
+ mErrorMsg =
+ mResource.getString("CGITASK_DIALOG_CMSDOWN_MESSAGE"
+) + " java.io.IOException: " + detail;
+ }
+ } else {
+ // need to determine case by case
+ mErrorMsg =
+ mResource.getString("CGITASK_DIALOG_CMSDOWN_MESSAGE")
++ " Exception: " + detail;
+ }
+ Debug.println( "Command " + fullCmd + " failed: " + e );
+ }
+ return mSuccess;
+ }
+
+ String getStage(String reqType){
+ if (reqType.equals(Constants.PR_CA_SIGNING_CERT)){
+ return ConfigConstants.STAGE_CA_REQ_SUCCESS;
+ }else if (reqType.equals(Constants.PR_SERVER_CERT)){
+ return ConfigConstants.STAGE_SSL_REQ_SUCCESS;
+ }else if (reqType.equals(Constants.PR_KRA_TRANSPORT_CERT)){
+ return ConfigConstants.STAGE_KRA_REQ_SUCCESS;
+ }else if (reqType.equals(Constants.PR_RA_SIGNING_CERT)){
+ return ConfigConstants.STAGE_RA_REQ_SUCCESS;
+ }else if (reqType.equals(Constants.PR_OCSP_SIGNING_CERT)){
+ return ConfigConstants.STAGE_OCSP_REQ_SUCCESS;
+ }else
+ return null;
+ }
+
+
+ public static String normalizeCertStr(String s) {
+ String val = "";
+
+ for (int i = 0; i < s.length(); i++) {
+ if (s.charAt(i) == '\n') {
+ continue;
+ } else if (s.charAt(i) == '\r') {
+ continue;
+ } else if (s.charAt(i) == '\\' && s.charAt(i+1) == 'r') {
+ i++;
+ continue;
+ } else if (s.charAt(i) == '"') {
+ continue;
+ } else if (s.charAt(i) == ' ') {
+ continue;
+ }
+ val += s.charAt(i);
+ }
+ return val;
+ }
+
+}
+
+
diff --git a/base/console/src/com/netscape/admin/certsrv/task/CMSMigrateCreate.java b/base/console/src/com/netscape/admin/certsrv/task/CMSMigrateCreate.java
new file mode 100644
index 000000000..c7ff02c36
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/task/CMSMigrateCreate.java
@@ -0,0 +1,340 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.task;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.management.client.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.*;
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import com.netscape.management.client.console.*;
+import com.netscape.management.client.topology.*;
+import com.netscape.management.client.comm.*;
+import java.net.*;
+import java.io.*;
+import netscape.ldap.*;
+import netscape.ldap.util.*;
+
+/**
+ * Create or Migrate the Certificate Server
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public class CMSMigrateCreate extends CGITask
+ implements IProductObject
+{
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PREFIX = "CMSMIGRATECREATE";
+
+ private static final String CREATE_CGI_NAME = "Tasks/Operation/Create";
+
+ //private boolean mSuccess = false; // status of last executed CGI
+ private Hashtable mCgiResponse = null; // holds parsed contents of CGI return
+ private String mCgiTask = null; // CGI task to call
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSMigrateCreate() {
+ super();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public void initialize(ConsoleInfo info) {
+ Debug.println("CMSMigrateCreate: initialize()");
+ _consoleInfo = info;
+ }
+
+ public boolean migrate(String serverRoot,
+ String server,
+ String targetDN,
+ boolean flag) {
+
+ Debug.println("CMSMigrateCreate: migrate()");
+
+ return false;
+ }
+
+ /**
+ * Starts the server specific creation code, providing the DN for the
+ * target admin group. The method returns true or false depending
+ * on whether it was successful.
+ *
+ * @param targetDN - the admin group DN where the new instance is to be
+ * created.
+ * @return boolean value indicating whether the process succeeded (true)
+ * or failed (false).
+ */
+ public boolean createNewInstance(String targetDN) {
+ //Debug.println("CMSMigrateCreate: createNewInstance()- "+targetDN);
+ //targetDN: cn=Server Group, cn=cynthiar.mcom.com, ou=mcom.com, o=NetscapeRoot
+
+ JFrame mActiveFrame = UtilConsoleGlobals.getActivatedFrame();
+ boolean status = false; // return value
+ //show dialog
+ CreateInstanceDialog dialog = new CreateInstanceDialog(mActiveFrame);
+ // UtilConsoleGlobals.getActivatedFrame());
+ dialog.show();
+ if (dialog.isCancel()) {
+ return status;
+ }
+
+ //construct the rest of the configuration parameters
+ //serverName=cynthiar.mcom.com
+ //sieURL=ldap://laiking.mcom.com:389/o=netscapeRoot
+ //adminUID=admin
+ //adminPWD=admin
+ //instanceID=cert-data
+ //serverRoot=/u/thomask/s4
+ //adminDomain=mcom.com
+
+ Hashtable configParams = new Hashtable();
+
+ configParams.put("instanceID",dialog.getInstanceName());
+
+ String[] entries = LDAPDN.explodeDN(targetDN, false);
+ String DN = entries[entries.length-3] + ", " +
+ entries[entries.length-2] + ", " +
+ entries[entries.length-1];
+
+ //DN: cn=cynthiar.mcom.com, ou=mcom.com, o=NetscapeRoot
+
+ configParams.put("machineName", getValue(DN, "serverHostName",
+ LDAPConnection.SCOPE_BASE, null));
+ configParams.put("serverRoot", getValue(targetDN, "nsconfigroot",
+ LDAPConnection.SCOPE_BASE, null));
+ LDAPConnection ldc = _consoleInfo.getLDAPConnection();
+ String ssdn = ldc.getAuthenticationDN();
+ String[] avas = LDAPDN.explodeDN(ssdn, false);
+ String uid = avas[0];
+ if (!uid.startsWith("uid")) {
+ CMSAdminUtil.showMessageDialog(mActiveFrame,
+ mResource, PREFIX, "RESTARTADMINERROR",
+ CMSAdminUtil.ERROR_MESSAGE);
+ return false;
+ }
+ configParams.put("adminUID", uid.substring(4,uid.length()));
+
+ configParams.put("adminPWD",ldc.getAuthenticationPassword());
+ String ldapUrl = "ldap://" + ldc.getHost() + ":" +
+ Integer.toString(ldc.getPort()) + "/" +
+ (String)_consoleInfo.get("BaseDN");
+ configParams.put("sieURL", ldapUrl);
+
+ String searchDN = entries[entries.length-2];
+ configParams.put("adminDomain", searchDN.substring(3,searchDN.length()));
+
+ Debug.println("CMSMigrateCreate: createNewInstance()- "+configParams.toString());
+
+ // set the arguments for the CGI call
+ _consoleInfo.put("arguments", configParams);
+ _consoleInfo.put(CREATE_CGI_NAME, "cert");
+ if (_consoleInfo.get("AdminUsername") == null)
+ _consoleInfo.put("AdminUsername", _consoleInfo.getAuthenticationDN());
+ Debug.println("AdminUsername = " + _consoleInfo.get("AdminUsername"));
+
+ if (_consoleInfo.get("AdminUserPassword") == null)
+ _consoleInfo.put("AdminUserPassword",
+ _consoleInfo.getAuthenticationPassword());
+ Debug.println("AdminUserPassword = " + _consoleInfo.get("AdminUserPassword"));
+
+ // call the CGI program
+ Debug.println("CMSMigrateCreate: createNewInstance() before run task="+CREATE_CGI_NAME);
+ mCgiTask = CREATE_CGI_NAME;
+
+ Cursor cursor = mActiveFrame.getCursor();
+ int type = cursor.getType();
+ cursor = new Cursor(Cursor.WAIT_CURSOR);
+ mActiveFrame.setCursor(cursor);
+
+ try {
+ status = super.run(null, CREATE_CGI_NAME);
+ } catch (Exception e) {
+ Debug.println("Unexpected Error"+e.toString());
+ status = false;
+ }
+
+ Debug.println("CMSMigrateCreate: createNewInstance() after run status=" +
+ status + " mSuccess=" + mSuccess);
+
+ if (!mSuccess) {
+ Debug.println("Show error dialog");
+ String errorMsg = getErrorMessage();
+ if (errorMsg == null || errorMsg.equals(""))
+ CMSAdminUtil.showMessageDialog(mActiveFrame, mResource, PREFIX,
+ "SYSTEMERROR", CMSAdminUtil.ERROR_MESSAGE);
+ else
+ JOptionPane.showMessageDialog(mActiveFrame, errorMsg,
+ "Error", CMSAdminUtil.ERROR_MESSAGE,
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_ERROR_ICON));
+ }
+
+ cursor = new Cursor(type);
+ mActiveFrame.setCursor(cursor);
+
+ return mSuccess;
+ }
+
+ /**
+ * the operation is finished after we receive the http stream
+ */
+ public void replyHandler(InputStream response, CommRecord cr) {
+ mSuccess = false;
+ if (mCgiResponse != null)
+ mCgiResponse.clear();
+
+ try {
+ BufferedReader rspStream =
+ new BufferedReader(new InputStreamReader(response, "UTF8"));
+ String rspStr;
+
+ Debug.println("CMSMigrateCreate: replyHandler() - start");
+ while ((rspStr = rspStream.readLine()) != null)
+ {
+ Debug.println("CMSMigrateCreate: replyHandler() - read [" + rspStr + "]");
+ // NMC_ messages are parsed, but not shown to the user
+ /*
+ if (_statusText != null && !rspStr.startsWith("NMC_")) {
+ _statusText.append(rspStr + "\n");
+ Thread.yield(); // allow graphics repaints
+ }
+ */
+ parse(rspStr);
+ }
+ } catch (Exception e) {
+ Debug.println("MigrateCreate.replyHandler: " + e.toString());
+ }
+
+ Debug.println("MigrateCreate.replyHandler: finished, mSuccess=" +
+ mSuccess);
+
+ finish();
+ }
+
+ /**
+ * return the value for the given keyword in the reply
+ */
+ private void parse(String s) {
+ String sName;
+ String sValue;
+ int iIndex;
+
+ Debug.println("Parse input: " + s);
+
+ if ((iIndex=s.indexOf(":")) != (-1))
+ {
+ sName = s.substring(0, iIndex).trim();
+ sValue = s.substring(iIndex+1).trim();
+ Debug.println("Parse input: name=" + sName + " value=" + sValue);
+ if (mCgiResponse == null)
+ mCgiResponse = new Hashtable();
+ mCgiResponse.put(sName, sValue);
+ if (sName.equalsIgnoreCase("NMC_Status")) {
+ int code = Integer.parseInt(sValue);
+ mSuccess = (code == 0);
+ Debug.println("Parse input: code=" + code + " mSuccess=" + mSuccess);
+ } else if (sName.equalsIgnoreCase("NMC_ERRINFO")) {
+ mErrorMsg = sValue;
+ }
+ }
+
+ Debug.println("Parse finished");
+ }
+
+ /**
+ * Get one value for one specified attribute from the given DN.
+ * If there is more than 1 entry which matches the given criteria, the
+ * first one will be used.
+ *
+ * @param DN DN of the entry with the specified attributes
+ * @param attr Attribute to get the value of
+ * @param scope LDAPConnection SCOPE_BASE SCOPE_ONE SCOPE_SUB
+ * @param filter LDAP search filter; if null, default is objectclass=*
+ * @return The string value of the attribute; multi-valued
+ * attributes are returned as 1 value, space delimited
+ * (flattened)
+ **/
+ protected String getValue(String DN, String attr, int scope,
+ String filter) {
+ String[] attrs = { attr };
+ String[] values = getValues(DN, attrs, scope, filter);
+ if (values != null)
+ return values[0];
+
+ return null;
+ }
+
+ /**
+ * Get the values for several specified attributes from the given DN.
+ * If there is more than 1 entry which matches the given criteria, the
+ * first one will be used.
+ *
+ * @param DN DN of the entry with the specified attributes
+ * @param attrs Array of attributes to get the values of
+ * @param scope LDAPConnection SCOPE_BASE SCOPE_ONE SCOPE_SUB
+ * @param filter LDAP search filter; if null, default is objectclass=*
+ * @return An array of string values for each attribute; multi-valued
+ * attributes are returned as 1 value, space delimited
+ * (flattened)
+ **/
+ protected String[] getValues(String DN, String[] attrs, int scope,
+ String filter) {
+ String[] values = null;
+ LDAPSearchResults results = null;
+ if (filter == null)
+ filter = "(objectclass=*)";
+
+ try {
+ LDAPConnection ldc = _consoleInfo.getLDAPConnection();
+ if (ldc != null)
+ {
+ results = ldc.search(DN, scope, filter, attrs, false);
+ }
+ } catch (LDAPException e) {
+ Debug.println("error MigrateCreate.getValues: LDAP read failed " +
+ "for DN=" + DN + " attributes " + attrs);
+ Debug.println("error MigrateCreate.getValues: LDAP Exception:" +
+ e);
+ }
+
+ if (results != null && results.hasMoreElements()) {
+ values = new String[attrs.length];
+ LDAPEntry entry = (LDAPEntry)results.nextElement();
+ for (int ii = 0; entry != null && ii < attrs.length; ++ii) {
+ values[ii] = LDAPUtil.flatting(entry.getAttribute(attrs[ii]));
+ }
+ } else {
+ Debug.println("error MigrateCreate.getValues: LDAP read failed " +
+ "for DN=" + DN + " attributes=" + attrs);
+ }
+
+ return values;
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/task/CMSRemove.java b/base/console/src/com/netscape/admin/certsrv/task/CMSRemove.java
new file mode 100644
index 000000000..57473c5e0
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/task/CMSRemove.java
@@ -0,0 +1,166 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.task;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.console.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.*;
+import netscape.ldap.*;
+
+/**
+ * Remove the server
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public class CMSRemove extends CGITask
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PREFIX = "TASKREMOVE";
+ public static final String REMOVE_TASK_CGI = "Tasks/Operation/remove";
+ private Hashtable mCgiResponse = null;
+ private String mCgiTask = null;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+
+ public CMSRemove() {
+ super();
+ setName(mResource.getString(PREFIX+"_REMOVE_LABEL"));
+ setDescription(mResource.getString(PREFIX+"_REMOVE_DESC"));
+ }
+
+ public void initialize(ConsoleInfo info) {
+ Debug.println("CMSRemove: initialize()");
+ _consoleInfo = info;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public boolean run(IPage viewInstance)
+ {
+ Debug.println("CMSRemove: run()");
+ boolean status = false; // return value
+ Hashtable configParams = new Hashtable();
+ configParams.put("serverRoot",_consoleInfo.get("serverRoot"));
+ String servid = (String)_consoleInfo.get("servid");
+ int index = servid.indexOf("-");
+ if (index != -1) {
+ servid = servid.substring(index+1);
+ }
+ configParams.put("instanceID", servid);
+
+ // get the CMS instance host and port
+ servid = (String)_consoleInfo.get("servid");
+ String configDN = _consoleInfo.getCurrentDN();
+
+ try {
+ LDAPConnection ldc = _consoleInfo.getLDAPConnection();
+ if (ldc == null) {
+ ldc = new LDAPConnection();
+ }
+ if (ldc.isConnected() == false) {
+ ldc.connect(_consoleInfo.getHost(), _consoleInfo.getPort(),
+ _consoleInfo.getAuthenticationDN(),
+ _consoleInfo.getAuthenticationPassword());
+ }
+ LDAPEntry entry = ldc.read(configDN);
+ String cmsHost = LDAPUtil.flatting(
+ entry.getAttribute("serverHostName",
+ LDAPUtil.getLDAPAttributeLocale()));
+ String cmsPort = LDAPUtil.flatting(
+ entry.getAttribute("nsServerPort",
+ LDAPUtil.getLDAPAttributeLocale()));
+
+ Debug.println("host:" + cmsHost+" port:"+cmsPort);
+ configParams.put("cmsHost", cmsHost);
+ configParams.put("cmsPort", cmsPort);
+ }
+ catch (LDAPException e) {
+ Debug.println(
+ "ERROR CMSRemove: LDAP read failed: " +
+ configDN);
+ }
+ _consoleInfo.put("arguments", configParams);
+
+ String authdn = _consoleInfo.getAuthenticationDN();
+
+ if (_consoleInfo.get("AdminUsername") == null)
+ _consoleInfo.put("AdminUsername", authdn);
+
+ if (!authdn.startsWith("uid")) {
+ JFrame mActiveFrame = UtilConsoleGlobals.getActivatedFrame();
+ CMSAdminUtil.showMessageDialog(mActiveFrame,
+ mResource, PREFIX, "RESTARTADMINERROR",
+ CMSAdminUtil.ERROR_MESSAGE);
+ return false;
+ }
+
+ Debug.println("AdminUsername = " + _consoleInfo.get("AdminUsername"));
+
+ if (_consoleInfo.get("AdminUserPassword") == null)
+ _consoleInfo.put("AdminUserPassword",
+ _consoleInfo.getAuthenticationPassword());
+ Debug.println("AdminUserPassword = " + _consoleInfo.get("AdminUserPassword"));
+ // call the CGI program
+ Debug.println("CMSRemove: remove() before run task="+REMOVE_TASK_CGI);
+ try {
+ status = super.run(null, REMOVE_TASK_CGI);
+ } catch (Exception e) {
+ Debug.println("Unexpected Error"+e.toString());
+ status = false;
+ }
+ Debug.println("CMSRemove: remove() after run status="+status);
+
+ String title = mResource.getString("REMOVERESULTDIALOG_TITLE");
+
+ if (!status) {
+ Debug.println("Show error dialog");
+ // if no error message from the server, then just show the generic
+ // error message.
+ if (mErrorMsg.equals(""))
+ CMSAdminUtil.showMessageDialog(
+ UtilConsoleGlobals.getActivatedFrame(),
+ mResource, PREFIX, "SYSTEMERROR", CMSAdminUtil.ERROR_MESSAGE);
+ else {
+ String errorMsg =
+ mResource.getString("REMOVERESULTDIALOG_FAILED_TEXT")+mErrorMsg;
+ Icon icon = CMSAdminUtil.getImage(CMSAdminResources.IMAGE_ERROR_ICON);
+ JOptionPane.showMessageDialog(UtilConsoleGlobals.getActivatedFrame(),
+ errorMsg, title, JOptionPane.ERROR_MESSAGE, icon);
+ }
+ } else {
+ Debug.println("Successful operation");
+ String msg = mResource.getString("REMOVERESULTDIALOG_SUCCESS_TEXT");
+ Icon icon = CMSAdminUtil.getImage(CMSAdminResources.IMAGE_INFO_ICON);
+ JOptionPane.showMessageDialog(UtilConsoleGlobals.getActivatedFrame(),
+ msg, title, JOptionPane.INFORMATION_MESSAGE, icon);
+ }
+ return status;
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/task/CMSRequestCert.java b/base/console/src/com/netscape/admin/certsrv/task/CMSRequestCert.java
new file mode 100644
index 000000000..8b3cfef6b
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/task/CMSRequestCert.java
@@ -0,0 +1,421 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.task;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.management.client.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.config.install.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.*;
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import com.netscape.management.client.console.*;
+import com.netscape.management.client.topology.*;
+import com.netscape.management.client.comm.*;
+import java.net.*;
+import java.io.*;
+import netscape.ldap.*;
+import netscape.ldap.util.*;
+
+/**
+ * Perform certificate request.
+ *
+ * @author Michelle Zhao
+ * @version $Revision$, $Date$
+ */
+public class CMSRequestCert extends CGITask {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PREFIX = "CGITASK";
+ private String mCgiTask = null; // CGI task to call
+ private InstallWizardInfo mWizardInfo;
+ private String mPolicyMsg = null;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSRequestCert() {
+ super();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public void initialize(InstallWizardInfo info) {
+ Debug.println("CMSRequestCert: initialize()");
+ _consoleInfo = info.getAdminConsoleInfo();
+
+ // the results coming back from the daemon will be added to the
+ // wizard information.
+ mWizardInfo = info;
+ }
+
+ /**
+ * Collect the data in name value pairs format and then send them to the
+ * cgi process.
+ */
+ public boolean requestCert(Hashtable data) {
+ boolean status = false; // return value
+
+ try {
+ status = run(data);
+ } catch (Exception e) {
+ Debug.println("Unexpected Error"+e.toString());
+ status = false;
+ }
+ Debug.println("CMSRequestCert: requestCert() after run status=" +
+ status + " mSuccess=" + mSuccess);
+
+ return mSuccess;
+ }
+
+ /**
+ * the operation is finished after we receive the http stream
+ */
+ public void replyHandler(InputStream response, CommRecord cr) {
+ mSuccess = false;
+
+ try {
+ BufferedReader rspStream =
+ new BufferedReader(new InputStreamReader(response, "UTF8"));
+ String rspStr;
+
+ Debug.println("CMSRequestCert: replyHandler() - start");
+ mErrorMsg = mResource.getString("REQUESTRESULTWIZARD_TEXT_ERRORDESC_LABEL");
+ while ((rspStr = rspStream.readLine()) != null && !mSuccess)
+ {
+ Debug.println("RequestCert: replyHandler() - read [" + rspStr + "]");
+ // NMC_ messages are parsed, but not shown to the user
+ parse2(rspStr);
+ }
+ mErrorMsg = mErrorMsg +
+ mResource.getString("REQUESTRESULTWIZARD_TEXT_ERROREND_LABEL");
+ String requestStatus =mWizardInfo.getRequestStatus();
+ if ((mWizardInfo.getRequestError() != null) &&
+ mWizardInfo.getRequestError().equals("true")) {
+ mWizardInfo.setRequestError(mErrorMsg);
+ mErrorMsg = null;
+ mSuccess = true;
+ } else if (requestStatus == null) {
+ // agent port, Unauthorizied access
+ mErrorMsg = mResource.getString("CGITASK_DIALOG_WRONGSERVER_MESSAGE");
+ } else if (requestStatus.equals("5")) {
+ // rejected
+ if (mPolicyMsg == null) {
+ mWizardInfo.setRequestError(mResource.getString("REQUESTRESULTWIZARD_TEXT_NODETAIL_LABEL"));
+ } else {
+ mWizardInfo.setRequestError(mPolicyMsg);
+ mPolicyMsg = null;
+ }
+ mSuccess = true;
+ }
+ // Use the same format for other status:success,pending,svcPending
+ } catch (Exception e) {
+ Debug.println("RequestCert.Exception : " + e.toString());
+ }
+
+ Debug.println("RequestCert.replyHandler: finished, mSuccess=" +
+ mSuccess);
+
+ finish();
+ }
+
+
+ private void parse2(String s)
+ {
+ int iIndex;
+ Debug.println("Parse2 input: " + s);
+ if ((iIndex=s.indexOf("errorCode")) != (-1))
+ {
+ String errorCode = s.substring(s.indexOf("\"") + 1,
+ s.lastIndexOf("\""));
+ Debug.println("errorCode: " + errorCode);
+ if (errorCode.equals("2")) { // pending
+ mWizardInfo.setRequestError("false");
+ mSuccess = true;
+ mWizardInfo.setRequestStatus("0");
+ } else if (errorCode.equals("1")) { // error
+ mWizardInfo.setRequestError("true");
+ mWizardInfo.setRequestStatus("5");
+ mSuccess = false;
+ } else {
+ mWizardInfo.setRequestError("true");
+ mWizardInfo.setRequestStatus("0");
+ mSuccess = false;
+ }
+ }
+ else if ((iIndex=s.indexOf("requestList.requestId")) != (-1))
+ {
+ String requestId = s.substring(s.indexOf("\"") + 1,
+ s.lastIndexOf("\""));
+ Debug.println("requestId: " + requestId);
+ mWizardInfo.setRequestID(requestId);
+ }
+ else if ((iIndex=s.indexOf("errorReason")) != (-1))
+ {
+ String errorReason = s.substring(s.indexOf("\"") + 1,
+ s.lastIndexOf("\""));
+ Debug.println("errorReason: " + errorReason);
+ mErrorMsg = mErrorMsg + "\n " + errorReason;
+ }
+ }
+
+
+
+ /**
+ * return the value for the given keyword in the reply
+ */
+ private void parse(String s) {
+ String sName;
+ String sValue = null;
+ int iIndex;
+
+ Debug.println("Parse input: " + s);
+
+ if ((iIndex=s.indexOf("requestStatus = ")) != (-1))
+ {
+ sName = s.substring(iIndex + 17).trim();
+ if ((iIndex = sName.indexOf("\"")) != (-1))
+ sValue = sName.substring(0,iIndex);
+
+ Debug.println("Parse input: name=" + sName + " output="
+ + sValue + " index=" + iIndex);
+ if (sValue != null && !sValue.equals("")) {
+ mWizardInfo.setRequestStatus(sValue);
+ if (sValue.equals("2") || sValue.equals("3")
+ || sValue.equals("4")){
+ //mSuccess = true;
+ }
+ }
+ }
+ else if ((iIndex=s.indexOf("requestId = ")) != (-1))
+ {
+ sName = s.substring(iIndex + 13).trim();
+ if ((iIndex = sName.indexOf("\"")) != (-1))
+ sValue = sName.substring(0,iIndex);
+
+ Debug.println("Parse input: name=" + sName + " output="
+ + sValue + " index=" + iIndex);
+ if (sValue != null && !sValue.equals("")) {
+ mWizardInfo.setRequestID(sValue);
+ //mSuccess = true;
+ }
+ }
+ else if ((iIndex=s.indexOf("unexpectedError = ")) != (-1))
+ {
+ sName = s.substring(iIndex + 19).trim();
+ if ((iIndex = sName.indexOf("\"")) != (-1))
+ sValue = sName.substring(0,iIndex);
+
+ Debug.println("Parse input: name=" + sName + " output="
+ + sValue + " index=" + iIndex);
+ if (sValue != null && !sValue.equals("")) {
+ mErrorMsg = mErrorMsg + "\n " + sValue;
+ mWizardInfo.setRequestError("true");
+ }
+ }
+ else if ((iIndex=s.indexOf("errorDetails = ")) != (-1))
+ {
+ sName = s.substring(iIndex + 16).trim();
+ if ((iIndex = sName.indexOf("\"")) != (-1))
+ sValue = sName.substring(0,iIndex);
+
+ Debug.println("Parse input: name=" + sName + " output="
+ + sValue + " index=" + iIndex);
+ if (sValue != null && !sValue.equals("")) {
+ mErrorMsg = mErrorMsg + "\n " + sValue;
+ mWizardInfo.setRequestError("true");
+ }
+ }
+ else if ((iIndex=s.indexOf("result.recordSet.length = ")) != (-1))
+ {
+ sName = s.substring(iIndex + 27).trim();
+ if ((iIndex = sName.indexOf("\"")) != (-1))
+ sValue = sName.substring(0,iIndex);
+
+ Debug.println("Parse input: name=" + sName + " output="
+ + sValue + " index=" + iIndex);
+ if (sValue != null && !sValue.equals("") && !sValue.equals("0")) {
+ mErrorMsg = mErrorMsg + mResource.getString("REQUESTRESULTWIZARD_TEXT_DETAIL_LABEL");;
+ }
+ }
+ else if ((iIndex=s.indexOf("errorDescription = ")) != (-1))
+ {
+ sName = s.substring(iIndex + 20).trim();
+ if ((iIndex = sName.indexOf("\"")) != (-1))
+ sValue = sName.substring(0,iIndex);
+
+ Debug.println("Parse input: name=" + sName + " output="
+ + sValue + " index=" + iIndex);
+ if (sValue != null && !sValue.equals("")) {
+ mErrorMsg = mErrorMsg + "\n " + sValue;
+ }
+ }
+ else if ((iIndex=s.indexOf("record.policyMessage=")) != (-1))
+ {
+ sName = s.substring(iIndex + 22).trim();
+ if ((iIndex = sName.indexOf("\"")) != (-1))
+ sValue = sName.substring(0,iIndex);
+
+ Debug.println("Parse input: name=" + sName + " output="
+ + sValue + " index=" + iIndex);
+ if (sValue != null && !sValue.equals("")) {
+ if (mPolicyMsg == null)
+ mPolicyMsg = " " + sValue;
+ else
+ mPolicyMsg = mPolicyMsg + "\n " + sValue;
+ }
+ }
+ else if ((iIndex=s.indexOf("/HTML")) != (-1))
+ mSuccess = true; // no need to parse further
+
+ Debug.println("Parse finished");
+ }
+
+ /**
+ * Send an http request to the server. Return true if we're sure it
+ * succeeded, otherwise false.
+ */
+ boolean run(Hashtable args) {
+
+ String fullCmd = mWizardInfo.getCMEEType() + "://" +
+ mWizardInfo.getCMHost() + ":" +
+ mWizardInfo.getCMEEPort() + "/ca/ee/ca/profileSubmit";
+
+ HttpManager h = new HttpManager();
+ // tell the http manager to use UTF8 encoding
+ h.setSendUTF8(true);
+
+ try {
+ mSuccess = false;
+ mFinished = false;
+
+ ByteArrayInputStream data = null;
+ if (args != null && !args.isEmpty())
+ data = encode(args);
+ Debug.println( "Posting " + fullCmd );
+ // tell the http manager to notify us immediately of replies
+ // if we're using async mode
+ int flags = 0;
+ CommRecord postResult = null;
+ if (data == null)
+ postResult = h.post(new URL(fullCmd), this, null, null, 0,
+ flags);
+ else
+ postResult = h.post(new URL(fullCmd), this, null, data, data.available(),
+ flags);
+
+ /*
+ AdmTask admTask = new AdmTask(new URL(fullCmd),null,null);
+ admTask.setArguments(args);
+ admTask.exec(h);
+ */
+
+ awaitSuccess();
+
+ Object postStatus = postResult.getStatus();
+ //Debug.println("status: " + postStatus);
+ if (postStatus != null &&
+ postStatus.toString().equals(CommRecord.ERROR)) {
+ // If it happens to be it's not CMS server who is listening
+ // e.g. the cms agent port or yahoo server
+ // you may get here
+ mErrorMsg = mResource.getString("CGITASK_DIALOG_WRONGSERVER_MESSAGE");
+ }
+
+ Debug.println( "Command executed: " + fullCmd );
+ } catch (Exception e) {
+ // This is very fragile. We have to handle it case by case.
+ // Handled the ones that I know of properly, but there may
+ // be other cases that I don't know, display the exception
+ // detail.
+ String detail = e.toString();
+ if (detail == null || detail.trim().equals(""))
+ detail = "No detail of the exception provided.";
+ if ( e instanceof java.net.ConnectException ) {
+ mErrorMsg = mResource.getString("CGITASK_DIALOG_CMSDOWN_MESSAGE");
+ //CMSAdminUtil.showMessageDialog(mResource,
+ // PREFIX, "CMSDOWN", CMSAdminUtil.ERROR_MESSAGE);
+ } else if ( e instanceof java.net.NoRouteToHostException ) {
+ // java.net.NoRouteToHostException: Connection timed out
+ // It takes 3-4 mins to time out, looks like hang to impatient
+ // ones. https://www.netscape.com:443
+ mErrorMsg =
+ mResource.getString("CGITASK_DIALOG_CMSDOWN_MESSAGE")
+;
+ } else if ( e instanceof java.net.SocketException ) {
+ if (detail.indexOf("Socket write failed") > -1){
+ // retry
+ run(args);
+ } else if ((detail.indexOf("Connection shutdown") > -1) ||
+ (detail.indexOf("Connection timed out") > -1) ) {
+ // java.net.NoRouteToHostException: Connection timed out
+ // double insurance
+ mErrorMsg =
+ mResource.getString("CGITASK_DIALOG_CMSDOWN_MESSAGE");
+ } else {
+ // need to determine case by case
+ mErrorMsg =
+ mResource.getString("CGITASK_DIALOG_CMSDOWN_MESSAGE")+ " java.net.SocketException: " + detail;
+ }
+
+ } else if ( e instanceof java.io.IOException ) {
+ if (e.toString().indexOf("Broken pipe") > -1){
+ // broken pipe, retry
+ run(args);
+ } else if (detail.indexOf("Unknown public-key algorithm")
+> -1) {
+ mErrorMsg =
+ mResource.getString("CGITASK_DIALOG_UNKNOWNALG_MESSAGE")
+;
+ } else if (detail.indexOf("End of input") > -1) {
+ // http://www.netscape.com:80/enrollment
+ mErrorMsg =
+ mResource.getString("CGITASK_DIALOG_CMSDOWN_MESSAGE")
+;
+ } else if (detail.indexOf("Certificate fingerprint =") > -1) {
+ // reject the cms certificate
+ mErrorMsg =
+ mResource.getString("CGITASK_DIALOG_REJECTCERT_MESSAGE");
+ } else {
+ // need to determine case by case
+ mErrorMsg =
+ mResource.getString("CGITASK_DIALOG_CMSDOWN_MESSAGE"
+) + " java.io.IOException: " + detail;
+ }
+ } else {
+ // need to determine case by case
+ mErrorMsg =
+ mResource.getString("CGITASK_DIALOG_CMSDOWN_MESSAGE")
++ " Exception: " + detail;
+ }
+ Debug.println( "Command " + fullCmd + " failed: " + e );
+ }
+ return mSuccess;
+ }
+
+}
+
+
+
diff --git a/base/console/src/com/netscape/admin/certsrv/task/CMSRestart.java b/base/console/src/com/netscape/admin/certsrv/task/CMSRestart.java
new file mode 100644
index 000000000..fa9d59ddd
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/task/CMSRestart.java
@@ -0,0 +1,186 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.task;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.console.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.*;
+import netscape.ldap.*;
+
+/**
+ * Start the server
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public class CMSRestart extends CGITask
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PREFIX = "TASKRESTART";
+ public static final String RESTART_TASK_CGI = "Tasks/Operation/restart";
+ //public static final String START_TASK_CGI = "Tasks/Operation/start";
+ //public static final String STOP_TASK_CGI = "Tasks/Operation/stop";
+ private Hashtable mCgiResponse = null;
+ private String mCgiTask = null;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+
+ public CMSRestart() {
+ super();
+ setName(mResource.getString(PREFIX+"_RESTART_LABEL"));
+ setDescription(mResource.getString(PREFIX+"_RESTART_DESC"));
+ }
+
+ public void initialize(ConsoleInfo info) {
+ Debug.println("CMSStart: initialize()");
+ _consoleInfo = info;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public boolean run(IPage viewInstance)
+ {
+ Debug.println("CMSRestart: run()");
+ boolean status = false; // return value
+ AuthDialog dialog = new AuthDialog(UtilConsoleGlobals.getActivatedFrame());
+ // dialog.show();
+ if (dialog.isCancel())
+ return false;
+
+ Hashtable configParams = new Hashtable();
+ configParams.put("serverRoot",_consoleInfo.get("serverRoot"));
+
+ String servid = (String)_consoleInfo.get("servid");
+ int index = servid.indexOf("-");
+ if (index != -1) {
+ servid = servid.substring(index+1);
+ }
+ configParams.put("instanceID", servid);
+ configParams.put("password",dialog.getPassword());
+ //configParams.put("instanceID",dialog.getInstanceName());
+ Debug.println("password "+dialog.getPassword());
+
+ // get the CMS instance host and port
+ servid = (String)_consoleInfo.get("servid");
+ String configDN = _consoleInfo.getCurrentDN();
+
+ try {
+ LDAPConnection ldc = _consoleInfo.getLDAPConnection();
+ if (ldc == null) {
+ ldc = new LDAPConnection();
+ }
+ if (ldc.isConnected() == false) {
+ ldc.connect(_consoleInfo.getHost(), _consoleInfo.getPort(),
+ _consoleInfo.getAuthenticationDN(),
+ _consoleInfo.getAuthenticationPassword());
+ }
+ LDAPEntry entry = ldc.read(configDN);
+ String cmsHost = LDAPUtil.flatting(
+ entry.getAttribute("serverHostName",
+ LDAPUtil.getLDAPAttributeLocale()));
+ String cmsPort = LDAPUtil.flatting(
+ entry.getAttribute("nsServerPort",
+ LDAPUtil.getLDAPAttributeLocale()));
+
+ Debug.println("host:" + cmsHost+" port:"+cmsPort);
+ configParams.put("cmsHost", cmsHost);
+ configParams.put("cmsPort", cmsPort);
+ }
+ catch (LDAPException e) {
+ Debug.println(
+ "ERROR CMSStatus: LDAP read failed: " +
+ configDN);
+ }
+ _consoleInfo.put("arguments", configParams);
+
+ if (_consoleInfo.get("AdminUsername") == null)
+ _consoleInfo.put("AdminUsername", _consoleInfo.getAuthenticationDN()
+);
+ Debug.println("AdminUsername = " + _consoleInfo.get("AdminUsername"));
+
+ if (_consoleInfo.get("AdminUserPassword") == null)
+ _consoleInfo.put("AdminUserPassword",
+ _consoleInfo.getAuthenticationPassword());
+ Debug.println("AdminUserPassword = " + _consoleInfo.get("AdminUserPassword"));
+ // call the CGI program
+ Debug.println("CMSRestart: restart() before run task="+RESTART_TASK_CGI);
+ try {
+ status = super.run(null, RESTART_TASK_CGI);
+ } catch (Exception e) {
+ Debug.println("Unexpected Error"+e.toString());
+ status = false;
+ }
+ Debug.println("CMSRestart: start() after run status="+status);
+
+ String title = mResource.getString("RESTARTRESULTDIALOG_TITLE");
+
+ if (!status) {
+ Debug.println("Show error dialog");
+ // if no error message from the server, then just show the generic
+ // error message.
+ if (mErrorMsg.equals(""))
+ CMSAdminUtil.showMessageDialog(
+ UtilConsoleGlobals.getActivatedFrame(),
+ mResource, PREFIX, "SYSTEMERROR", CMSAdminUtil.ERROR_MESSAGE);
+ else {
+ String errorMsg =
+ mResource.getString("RESTARTRESULTDIALOG_FAILED_TEXT")+mErrorMsg;
+ Icon icon = CMSAdminUtil.getImage(CMSAdminResources.IMAGE_ERROR_ICON);
+ JOptionPane.showMessageDialog(UtilConsoleGlobals.getActivatedFrame(),
+ errorMsg, title, JOptionPane.ERROR_MESSAGE, icon);
+ }
+ } else {
+ CMSAdmin cmsAdmin = (CMSAdmin)(_consoleInfo.get("CMSAdmin"));
+ cmsAdmin.getServerStatus();
+ Debug.println("Successful operation");
+ String msg = "";
+ // If warning message is received along with the started
+ // signal from the start.cc, we want to display the
+ // warning.
+ if (mWarnMsg.equals("")) {
+ msg = mResource.getString("RESTARTRESULTDIALOG_SUCCESS_TEXT");
+ Icon icon = CMSAdminUtil.getImage(CMSAdminResources.IMAGE_INFO_ICON);
+ JOptionPane.showMessageDialog(UtilConsoleGlobals.getActivatedFrame(),
+ msg, title, JOptionPane.INFORMATION_MESSAGE, icon);
+ } else {
+ StringTokenizer st = new StringTokenizer(mWarnMsg, "|");
+ while (st.hasMoreTokens()) {
+ msg += st.nextToken();
+ if (st.hasMoreTokens()) {
+ msg += "\n";
+ }
+ }
+ StatusDialog sd = new StatusDialog(UtilConsoleGlobals.getActivatedFrame());
+ sd.showDialog(mResource.getString("RESTARTRESULTDIALOG_SUCCESS_TEXT"), msg);
+ }
+ }
+
+ return status;
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/task/CMSStart.java b/base/console/src/com/netscape/admin/certsrv/task/CMSStart.java
new file mode 100644
index 000000000..2122145c3
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/task/CMSStart.java
@@ -0,0 +1,179 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.task;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.console.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.*;
+import netscape.ldap.*;
+
+/**
+ * Start the server
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public class CMSStart extends CGITask
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PREFIX = "TASKSTART";
+ public static final String START_TASK_CGI = "Tasks/Operation/start";
+ private Hashtable mCgiResponse = null;
+ private String mCgiTask = null;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+
+ public CMSStart() {
+ super();
+ setName(mResource.getString(PREFIX+"_START_LABEL"));
+ setDescription(mResource.getString(PREFIX+"_START_DESC"));
+ }
+
+ public void initialize(ConsoleInfo info) {
+ Debug.println("CMSStart: initialize()");
+ _consoleInfo = info;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public boolean run(IPage viewInstance)
+ {
+ Debug.println("CMSStart: run()");
+ boolean status = false; // return value
+ AuthDialog dialog = new AuthDialog(UtilConsoleGlobals.getActivatedFrame());
+ // dialog.show();
+ if (dialog.isCancel())
+ return false;
+
+ Hashtable configParams = new Hashtable();
+ configParams.put("serverRoot",_consoleInfo.get("serverRoot"));
+ String servid = (String)_consoleInfo.get("servid");
+ int index = servid.indexOf("-");
+ if (index != -1) {
+ servid = servid.substring(index+1);
+ }
+ configParams.put("instanceID", servid);
+ configParams.put("password",dialog.getPassword());
+ //configParams.put("instanceID",dialog.getInstanceName());
+ Debug.println("password "+dialog.getPassword());
+
+ // get the CMS instance host and port
+ servid = (String)_consoleInfo.get("servid");
+ String configDN = _consoleInfo.getCurrentDN();
+
+ try {
+ LDAPConnection ldc = _consoleInfo.getLDAPConnection();
+ if (ldc == null) {
+ ldc = new LDAPConnection();
+ }
+ if (ldc.isConnected() == false) {
+ ldc.connect(_consoleInfo.getHost(), _consoleInfo.getPort(),
+ _consoleInfo.getAuthenticationDN(),
+ _consoleInfo.getAuthenticationPassword());
+ }
+ LDAPEntry entry = ldc.read(configDN);
+ String cmsHost = LDAPUtil.flatting(
+ entry.getAttribute("serverHostName",
+ LDAPUtil.getLDAPAttributeLocale()));
+ String cmsPort = LDAPUtil.flatting(
+ entry.getAttribute("nsServerPort",
+ LDAPUtil.getLDAPAttributeLocale()));
+
+ Debug.println("host:" + cmsHost+" port:"+cmsPort);
+ configParams.put("cmsHost", cmsHost);
+ configParams.put("cmsPort", cmsPort);
+ }
+ catch (LDAPException e) {
+ Debug.println(
+ "ERROR CMSStatus: LDAP read failed: " +
+ configDN);
+ }
+ _consoleInfo.put("arguments", configParams);
+
+ if (_consoleInfo.get("AdminUsername") == null)
+ _consoleInfo.put("AdminUsername", _consoleInfo.getAuthenticationDN()
+);
+ Debug.println("AdminUsername = " + _consoleInfo.get("AdminUsername"));
+
+ if (_consoleInfo.get("AdminUserPassword") == null)
+ _consoleInfo.put("AdminUserPassword",
+ _consoleInfo.getAuthenticationPassword());
+ Debug.println("AdminUserPassword = " + _consoleInfo.get("AdminUserPassword"));
+ // call the CGI program
+ Debug.println("CMSStart: start() before run task="+START_TASK_CGI);
+ try {
+ status = super.run(null, START_TASK_CGI);
+ } catch (Exception e) {
+ Debug.println("Unexpected Error"+e.toString());
+ status = false;
+ }
+ Debug.println("CMSStart: start() after run status="+status);
+
+ String title = mResource.getString("STARTRESULTDIALOG_TITLE");
+
+ if (!status) {
+ Debug.println("Show error dialog");
+ // if no error message from the server, then just show the generic
+ // error message.
+ if (mErrorMsg.equals(""))
+ CMSAdminUtil.showMessageDialog(
+ UtilConsoleGlobals.getActivatedFrame(),
+ mResource, PREFIX, "SYSTEMERROR", CMSAdminUtil.ERROR_MESSAGE);
+ else {
+ String errorMsg =
+ mResource.getString("STARTRESULTDIALOG_FAILED_TEXT")+mErrorMsg;
+ Icon icon = CMSAdminUtil.getImage(CMSAdminResources.IMAGE_ERROR_ICON);
+ JOptionPane.showMessageDialog(UtilConsoleGlobals.getActivatedFrame(),
+ errorMsg, title, JOptionPane.ERROR_MESSAGE, icon);
+ }
+ } else {
+ Debug.println("Successful operation");
+ String msg = "";
+ // If warning message is received along with the started
+ // signal from the start.cc, we want to display the
+ // warning.
+ if (mWarnMsg.equals("")) {
+ msg = mResource.getString("STARTRESULTDIALOG_SUCCESS_TEXT");
+ Icon icon = CMSAdminUtil.getImage(CMSAdminResources.IMAGE_INFO_ICON);
+ JOptionPane.showMessageDialog(UtilConsoleGlobals.getActivatedFrame(),
+ msg, title, JOptionPane.INFORMATION_MESSAGE, icon);
+ } else {
+ StringTokenizer st = new StringTokenizer(mWarnMsg, "|");
+ while (st.hasMoreTokens()) {
+ msg += st.nextToken();
+ if (st.hasMoreTokens()) {
+ msg += "\n";
+ }
+ }
+ StatusDialog sd = new StatusDialog(UtilConsoleGlobals.getActivatedFrame());
+ sd.showDialog(mResource.getString("STARTRESULTDIALOG_SUCCESS_TEXT"), msg);
+ }
+ }
+ return status;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/task/CMSStartDaemon.java b/base/console/src/com/netscape/admin/certsrv/task/CMSStartDaemon.java
new file mode 100644
index 000000000..510bf0661
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/task/CMSStartDaemon.java
@@ -0,0 +1,284 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.task;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.management.client.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.*;
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import com.netscape.management.client.console.*;
+import com.netscape.management.client.topology.*;
+import com.netscape.management.client.comm.*;
+import java.net.*;
+import java.io.*;
+import netscape.ldap.*;
+import netscape.ldap.util.*;
+
+/**
+ * Start daemon to do the certificate server configuration.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ */
+public class CMSStartDaemon extends CGITask {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PREFIX = "CMSSTARTDAEMON";
+
+ public static final String START_DAEMON_CGI = "Tasks/Operation/start-daemon";
+
+ private boolean mSuccess = false; // status of last executed CGI
+ private Hashtable mCgiResponse = null; // holds parsed contents of CGI return
+ private String mCgiTask = null; // CGI task to call
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSStartDaemon() {
+ super();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public void initialize(ConsoleInfo info) {
+ Debug.println("CMSStartDaemon: initialize()");
+ _consoleInfo = info;
+ }
+
+ /**
+ * Starts the server specific creation code, providing the DN for the
+ * target admin group. The method returns true or false depending
+ * on whether it was successful.
+ *
+ * @param targetDN - the admin group DN where the new instance is to be
+ * created.
+ * @return boolean value indicating whether the process succeeded (true)
+ * or failed (false).
+ */
+ public boolean runDaemon(Hashtable configParams) {
+ String response = null;
+/*
+ LDAPConnection ldc = _consoleInfo.getLDAPConnection();
+ String ssdn = ldc.getAuthenticationDN();
+ String[] avas = LDAPDN.explodeDN(ssdn, false);
+ String uid = avas[0];
+ configParams.put("adminUID", uid.substring(4,uid.length()));
+
+ configParams.put("adminPWD",ldc.getAuthenticationPassword());
+
+ _consoleInfo.put(START_DAEMON_CGI, "cert-bcsnpk");
+*/
+ _consoleInfo.put("arguments", configParams);
+
+ if (_consoleInfo.get("AdminUsername") == null)
+ _consoleInfo.put("AdminUsername", _consoleInfo.getAuthenticationDN());
+ Debug.println("AdminUsername = " + _consoleInfo.get("AdminUsername"));
+
+ if (_consoleInfo.get("AdminUserPassword") == null)
+ _consoleInfo.put("AdminUserPassword",
+ _consoleInfo.getAuthenticationPassword());
+ Debug.println("AdminUserPassword = " + _consoleInfo.get("AdminUserPassword"));
+
+ Debug.println("Current DN = "+_consoleInfo.getCurrentDN());
+ boolean status = false; // return value
+
+ try {
+ status = super.run(null, START_DAEMON_CGI);
+ } catch (Exception e) {
+ Debug.println("Unexpected Error"+e.toString());
+ status = false;
+ }
+ Debug.println("CMSStartDaemon: startDaemon() after run status=" +
+ status + " mSuccess=" + mSuccess);
+again:
+ if (!mSuccess) {
+ response = (String) mCgiResponse.get("NMC_ERRINFO");
+ if ((response != null) && response.equalsIgnoreCase("daemon found lock file")) {
+ int result = CMSAdminUtil.showConfirmDialog(mResource, "CMSSTARTDAEMON"/*PREFIX*/,
+ "LOCKDELETECONFIRM", CMSAdminUtil.WARNING_MESSAGE);
+ if (result == CMSAdminUtil.OK_OPTION) {
+ Debug.println("User wants to delete lock file.");
+ configParams.put("IGNORE", "TRUE");
+ status = super.run(null, START_DAEMON_CGI);
+ break again;
+ }
+ else
+ Debug.println("User doesn't want to delete lock file.");
+ }
+ else {
+ Debug.println("Show error dialog");
+ CMSAdminUtil.showMessageDialog(UtilConsoleGlobals.getActivatedFrame(), mResource, PREFIX,
+ "SYSTEMERROR", CMSAdminUtil.ERROR_MESSAGE);
+ }
+ }
+
+ return mSuccess;
+ }
+
+ /**
+ * the operation is finished after we receive the http stream
+ */
+ public void replyHandler(InputStream response, CommRecord cr) {
+ mSuccess = false;
+ if (mCgiResponse != null)
+ mCgiResponse.clear();
+
+ try {
+ BufferedReader rspStream =
+ new BufferedReader(new InputStreamReader(response, "UTF8"));
+ String rspStr;
+
+ Debug.println("CMSStartDaemon: replyHandler() - start");
+ while ((rspStr = rspStream.readLine()) != null)
+ {
+ Debug.println("CMSStartDaemon: replyHandler() - read [" + rspStr + "]");
+ // NMC_ messages are parsed, but not shown to the user
+ /*
+ if (_statusText != null && !rspStr.startsWith("NMC_")) {
+ _statusText.append(rspStr + "\n");
+ Thread.yield(); // allow graphics repaints
+ }
+ */
+ parse(rspStr);
+ }
+ } catch (Exception e) {
+ Debug.println("StartDaemon.replyHandler: " + e.toString());
+ }
+
+ Debug.println("StartDaemon.replyHandler: finished, mSuccess=" +
+ mSuccess);
+
+ finish();
+ }
+
+ /**
+ * return the value for the given keyword in the reply
+ */
+ private void parse(String s) {
+ String sName;
+ String sValue;
+ int iIndex;
+
+ Debug.println("Parse input: " + s);
+
+ if ((iIndex=s.indexOf(":")) != (-1))
+ {
+ sName = s.substring(0, iIndex).trim();
+ sValue = s.substring(iIndex+1).trim();
+ Debug.println("Parse input: name=" + sName + " value=" + sValue);
+ if (mCgiResponse == null)
+ mCgiResponse = new Hashtable();
+ mCgiResponse.put(sName, sValue);
+ if (sName.equalsIgnoreCase("NMC_Status"))
+ {
+ int code = Integer.parseInt(sValue);
+ mSuccess = (code == 0);
+ Debug.println("Parse input: code=" + code + " mSuccess=" + mSuccess);
+ }
+ }
+
+ Debug.println("Parse finished");
+ }
+
+ /**
+ * return the value for the response
+ */
+ public Hashtable getResponse() {
+ return mCgiResponse;
+ }
+
+ /**
+ * Get one value for one specified attribute from the given DN.
+ * If there is more than 1 entry which matches the given criteria, the
+ * first one will be used.
+ *
+ * @param DN DN of the entry with the specified attributes
+ * @param attr Attribute to get the value of
+ * @param scope LDAPConnection SCOPE_BASE SCOPE_ONE SCOPE_SUB
+ * @param filter LDAP search filter; if null, default is objectclass=*
+ * @return The string value of the attribute; multi-valued
+ * attributes are returned as 1 value, space delimited
+ * (flattened)
+ **/
+ protected String getValue(String DN, String attr, int scope,
+ String filter) {
+ String[] attrs = { attr };
+ String[] values = getValues(DN, attrs, scope, filter);
+ if (values != null)
+ return values[0];
+
+ return null;
+ }
+
+ /**
+ * Get the values for several specified attributes from the given DN.
+ * If there is more than 1 entry which matches the given criteria, the
+ * first one will be used.
+ *
+ * @param DN DN of the entry with the specified attributes
+ * @param attrs Array of attributes to get the values of
+ * @param scope LDAPConnection SCOPE_BASE SCOPE_ONE SCOPE_SUB
+ * @param filter LDAP search filter; if null, default is objectclass=*
+ * @return An array of string values for each attribute; multi-valued
+ * attributes are returned as 1 value, space delimited
+ * (flattened)
+ **/
+ protected String[] getValues(String DN, String[] attrs, int scope,
+ String filter) {
+ String[] values = null;
+ LDAPSearchResults results = null;
+ if (filter == null)
+ filter = "(objectclass=*)";
+
+ try {
+ LDAPConnection ldc = _consoleInfo.getLDAPConnection();
+ if (ldc != null)
+ {
+ results = ldc.search(DN, scope, filter, attrs, false);
+ }
+ } catch (LDAPException e) {
+ Debug.println("error MigrateCreate.getValues: LDAP read failed " +
+ "for DN=" + DN + " attributes " + attrs);
+ Debug.println("error MigrateCreate.getValues: LDAP Exception:" +
+ e);
+ }
+
+ if (results != null && results.hasMoreElements()) {
+ values = new String[attrs.length];
+ LDAPEntry entry = (LDAPEntry)results.nextElement();
+ for (int ii = 0; entry != null && ii < attrs.length; ++ii) {
+ values[ii] = LDAPUtil.flatting(entry.getAttribute(attrs[ii]));
+ }
+ } else {
+ Debug.println("error MigrateCreate.getValues: LDAP read failed " +
+ "for DN=" + DN + " attributes=" + attrs);
+ }
+
+ return values;
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/task/CMSStatus.java b/base/console/src/com/netscape/admin/certsrv/task/CMSStatus.java
new file mode 100644
index 000000000..edd80b5b2
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/task/CMSStatus.java
@@ -0,0 +1,207 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.task;
+
+import java.util.*;
+import java.io.*;
+import java.net.URL;
+import javax.swing.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.console.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.*;
+import com.netscape.management.client.comm.*;
+import netscape.ldap.*;
+
+/**
+ * Retrieve the status of the server
+ *
+ * @author Ross Fubini
+ * @version $Revision$, $Date$
+ */
+public class CMSStatus extends CGITask
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PREFIX = "TASKSTATUS";
+ public static final String STATUS_TASK_CGI = "Tasks/Operation/status";
+ private Hashtable mCgiResponse = null;
+ private String mCgiTask = null;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+
+ public CMSStatus() {
+ super();
+/*
+ setName(mResource.getString(PREFIX+"_STATUS_LABEL"));
+ setDescription(mResource.getString(PREFIX+"_STATUS_DESC"));
+*/
+ }
+
+ public void initialize(ConsoleInfo info) {
+ Debug.println("CMSStatus: initialize()");
+ _consoleInfo = info;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public boolean run(IPage viewInstance)
+ {
+ Debug.println("CMSStatus: run()");
+ boolean status = false; // return value
+
+ Hashtable configParams = new Hashtable();
+ configParams.put("serverRoot",_consoleInfo.get("serverRoot"));
+ String servid = (String)_consoleInfo.get("servid");
+ int index = servid.indexOf("-");
+ if (index != -1) {
+ servid = servid.substring(index+1);
+ }
+ configParams.put("instanceID", servid);
+
+ // get the CMS instance host and port
+ servid = (String)_consoleInfo.get("servid");
+ String configDN = _consoleInfo.getCurrentDN();
+
+ try {
+ LDAPConnection ldc = _consoleInfo.getLDAPConnection();
+ if (ldc == null) {
+ ldc = new LDAPConnection();
+ }
+ if (ldc.isConnected() == false) {
+ ldc.connect(_consoleInfo.getHost(), _consoleInfo.getPort(),
+ _consoleInfo.getAuthenticationDN(),
+ _consoleInfo.getAuthenticationPassword());
+ }
+ LDAPEntry entry = ldc.read(configDN);
+ String cmsHost = LDAPUtil.flatting(
+ entry.getAttribute("serverHostName",
+ LDAPUtil.getLDAPAttributeLocale()));
+ String cmsPort = LDAPUtil.flatting(
+ entry.getAttribute("nsServerPort",
+ LDAPUtil.getLDAPAttributeLocale()));
+
+ Debug.println("host:" + cmsHost+" port:"+cmsPort);
+ configParams.put("cmsHost", cmsHost);
+ configParams.put("cmsPort", cmsPort);
+ }
+ catch (LDAPException e) {
+ Debug.println(
+ "ERROR CMSStatus: LDAP read failed: " +
+ configDN);
+ }
+ _consoleInfo.put("arguments", configParams);
+
+ if (_consoleInfo.get("AdminUsername") == null)
+ _consoleInfo.put("AdminUsername", _consoleInfo.getAuthenticationDN()
+);
+ Debug.println("AdminUsername = " + _consoleInfo.get("AdminUsername"));
+
+ if (_consoleInfo.get("AdminUserPassword") == null)
+ _consoleInfo.put("AdminUserPassword",
+ _consoleInfo.getAuthenticationPassword());
+ Debug.println("AdminUserPassword = " + _consoleInfo.get("AdminUserPassword"));
+
+ // call the CGI program
+ Debug.println("CMSStatus: status() before run task="+STATUS_TASK_CGI);
+ try {
+ status = getStatusWithFallback(null, STATUS_TASK_CGI);
+ } catch (Exception e) {
+ Debug.println("Unexpected Error"+e.toString());
+ status = false;
+ }
+ Debug.println("CMSStatus: status() after run status="+status);
+
+ if (!status) {
+ Debug.println("Status task returned false");
+ } else {
+ Debug.println("Successful operation");
+ }
+ return status;
+ }
+
+
+ /**
+ * Send an http request to the server.
+ * if the admin serever is down do
+ * Return true if we're sure it
+ * succeeded, otherwise false.
+ *
+ * @param viewInstance The calling page
+ * @param cmd Command to execute
+ */
+ boolean getStatusWithFallback(IPage viewInstance, String cmd) {
+ // get the admin URL location first
+ mAdminURL = _consoleInfo.getAdminURL();
+ if ( mAdminURL == null ) {
+ Debug.println( "Could not get adminURL for " + getDN() );
+ return false;
+ }
+
+ // Allow specifying e.g. "slapd-install" for instance
+ String instance = (String)_consoleInfo.get( cmd );
+
+ if ( instance == null )
+ instance = (String)_consoleInfo.get( "ServerInstance" );
+ String fullCmd = mAdminURL + instance + "/" + cmd;
+
+ HttpManager h = new HttpManager();
+ // tell the http manager to use UTF8 encoding
+ h.setSendUTF8(true);
+
+ try {
+ mSuccess = false;
+ mFinished = false;
+
+ // _consoleInfo.get("arguments") is a hashtable of key/value pairs
+ // to use as the arguments to the CGI
+ Hashtable args = (Hashtable)_consoleInfo.get("arguments");
+ ByteArrayInputStream data = null;
+ if (args != null && !args.isEmpty())
+ data = encode(args);
+ Debug.println( "Posting " + fullCmd );
+ // tell the http manager to notify us immediately of replies
+ // if we're using async mode
+ int flags = 0;
+ if (data == null)
+ h.post(new URL(fullCmd), this, null, null, 0,
+ flags);
+ else
+ h.post(new URL(fullCmd), this, null, data, data.available(),
+ flags);
+ awaitSuccess();
+ Debug.println( "Command executed: " + fullCmd );
+ } catch (Exception e) {
+ if ( e instanceof java.net.ConnectException ) {
+ Debug.println( "Admin server failed to status task" );
+ CMSAdmin cmsAdmin = (CMSAdmin)(_consoleInfo.get("CMSAdmin"));
+ mSuccess = cmsAdmin.getStatusFromAgentPort();
+ }
+ Debug.println( "Falling back to get status by connecting to the server");
+
+ }
+ return mSuccess;
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/task/CMSStop.java b/base/console/src/com/netscape/admin/certsrv/task/CMSStop.java
new file mode 100644
index 000000000..b2a909633
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/task/CMSStop.java
@@ -0,0 +1,161 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.task;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.console.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.*;
+import netscape.ldap.*;
+
+/**
+ * Stop the server
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ */
+public class CMSStop extends CGITask
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PREFIX = "TASKSTOP";
+ public static final String STOP_TASK_CGI = "Tasks/Operation/stop";
+ private Hashtable mCgiResponse = null;
+ private String mCgiTask = null;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+
+ public CMSStop() {
+ super();
+ setName(mResource.getString(PREFIX+"_STOP_LABEL"));
+ setDescription(mResource.getString(PREFIX+"_STOP_DESC"));
+ }
+
+ public void initialize(ConsoleInfo info) {
+ _consoleInfo = info;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public boolean run(IPage viewInstance)
+ {
+ Debug.println("CMSStop: run()");
+ boolean status = false; // return value
+ /*
+ AuthDialog dialog = new AuthDialog(UtilConsoleGlobals.getActivatedFrame());
+ dialog.show();
+ if (dialog.isCancel())
+ return false;
+ */
+ Hashtable configParams = new Hashtable();
+ configParams.put("serverRoot", _consoleInfo.get("serverRoot"));
+ String servid = (String)_consoleInfo.get("servid");
+ int index = servid.indexOf("-");
+ if (index != -1) {
+ servid = servid.substring(index+1);
+ }
+ configParams.put("instanceID", servid);
+ // configParams.put("password",dialog.getPassword());
+
+ // get the CMS instance host and port
+ servid = (String)_consoleInfo.get("servid");
+ String configDN = _consoleInfo.getCurrentDN();
+
+ try {
+ LDAPConnection ldc = _consoleInfo.getLDAPConnection();
+ if (ldc == null) {
+ ldc = new LDAPConnection();
+ }
+ if (ldc.isConnected() == false) {
+ ldc.connect(_consoleInfo.getHost(), _consoleInfo.getPort(),
+ _consoleInfo.getAuthenticationDN(),
+ _consoleInfo.getAuthenticationPassword());
+ }
+ LDAPEntry entry = ldc.read(configDN);
+ String cmsHost = LDAPUtil.flatting(
+ entry.getAttribute("serverHostName",
+ LDAPUtil.getLDAPAttributeLocale()));
+ String cmsPort = LDAPUtil.flatting(
+ entry.getAttribute("nsServerPort",
+ LDAPUtil.getLDAPAttributeLocale()));
+
+ Debug.println("host:" + cmsHost+" port:"+cmsPort);
+ configParams.put("cmsHost", cmsHost);
+ configParams.put("cmsPort", cmsPort);
+ }
+ catch (LDAPException e) {
+ Debug.println(
+ "ERROR CMSStatus: LDAP read failed: " +
+ configDN);
+ }
+ _consoleInfo.put("arguments", configParams);
+
+ if (_consoleInfo.get("AdminUsername") == null)
+ _consoleInfo.put("AdminUsername", _consoleInfo.getAuthenticationDN()
+);
+ Debug.println("AdminUsername = " + _consoleInfo.get("AdminUsername"));
+
+ if (_consoleInfo.get("AdminUserPassword") == null)
+ _consoleInfo.put("AdminUserPassword",
+ _consoleInfo.getAuthenticationPassword());
+ Debug.println("AdminUserPassword = " + _consoleInfo.get("AdminUserPassword"));
+ // call the CGI program
+ Debug.println("CMSStop: stop() before run task="+STOP_TASK_CGI);
+ try {
+ status = super.run(null, STOP_TASK_CGI);
+ } catch (Exception e) {
+ Debug.println("Unexpected Error"+e.toString());
+ status = false;
+ }
+ Debug.println("CMSStop: stop() after run status="+status);
+
+ String title = mResource.getString("STOPRESULTDIALOG_TITLE");
+ if (!status) {
+ Debug.println("Show error dialog");
+ // if no error message from the server, then just show the generic
+ // error message.
+ if (mErrorMsg.equals(""))
+ CMSAdminUtil.showMessageDialog(
+ UtilConsoleGlobals.getActivatedFrame(),
+ mResource, PREFIX, "SYSTEMERROR", CMSAdminUtil.ERROR_MESSAGE);
+ else {
+ String errorMsg =
+ mResource.getString("STOPRESULTDIALOG_FAILED_TEXT")+mErrorMsg;
+ Icon icon = CMSAdminUtil.getImage(CMSAdminResources.IMAGE_ERROR_ICON);
+ JOptionPane.showMessageDialog(UtilConsoleGlobals.getActivatedFrame(),
+ errorMsg, title, JOptionPane.ERROR_MESSAGE, icon);
+ }
+ } else {
+ Debug.println("Successful operation");
+ String msg = mResource.getString("STOPRESULTDIALOG_SUCCESS_TEXT");
+ Icon icon = CMSAdminUtil.getImage(CMSAdminResources.IMAGE_INFO_ICON);
+ JOptionPane.showMessageDialog(UtilConsoleGlobals.getActivatedFrame(),
+ msg, title, JOptionPane.INFORMATION_MESSAGE, icon);
+ }
+ return status;
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/task/CreateInstanceDialog.java b/base/console/src/com/netscape/admin/certsrv/task/CreateInstanceDialog.java
new file mode 100644
index 000000000..3092bf16d
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/task/CreateInstanceDialog.java
@@ -0,0 +1,246 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.task;
+
+import java.awt.*;
+import java.util.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import javax.swing.border.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Display this dialog to get the certificate
+ * instance name.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public class CreateInstanceDialog extends JDialog
+ implements ActionListener, DocumentListener, MouseListener
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PREFIX = "CREATEINSTANCE";
+
+ private static final int WIDTH = 300;
+ private static final int HEIGHT = 150;
+ private JTextField mInstanceField; // username textfield
+ private boolean mCanceled = true; // exit state of the dialog
+ private String mInstanceName; // username
+ private JFrame mParentFrame;
+ private ResourceBundle mResource;
+ private JButton mOK, mCancel;
+ private KeyListener mTextFieldKeyListener;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+
+ /**
+ * @param parent parent frame
+ */
+ public CreateInstanceDialog(JFrame parent) {
+ super(parent, true);
+ mParentFrame = parent;
+ mResource =
+ ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ mTextFieldKeyListener = new TextFieldKeyListener();
+ setTitle(mResource.getString(PREFIX+"_TITLE"));
+ setLocationRelativeTo(parent);
+
+ JPanel center = new JPanel();
+ getContentPane().setLayout(new BorderLayout());
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ center.setLayout(gb);
+
+ JPanel contentPanel = new JPanel();
+ GridBagLayout gb1 = new GridBagLayout();
+ contentPanel.setLayout(gb1);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(contentPanel, gbc);
+ center.add(contentPanel);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel lUsername =
+ new JLabel(mResource.getString(PREFIX+"_LABEL_INSTANCE_LABEL"));
+ lUsername.setToolTipText(
+ mResource.getString(PREFIX+"_LABEL_INSTANCE_TTIP"));
+
+ mInstanceField = new JTextField();
+ mInstanceField.addKeyListener(mTextFieldKeyListener);
+ mInstanceField.getDocument().addDocumentListener(this);
+ mInstanceField.addMouseListener(this);
+
+ CMSAdminUtil.addEntryField(contentPanel, lUsername, mInstanceField,
+ gbc);
+
+ JPanel actionPanel = makeActionPane();
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints(actionPanel, gbc);
+ center.add(actionPanel);
+
+ getContentPane().add("Center",center);
+
+ mCanceled=false;
+ mInstanceName="";
+
+ setSize( WIDTH, HEIGHT );
+
+ addWindowListener(
+ new WindowAdapter() {
+ public void windowClosing(WindowEvent e) {
+ //setVisible(false);
+ dispose();
+ mCanceled = true;
+ }
+ }
+ );
+
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * return the exit status of the dialog
+ *
+ * @return true if the user hits the cancel button.
+ */
+ public boolean isCancel() {
+ return mCanceled;
+ }
+
+ /**
+ * Returns the username typed in by the user, on OK.
+ *
+ * @return The selected username, if the user hits the OK button.
+ */
+ public String getInstanceName() {
+ return mInstanceName;
+ }
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+ public void actionPerformed(ActionEvent evt) {
+ if (evt.getSource().equals(mOK)) {
+ mInstanceName = mInstanceField.getText().trim();
+
+ mCanceled = false;
+ //setVisible(false);
+ this.dispose();
+ return;
+
+ }
+ if (evt.getSource().equals(mCancel)) {
+ //setVisible(false);
+ mCanceled = true;
+ this.dispose();
+ return;
+ }
+ }
+
+ //== DocumentListener ==
+ public void insertUpdate(DocumentEvent e) {
+ setButtons();
+ }
+
+ public void removeUpdate(DocumentEvent e){
+ setButtons();
+ }
+
+ public void changedUpdate(DocumentEvent e){
+ setButtons();
+ }
+
+ //==== MOUSELISTENER ======================
+ public void mouseClicked(MouseEvent e) {
+ setButtons();
+ }
+
+ public void mousePressed(MouseEvent e) {}
+ public void mouseReleased(MouseEvent e) {}
+ public void mouseEntered(MouseEvent e) {}
+ public void mouseExited(MouseEvent e) {
+ setButtons();
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+
+ private JPanel makeActionPane() {
+ mOK = CMSAdminUtil.makeJButton(mResource, PREFIX, "OK", null,
+ this);
+ mOK.setEnabled(false);
+ mCancel = CMSAdminUtil.makeJButton(mResource, PREFIX, "CANCEL",
+ null, this);
+
+ JButton[] buttons = { mOK, mCancel};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonPanel(buttons, false);
+ }
+
+ //set buttons
+ private void setButtons() {
+ if (mInstanceField.getText().trim().equals("")){
+ mOK.setEnabled(false);
+ } else {
+ mOK.setEnabled(true);
+ getRootPane().setDefaultButton(mOK);
+ }
+ }
+
+ /**
+ * Inner class which handles key events for JTextField components.
+ */
+ class TextFieldKeyListener implements KeyListener
+ {
+ public void keyTyped(KeyEvent e) {
+ }
+
+ public void keyPressed(KeyEvent e) {
+ }
+
+ public void keyReleased(KeyEvent e) {
+ if(e.getKeyCode() == KeyEvent.VK_ENTER) {
+ if (!mInstanceField.getText().trim().equals("")) {
+ mOK.doClick();
+ }
+ }
+ }
+ }
+
+} \ No newline at end of file
diff --git a/base/console/src/com/netscape/admin/certsrv/task/KeyCert.java b/base/console/src/com/netscape/admin/certsrv/task/KeyCert.java
new file mode 100644
index 000000000..589983f61
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/task/KeyCert.java
@@ -0,0 +1,62 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.task;
+
+import java.util.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.console.*;
+import com.netscape.admin.certsrv.keycert.*;
+
+/**
+ * Restart the server
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public class KeyCert extends CMSTaskObject
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static String PREFIX = "TASKKEYCERT_";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+
+ public KeyCert() {
+ setName(mResource.getString(PREFIX+"KEYCERT_LABEL"));
+ setDescription(mResource.getString(PREFIX+"KEYCERT_DESC"));
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public boolean run(IPage viewInstance) {
+ ConsoleInfo console = getConsoleInfo();
+ CMSServerInfo serverInfo = (CMSServerInfo)console.get("serverInfo");
+ CMSBaseResourceModel model = new CMSBaseResourceModel(console, serverInfo);
+ AdminConnection admin = serverInfo.getAdmin();
+ CertSetupWizardInfo wizardinfo = new CertSetupWizardInfo(admin, console);
+ CertSetupWizard wizard = new CertSetupWizard(model, wizardinfo);
+ return true;
+ }
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/task/StatusDialog.java b/base/console/src/com/netscape/admin/certsrv/task/StatusDialog.java
new file mode 100644
index 000000000..0cd11beb5
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/task/StatusDialog.java
@@ -0,0 +1,186 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.task;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import javax.swing.table.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Policy Implementation Information viewer
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class StatusDialog extends JDialog
+ implements ActionListener
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private String PREFIX = "STATUSDIALOG";
+
+ private JFrame mParentFrame;
+ private ResourceBundle mResource;
+ private JTextArea mTextArea;
+ private JLabel mTitle, mDetails;
+
+ private JButton mOK;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public StatusDialog(JFrame parent) {
+ super(parent,true);
+ mParentFrame = parent;
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ setSize(300, 200);
+ setTitle(mResource.getString(PREFIX+"_TITLE"));
+ setLocationRelativeTo(parent);
+ getRootPane().setDoubleBuffered(true);
+ setDisplay();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * show the windows
+ */
+ public void showDialog(String title, String desc) {
+ //initialize and setup
+ mTitle.setText(title);
+ mDetails.setText("Details:");
+ mTextArea.setText(desc);
+ mTextArea.setCaretPosition(0);
+ this.show();
+ }
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent evt) {
+ if (evt.getSource().equals(mOK)) {
+ this.hide();
+ }
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+ private void setDisplay() {
+ getContentPane().setLayout(new BorderLayout());
+ JPanel center = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ center.setLayout(gb);
+
+ //content panel
+ JPanel content = makeContentPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.fill = gbc.BOTH;
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(content, gbc);
+ center.add(content);
+
+ //action panel
+ JPanel action = makeActionPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints(action, gbc);
+ center.add(action);
+
+ getContentPane().add("Center",center);
+ }
+
+ private JPanel makeActionPane() {
+ mOK = CMSAdminUtil.makeJButton(mResource, PREFIX, "OK", null, this);
+ Dimension d = mOK.getMinimumSize();
+ if (d.width < CMSAdminUtil.DEFAULT_BUTTON_SIZE) {
+ d.width = CMSAdminUtil.DEFAULT_BUTTON_SIZE;
+ mOK.setMinimumSize(d);
+ }
+ JButton[] buttons = {mOK};
+ return CMSAdminUtil.makeJButtonPanel( buttons );
+ }
+
+ private JPanel makeContentPane() {
+ JPanel content = new JPanel();
+ GridBagLayout gb3 = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ content.setLayout(gb3);
+
+ mTitle = new JLabel();
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx=1.0;
+ gbc.weighty=0.0;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,CMSAdminUtil.COMPONENT_SPACE, CMSAdminUtil.COMPONENT_SPACE,CMSAdminUtil.COMPONENT_SPACE);
+ gb3.setConstraints(mTitle, gbc);
+ content.add(mTitle);
+
+ mDetails = new JLabel();
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx=1.0;
+ gbc.weighty=0.0;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,CMSAdminUtil.COMPONENT_SPACE, CMSAdminUtil.COMPONENT_SPACE,CMSAdminUtil.COMPONENT_SPACE);
+ gb3.setConstraints(mDetails, gbc);
+ content.add(mDetails);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mTextArea = new JTextArea("",3,50);
+ mTextArea.setFont(mTitle.getFont());
+ mTextArea.setEditable(false);
+ mTextArea.setBackground(getBackground());
+ JScrollPane scrollPanel = new JScrollPane(mTextArea,
+ JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+ JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
+ scrollPanel.setAlignmentX(LEFT_ALIGNMENT);
+ scrollPanel.setAlignmentY(TOP_ALIGNMENT);
+ scrollPanel.setBackground(getBackground());
+ //scrollPanel.setBorder(BorderFactory.createEmptyBorder());
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx=1.0;
+ gbc.weighty=1.0;
+ gb3.setConstraints(scrollPanel, gbc);
+ content.add(scrollPanel);
+
+ return content;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/ug/AuthBaseDialog.java b/base/console/src/com/netscape/admin/certsrv/ug/AuthBaseDialog.java
new file mode 100644
index 000000000..6656b3abb
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/ug/AuthBaseDialog.java
@@ -0,0 +1,355 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.ug;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import javax.swing.text.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Auth Parameter Configuration Dialog
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.ug
+ */
+public class AuthBaseDialog extends JDialog
+ implements ActionListener
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ protected JFrame mParentFrame;
+ protected ResourceBundle mResource;
+ protected CMSTableModel mDataModel;
+ protected NameValuePairs mData;
+ protected JScrollPane mScrollPane;
+ protected JTable mTable;
+ protected String mRuleName;
+ protected String mPrefix;
+ protected String mType;
+ protected JButton mOK, mCancel, mHelp;
+ protected JTextField mAuthName;
+ protected JLabel mImplName, mAuthLabel;
+ protected AdminConnection mConn;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public AuthBaseDialog(JFrame parent, String type, String prefix) {
+ super(parent, true);
+ mParentFrame = parent;
+ mPrefix = prefix;
+ mType = type;
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ setSize(360, 316);
+ setTitle(mResource.getString(mPrefix+"_TITLE"));
+ setLocationRelativeTo(parent);
+ getRootPane().setDoubleBuffered(true);
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * show the windows
+ * @param users list of current groups
+ */
+ // Changed by beomsuk
+ /*public void showDialog(NameValuePairs data, String name,
+ boolean pinDirExist, boolean userDirExist) {*/
+ public void showDialog(NameValuePairs data, String name,
+ boolean pinDirExist, boolean userDirExist, boolean portalExist) {
+ // Change end
+ mDataModel.removeAllRows();
+ mData = data;
+
+ mImplName.setText(data.get(Constants.PR_AUTH_IMPL_NAME));
+
+ for (String entry : data.keySet()) {
+ entry = entry.trim();
+ if (!entry.equals(Constants.PR_AUTH_IMPL_NAME)) {
+ String value = data.get(entry);
+ Vector v = new Vector();
+ v.addElement(entry);
+ v.addElement(value);
+ mDataModel.addRow(v);
+ }
+ }
+
+ if ((name==null)||name.equals("")) {
+ //new policy
+ mAuthName.setVisible(true);
+ mAuthName.setText("");
+ mAuthLabel.setVisible(false);
+ String str = mImplName.getText().trim();
+ if (!pinDirExist && str.equals("UidPwdPinDirAuth"))
+ mAuthName.setText("PinDirEnrollment");
+ else if (!userDirExist && str.equals("UidPwdDirAuth"))
+ mAuthName.setText("UserDirEnrollment");
+ else if (!userDirExist && str.equals("UdnPwdDirAuth"))
+ mAuthName.setText("UserDnEnrollment");
+ else if (str.equals("NISAuth"))
+ mAuthName.setText("NISAuth");
+ // Inserted by beomsuk
+ else if (!portalExist && str.equals("PortalEnroll"))
+ mAuthName.setText("PortalEnrollment");
+ // Insert end
+ } else {
+ //old one
+ mRuleName = name;
+ mAuthName.setVisible(false);
+ mAuthLabel.setVisible(true);
+ mAuthLabel.setText(name);
+ }
+
+ this.show();
+ }
+
+ protected NameValuePairs getData() {
+ NameValuePairs response = new NameValuePairs();
+ response.put(Constants.PR_AUTH_IMPL_NAME, mImplName.getText());
+ for (int i=0; i< mDataModel.getRowCount(); i++) {
+ response.put((String) mDataModel.getValueAt(i, 0),
+ (String) mDataModel.getValueAt(i, 1));
+ }
+ return response;
+ }
+
+ protected String getRuleName() {
+ return mRuleName;
+ }
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent evt) {
+
+ if (evt.getSource().equals(mOK)) {
+
+ if(mAuthName.isVisible()) {
+ mRuleName = mAuthName.getText();
+ if (mRuleName.trim().equals("")) {
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ mResource.getString(mPrefix+"_DIALOG_NORULENAME_MESSAGE"),
+ CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ }
+
+ //save any current edit component
+ Component component = mTable.getEditorComponent();
+ if (component!= null) {
+ int col = mTable.getEditingColumn();
+ int row = mTable.getEditingRow();
+ if ((col>-1)&&(row>-1)) {
+ String str = ((JTextComponent)component).getText();
+ mTable.setValueAt(str, row, col);
+ }
+ }
+
+ try {
+ if (mAuthName.isVisible())
+ addPolicyRule(getData(), getRuleName());
+ else
+ modifyPolicyRule(getData(), getRuleName());
+ } catch (EAdminException e) {
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ e.toString(),CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ }
+
+ if (evt.getSource().equals(mOK) || evt.getSource().equals(mCancel))
+ this.dispose();
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+ protected void setDisplay() {
+ getContentPane().setLayout(new BorderLayout());
+ JPanel center = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ center.setLayout(gb);
+
+ //content panel
+ JPanel content = makeContentPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(content, gbc);
+ center.add(content);
+
+ //action panel
+ JPanel action = makeActionPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints(action, gbc);
+ center.add(action);
+
+ getContentPane().add("Center",center);
+ }
+
+ //create botton action panel
+ private JPanel makeActionPane() {
+ mOK = CMSAdminUtil.makeJButton(mResource, mPrefix, "OK", null, this);
+ if (mType.equals(Constants.VIEW))
+ mOK.setEnabled(false);
+ else
+ mOK.setEnabled(true);
+ mCancel = CMSAdminUtil.makeJButton(mResource, mPrefix, "CANCEL", null, this);
+ mHelp = CMSAdminUtil.makeJButton(mResource, mPrefix, "HELP", null, this);
+ // JButton[] buttons = { mOK, mCancel, mHelp};
+ JButton[] buttons = { mOK, mCancel};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonPanel( buttons, true);
+ }
+
+ private JPanel makeContentPane() {
+ JPanel mListPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mListPanel.setLayout(gb);
+ //content.setBorder(CMSAdminUtil.makeEtchedBorder());
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label1 = CMSAdminUtil.makeJLabel(mResource, mPrefix, "RULENAME", null);
+ mAuthLabel = new JLabel();
+ mAuthLabel.setVisible(false);
+ mAuthName = new JTextField();
+
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.anchor = gbc.EAST;
+ gbc. insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ mListPanel.add(label1, gbc);
+
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc. insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,
+ 0,CMSAdminUtil.COMPONENT_SPACE);
+ mListPanel.add( mAuthLabel, gbc );
+ mListPanel.add( mAuthName, gbc );
+
+ JLabel dummy = new JLabel();
+ dummy.setVisible(false);
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 0.0;
+ mListPanel.add( dummy, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label3 = CMSAdminUtil.makeJLabel(mResource, mPrefix, "IMPLNAME", null);
+ mImplName = new JLabel();
+ CMSAdminUtil.addEntryField(mListPanel, label3, mImplName, gbc);
+
+ //left side certificate table
+ mTable = new JTable(mDataModel);
+ mScrollPane = JTable.createScrollPaneForTable(mTable);
+ //mScrollPane.setBorder(CMSAdminUtil.makeTitledBorder(mResource,PANEL_NAME,"USERS"));
+ mScrollPane.setHorizontalScrollBarPolicy(mScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mScrollPane.setVerticalScrollBarPolicy(mScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ mTable.setAutoscrolls(true);
+ mTable.sizeColumnsToFit(true);
+ mTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
+ //mTable.getSelectionModel().addListSelectionListener(this);
+ mScrollPane.setBackground(Color.white);
+ setLabelCellRenderer(mTable,0);
+ setLabelCellRenderer(mTable,1);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(mScrollPane, gbc);
+ mListPanel.add(mScrollPane);
+
+ return mListPanel;
+ }
+
+ //Set the first column's cellrender as label cell
+ protected void setLabelCellRenderer(JTable table, int index) {
+ //table.getColumnModel().getColumn(index).setCellRenderer(new DefaultTableCellRenderer());
+ JLabel label = new JLabel();
+ if (mType.equals(Constants.VIEW)) {
+ label.setEnabled(false);
+ table.getColumnModel().getColumn(index).setCellRenderer(
+ new CustomLabelCellRenderer(label));
+ } else {
+ label.setEnabled(true);
+ table.getColumnModel().getColumn(index).setCellRenderer(
+ new LabelCellRenderer(label));
+ }
+ }
+
+ public class CustomLabelCellRenderer extends LabelCellRenderer {
+ public CustomLabelCellRenderer(JLabel x) {
+ super(x);
+ }
+
+ public Component getTableCellRendererComponent(JTable table,
+ Object value, boolean isSelected, boolean hasFocus, int row,
+ int column) {
+
+ if(value == null) {
+ value = table.getModel().getValueAt(row, column);
+ }
+ this.value.setValue(value);
+ component.setBackground(WHITECOLOR);
+ component.setForeground(WHITECOLOR);
+ return component;
+ }
+ }
+
+ protected void addPolicyRule(NameValuePairs config, String name)
+ throws EAdminException
+ {
+ mConn.add(DestDef.DEST_AUTH_ADMIN,
+ ScopeDef.SC_AUTH_MGR_INSTANCE,
+ name, config);
+ }
+
+ protected void modifyPolicyRule(NameValuePairs config, String name)
+ throws EAdminException
+ {
+ mConn.modify(DestDef.DEST_AUTH_ADMIN,
+ ScopeDef.SC_AUTH_MGR_INSTANCE,
+ name, config);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/ug/AuthConfigDialog.java b/base/console/src/com/netscape/admin/certsrv/ug/AuthConfigDialog.java
new file mode 100644
index 000000000..aa756b388
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/ug/AuthConfigDialog.java
@@ -0,0 +1,91 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.ug;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.config.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import javax.swing.table.*;
+import javax.swing.text.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+
+/**
+ * Auth Parameter Configuration Dialog
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.ug
+ */
+public class AuthConfigDialog extends CMSBaseConfigDialog
+{
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+
+ public AuthConfigDialog(NameValuePairs nvp,
+ JFrame parent,
+ AdminConnection conn,
+ String dest) {
+
+ super(parent,dest);
+
+ PREFIX = "AUTHCONFIGDIALOG";
+ RAHELPINDEX = "authentication-certsrv-edit-authrule-dbox-help";
+ KRAHELPINDEX = "authentication-certsrv-edit-authrule-dbox-help";
+ CAHELPINDEX = "authentication-certsrv-edit-authrule-dbox-help";
+ mImplName_token = Constants.PR_AUTH_IMPL_NAME;
+ mImplType = Constants.PR_EXT_PLUGIN_IMPLTYPE_AUTH;
+ mHelpToken = "configuration-authentication";
+ init (nvp,parent,conn,dest);
+ }
+
+ public String getDefaultInstanceName(String implName)
+ {
+ Debug.println("Getting DefaultInstanceName for "+implName);
+ String instanceName = "";
+ if (implName.equals("UidPwdDirAuth")) {
+ instanceName = "UserDirEnrollment";
+ }
+ else if (implName.equals("UidPwdPinDirAuth")) {
+ instanceName = "PinDirEnrollment";
+ }
+ else if (implName.equals("UdnPwdDirAuth")) {
+ instanceName = "UserDnEnrollment";
+ }
+ else if (implName.equals("NISAuth")) {
+ instanceName = "NISAuth";
+ }
+ else if (implName.equals("PortalEnroll")) {
+ instanceName = "PortalEnrollment";
+ }
+
+ Debug.println("Returning instance name "+instanceName);
+ return instanceName;
+
+ }
+
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/ug/AuthImplDataModel.java b/base/console/src/com/netscape/admin/certsrv/ug/AuthImplDataModel.java
new file mode 100644
index 000000000..98214871e
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/ug/AuthImplDataModel.java
@@ -0,0 +1,72 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.ug;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.*;
+
+/**
+ * Auth Plugin Implementation Data model - represents the implementation
+ * table information
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.ug
+ */
+public class AuthImplDataModel extends CMSContentTableModel
+ implements IDataProcessor
+{
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ public static final String IMPL_NAME = "NAME";
+ public static final String IMPL_CLASS = "CLASS";
+ public static final String IMPL_DESC = "DESC";
+ public static final String IMPL_TYPE = "TYPE";
+
+ private static String[] mColumns = {POLICY_IMPL, CLASSNAME};
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public AuthImplDataModel() {
+ super();
+ init(mColumns);
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public void processData(Object data) {
+ Vector v = new Vector();
+ NameValuePairs obj = (NameValuePairs) data;
+ JLabel label = new JLabel(obj.get(IMPL_NAME),
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_AUTH_PLUGIN),
+ JLabel.LEFT);
+ if(!obj.get(IMPL_DESC).trim().equals(""))
+ label.setToolTipText(obj.get(IMPL_DESC));
+ v.addElement(label);
+ v.addElement(obj.get(IMPL_CLASS));
+ //v.addElement(obj.getValue(IMPL_DESC));
+ addRow(v, data);
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/ug/AuthImplTab.java b/base/console/src/com/netscape/admin/certsrv/ug/AuthImplTab.java
new file mode 100644
index 000000000..0cc964c60
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/ug/AuthImplTab.java
@@ -0,0 +1,353 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.ug;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+
+import javax.swing.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Auth Plugin Management Tab
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.ug
+ */
+public class AuthImplTab extends CMSBaseUGTab {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String IMPL_NAME = AuthImplDataModel.IMPL_NAME;
+ private static final String IMPL_CLASS = AuthImplDataModel.IMPL_CLASS;
+ private static final String IMPL_DESC = AuthImplDataModel.IMPL_DESC;
+ private static final String IMPL_TYPE = AuthImplDataModel.IMPL_TYPE;
+
+ private static final String PANEL_NAME = "AUTHIMPL";
+ private static final String TOKEN = ";";
+
+ private AdminConnection mConnection;
+ private String mDestination;
+
+ protected JScrollPane mScrollPane;
+ protected JTable mTable; //table
+ protected AuthImplDataModel mDataModel; //table model
+ protected AuthRegisterDialog mEditor=null; //keep single copy
+ protected JButton mRefresh, mAdd, mDelete, mHelp;
+ private static final String HELPINDEX =
+ "authentication-certsrv-authplugin-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public AuthImplTab(CMSBaseResourceModel model) {
+ super(PANEL_NAME, model);
+ mConnection = model.getServerInfo().getAdmin();
+ mDataModel = new AuthImplDataModel();
+ mDestination = DestDef.DEST_AUTH_ADMIN;
+ mHelpToken = HELPINDEX;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mRefresh)) {
+ refresh();
+ }
+ if (e.getSource().equals(mAdd)) {
+ if (mEditor==null)
+ mEditor = new AuthRegisterDialog(mModel.getFrame(), mConnection);
+ mEditor.showDialog(mDestination, ScopeDef.SC_AUTH_IMPLS);
+
+ if (mEditor.isOK())
+ refresh();
+ }
+ if (e.getSource().equals(mDelete)) {
+ Debug.println("Delete");
+ if(mTable.getSelectedRow()< 0)
+ return;
+ int i = showConfirmDialog("DELETE");
+ if (i == JOptionPane.YES_OPTION) {
+ delete();
+ Debug.println("Deleted");
+ }
+ }
+ if (e.getSource().equals(mHelp)) {
+ helpCallback();
+ }
+ }
+
+ //==== MOUSELISTENER ======================
+ public void mouseClicked(MouseEvent e) {
+ setButtons();
+ }
+
+ public void mouseReleased(MouseEvent e) {
+ setButtons();
+ }
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+ public void refresh() {
+
+ mDataModel.removeAllRows();
+ update();
+
+ setButtons();
+ mTable.invalidate();
+ mTable.validate();
+ mScrollPane.invalidate();
+ mScrollPane.validate();
+ mScrollPane.repaint(1);
+ }
+
+ /**
+ * create the user action button panel
+ */
+ protected JPanel createButtonPanel() {
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mAdd = makeJButton("ADD");
+ mDelete = makeJButton("DELETE");
+ JButton[] buttons = {mAdd, mDelete};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonVPanel( buttons );
+ }
+
+ protected JPanel createActionPanel() {
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mRefresh = makeJButton("REFRESH");
+ mHelp = makeJButton("HELP");
+ //JButton[] buttons = { mRefresh, mHelp };
+ JButton[] buttons = { mRefresh };
+ return makeJButtonPanel(buttons, true);
+ }
+
+ protected JPanel createListPanel() {
+ mListPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mListPanel.setLayout(gb);
+
+ //center table
+ mTable = new JTable(mDataModel);
+ mScrollPane = JTable.createScrollPaneForTable(mTable);
+ //mScrollPane.setBorder(CMSAdminUtil.makeTitledBorder(mResource,PANEL_NAME,"USERS"));
+ mScrollPane.setHorizontalScrollBarPolicy(mScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mScrollPane.setVerticalScrollBarPolicy(mScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ mTable.setAutoscrolls(true);
+ mTable.sizeColumnsToFit(true);
+ mTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ mTable.getSelectionModel().addListSelectionListener(this);
+ mScrollPane.setBackground(Color.white);
+ mTable.addMouseListener(this);
+ setLabelCellRenderer(mTable,0);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = 1;
+ gbc.weightx = 1.0;
+ gbc.insets = EMPTY_INSETS;
+ gb.setConstraints(mScrollPane, gbc);
+ mListPanel.add(mScrollPane);
+
+ JPanel buttonPanel = createButtonPanel();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 0.0;
+ gbc.weighty = 1.0;
+ gbc.insets = EMPTY_INSETS;
+ gb.setConstraints(buttonPanel, gbc);
+ mListPanel.add(buttonPanel);
+
+ refresh();
+
+ return mListPanel;
+ }
+
+ //Set the first column's cellrender as label cell
+ protected void setLabelCellRenderer(JTable table, int index) {
+ table.getColumnModel().getColumn(index).setCellRenderer(new LabelCellRenderer(new JLabel()));
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+
+ //set buttons
+ private void setButtons() {
+
+ //enable and diable buttons accordingly
+ //Debug.println("setButtons() - "+mTable.getSelectedRow());
+ //Debug.println("setButtons() - "+mTable.getSelectionModel().isSelectionEmpty());
+ if (mTable.getSelectionModel().isSelectionEmpty()) {
+ mDelete.setEnabled(false);
+ return;
+ }
+
+ if(mDataModel.getRowCount()< 0) {
+ mDelete.setEnabled(false);
+ return;
+ }
+
+ mDelete.setEnabled(true);
+ int index = mTable.getSelectedRow();
+
+ if (index >= 0) {
+ NameValuePairs nvp =
+ (NameValuePairs)mDataModel.getObjectValueAt(index);
+ String type = nvp.get(IMPL_TYPE);
+ if (type.equals(Constants.VIEW) || type.equals(Constants.VIEW))
+ mDelete.setEnabled(false);
+ }
+ }
+
+ //=============================================
+ // SEND REQUESTS TO THE SERVER SIDE
+ //=============================================
+ private void update() {
+ //send request and parse data
+
+ mModel.progressStart();
+ NameValuePairs response;
+ try {
+ response = mConnection.search(mDestination,
+ ScopeDef.SC_AUTH_IMPLS,
+ new NameValuePairs());
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ mModel.progressStop();
+ return;
+ }
+
+ Debug.println(response.toString());
+
+ //parse the response
+ //The response is a set of name
+ int i=0;
+ String[] vals = new String[response.size()];
+ Hashtable data = new Hashtable();
+ for (String entry : response.keySet()) {
+ entry = entry.trim();
+ String value = response.get(entry);
+ Debug.println("AuthImplTab.java update(): "+
+ "entry="+entry+
+ "value="+value
+ );
+ int x = value.indexOf(",");
+ int y = value.indexOf(TOKEN);
+ NameValuePairs obj = new NameValuePairs();
+ obj.put(IMPL_NAME, entry);
+ Debug.println("x="+x);
+ if(x != -1) {
+ Debug.println("0 obj.add(IMPL_CLASS,"+value.substring(0,x));
+ obj.put(IMPL_CLASS, value.substring(0, x));
+ if (y == -1) {
+ Debug.println("1 obj.add(IMPL_DESC,"+value.substring(0,x));
+ obj.put(IMPL_DESC, value.substring(x + 1));
+ }
+ else {
+ Debug.println("1 obj.add(IMPL_DESC,"+value.substring(x+1,y));
+ obj.put(IMPL_DESC, value.substring(x + 1, y));
+ }
+ } else {
+ Debug.println(" 2 obj.add(IMPL_CLASS,"+value.substring(0,y));
+ obj.put(IMPL_CLASS, value.substring(0, y));
+ Debug.println(" 2 obj.add(IMPL_DESC,\"\"");
+ obj.put(IMPL_DESC, "");
+ }
+
+ String type = "";
+ Debug.println("y="+y);
+ if (y == -1) {
+ type = Constants.EDIT;
+ obj.put(IMPL_TYPE, Constants.EDIT);
+ } else {
+ type = value.substring(y+1);
+ obj.put(IMPL_TYPE, type);
+ }
+ if (type.equals(Constants.EDIT)) {
+ data.put(entry,obj);
+ vals[i++]= entry ;
+ }
+ }
+
+ if (i >= 1) {
+ String[] valCopy = new String[i];
+ System.arraycopy(vals, 0, valCopy, 0, i);
+ CMSAdminUtil.bubbleSort(valCopy);
+ for (int y=0; y< valCopy.length ; y++) {
+ if (data.get(valCopy[y]) instanceof String) {
+ Debug.println("processData: "+(String)data.get(valCopy[y]));
+ }
+ mDataModel.processData(data.get(valCopy[y]));
+ }
+
+ data.clear();
+ }
+
+ if (mDataModel.getRowCount() >0)
+ mTable.setRowSelectionInterval(0,0);
+
+ mModel.progressStop();
+ }
+
+ private void delete() {
+ //get entry name
+ mModel.progressStart();
+ NameValuePairs obj = (NameValuePairs)
+ mDataModel.getObjectValueAt(mTable.getSelectedRow());
+
+ //send comment to server for the removal of user
+ try {
+ mConnection.delete(mDestination,
+ ScopeDef.SC_AUTH_IMPLS,
+ obj.get(IMPL_NAME));
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ mModel.progressStop();
+ return;
+ }
+ mModel.progressStop();
+ //send comment to server and refetch the content
+ refresh();
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/ug/AuthInstanceTab.java b/base/console/src/com/netscape/admin/certsrv/ug/AuthInstanceTab.java
new file mode 100644
index 000000000..929f99aef
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/ug/AuthInstanceTab.java
@@ -0,0 +1,141 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.ug;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.config.*;
+import javax.swing.*;
+
+import com.netscape.certsrv.common.*;
+
+/**
+ * Auth Instances Management Tab
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.ug
+ */
+public class AuthInstanceTab extends CMSPluginInstanceTab {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PANEL_NAME = "AUTHRULE";
+ private static final String ADMINRULE = "adminAuth";
+ private static final String AGENTRULE = "agentAuth";
+
+ private static final String HELPINDEX =
+ "authentication-certsrv-authrules-help";
+
+ private static final String DEST = DestDef.DEST_AUTH_ADMIN;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public AuthInstanceTab(CMSBaseResourceModel model) {
+ super(model,DEST, PANEL_NAME );
+ RULE_NAME = AuthRuleDataModel.RULE_NAME;
+ RULE_IMPL = AuthRuleDataModel.RULE_IMPL;
+ RULE_TYPE = AuthRuleDataModel.RULE_TYPE;
+ mConnection = model.getServerInfo().getAdmin();
+ mDataModel = new AuthRuleDataModel();
+ mScope = ScopeDef.SC_AUTH_MGR_INSTANCE;
+ mHelpToken = HELPINDEX;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ public CMSBaseConfigDialog makeNewConfigDialog(
+ NameValuePairs nvp,
+ JFrame parent,
+ AdminConnection conn,
+ String dest
+ )
+ {
+
+ return new AuthConfigDialog(nvp,
+ parent,
+ conn,
+ dest);
+ }
+
+ public PluginSelectionDialog getPluginSelectionDialog(
+ JFrame parent,
+ AdminConnection conn,
+ String dest,
+ CMSPluginInstanceTab pluginType
+ )
+ {
+ return new AuthPluginSelectionDialog(parent,conn,dest,pluginType);
+ }
+
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+
+
+ //=============================================
+ // SEND REQUESTS TO THE SERVER SIDE
+ //=============================================
+
+ private void delete() {
+
+ mModel.progressStart();
+ //get entry name
+ NameValuePairs data = (NameValuePairs)
+ mDataModel.getObjectValueAt(mTable.getSelectedRow());
+
+ //send comment to server for the removal of user
+ try {
+ mConnection.delete(DestDef.DEST_AUTH_ADMIN,
+ ScopeDef.SC_AUTH_MGR_INSTANCE,
+ data.get(RULE_NAME));
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ mModel.progressStop();
+ return;
+ }
+
+ mModel.progressStop();
+ //send comment to server and refetch the content
+ refresh();
+
+ }
+
+ //this returns the configuration
+ private NameValuePairs getConfig() throws EAdminException {
+ NameValuePairs data = (NameValuePairs)
+ mDataModel.getObjectValueAt(mTable.getSelectedRow());
+
+ NameValuePairs response;
+ response = mConnection.read(DestDef.DEST_AUTH_ADMIN,
+ ScopeDef.SC_AUTH_MGR_INSTANCE,
+ data.get(RULE_NAME),
+ new NameValuePairs());
+ return response;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/ug/AuthPluginSelectionDialog.java b/base/console/src/com/netscape/admin/certsrv/ug/AuthPluginSelectionDialog.java
new file mode 100644
index 000000000..8721363d1
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/ug/AuthPluginSelectionDialog.java
@@ -0,0 +1,95 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.ug;
+
+import com.netscape.admin.certsrv.config.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Auth Plugin Selection Dialog
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.ug
+ */
+public class AuthPluginSelectionDialog extends PluginSelectionDialog
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static String PREFIX = "AUTHSELECTIONDIALOG";
+
+/*
+ private final static String token = ";";
+ private JFrame mParentFrame;
+ private AdminConnection mConnection;
+ private ResourceBundle mResource;
+ protected DefaultListModel mDataModel;
+ private CMSBaseResourceModel mModel;
+
+ private JScrollPane mScrollPane;
+ private JList mList;
+
+ private JButton mOK, mCancel, mHelp;
+*/
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public AuthPluginSelectionDialog(JFrame parent,
+ AdminConnection conn,
+ String dest,
+ CMSPluginInstanceTab pluginType) {
+
+ super(PREFIX,parent,conn,dest,pluginType);
+ mScope = ScopeDef.SC_AUTH_IMPLS;
+ mInstanceScope = ScopeDef.SC_AUTH_MGR_INSTANCE;
+ mImageName = CMSAdminResources.IMAGE_RULE_PLUGIN;
+
+ mHelpToken = "authentication-certsrv-add-authrule-dbox-help";
+ setDisplay();
+/****
+ super(model.getFrame(),true);
+ mParentFrame = model.getFrame();
+ mModel = model;
+ mConnection = model.getServerInfo().getAdmin();
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ mDataModel = new DefaultListModel();
+ setTitle(mResource.getString(PREFIX+"_TITLE"));
+ setLocationRelativeTo(mParentFrame);
+ getRootPane().setDoubleBuffered(true);
+ setDisplay();
+***/
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/ug/AuthRegisterDialog.java b/base/console/src/com/netscape/admin/certsrv/ug/AuthRegisterDialog.java
new file mode 100644
index 000000000..f97a11388
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/ug/AuthRegisterDialog.java
@@ -0,0 +1,40 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.ug;
+
+import com.netscape.admin.certsrv.config.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+
+/**
+ * Auth Plugin Implementation Registration Editor
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.ug
+ */
+
+public class AuthRegisterDialog extends RegisterDialog {
+
+ private final static String PREFIX = "AUTHREGISTERDIALOG";
+
+ public AuthRegisterDialog(JFrame parent, AdminConnection conn) {
+ super(PREFIX, parent, conn);
+ setDisplay();
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/ug/AuthRuleDataModel.java b/base/console/src/com/netscape/admin/certsrv/ug/AuthRuleDataModel.java
new file mode 100644
index 000000000..35e08d0eb
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/ug/AuthRuleDataModel.java
@@ -0,0 +1,64 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.ug;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.config.*;
+import com.netscape.management.client.util.Debug;
+
+
+/**
+ * Auth instance Data model - represents the instance
+ * table information
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public class AuthRuleDataModel extends CMSRuleDataModel
+{
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public AuthRuleDataModel() {
+ super();
+ }
+
+ protected String[] getColumns() {
+ Debug.println("PolicyRuleDataModel.getColumns()");
+ String x[] = {RULE, PLUGIN};
+ return x;
+ }
+
+ public void processData(Object data) {
+ Vector v = new Vector();
+ NameValuePairs obj = (NameValuePairs) data;
+
+ //XXX NEED TO ADD STUFF
+ v.addElement(new JLabel(obj.get(RULE_NAME),
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_AUTH),
+ JLabel.LEFT));
+ v.addElement(obj.get(RULE_IMPL));
+ addRow(v, data);
+ }
+
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/ug/AuthViewDialog.java b/base/console/src/com/netscape/admin/certsrv/ug/AuthViewDialog.java
new file mode 100644
index 000000000..6f3ed575a
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/ug/AuthViewDialog.java
@@ -0,0 +1,65 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.ug;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.config.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import javax.swing.table.*;
+import javax.swing.text.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Authentication Parameter View Dialog
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.ug
+ */
+public class AuthViewDialog extends AuthBaseDialog
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PREFIX = "AUTHVIEWDIALOG";
+ private static final String HELPINDEX =
+ "authentication-certsrv-view-authrule-dbox-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public AuthViewDialog(CMSBaseResourceModel model) {
+ super(model.getFrame(), Constants.VIEW, PREFIX);
+ mConn = model.getServerInfo().getAdmin();
+ mDataModel = new ViewTableModel();
+ setDisplay();
+ }
+
+ public void actionPerformed(ActionEvent evt) {
+ super.actionPerformed(evt);
+ if (evt.getSource().equals(mHelp))
+ CMSAdminUtil.help(HELPINDEX);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/ug/CMSBaseUGTab.java b/base/console/src/com/netscape/admin/certsrv/ug/CMSBaseUGTab.java
new file mode 100644
index 000000000..8e7fb34dd
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/ug/CMSBaseUGTab.java
@@ -0,0 +1,153 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.ug;
+
+import com.netscape.admin.certsrv.*;
+import java.util.*;
+import java.awt.event.*;
+import java.awt.*;
+import javax.swing.*;
+import javax.swing.border.*;
+
+/**
+ * Base class for the tabs in the User and group tabbed pane.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public abstract class CMSBaseUGTab extends CMSBasePanel
+ implements MouseListener, IRefreshTab
+{
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ protected CMSBaseResourceModel mModel; //resource model
+
+ private String mTitle; // panel title actually shows
+ protected boolean mInit = false; // true if this panel is initialized
+ protected JPanel mListPanel, mActionPanel; //panels
+ protected String mHelpToken;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSBaseUGTab(String panelName, CMSBaseResourceModel model) {
+ super(panelName);
+ mModel = model;
+ try {
+ String title = mResource.getString(mPanelName+"_TITLE");
+ mTitle = title;
+ } catch (MissingResourceException e) {
+ mTitle = "Missing Title";
+ }
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * Initialization of the panel. Subcalss must provide
+ * the proper implementation.
+ */
+ public void init() {
+ setLayout(new BorderLayout());
+
+ //======== list panel ========================
+ mListPanel = createListPanel();
+ mListPanel.setBorder(new EmptyBorder(DIFFERENT_COMPONENT_SPACE,
+ DIFFERENT_COMPONENT_SPACE,
+ DIFFERENT_COMPONENT_SPACE - COMPONENT_SPACE,
+ DIFFERENT_COMPONENT_SPACE));
+ add("Center",mListPanel);
+
+ //====== action panel ===========================
+ mActionPanel = createActionPanel();
+ add("South",mActionPanel);
+ }
+
+ /**
+ * Called by the Tab parent to initialize the panel
+ */
+ public void initialize() {
+ if (!mInit) {
+ init();
+ mInit = true;
+ }
+ }
+
+
+ /**
+ * Returns the title of the tab
+ * @return string representation of the title
+ */
+ public String getTitle() {
+ return mTitle;
+ }
+
+ /**
+ * set the title of the tab
+ */
+ public void setTitle(String title) {
+ mTitle = title;
+ }
+
+ public void helpCallback() {
+ CMSAdminUtil.help(mHelpToken);
+ }
+
+ public void mousePressed(MouseEvent e) {}
+ public void mouseReleased(MouseEvent e) {}
+ public void mouseEntered(MouseEvent e) {}
+ public void mouseExited(MouseEvent e) {}
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+ protected abstract JPanel createActionPanel();
+ protected abstract JPanel createListPanel();
+
+ //=== OVERWRITE DIALOG MESSAGE =====================
+
+ protected void showMessageDialog(String keyword, int messageType ) {
+ CMSAdminUtil.showMessageDialog(mModel.getFrame(), mResource, mPanelName, keyword, messageType);
+ }
+
+ protected void showMessageDialog(String keyword) {
+ showMessageDialog(keyword, ERROR_MESSAGE);
+ }
+
+ protected int showConfirmDialog(String keyword, int messageType ) {
+ return CMSAdminUtil.showConfirmDialog(mModel.getFrame(), mResource, mPanelName, keyword, messageType);
+ }
+
+ protected int showConfirmDialog(String keyword) {
+ return showConfirmDialog(keyword, WARNING_MESSAGE);
+ }
+
+ protected int showConfirmDialog(String keyword, String[] params) {
+ return showConfirmDialog(keyword, params, WARNING_MESSAGE);
+ }
+
+ protected void showErrorDialog(String message) {
+ CMSAdminUtil.showErrorDialog(mModel.getFrame(), mResource, message, ERROR_MESSAGE);
+ }
+
+ public abstract void refresh();
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/ug/CMSUGTabPanel.java b/base/console/src/com/netscape/admin/certsrv/ug/CMSUGTabPanel.java
new file mode 100644
index 000000000..b2f2b1c37
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/ug/CMSUGTabPanel.java
@@ -0,0 +1,136 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.ug;
+
+import com.netscape.admin.certsrv.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import javax.swing.tree.*;
+import java.awt.event.*;
+import java.awt.*;
+
+/**
+ * Base Class for Tabbed right hand pane
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public class CMSUGTabPanel extends CMSBasePanel
+ implements IResourceSelectionListener, ChangeListener,
+ IRefreshTabPanel
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static String PANEL_NAME = "CMSUGTABPANEL";
+
+ protected JTabbedPane mTabbedPane; //tabbed panel
+ protected CMSBaseResourceModel mModel; //resource model
+ protected ResourceObject mParent; //tree node parent
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSUGTabPanel(CMSBaseResourceModel model, ResourceObject parent) {
+ super(PANEL_NAME);
+ mModel = model;
+ mParent = parent;
+ mModel.addIResourceSelectionListener(this);
+
+ setLayout(new BorderLayout());
+ // Look and Feel
+ mTabbedPane = new NSTabbedPane();
+ add("Center", mTabbedPane);
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * Retrieve Resource Model
+ */
+ public CMSBaseResourceModel getResourceModel() {
+ return mModel;
+ }
+
+ //== IResourceListener ===
+
+ public void select(IResourceObject parent, Object viewInstance) {
+ //System.out.println("CMSTabPanel: select() "+ parent);
+ if (parent == mParent) {
+ try {
+ mTabbedPane.addChangeListener(this);
+ mTabbedPane.setSelectedIndex(0);
+ CMSBaseUGTab selectedPanel = (CMSBaseUGTab) mTabbedPane.getComponentAt(0);
+ if ( selectedPanel != null )
+ selectedPanel.initialize();
+ mTabbedPane.invalidate();
+ mTabbedPane.validate();
+ } catch (ArrayIndexOutOfBoundsException e) {
+ //NO TAB SO IGNORE
+ }
+ }
+ }
+
+ public boolean unselect(IResourceObject parent, Object viewInstance) {
+ return true;
+ }
+
+ public CMSBasePanel getSelectedTab() {
+ //Debug.println("CMSUGTabPanel: getSelectedTab()");
+ return (CMSBasePanel)mTabbedPane.getSelectedComponent();
+ }
+
+ //== ChangeListener ==
+ public void stateChanged(ChangeEvent e) {
+ //Debug.println("CMSTabPanel: stateChanged()");
+ CMSBaseUGTab selectedPanel = (CMSBaseUGTab)mTabbedPane.getSelectedComponent();
+ if ( selectedPanel != null )
+ selectedPanel.initialize();
+ mTabbedPane.invalidate();
+ mTabbedPane.validate();
+ mTabbedPane.repaint(1);
+ }
+
+ /**
+ * Add Panels to the Tab Panel. ChangeListener is
+ * added automatically.
+ *
+ * @param p CMS Panel to be added
+ */
+ public void addTab(CMSBaseUGTab p) {
+ mTabbedPane.addTab(p.getTitle(), p);
+ }
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+
+ //look and feel
+ class NSTabbedPane extends JTabbedPane {
+/*
+ public String getUIClassID() {
+ return "SecondaryTabbedPaneUI";
+ }
+*/
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/ug/CertDataModel.java b/base/console/src/com/netscape/admin/certsrv/ug/CertDataModel.java
new file mode 100644
index 000000000..de6a588f6
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/ug/CertDataModel.java
@@ -0,0 +1,85 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.ug;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.*;
+import java.util.*;
+import javax.swing.*;
+
+/**
+ * Certificate Data Model
+ * Single column display with internal data object as NVP
+ * which stores Name and Data Blob (PrettyPrint or B64E)
+ */
+public class CertDataModel extends CMSContentTableModel
+ implements IDataProcessor
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ public static final String CERT_NAME="CERT_NAME";
+ public static final String CERT_DATA="CERT_DATA";
+ public static final String CERT_VIEW="CERT_VIEW";
+ public static final String CERT_B64E="CERT_B64E";
+ public static final String CERT_PP="CERT_PP";
+
+ private static String[] mColumns = {CERTIFICATE};
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CertDataModel() {
+ super();
+ init(mColumns);
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public void processData(Object data) {
+ Vector v = new Vector();
+
+ NameValuePairs obj = (NameValuePairs) data;
+
+ //XXX NEED TO CHANGE if we are going to have multi-column table
+ v.addElement(new JLabel(obj.get(CERT_NAME),
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_CERTICON_SMALL),
+ JLabel.LEFT));
+ addRow(v, data);
+ }
+
+ /**
+ * Retrieve the data blob, Certificate Pretty Print
+ * or Base64Encode cert, from the data object. Used
+ * by the view functionality.
+ *
+ * @param row cert table row number
+ * @retrun data in string format
+ */
+ public String getDataBlob(int row) {
+ try {
+ NameValuePairs obj = (NameValuePairs)getObjectValueAt(row);
+ return obj.get(CERT_DATA);
+ } catch (Exception e) {
+ Debug.println("CertDataModel: getDataBlob()- "+e.toString());
+ return "";
+ }
+ }
+} \ No newline at end of file
diff --git a/base/console/src/com/netscape/admin/certsrv/ug/CertImportDialog.java b/base/console/src/com/netscape/admin/certsrv/ug/CertImportDialog.java
new file mode 100644
index 000000000..758dda109
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/ug/CertImportDialog.java
@@ -0,0 +1,256 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.ug;
+
+import com.netscape.admin.certsrv.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import javax.swing.table.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Certificate Import Editor - this UI will take Base64Encoded
+ * certificate block with BEGIN and END comment and deliver it
+ * to server side for processing. EOL, CRT, EOF characters are
+ * removed from the output.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.ug.CertManagementDialog
+ */
+public class CertImportDialog extends JDialog
+ implements ActionListener, DocumentListener, MouseListener
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private String PREFIX = "CERTIMPORTDIALOG";
+
+ private JFrame mParentFrame;
+ private ResourceBundle mResource;
+
+ private JTextArea mTextArea;
+ private JButton mOK, mCancel;
+ private String mB64E;
+ private boolean mIsOk = false;
+ private JButton mPaste;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CertImportDialog(JFrame parent) {
+ super(parent,true);
+ mParentFrame = parent;
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ setSize(500, 400);
+ setTitle(mResource.getString(PREFIX+"_TITLE"));
+ setLocationRelativeTo(parent);
+ getRootPane().setDoubleBuffered(true);
+ setDisplay();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * show the windows
+ */
+ public void showDialog() {
+ //initialize and setup
+ mTextArea.setText("");
+ mIsOk = false;
+ this.show();
+ }
+
+ /**
+ * get Base 64 Encoded blob
+ */
+ public String getB64E() {
+ return mB64E;
+ }
+
+ /**
+ * get the exit code
+ * @return true if ok; otherwise false
+ */
+ public boolean isOK() {
+ return mIsOk;
+ }
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent evt) {
+
+ if (evt.getSource().equals(mPaste)) {
+ mTextArea.paste();
+ return;
+ }
+
+ if (evt.getSource().equals(mCancel)) {
+ this.hide();
+ }
+
+ if (evt.getSource().equals(mOK)) {
+
+ //set values
+ mB64E = mTextArea.getText().trim();
+ mIsOk = true;
+ this.hide();
+ }
+ }
+
+ //==== MOUSELISTENER ======================
+ public void mouseClicked(MouseEvent e) {
+ setButtons();
+ }
+
+ public void mousePressed(MouseEvent e) {}
+ public void mouseReleased(MouseEvent e) {}
+ public void mouseEntered(MouseEvent e) {}
+ public void mouseExited(MouseEvent e) {
+ setButtons();
+ }
+
+ //== DocumentListener ==
+ public void insertUpdate(DocumentEvent e) {
+ setButtons();
+ }
+
+ public void removeUpdate(DocumentEvent e){
+ setButtons();
+ }
+
+ public void changedUpdate(DocumentEvent e){
+ setButtons();
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+
+ /**
+ * set buttons - proactive verification
+ */
+ private void setButtons() {
+ if (mTextArea.getText().trim().equals("")) {
+ mOK.setEnabled(false);
+ } else {
+ mOK.setEnabled(true);
+ }
+ }
+
+ /**
+ * Setup the initial UI components
+ */
+ private void setDisplay() {
+ getContentPane().setLayout(new BorderLayout());
+ JPanel center = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ center.setLayout(gb);
+
+ //content panel
+ JPanel content = makeContentPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.fill = gbc.BOTH;
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(content, gbc);
+ center.add(content);
+
+ //action panel
+ JPanel action = makeActionPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints(action, gbc);
+ center.add(action);
+
+ getContentPane().add("Center",center);
+ }
+
+ private JPanel makeActionPane() {
+ mOK = CMSAdminUtil.makeJButton(mResource, PREFIX, "OK", null, this);
+ mOK.setEnabled(false);
+ mCancel = CMSAdminUtil.makeJButton(mResource, PREFIX, "CANCEL", null, this);
+ JButton[] buttons = { mOK, mCancel};
+ return CMSAdminUtil.makeJButtonPanel( buttons );
+ }
+
+ private JPanel makeContentPane() {
+ JPanel content = new JPanel();
+ GridBagLayout gb3 = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ content.setLayout(gb3);
+ //content.setBorder(CMSAdminUtil.makeEtchedBorder());
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label2 = CMSAdminUtil.makeJLabel(mResource, PREFIX, "B64E", null);
+ gbc.fill = gbc.NONE;
+ gbc.anchor = gbc.WEST;
+ gbc.weightx=0.0;
+ gb3.setConstraints(label2, gbc);
+ content.add(label2);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mPaste = CMSAdminUtil.makeJButton(mResource, PREFIX, "PASTE", null, this);
+ gbc.fill = gbc.NONE;
+ gbc.anchor = gbc.EAST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx=1.0;
+ gb3.setConstraints(mPaste, gbc);
+ content.add(mPaste);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mTextArea = new JTextArea("",40,70);
+ Font f = new Font("Monospaced", Font.PLAIN, 12);
+ if (f != null) mTextArea.setFont(f);
+ mTextArea.getDocument().addDocumentListener(this);
+ mTextArea.addMouseListener(this);
+ JScrollPane scrollPanel = new JScrollPane(mTextArea,
+ JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+ JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
+ scrollPanel.setAlignmentX(LEFT_ALIGNMENT);
+ scrollPanel.setAlignmentY(TOP_ALIGNMENT);
+ scrollPanel.setBorder(BorderFactory.createLoweredBevelBorder());
+ scrollPanel.setPreferredSize(new Dimension(300, 500));
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx=1.0;
+ gbc.weighty=1.0;
+ gb3.setConstraints(scrollPanel, gbc);
+ content.add(scrollPanel);
+
+ return content;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/ug/CertManagementDialog.java b/base/console/src/com/netscape/admin/certsrv/ug/CertManagementDialog.java
new file mode 100644
index 000000000..82083649e
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/ug/CertManagementDialog.java
@@ -0,0 +1,441 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.ug;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * User Certificate Management Dialog - <p>
+ *
+ * The administrator can use this dialog to management the
+ * certificates of specific user. This allows the import of
+ * new certificates and delete/view of existing certificates.
+ *
+ * This dialog is launched by clicking on the certificate button
+ * on the main user management tab.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.ug.CertImportDialog
+ * @see com.netscape.admin.certsrv.ug.CertViewDialog
+ * @see com.netscape.admin.certsrv.ug.UserTab
+ */
+public class CertManagementDialog extends JDialog
+ implements ActionListener, MouseListener
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private String PREFIX = "CERTMANAGEMENTDIALOG";
+
+ private JFrame mParentFrame;
+ private AdminConnection mConnection;
+ private ResourceBundle mResource;
+ protected DefaultListModel mDataModel;
+ protected Vector mPPData;
+ protected String mUID; //dest flag
+ protected CertViewDialog mViewDialog = null; //keeping a copy for reuse
+ protected CertImportDialog mCertDialog = null; //keeping a copy for reuse
+
+ private JScrollPane mScrollPane;
+ private JList mList;
+
+ private JButton mOK, mCancel, mAdd, mDelete, mView, mHelp;
+ private final static String HELPINDEX =
+ "usersgroups-certsrv-manage-usercert-dbox-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CertManagementDialog(JFrame parent, AdminConnection conn) {
+ super(parent,true);
+ mParentFrame = parent;
+ mConnection = conn;
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ mDataModel = new DefaultListModel();
+ mPPData = new Vector();
+ setSize(800, 216);
+ setTitle(mResource.getString(PREFIX+"_TITLE"));
+ setLocationRelativeTo(parent);
+ getRootPane().setDoubleBuffered(true);
+ setDisplay();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * show the windows
+ * @param uid current user id
+ */
+ public void showDialog(String uid) {
+ mUID = uid;
+
+ if (!refresh())
+ return;
+ setButtons();
+ this.show();
+ }
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent evt) {
+
+ if (evt.getSource().equals(mOK)) {
+ //nothing to do here
+ this.dispose();
+ } else if (evt.getSource().equals(mCancel)) {
+ this.dispose();
+ } else if (evt.getSource().equals(mAdd)) {
+ //call cert import editor
+ if (mCertDialog==null)
+ mCertDialog = new CertImportDialog(mParentFrame);
+ mCertDialog.showDialog();
+ if (!mCertDialog.isOK())
+ return;
+ addCert(mCertDialog.getB64E());
+ refresh();
+ setButtons();
+ } else if (evt.getSource().equals(mDelete)) {
+ int i = CMSAdminUtil.showConfirmDialog(mParentFrame, mResource, "USERCERTS",
+ "DELETE", JOptionPane.INFORMATION_MESSAGE);
+ if (i == JOptionPane.YES_OPTION) {
+ deleteCert();
+ refresh();
+ setButtons();
+ }
+ } else if (evt.getSource().equals(mView)) {
+ if (mViewDialog==null)
+ mViewDialog = new CertViewDialog(mParentFrame);
+ String id = ((JLabel)mDataModel.elementAt(mList.getSelectedIndex())).getText();
+ mViewDialog.showDialog(id,(String)mPPData.elementAt(mList.getSelectedIndex()));
+ } else if (evt.getSource().equals(mHelp)) {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+ }
+
+ //==== MOUSELISTENER ======================
+ public void mouseClicked(MouseEvent e) {
+ setButtons();
+ }
+
+ public void mousePressed(MouseEvent e) {}
+ public void mouseReleased(MouseEvent e) {}
+ public void mouseEntered(MouseEvent e) {}
+ public void mouseExited(MouseEvent e) {}
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+
+ /**
+ * Setup the initial UI components
+ */
+ private void setDisplay() {
+ getContentPane().setLayout(new BorderLayout());
+ JPanel center = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ center.setLayout(gb);
+
+ //content panel
+ JPanel content = makeContentPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.fill = gbc.BOTH;
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(content, gbc);
+ center.add(content);
+
+ //action panel
+ JPanel action = makeActionPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints(action, gbc);
+ center.add(action);
+
+ getContentPane().add("Center",center);
+ }
+
+ /**
+ * create the bottom action button panel
+ */
+ protected JPanel createUDButtonPanel() {
+ //up, down buttons required
+ //actionlister to this object
+ mAdd = CMSAdminUtil.makeJButton(mResource, PREFIX, "IMPORT", null, this);
+ mDelete = CMSAdminUtil.makeJButton(mResource, PREFIX, "DELETE", null, this);
+ mView = CMSAdminUtil.makeJButton(mResource, PREFIX, "VIEW", null, this);
+ JButton[] buttons = { mAdd, mDelete, mView};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonVPanel( buttons );
+ }
+
+ //create botton action panel
+ private JPanel makeActionPane() {
+ mOK = CMSAdminUtil.makeJButton(mResource, PREFIX, "OK", null, this);
+ mCancel = CMSAdminUtil.makeJButton(mResource, PREFIX, "CANCEL", null, this);
+ mHelp = CMSAdminUtil.makeJButton(mResource, PREFIX, "HELP", null, this);
+ // JButton[] buttons = { mOK, mHelp};
+ JButton[] buttons = { mOK};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonPanel( buttons, true);
+ }
+
+ private JPanel makeContentPane() {
+ JPanel mListPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mListPanel.setLayout(gb);
+ //content.setBorder(CMSAdminUtil.makeEtchedBorder());
+
+ //left side certificate table
+ mList = CMSAdminUtil.makeJList(mDataModel,10);
+ mScrollPane = new JScrollPane(mList,
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
+ mList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION );
+ mList.addMouseListener(this);
+ mScrollPane.setBackground(Color.white);
+ mScrollPane.setBorder(BorderFactory.createLoweredBevelBorder());
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = 1;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,CMSAdminUtil.COMPONENT_SPACE,0,0);
+ gb.setConstraints(mScrollPane, gbc);
+ mListPanel.add(mScrollPane);
+
+ JPanel buttonPanel = createUDButtonPanel();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 0.0;
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ 0,0,CMSAdminUtil.COMPONENT_SPACE);
+ gb.setConstraints(buttonPanel, gbc);
+ mListPanel.add(buttonPanel);
+
+ return mListPanel;
+ }
+
+ /**
+ * set buttons - proactive verification
+ */
+ private void setButtons() {
+
+ //enable and diable buttons accordingly
+ //Debug.println("setButtons() - "+mList.getSelectedIndex());
+ if (mList.getSelectedIndex()< 0) {
+ mDelete.setEnabled(false);
+ mView.setEnabled(false);
+ return;
+ }
+ mDelete.setEnabled(true);
+ mView.setEnabled(true);
+ }
+
+ //=================================================
+ // RETRIEVE INFO FROM SERVER SIDE
+ //=================================================
+
+ //refresh the table content
+ private boolean refresh() {
+
+ mDataModel.clear();
+ mPPData.removeAllElements();
+
+ NameValuePairs response;
+ try {
+ response = mConnection.read(DestDef.DEST_USER_ADMIN,
+ ScopeDef.SC_USER_CERTS,
+ mUID, new NameValuePairs());
+ } catch (EAdminException e) {
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ e.getMessage(), CMSAdminUtil.ERROR_MESSAGE);
+ return false;
+ }
+
+ //parse data
+ String[] vals = new String[response.size()];
+ int i=0;
+
+ for (String entry : response.keySet()) {
+ vals[i++] = entry.trim();
+ }
+
+ CMSAdminUtil.bubbleSort(vals);
+
+ for (int y=0; y< vals.length ; y++) {
+ String str = reformat(vals[y]);
+ mDataModel.addElement(new JLabel(str,
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_CERTICON_SMALL),
+ JLabel.LEFT));
+ mPPData.addElement(response.get(vals[y]));
+ }
+
+ return true;
+ }
+
+ /**
+ * Change DN from the following format:
+ * Serial:0x0 Subject:<DN> Issuer:<DN>
+ * to the following fomrat:
+ * <version>;<serial>;<subject>;<issuer>
+ */
+ private String toServerFormat(String val) {
+ if (val == null)
+ return "";
+ int subject_pos = val.indexOf("Subject:");
+ if (subject_pos == -1)
+ return "";
+ int issuer_pos = val.indexOf("Issuer:");
+ if (issuer_pos == -1)
+ return "";
+ // we lost the version in reformat()
+
+ String serial = val.substring(9, subject_pos).trim();
+ long num = CMSAdminUtil.hexToLong(serial);
+ try {
+ return "-1;" +
+ num + ";" +
+ val.substring(issuer_pos+7).trim() + ";" +
+ val.substring(subject_pos+8, issuer_pos).trim();
+ } catch (NumberFormatException e) {
+ return "-1;" + num+";"+
+ val.substring(issuer_pos+7).trim() + ";" +
+ val.substring(subject_pos+8, issuer_pos).trim();
+ }
+ }
+
+ // swap the issuer name order with the subject name
+ private String reformat(String val) {
+
+ String name = "";
+
+ StringTokenizer st = new StringTokenizer(val,";",false);
+ String version=null; // I think this is cert version #
+ String serial=null;
+ String issuer=null;
+ String subject=null;
+
+ try {
+ version = st.nextToken();
+ serial = st.nextToken();
+ issuer = st.nextToken();
+ subject = st.nextToken();
+ } catch (Exception e) {}
+
+ try {
+ if (serial != null) {
+ String hexserial = Integer.toHexString(Integer.parseInt(serial));
+ name = name + "Serial:0x"+hexserial;
+ }
+ } catch (Exception e) {}
+
+
+ if (subject != null) {
+ name = name + " Subject:"+subject;
+ }
+
+ if (issuer != null) {
+ name = name + " Issuer:"+issuer;
+ }
+
+ return name;
+ }
+
+ private void addCert(String B64E) {
+ //send comment to server for the removal of user
+ NameValuePairs config = new NameValuePairs();
+ config.put(Constants.PR_USER_CERT, cleanupCertData(B64E));
+ try {
+ mConnection.add(DestDef.DEST_USER_ADMIN,
+ ScopeDef.SC_USER_CERTS,
+ mUID,
+ config);
+ } catch (EAdminException e) {
+ //display error dialog
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ e.getMessage(), CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ }
+
+ /**
+ * routine to cleanup the certificate data
+ * this removes end of line embedded in the
+ * certificate data.
+ *
+ * @param data b64e cert request blob
+ */
+ private String cleanupCertData(String data) {
+ StringBuffer input = new StringBuffer(data);
+ StringBuffer buff = new StringBuffer();
+ for (int i=0; i< input.length(); i++) {
+ char c = input.charAt(i);
+ if ((c != '\n') && (c != '\r'))
+ buff.append(c);
+ }
+ return buff.toString();
+ }
+
+ private void deleteCert() {
+ //get entry name
+ String dn = ((JLabel)mDataModel.elementAt(mList.getSelectedIndex())).getText();
+ dn = toServerFormat(dn);
+ NameValuePairs config = new NameValuePairs();
+ config.put(Constants.PR_USER_CERT, dn);
+
+ //send comment to server for the removal of user
+ try {
+ mConnection.modify(DestDef.DEST_USER_ADMIN,
+ ScopeDef.SC_USER_CERTS,
+ mUID,
+ config);
+ } catch (EAdminException e) {
+ //display error dialog
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ e.getMessage(), CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/ug/CertViewDialog.java b/base/console/src/com/netscape/admin/certsrv/ug/CertViewDialog.java
new file mode 100644
index 000000000..ae4cfd113
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/ug/CertViewDialog.java
@@ -0,0 +1,201 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.ug;
+
+import com.netscape.admin.certsrv.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import javax.swing.table.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Certificate Import Editor
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.ug
+ */
+public class CertViewDialog extends JDialog
+ implements ActionListener
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private String PREFIX = "CERTVIEWDIALOG";
+
+ private JFrame mParentFrame;
+ private ResourceBundle mResource;
+ private JTextArea mTextArea;
+ private JLabel mCertNameField;
+
+ private JButton mOK;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CertViewDialog(JFrame parent) {
+ super(parent,true);
+ mParentFrame = parent;
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ //setSize(800, 700);
+ setSize(400, 350);
+ setTitle(mResource.getString(PREFIX+"_TITLE"));
+ setLocationRelativeTo(parent);
+ getRootPane().setDoubleBuffered(true);
+ setDisplay();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * show the windows
+ */
+ public void showDialog(String name, String pp) {
+ //initialize and setup
+ String certName = "";
+ if (name != null && name.length() > 0) {
+ int j = name.indexOf("Subject:");
+ int i = name.indexOf("Issuer:");
+ if (j < i) {
+ certName = name.substring(j, i);
+ }
+ }
+ mCertNameField.setText(certName);
+ mTextArea.setText(pp);
+ this.show();
+ }
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent evt) {
+ if (evt.getSource().equals(mOK)) {
+ this.hide();
+ }
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+ private void setDisplay() {
+ getContentPane().setLayout(new BorderLayout());
+ JPanel center = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ center.setLayout(gb);
+
+ //content panel
+ JPanel content = makeContentPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.fill = gbc.BOTH;
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(content, gbc);
+ center.add(content);
+
+ //action panel
+ JPanel action = makeActionPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints(action, gbc);
+ center.add(action);
+
+ getContentPane().add("Center",center);
+ }
+
+ private JPanel makeActionPane() {
+ mOK = CMSAdminUtil.makeJButton(mResource, PREFIX, "OK", null, this);
+ Dimension d = mOK.getMinimumSize();
+ if (d.width < CMSAdminUtil.DEFAULT_BUTTON_SIZE) {
+ d.width = CMSAdminUtil.DEFAULT_BUTTON_SIZE;
+ mOK.setMinimumSize(d);
+ }
+ JButton[] buttons = {mOK};
+ return CMSAdminUtil.makeJButtonPanel( buttons );
+ }
+
+ private JPanel makeContentPane() {
+ JPanel content = new JPanel();
+ GridBagLayout gb3 = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ content.setLayout(gb3);
+ //content.setBorder(CMSAdminUtil.makeEtchedBorder());
+
+ CMSAdminUtil.resetGBC(gbc);
+ //JLabel label1 = CMSAdminUtil.makeJLabel(mResource, PREFIX, "CERTNAME", null);
+ mCertNameField = new JLabel();
+ gbc.fill = gbc.NONE;
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx=1.0;
+ gbc.weightx=0.0;
+ gb3.setConstraints(mCertNameField, gbc);
+ content.add(mCertNameField);
+ //CMSAdminUtil.addEntryField(content, label1, mCertNameField, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label2 = CMSAdminUtil.makeJLabel(mResource, PREFIX, "PP", null);
+ gbc.fill = gbc.NONE;
+ gbc.anchor = gbc.WEST;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx=1.0;
+ gb3.setConstraints(label2, gbc);
+ content.add(label2);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mTextArea = new JTextArea("",40,70);
+ Font f = new Font("Monospaced", Font.PLAIN, 12);
+ if (f != null) mTextArea.setFont(f);
+ mTextArea.setEditable(false);
+ mTextArea.setBackground(getBackground());
+ JScrollPane scrollPanel = new JScrollPane(mTextArea,
+ JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+ JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
+ scrollPanel.setAlignmentX(LEFT_ALIGNMENT);
+ scrollPanel.setAlignmentY(TOP_ALIGNMENT);
+ scrollPanel.setBorder(BorderFactory.createLoweredBevelBorder());
+ scrollPanel.setPreferredSize(new Dimension(300, 500));
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx=1.0;
+ gbc.weighty=1.0;
+// gbc.insets = new Insets(0, CMSAdminUtil.COMPONENT_SPACE,
+// CMSAdminUtil.COMPONENT_SPACE,
+// CMSAdminUtil.COMPONENT_SPACE);
+ gb3.setConstraints(scrollPanel, gbc);
+ content.add(scrollPanel);
+
+ return content;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/ug/GroupDataModel.java b/base/console/src/com/netscape/admin/certsrv/ug/GroupDataModel.java
new file mode 100644
index 000000000..779e9903e
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/ug/GroupDataModel.java
@@ -0,0 +1,61 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.ug;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+
+/**
+ * Group Data model - represents the group table information
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public class GroupDataModel extends CMSContentTableModel {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static String[] mColumns = {GROUPNAME, GROUPDESC};
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public GroupDataModel() {
+ super();
+ init(mColumns);
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public void processData(String name, String desc) {
+ Vector v = new Vector();
+
+ //XXX NEED TO CHANGE if we are going to have multi-column table
+ v.addElement(new JLabel((String)name,
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_USERGROUP),
+ JLabel.LEFT));
+ v.addElement(desc);
+ addRow(v,name);
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/ug/GroupEditor.java b/base/console/src/com/netscape/admin/certsrv/ug/GroupEditor.java
new file mode 100644
index 000000000..e9693b15d
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/ug/GroupEditor.java
@@ -0,0 +1,596 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.ug;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Group Membership Editor
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.ug
+ */
+public class GroupEditor extends JDialog
+ implements ActionListener, ListSelectionListener
+{
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private String PREFIX = "GROUPEDITOR";
+
+ private JFrame mParentFrame;
+ private AdminConnection mConnection;
+ private String mGroupName;
+ private boolean mIsNewGroup = false;
+ private ResourceBundle mResource;
+ protected DefaultListModel mDataModel;
+ protected UserListDialog mUserDialog = null; //keeping a copy for reuse
+
+ protected JScrollPane mScrollPane;
+ protected JList mList;
+
+ private JButton mOK, mCancel, mHelp, mAddUser, mDelete;
+ private JTextField mGroupNameField, mGroupDescField;
+ private JLabel mGroupNameLabel;
+
+ private static final String ADDHELPINDEX =
+ "usersgroups-certsrv-add-group-dbox-help";
+ private static final String EDITHELPINDEX =
+ "usersgroups-certsrv-edit-group-dbox-help";
+ private String mHelpToken;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public GroupEditor(JFrame parent, AdminConnection conn) {
+ super(parent,true);
+ mParentFrame = parent;
+ mConnection = conn;
+ mDataModel = new DefaultListModel();
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+
+ setSize(360, 300);
+ setTitle(mResource.getString(PREFIX+"_TITLE"));
+ setLocationRelativeTo(parent);
+ getRootPane().setDoubleBuffered(true);
+ setDisplay();
+ //toFront();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * show the windows
+ * @param users list of current groups
+ */
+ public void showDialog(String group, boolean isNew) {
+
+ //initialize and setup
+ mGroupName = group;
+ mIsNewGroup = isNew;
+
+ if (isNew)
+ mHelpToken = ADDHELPINDEX;
+ else
+ mHelpToken = EDITHELPINDEX;
+
+ mGroupDescField.setText("");
+ mGroupNameField.setText("");
+
+ mDataModel.clear();
+
+ //disable name change
+ if(!mIsNewGroup) {
+ mGroupNameField.setVisible(false);
+ mGroupNameLabel.setVisible(true);
+ mGroupNameLabel.setText(mGroupName);
+ } else {
+ mGroupNameField.setVisible(true);
+ mGroupNameLabel.setVisible(false);
+ }
+
+ //retrieve the user record from the server
+ try {
+ if (mIsNewGroup == false)
+ refresh();
+ } catch (EAdminException ex) {
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ ex.toString(), CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+
+ setButtons();
+ this.show();
+ }
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+
+ public void actionPerformed(ActionEvent evt) {
+
+ if (evt.getSource().equals(mOK)) {
+
+ if (mIsNewGroup) {
+
+ //check text fields
+ if (mGroupNameField.getText().trim().equals("")) {
+ CMSAdminUtil.showMessageDialog(mParentFrame, mResource, PREFIX,
+ "NOGROUPNAME", CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+
+ try {
+ mGroupName = mGroupNameField.getText().trim();
+ addGroup();
+ } catch (EAdminException e) {
+ //display error dialog
+ Debug.println(e.toString());
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ e.toString(), CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+
+ } else {
+
+ try {
+ modifyGroup();
+ } catch (EAdminException e) {
+ //display error dialog
+ Debug.println(e.toString());
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ e.toString(), CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+
+ }
+ this.hide();
+ }
+
+ if (evt.getSource().equals(mCancel)) {
+ Debug.println("Cancel Pressed");
+
+ //display are you sure dialog
+ this.hide();
+ }
+
+ if (evt.getSource().equals(mHelp)) {
+ CMSAdminUtil.help(mHelpToken);
+ }
+
+ if (evt.getSource().equals(mAddUser)) {
+ //bring up the list for selection
+
+ //create vector here
+ Vector currentUser = new Vector();
+ for (int i=0; i<mDataModel.getSize(); i++) {
+ currentUser.addElement((String)mDataModel.getElementAt(i));
+ }
+
+ NameValuePairs response;
+ try {
+ response = mConnection.search(DestDef.DEST_USER_ADMIN,
+ ScopeDef.SC_USERS, new NameValuePairs());
+ boolean hasNewUser = false;
+ for (String entry : response.keySet()) {
+ entry = entry.trim();
+ if (currentUser.indexOf(entry)== -1)
+ hasNewUser = true;
+ }
+ if (!hasNewUser) {
+ CMSAdminUtil.showMessageDialog(mParentFrame, mResource, PREFIX,
+ "ALLUSERS", CMSAdminUtil.INFORMATION_MESSAGE);
+ return;
+ }
+ } catch (EAdminException e) {
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ e.getMessage(), CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+
+ if (mUserDialog==null)
+ mUserDialog = new UserListDialog(mParentFrame, mConnection);
+
+ mUserDialog.showDialog(currentUser);
+
+ //get selection
+ if (!mUserDialog.isOK())
+ return;
+
+ //create user NVP data object and add user entry
+ Vector selectedUser = mUserDialog.getSelectedUser();
+ //Debug.println("Selected User = "+selectedUser.toString());
+
+
+ for(int i=0; i<selectedUser.size(); i++) {
+ String name = ((String) selectedUser.elementAt(i)).trim();
+ if (!isDuplicate(name))
+ mDataModel.addElement(name);
+ }
+
+ refreshTable();
+ }
+
+ if (evt.getSource().equals(mDelete)) {
+ if(mList.getSelectedIndex()< 0)
+ return;
+ int i = CMSAdminUtil.showConfirmDialog(mParentFrame, mResource,
+ PREFIX, "DELETE", CMSAdminUtil.WARNING_MESSAGE);
+ if (i == JOptionPane.YES_OPTION) {
+ deleteMember();
+ Debug.println("Member Deleted");
+ }
+ setButtons();
+ }
+ }
+
+ private boolean isDuplicate(String name) {
+ for (int i=0; i<mDataModel.getSize(); i++) {
+ String name1 = ((String)mDataModel.getElementAt(i)).trim();
+ if (name1.equals(name))
+ return true;
+ }
+ return false;
+ }
+
+ public void valueChanged(ListSelectionEvent e) {
+ setButtons();
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+ private void setDisplay() {
+ getContentPane().setLayout(new BorderLayout());
+ JPanel center = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ center.setLayout(gb);
+
+ //content panel
+ JPanel content = makeContentPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(content, gbc);
+ center.add(content);
+
+ //action panel
+ JPanel action = makeActionPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints(action, gbc);
+ center.add(action);
+
+ getContentPane().add("Center",center);
+
+ }
+
+ //resize vertical buttons
+ private void resizeButtons() {
+ mAddUser = CMSAdminUtil.makeJButton(mResource, PREFIX,"ADDUSER", null, this);
+ //mAddGroup = CMSAdminUtil.makeJButton(mResource, PREFIX, "ADDGROUP", null, this);
+ mDelete = CMSAdminUtil.makeJButton(mResource, PREFIX, "DELETE", null, this);
+ JButton[] buttons = {mAddUser, mDelete};
+ //JButton[] buttons = {mAddUser, mAddGroup, mDelete};
+ JButtonFactory.resize( buttons );
+ }
+
+ private JPanel makeActionPane() {
+ mOK = CMSAdminUtil.makeJButton(mResource, PREFIX, "OK", null, this);
+ mCancel = CMSAdminUtil.makeJButton(mResource, PREFIX, "CANCEL", null, this);
+ mHelp = CMSAdminUtil.makeJButton(mResource, PREFIX, "HELP", null, this);
+ //JButton[] buttons = { mOK, mCancel, mHelp };
+ JButton[] buttons = { mOK, mCancel };
+ return CMSAdminUtil.makeJButtonPanel( buttons, true);
+ }
+
+
+ //create the vertical button panel for System Groups
+ private JPanel createMemberButtonPanel() {
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ JButton[] buttons = {mAddUser, mDelete};
+ //JButton[] buttons = {mAddUser, mAddGroup, mDelete};
+ return CMSAdminUtil.makeJButtonVPanel( buttons );
+ }
+
+ private JPanel makeContentPane() {
+ JPanel content = new JPanel();
+ GridBagLayout gb3 = new GridBagLayout();
+ content.setLayout(gb3);
+ //content.setBorder(CMSAdminUtil.makeEtchedBorder());
+
+ Insets insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,0,
+ CMSAdminUtil.COMPONENT_SPACE,0);
+
+ //top panel
+ JPanel top = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ CMSAdminUtil.resetGBC(gbc);
+ top.setLayout(gb);
+
+ JLabel label1 = CMSAdminUtil.makeJLabel(mResource, PREFIX, "GROUPNAME", null);
+ mGroupNameField = new JTextField();
+ mGroupNameLabel = new JLabel();
+ mGroupNameLabel.setVisible(false);
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.anchor = gbc.EAST;
+ gbc. insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ top.add(label1, gbc);
+
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc. insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,
+ 0,CMSAdminUtil.DIFFERENT_COMPONENT_SPACE);
+ top.add( mGroupNameLabel, gbc );
+ top.add( mGroupNameField, gbc );
+
+ JLabel dummy = new JLabel();
+ dummy.setVisible(false);
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 0.0;
+ top.add( dummy, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ //gbc.gridheight = gbc.REMAINDER;
+ JLabel label2 = CMSAdminUtil.makeJLabel(mResource, PREFIX, "GROUPDESC", null);
+ mGroupDescField = new JTextField();
+ CMSAdminUtil.addEntryField(top, label2, mGroupDescField, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label3 = CMSAdminUtil.makeJLabel(mResource, PREFIX, "MEMBER", null);
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.anchor = gbc.WEST;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.DIFFERENT_COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0);
+ top.add(label3, gbc );
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.insets = CMSAdminUtil.DEFAULT_EMPTY_INSETS;
+ gb3.setConstraints(top, gbc);
+ content.add(top);
+
+ //bottom panel
+ JPanel bottom = new JPanel();
+ //bottom.setBorder(BorderFactory.createEtchedBorder());
+ GridBagLayout gb2 = new GridBagLayout();
+ CMSAdminUtil.resetGBC(gbc);
+ bottom.setLayout(gb2);
+
+ resizeButtons();
+
+ //group membership table
+
+
+ mList = makeJList(mDataModel,9);
+ mList.addListSelectionListener(this);
+ mScrollPane = new JScrollPane(mList,
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ //mList.addMouseListener(this);
+ mScrollPane.setBackground(Color.white);
+ mScrollPane.setBorder(BorderFactory.createLoweredBevelBorder());
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = 1;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,
+ 0);
+ gb2.setConstraints(mScrollPane, gbc);
+ bottom.add(mScrollPane);
+
+ JPanel memberButtonPanel = createMemberButtonPanel();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 0.0;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,0,
+ CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.DIFFERENT_COMPONENT_SPACE);
+ gb2.setConstraints(memberButtonPanel, gbc);
+ bottom.add(memberButtonPanel);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.insets = CMSAdminUtil.DEFAULT_EMPTY_INSETS;
+ gb3.setConstraints(bottom, gbc);
+ content.add(bottom);
+
+
+ return content;
+ }
+
+ //Set the first column's cellrender as label cell
+ protected void setLabelCellRenderer(JTable table, int index) {
+ table.getColumnModel().getColumn(index).setCellRenderer(new LabelCellRenderer(new JLabel()));
+ }
+
+ private void setButtons() {
+ if (mList.getSelectedIndex() < 0) {
+ mDelete.setEnabled(false);
+ } else
+ mDelete.setEnabled(true);
+ CMSAdminUtil.repaintComp(mDelete);
+ }
+
+ //=================================================
+ // RETRIEVE INFO FROM SERVER SIDE
+ //=================================================
+
+ //retrieve group information from the server
+ private void refresh() throws EAdminException {
+ //Call AdminConnection to get data mGroupName
+ //mDataModel.removeAllRows();
+
+ //construct NVP
+ NameValuePairs config = new NameValuePairs();
+ config.put(Constants.PR_GROUP_DESC, "");
+ config.put(Constants.PR_GROUP_USER, "");
+ config.put(Constants.PR_GROUP_GROUP, "");
+
+ NameValuePairs response;
+ response = mConnection.read(DestDef.DEST_GROUP_ADMIN,
+ ScopeDef.SC_GROUPS,
+ mGroupName,
+ config);
+
+ Debug.println("Received Memebership: "+response.toString());
+ //setup the ui
+ mGroupNameField.setText(mGroupName);
+ mGroupDescField.setText(response.get(Constants.PR_GROUP_DESC));
+
+ //setup the member table
+
+ //parse user entry
+ String user = response.get(Constants.PR_GROUP_USER).trim();
+ StringTokenizer tokenizer = new StringTokenizer(user, ",");
+ while (tokenizer.hasMoreTokens()) {
+ String user_str = tokenizer.nextToken().trim();
+ mDataModel.addElement(user_str);
+ }
+
+ }
+
+ //add new group information
+ private void addGroup() throws EAdminException {
+
+ //construct NVP
+ NameValuePairs config = new NameValuePairs();
+ config.put(Constants.PR_GROUP_DESC, mGroupName);
+ createUGString(config);
+
+ //send request
+ mConnection.add(DestDef.DEST_GROUP_ADMIN,
+ ScopeDef.SC_GROUPS,
+ mGroupName,
+ config);
+ }
+
+ //change new group information
+ private void modifyGroup() throws EAdminException {
+
+ //construct NVP
+ NameValuePairs config = new NameValuePairs();
+ config.put(Constants.PR_GROUP_DESC, mGroupDescField.getText());
+ createUGString(config);
+
+ //send request
+ mConnection.modify(DestDef.DEST_GROUP_ADMIN,
+ ScopeDef.SC_GROUPS,
+ mGroupName,
+ config);
+
+ }
+
+ //remove member from the member list
+ private void deleteMember() {
+ Debug.println("GroupEditor: deleteMember()");
+ int i = mList.getSelectedIndex();
+ try{
+ mDataModel.removeElementAt(i);
+ } catch (Exception e) {
+ Debug.println("GroupEditor: deleteMember()-" +e.toString());
+ }
+ refreshTable();
+ }
+
+ //create user and group membership string
+ private void createUGString(NameValuePairs config) {
+ StringBuffer userBuf = new StringBuffer();
+
+ //go through membership table
+ if(mDataModel.getSize()>0)
+ for (int i=0; i<mDataModel.getSize(); i++) {
+ String data = (String)mDataModel.getElementAt(i);
+ if (userBuf.length()>0)
+ userBuf.append(",");
+ userBuf.append(data);
+ }
+
+ //set parameters
+ config.put(Constants.PR_GROUP_USER, userBuf.toString());
+ }
+
+ //refresh the table content
+ private void refreshTable() {
+ //Debug.println("GroupEditor: refreshTable() - start");
+ //mTable.invalidate();
+ //mTable.validate();
+ //mTable.repaint(1);
+ //mScrollPane.invalidate();
+ //mScrollPane.validate();
+ //mScrollPane.repaint(1);
+ //Debug.println("GroupEditor: refreshTable() - end");
+ }
+
+ public JList makeJList(DefaultListModel listModel, int visibleCount) {
+ JList listbox = new JList(listModel);
+ listbox.setCellRenderer(new AttrCellRenderer());
+ listbox.setSelectionModel(new DefaultListSelectionModel());
+ listbox.setVisibleRowCount(visibleCount);
+ if(listModel.size()!=0)
+ listbox.setSelectedIndex(0);
+ return listbox;
+ }
+
+}
+
+
diff --git a/base/console/src/com/netscape/admin/certsrv/ug/GroupListDataModel.java b/base/console/src/com/netscape/admin/certsrv/ug/GroupListDataModel.java
new file mode 100644
index 000000000..7893d9cb0
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/ug/GroupListDataModel.java
@@ -0,0 +1,67 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.ug;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+
+/**
+ * Group List Data model - represents the group selection information
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public class GroupListDataModel extends CMSContentTableModel
+ implements IDataProcessor
+{
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static String[] mColumns = {GROUPNAME};
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public GroupListDataModel() {
+ super();
+ init(mColumns);
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public void processData(Object data) {
+ Vector v = new Vector();
+
+ String entry = (String)data;
+ String name;
+ if (entry.startsWith(PrefixDef.PX_SYS))
+ name = entry.substring(PrefixDef.PX_SYS.length());
+ else
+ name = entry.substring(PrefixDef.PX_DEF.length());
+
+ v.addElement(new JLabel(name,
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_USERGROUP),
+ JLabel.LEFT));
+ addRow(v, data);
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/ug/GroupListDialog.java b/base/console/src/com/netscape/admin/certsrv/ug/GroupListDialog.java
new file mode 100644
index 000000000..d5931a6f8
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/ug/GroupListDialog.java
@@ -0,0 +1,284 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.ug;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import javax.swing.table.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Group Listing Dialog - <p>
+ *
+ * This dialog support multiple group selection and displays
+ * only groups that are not in the current group. This dialog
+ * will be created once and being reused per group editor.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.ug
+ */
+public class GroupListDialog extends JDialog
+ implements ActionListener
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private String PREFIX = "GROUPLISTDIALOG";
+
+ private JFrame mParentFrame;
+ private AdminConnection mConnection;
+ private ResourceBundle mResource;
+ protected GroupListDataModel mDataModel;
+ protected Vector mCurrentGroups;
+ protected Vector mSelectedGroups;
+
+ private JScrollPane mScrollPane;
+ private JTable mTable;
+
+ private JButton mOK, mCancel;
+ private boolean mIsOk = false;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public GroupListDialog(JFrame parent, AdminConnection conn) {
+ super(parent,true);
+ mParentFrame = parent;
+ mConnection = conn;
+ mSelectedGroups = new Vector();
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ mDataModel = new GroupListDataModel();
+ setSize(350, 300);
+ setTitle(mResource.getString(PREFIX+"_TITLE"));
+ setLocationRelativeTo(parent);
+ getRootPane().setDoubleBuffered(true);
+ setDisplay();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * show the windows
+ * @param users list of current groups
+ */
+ public void showDialog(Vector groups) {
+
+ mCurrentGroups = groups;
+ mSelectedGroups.removeAllElements();
+
+ //retrieve the cert record from the server
+ try {
+ refresh();
+ } catch (EAdminException ex) {
+ CMSAdminUtil.showMessageDialog(mParentFrame, mResource, PREFIX,
+ "SERVERERROR", CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ mIsOk = false;
+ this.show();
+ }
+
+
+ /**
+ * if selection is ok, the group names will be returned
+ * otherwise, empty vector will be returned.
+ * @return group names
+ */
+ public Vector getSelectedGroup() {
+ return mSelectedGroups;
+ }
+
+ /**
+ * get the exit code
+ * @return true if ok; otherwise false
+ */
+ public boolean isOK() {
+ return mIsOk;
+ }
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent evt) {
+ if (evt.getSource().equals(mOK)) {
+ //check if selection has been made
+ //Debug.println("Row Selected = "+mDataModel.getRowCount());
+ if(mDataModel.getRowCount()<=0) {
+ //display error message
+ CMSAdminUtil.showMessageDialog(mParentFrame, mResource, PREFIX,
+ "NOSELECTION", CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+
+ //get selection
+ //int i = mTable.getSelectedRowCount();
+ //Debug.println("Rows Selected ="+i);
+ int[] rowIndex = mTable.getSelectedRows();
+ //Debug.println("Rows Selected ="+rowIndex.length);
+ for (int j=0; j< rowIndex.length; j++)
+ mSelectedGroups.addElement(
+ mDataModel.getObjectValueAt(rowIndex[j]));
+
+ //set return flag
+ mIsOk = true;
+ this.hide();
+ }
+
+ if (evt.getSource().equals(mCancel)) {
+ this.hide();
+ }
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+ private void setDisplay() {
+ getContentPane().setLayout(new BorderLayout());
+ JPanel center = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ center.setLayout(gb);
+
+ //content panel
+ JPanel content = makeContentPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(content, gbc);
+ center.add(content);
+
+ //action panel
+ JPanel action = makeActionPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints(action, gbc);
+ center.add(action);
+
+ getContentPane().add("Center",center);
+ }
+
+ private JPanel makeActionPane() {
+ mOK = CMSAdminUtil.makeJButton(mResource, PREFIX, "OK", null, this);
+ mCancel = CMSAdminUtil.makeJButton(mResource, PREFIX, "CANCEL", null, this);
+ JButton[] buttons = { mOK, mCancel};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonPanel( buttons );
+ }
+
+ private JPanel makeContentPane() {
+ JPanel content = new JPanel();
+ GridBagLayout gb3 = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ content.setLayout(gb3);
+ //content.setBorder(CMSAdminUtil.makeEtchedBorder());
+
+ //left side certificate table
+ mTable = new JTable(mDataModel);
+ mScrollPane = JTable.createScrollPaneForTable(mTable);
+ //mScrollPane.setBorder(CMSAdminUtil.makeTitledBorder(mResource,PREFIX,"CERTIFICATE"));
+ mScrollPane.setHorizontalScrollBarPolicy(mScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mScrollPane.setVerticalScrollBarPolicy(mScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ int width = CMSAdminUtil.getTotalColumnWidth( mTable );
+ //Dimension d = new Dimension( width, mTable.getRowHeight()*14);
+ //mTable.setMinimumSize( d );
+ //mTable.setSize( d );
+ mTable.setAutoscrolls(true);
+ mTable.sizeColumnsToFit(true);
+ mTable.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
+ //mTable.getSelectionModel().addListSelectionListener(new StandardListSelectionListener());
+ //mTable.addMouseListener(this);
+ //mTable.setPreferredScrollableViewportSize(d);
+ setLabelCellRenderer(mTable,0);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ gbc.weightx = 1.0;
+ gb3.setConstraints(mScrollPane, gbc);
+ content.add(mScrollPane);
+
+ return content;
+ }
+
+ //Set the first column's cellrender as label cell
+ protected void setLabelCellRenderer(JTable table, int index) {
+ table.getColumnModel().getColumn(index).setCellRenderer(new LabelCellRenderer(new JLabel()));
+ }
+
+ //=================================================
+ // RETRIEVE INFO FROM SERVER SIDE
+ //=================================================
+
+ //retrieve group information from the server
+ private void refresh() throws EAdminException {
+ mDataModel.removeAllRows();
+
+ NameValuePairs response;
+ try {
+ response = mConnection.search(DestDef.DEST_GROUP_ADMIN,
+ ScopeDef.SC_GROUPS,
+ new NameValuePairs());
+ } catch (EAdminException e) {
+ //display error dialog
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ e.getMessage(), CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+
+ //parse the data
+ for (String entry : response.keySet()) {
+ entry = entry.trim();
+ //check if not already in current list
+ if (mCurrentGroups.indexOf(entry)== -1)
+ mDataModel.processData(entry);
+ }
+
+ refreshTable();
+ }
+
+ //refresh the table content
+ private void refreshTable() {
+ mTable.invalidate();
+ mTable.validate();
+ //mTable.repaint(1);
+ mScrollPane.invalidate();
+ mScrollPane.validate();
+ //mScrollPane.repaint(1);
+ repaint();
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/ug/GroupTab.java b/base/console/src/com/netscape/admin/certsrv/ug/GroupTab.java
new file mode 100644
index 000000000..e80cc7047
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/ug/GroupTab.java
@@ -0,0 +1,369 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.ug;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Group Tab
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public class GroupTab extends CMSBaseUGTab {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PANEL_NAME = "GROUPTAB";
+ private AdminConnection mConnection;
+
+ protected JScrollPane mScrollPane;
+ protected JTable mTable; //table
+ protected GroupDataModel mDataModel; //table model
+ protected GroupEditor mEditor=null; //keep single copy
+
+ protected JButton mRefresh, mEdit, mAdd, mDelete, mHelp;
+ private static final String HELPINDEX = "usersgroups-certsrv-groups-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public GroupTab(CMSBaseResourceModel model) {
+ super(PANEL_NAME, model);
+ mConnection = model.getServerInfo().getAdmin();
+ mDataModel = new GroupDataModel();
+ mHelpToken = HELPINDEX;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent e) {
+
+ if (e.getSource().equals(mRefresh)) {
+ Debug.println("Refresh Group");
+ refresh();
+ }
+ if (e.getSource().equals(mEdit)) {
+ if(mTable.getSelectedRow()< 0)
+ return;
+
+ Debug.println("Edit Groups "+mTable.getSelectedRow());
+ String groupName = (String) mDataModel.getObjectValueAt(mTable.getSelectedRow());
+
+ if (mEditor==null){
+ mEditor = new GroupEditor(mModel.getFrame(), mConnection);
+ }
+
+ mEditor.showDialog(groupName, false);
+ refresh();
+
+ }
+ if (e.getSource().equals(mAdd)) {
+ Debug.println("Show Editor");
+ if (mEditor==null)
+ mEditor = new GroupEditor(mModel.getFrame(), mConnection);
+ mEditor.showDialog("",true);
+ refresh();
+ }
+ if (e.getSource().equals(mDelete)) {
+ if(mTable.getSelectedRow()< 0)
+ return;
+ int i = showConfirmDialog("DELETE");
+ if (i == JOptionPane.YES_OPTION) {
+ deleteGroup();
+ Debug.println("Group Deleted");
+ }
+ }
+ if (e.getSource().equals(mHelp)) {
+ helpCallback();
+ }
+ }
+
+ //==== MOUSELISTENER ======================
+ public void mouseClicked(MouseEvent e) {
+ setButtons();
+
+ /*
+
+ //NEED TO DISABLE THIS DUE TO BUG THAT WILL RE-DISPLAY
+ //THE DISLOG WINDOW AFTER CLOSING
+
+ //NEED TO PUT CODE TO DO PROACTIVE VERIFICATION
+
+ Debug.println("GroupTab: mouseClicked() -"+e.toString());
+
+ //we track the double click action on the table entry - View op
+ if(mTable.getSelectedRow() >= 0) {
+ if(e.getClickCount() == 2) {
+ Debug.println("Edit System group");
+ String groupName = (String)
+ mDataModel.getObjectValueAt(mTable.getSelectedRow());
+ mEditor = new GroupEditor(mModel.getFrame(), mConnection);
+ mEditor.showDialog(PrefixDef.PX_SYS+groupName,false);
+ refresh();
+ }
+ }
+
+ //we track the double click action on the table entry - View op
+ if(mDefTable.getSelectedRow() >= 0) {
+ if(e.getClickCount() == 2) {
+ Debug.println("Edit Admin Define Group");
+ String groupName = (String)
+ mDefDataModel.getObjectValueAt(mDefTable.getSelectedRow());
+ mEditor = new GroupEditor(mModel.getFrame(), mConnection);
+ mEditor.showDialog(PrefixDef.PX_DEF+groupName,false);
+ refresh();
+ }
+ }
+ */
+
+ }
+
+ public void mouseReleased(MouseEvent e) {
+ setButtons();
+ }
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+
+ /**
+ * Updates the groups
+ */
+ public void refresh() {
+ //Debug.println("refresh group");
+
+ mDataModel.removeAllRows();
+
+ updateGroup();
+ setButtons();
+
+ mTable.invalidate();
+ mTable.validate();
+ mTable.repaint(1);
+ mScrollPane.invalidate();
+ mScrollPane.validate();
+ mScrollPane.repaint(1);
+ }
+
+ //resize vertical buttons
+ protected void resizeButtons() {
+ mEdit = makeJButton("EDIT");
+ mAdd = makeJButton("ADD");
+ mDelete = makeJButton("DELETE");
+ //JButton[] buttons = {mEdit};
+ JButton[] buttons = {mAdd, mDelete, mEdit};
+ JButtonFactory.resize( buttons );
+ }
+
+ /**
+ * create the bottom action button panel
+ */
+ protected JPanel createUDButtonPanel() {
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ // JButton[] buttons = { mEdit };
+ JButton[] buttons = { mAdd, mDelete, mEdit };
+ return CMSAdminUtil.makeJButtonVPanel( buttons );
+ }
+
+ /**
+ * create the bottom action button panel
+ */
+ protected JPanel createActionPanel() {
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mRefresh = makeJButton("REFRESH");
+ mHelp = makeJButton("HELP");
+ // JButton[] buttons = { mRefresh, mHelp };
+ JButton[] buttons = { mRefresh };
+ return makeJButtonPanel( buttons, true);
+ }
+
+ /**
+ * create the center listing panel
+ */
+ protected JPanel createListPanel() {
+ mListPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mListPanel.setLayout(gb);
+
+ resizeButtons();
+
+ //top standard table
+ //fix the size of the top table - since the content will be fixed
+ //also fixed the problem of resizing.
+ mTable = new JTable(mDataModel);
+ mScrollPane = JTable.createScrollPaneForTable(mTable);
+ //mScrollPane.setBorder(CMSAdminUtil.makeTitledBorder(mResource,PANEL_NAME,"STANDARD"));
+ mScrollPane.setHorizontalScrollBarPolicy(mScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mScrollPane.setVerticalScrollBarPolicy(mScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ //int width = CMSAdminUtil.getTotalColumnWidth( mTable );
+ //Dimension d = new Dimension( width, mTable.getRowHeight()*8);
+ //mTable.setMinimumSize( d );
+ //mTable.setSize( d );
+ mTable.setAutoscrolls(true);
+ mTable.sizeColumnsToFit(true);
+ mTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ //mTable.getSelectionModel().addListSelectionListener(new StandardListSelectionListener());
+ mTable.addMouseListener(this);
+ //mTable.setPreferredScrollableViewportSize(d);
+ mScrollPane.setBackground(Color.white);
+ setLabelCellRenderer(mTable,0);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = 1;
+ gbc.weightx = 1.0;
+ gbc.insets = EMPTY_INSETS;
+ gb.setConstraints(mScrollPane, gbc);
+ mListPanel.add(mScrollPane);
+
+ JPanel buttonPanel = createUDButtonPanel();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 0.0;
+ gbc.weighty = 1.0;
+ gbc.insets = EMPTY_INSETS;
+ gb.setConstraints(buttonPanel, gbc);
+ mListPanel.add(buttonPanel);
+
+ refresh();
+
+ return mListPanel;
+ }
+
+ //Set the first column's cellrender as label cell
+ protected void setLabelCellRenderer(JTable table, int index) {
+ table.getColumnModel().getColumn(index).setCellRenderer(new LabelCellRenderer(new JLabel()));
+ }
+
+ //=============================================
+ // SEND REQUESTS TO THE SERVER SIDE
+ //=============================================
+
+
+ /**
+ * set buttons - proactive verification
+ */
+ private void setButtons() {
+
+ //enable and diable buttons accordingly
+ if (mTable.getSelectionModel().isSelectionEmpty()) {
+ mDelete.setEnabled(false);
+ mEdit.setEnabled(false);
+ return;
+ }
+
+ if(mDataModel.getRowCount()< 0) {
+ mDelete.setEnabled(false);
+ mEdit.setEnabled(false);
+ return;
+ }
+
+ mDelete.setEnabled(true);
+ mEdit.setEnabled(true);
+
+ }
+
+ private void updateGroup() {
+ //send request and parse data
+
+ NameValuePairs response;
+ mModel.progressStart();
+ try {
+ response = mConnection.search(DestDef.DEST_GROUP_ADMIN,
+ ScopeDef.SC_GROUPS,
+ new NameValuePairs());
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ mModel.progressStop();
+ return;
+ }
+
+ Debug.println(response.toString());
+
+ //parse the data
+ Vector store = new Vector();
+ for (String entry : response.keySet()) {
+ store.addElement(entry.trim());
+ }
+
+ String[] vals = new String[store.size()];
+ store.copyInto(vals);
+
+ CMSAdminUtil.bubbleSort(vals);
+
+ for (int y=0; y< vals.length ; y++) {
+ String value = response.get(vals[y]);
+ mDataModel.processData(vals[y],value);
+ }
+
+ if (mDataModel.getRowCount() >0)
+ mTable.setRowSelectionInterval(0,0);
+
+ mModel.progressStop();
+ }
+
+ private void deleteGroup() {
+ //get entry name
+ String groupName = (String)
+ mDataModel.getObjectValueAt(mTable.getSelectedRow());
+
+ //send comment to server for the removal of the admin
+ //defined group - no multiple groups selection - append
+ //admin prefix
+ mModel.progressStart();
+ try {
+ mConnection.delete(DestDef.DEST_GROUP_ADMIN,
+ ScopeDef.SC_GROUPS,
+ groupName);
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ mModel.progressStop();
+ return;
+ }
+ mModel.progressStop();
+ //send comment to server and refetch the content
+ refresh();
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/ug/MemberDataModel.java b/base/console/src/com/netscape/admin/certsrv/ug/MemberDataModel.java
new file mode 100644
index 000000000..6b1fbfeec
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/ug/MemberDataModel.java
@@ -0,0 +1,140 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.ug;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Group Membership model - represents the group table information
+ * We will need to store the user and group information in separate
+ * vector also for comparison purpose.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public class MemberDataModel extends CMSContentTableModel
+ implements IDataProcessor
+{
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ public static final String MEMBER_NAME = "MEMBER_NAME";
+ public static final String MEMBER_TYPE = "MEMBER_TYPE";
+ public static final String MEMBER_GROUP = "MEMBER_GROUP";
+ public static final String MEMBER_USER = "MEMBER_USER";
+
+ private static String[] mColumns = {MEMBER};
+
+ private Vector mUsers = new Vector();
+ private Vector mGroups = new Vector();
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public MemberDataModel() {
+ super();
+ init(mColumns);
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public void processData(Object data) {
+ Vector v = new Vector();
+
+ NameValuePairs rec = (NameValuePairs)data;
+
+ Icon icon;
+ icon = (rec.get(MEMBER_TYPE).equals(MEMBER_GROUP))?
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_USERGROUP):
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_USER);
+
+ String entry = rec.get(MEMBER_NAME);
+ String name = entry;
+ if(rec.get(MEMBER_TYPE).equals(MEMBER_GROUP)) {
+ if (entry.startsWith(PrefixDef.PX_SYS))
+ name = entry.substring(PrefixDef.PX_SYS.length());
+ else
+ name = entry.substring(PrefixDef.PX_DEF.length());
+ }
+ v.addElement(new JLabel(name,icon, JLabel.LEFT));
+ addRow(v, data);
+ }
+
+ /**
+ * clean up the table including the datat objects
+ */
+ public void removeAllRows() {
+ super.removeAllRows();
+ mObjectContainer.removeAllElements();
+ mUsers.removeAllElements();
+ mGroups.removeAllElements();
+ }
+
+ /**
+ * Remove row at the specified index position
+ * @param index row index to be removed
+ */
+ public void removeRow(int index)
+ throws ArrayIndexOutOfBoundsException
+ {
+ Debug.println("MemberDataModel: removeRow() - start");
+ NameValuePairs data = (NameValuePairs)getObjectValueAt(index);
+ if (data.get(MEMBER_TYPE).equals(MEMBER_GROUP))
+ mGroups.removeElement(data.get(MEMBER_NAME));
+ else
+ mUsers.removeElement(data.get(MEMBER_NAME));
+ super.removeRow(index);
+ Debug.println("MemberDataModel: removeRow() - end");
+ }
+
+ /**
+ * Add data row and data object associated with this row
+ * @param values row values for the table
+ * @param obj data object
+ */
+ public void addRow(Vector values, Object obj) {
+ super.addRow(values);
+ mObjectContainer.addElement(obj);
+ NameValuePairs rec = (NameValuePairs)obj;
+ if (rec.get(MEMBER_TYPE).equals(MEMBER_GROUP))
+ mGroups.addElement(rec.get(MEMBER_NAME));
+ else
+ mUsers.addElement(rec.get(MEMBER_NAME));
+ }
+
+ /**
+ * get user vector for comparison
+ */
+ public Vector getUsers() {
+ return (Vector)mUsers.clone();
+ }
+
+ /**
+ * get group vector for comparison
+ */
+ public Vector getGroups() {
+ return (Vector)mGroups.clone();
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/ug/UserDataModel.java b/base/console/src/com/netscape/admin/certsrv/ug/UserDataModel.java
new file mode 100644
index 000000000..c3b74ce35
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/ug/UserDataModel.java
@@ -0,0 +1,68 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.ug;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+
+/**
+ * User Data model - represents the user table information
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public class UserDataModel extends CMSContentTableModel {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static String[] mColumns = {USERID, FULLNAME};
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public UserDataModel() {
+ super();
+ init(mColumns);
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public void processData(String uid, String name) {
+ Vector v = new Vector();
+
+ v.addElement(new JLabel(uid,
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_USER),
+ JLabel.LEFT));
+ v.addElement(name);
+
+ addRow(v,uid);
+ }
+
+ /**
+ * get user vector for comparison
+ */
+ public Vector getUsers() {
+ return (Vector) mObjectContainer.clone();
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/ug/UserEditor.java b/base/console/src/com/netscape/admin/certsrv/ug/UserEditor.java
new file mode 100644
index 000000000..75908fe6a
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/ug/UserEditor.java
@@ -0,0 +1,627 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.ug;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * User Information Editor - UI provides the user information
+ * management functionality. The management of user certificate
+ * is done by certificate management dialog
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ *
+ * @see com.netscape.admin.certsrv.ug.UserTab
+ */
+public class UserEditor extends JDialog
+ implements ActionListener, MouseListener, DocumentListener
+{
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private String PREFIX = "USEREDITOR";
+
+ private JFrame mParentFrame;
+ private AdminConnection mConnection;
+ private String mUserName;
+ private boolean mIsNewUser = false;
+ private ResourceBundle mResource;
+ private Color mActiveColor;
+ protected DefaultListModel mDataModel;
+
+ protected JScrollPane mScrollPane;
+ protected JList mList;
+
+ private boolean mUserAdded;
+ private JButton mOK, mCancel, mHelp;
+ private JLabel mPasswordLbl, mPasswordConfirmLbl;
+ private JTextField mUserNameField, mFullNameField, mEMailField, mPhoneField, mStateField;
+ private JPasswordField mPasswordField;
+ private JPasswordField mPasswordConfirm;
+ private JLabel mUserLabel, mMembership, mGroupLbl, dummy1;
+ private JComboBox mGroupBox;
+ private static final String ADDHELPINDEX =
+ "usersgroups-certsrv-add-user-dbox-help";
+ private static final String EDITHELPINDEX =
+ "usersgroups-certsrv-edit-user-dbox-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public UserEditor( JFrame parent,
+ AdminConnection conn, boolean isNew) {
+ super(parent,true);
+ mParentFrame = parent;
+ mConnection = conn;
+ mDataModel = new DefaultListModel();
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ setTitle(mResource.getString(PREFIX+"_TITLE"));
+ mIsNewUser = isNew;
+ if(!mIsNewUser)
+ setSize(360, 370);
+ else
+ setSize(360, 350);
+ setLocationRelativeTo(parent);
+ getRootPane().setDoubleBuffered(true);
+ setDisplay();
+
+ if(!mIsNewUser) {
+ mUserNameField.setVisible(false);
+ mUserLabel.setVisible(true);
+ mMembership.setVisible(true);
+ mScrollPane.setVisible(true);
+ mGroupLbl.setVisible(false);
+ mGroupBox.setVisible(false);
+ dummy1.setVisible(false);
+ } else {
+ mUserNameField.setVisible(true);
+ mUserNameField.setText("");
+ mUserLabel.setVisible(false);
+ mUserLabel.setText("");
+ mMembership.setVisible(false);
+ mScrollPane.setVisible(false);
+ mGroupLbl.setVisible(true);
+ mGroupBox.setVisible(true);
+ dummy1.setVisible(true);
+ }
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * show the windows
+ * @param user user name
+ * @param isNew true if this is a new entry
+ */
+ public void showDialog(String user) {
+
+ //initialize and setup
+ mUserName = user;
+ mFullNameField.setText("");
+ mEMailField.setText("");
+ mPhoneField.setText("");
+ mStateField.setText("");
+ mPasswordField.setText("");
+ mPasswordConfirm.setText("");
+
+ mDataModel.clear();
+ //mViewCert.setEnabled(false);
+
+ if(!mIsNewUser) {
+ mUserLabel.setText(user);
+ } else {
+ mUserNameField.setText("");
+ mUserLabel.setText("");
+ mStateField.setText("1");
+ }
+
+ //retrieve the cert record from the server
+ try {
+ if (mIsNewUser == false)
+ refresh();
+ else {
+ addGroup();
+ }
+ } catch (EAdminException ex) {
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ ex.toString(), CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ updateView();
+ this.show();
+ }
+
+ private void enablePasswordFields(boolean enable, Color color) {
+ mPasswordField.setVisible(enable);
+ mPasswordLbl.setVisible(enable);
+ mPasswordConfirm.setVisible(enable);
+ mPasswordConfirmLbl.setVisible(enable);
+ CMSAdminUtil.repaintComp(mPasswordField);
+ CMSAdminUtil.repaintComp(mPasswordConfirm);
+ CMSAdminUtil.repaintComp(mPasswordLbl);
+ CMSAdminUtil.repaintComp(mPasswordConfirmLbl);
+ }
+
+ public boolean isUserAdded() {
+ return mUserAdded;
+ }
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+
+ public void actionPerformed(ActionEvent evt) {
+
+ mUserAdded = false;
+ if (evt.getSource().equals(mOK)) {
+
+ //check password field
+ String pwd = mPasswordField.getText().trim();
+ if (!pwd.equals("")) {
+ if (!mPasswordConfirm.getText().trim().equals(pwd)) {
+ CMSAdminUtil.showMessageDialog(mParentFrame, mResource, PREFIX,
+ "PWDNOTMATCH", CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ }
+
+ if (mIsNewUser) {
+
+ //check text fields
+ if (mUserNameField.getText().trim().equals("")) {
+ CMSAdminUtil.showMessageDialog(mParentFrame, mResource, PREFIX,
+ "NOUSERNAME", CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+
+ try {
+ addUser();
+ mUserAdded = true;
+ } catch (EAdminException e) {
+ //display error dialog
+ Debug.println(e.toString());
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ e.toString(), CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+
+ } else {
+
+ try {
+ modifyUser();
+ } catch (EAdminException e) {
+ //display error dialog
+ Debug.println(e.toString());
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ e.toString(), CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+
+ }
+ this.hide();
+ }
+
+ if (evt.getSource().equals(mCancel)) {
+ Debug.println("Cancel Pressed");
+
+ //display are you sure dialog
+ this.hide();
+ }
+
+ if (evt.getSource().equals(mHelp)) {
+ if (mIsNewUser)
+ CMSAdminUtil.help(ADDHELPINDEX);
+ else
+ CMSAdminUtil.help(EDITHELPINDEX);
+ }
+
+ /*
+ * possible enhancement here to put in
+ * a WIZARD that will take 1) B64E ,2)
+ * ldap dir, 3) cert server for retrieval
+ * we will do B64E first
+ *
+ if (evt.getSource().equals(mAddCert)) {
+ //display dialog to add B64E
+ if (mCertDialog==null)
+ mCertDialog = new CertImportDialog(mParentFrame);
+ mCertDialog.showDialog();
+ if (!mCertDialog.isOK())
+ return;
+
+ //add entry
+ Debug.println("Name="+mCertDialog.getCertName());
+ Debug.println("B64E= "+mCertDialog.getB64E());
+ NameValuePairs data = new NameValuePairs();
+ data.add(CERT_NAME,mCertDialog.getCertName());
+ data.add(CERT_DATA,mCertDialog.getB64E());
+ data.add(CERT_VIEW,CERT_B64E);
+ mDataModel.processData(data);
+ refreshTable();
+ }
+
+ if (evt.getSource().equals(mViewCert)) {
+ //display certificate pp
+ NameValuePairs obj = (NameValuePairs)mDataModel.getObjectValueAt
+ (mTable.getSelectedRow());
+ if (mViewDialog==null)
+ mViewDialog = new CertViewDialog(mParentFrame);
+ mViewDialog.showDialog(obj.getValue(CERT_NAME),obj.getValue(CERT_DATA));
+ }
+
+ if (evt.getSource().equals(mDeleteCert)) {
+ if(mTable.getSelectedRow()< 0)
+ return;
+ int i = CMSAdminUtil.showConfirmDialog(mParentFrame, mResource,
+ PREFIX, "DELETE", CMSAdminUtil.WARNING_MESSAGE);
+ if (i == JOptionPane.YES_OPTION) {
+ deleteCert();
+ Debug.println("Cert Deleted");
+ }
+ }
+ */
+ }
+
+ //==== MOUSELISTENER ======================
+ public void mouseClicked(MouseEvent e) {
+ //check if stuff is selected
+ updateView();
+ }
+
+ public void mousePressed(MouseEvent e) {}
+ public void mouseReleased(MouseEvent e) {
+ updateView();
+ }
+ public void mouseEntered(MouseEvent e) {}
+ public void mouseExited(MouseEvent e) {}
+
+
+ //== DocumentListener ==
+ public void insertUpdate(DocumentEvent e) {
+ updateView();
+ }
+
+ public void removeUpdate(DocumentEvent e){
+ updateView();
+ }
+
+ public void changedUpdate(DocumentEvent e){
+ updateView();
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+
+ /**
+ * proactive verification
+ */
+ private void updateView() {
+ if (mIsNewUser) {
+ if (mUserNameField.getText().trim().equals("")) {
+ mOK.setEnabled(false);
+ return;
+ }
+ }
+ if (mFullNameField.getText().trim().equals("")) {
+ mOK.setEnabled(false);
+ return;
+ }
+ /* ONLY UID is verify now
+ if (mPasswordField.getText().trim().equals("")) {
+ mOK.setEnabled(false);
+ return;
+ }
+ */
+ mOK.setEnabled(true);
+ }
+
+ /**
+ * Construction of the initial UI components
+ */
+ private void setDisplay() {
+ getContentPane().setLayout(new BorderLayout());
+ JPanel center = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ center.setLayout(gb);
+
+ //content panel
+ JPanel content = makeContentPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.fill = gbc.BOTH;
+ gb.setConstraints(content, gbc);
+ center.add(content);
+
+ //action panel
+ JPanel action = makeActionPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints(action, gbc);
+ center.add(action);
+
+ getContentPane().add("Center",center);
+
+ }
+
+ private JPanel makeActionPane() {
+ mOK = CMSAdminUtil.makeJButton(mResource, PREFIX, "OK", null, this);
+ mCancel = CMSAdminUtil.makeJButton(mResource, PREFIX, "CANCEL", null, this);
+ mHelp = CMSAdminUtil.makeJButton(mResource, PREFIX, "HELP", null, this);
+ //JButton[] buttons = { mOK, mCancel, mHelp };
+ JButton[] buttons = { mOK, mCancel };
+ return CMSAdminUtil.makeJButtonPanel( buttons, true);
+ }
+
+ private JPanel makeContentPane() {
+
+ Insets insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,0,
+ CMSAdminUtil.COMPONENT_SPACE,0);
+
+ //top panel
+ JPanel top = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ CMSAdminUtil.resetGBC(gbc);
+ top.setLayout(gb);
+
+ JLabel label1 = CMSAdminUtil.makeJLabel(mResource, PREFIX, "USERNAME", null);
+ mUserNameField = new JTextField();
+ mUserNameField.addMouseListener(this);
+ mUserNameField.getDocument().addDocumentListener(this);
+ mUserLabel = new JLabel();
+ mUserLabel.setVisible(false);
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.anchor = gbc.EAST;
+ gbc. insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ top.add(label1, gbc);
+
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc. insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,
+ 0,CMSAdminUtil.COMPONENT_SPACE);
+ top.add( mUserLabel, gbc );
+ top.add( mUserNameField, gbc );
+
+ JLabel dummy = new JLabel();
+ dummy.setVisible(false);
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 0.0;
+ top.add( dummy, gbc);
+
+ JLabel label2 = CMSAdminUtil.makeJLabel(mResource, PREFIX, "FULLNAME", null);
+ mFullNameField = new JTextField();
+ mFullNameField.addMouseListener(this);
+ mFullNameField.getDocument().addDocumentListener(this);
+ CMSAdminUtil.addEntryField(top, label2, mFullNameField, gbc);
+
+ mPasswordLbl = CMSAdminUtil.makeJLabel(mResource, PREFIX, "PASSWORD", null);
+ mPasswordField = new JPasswordField();
+ mPasswordField.addMouseListener(this);
+ mPasswordField.getDocument().addDocumentListener(this);
+ mActiveColor = mPasswordField.getBackground();
+ CMSAdminUtil.addEntryField(top, mPasswordLbl, mPasswordField, gbc);
+
+ mPasswordConfirmLbl = CMSAdminUtil.makeJLabel(mResource, PREFIX, "PASSWORDCONFIRM", null);
+ mPasswordConfirm = new JPasswordField();
+ mPasswordConfirm.addMouseListener(this);
+ mPasswordConfirm.getDocument().addDocumentListener(this);
+ CMSAdminUtil.addEntryField(top, mPasswordConfirmLbl, mPasswordConfirm, gbc);
+
+ JLabel label4 = CMSAdminUtil.makeJLabel(mResource, PREFIX, "EMAIL", null);
+ mEMailField = new JTextField();
+ CMSAdminUtil.addEntryField(top, label4, mEMailField, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ //gbc.gridheight = gbc.REMAINDER;
+ JLabel label5 = CMSAdminUtil.makeJLabel(mResource, PREFIX, "PHONE", null);
+ mPhoneField = new JTextField();
+ CMSAdminUtil.addEntryField(top, label5, mPhoneField, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ //gbc.gridheight = gbc.REMAINDER;
+ JLabel label51 = CMSAdminUtil.makeJLabel(mResource, PREFIX, "STATE", null);
+ mStateField = new JTextField();
+ CMSAdminUtil.addEntryField(top, label51, mStateField, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mGroupLbl = CMSAdminUtil.makeJLabel(mResource, PREFIX, "GROUP",null);
+ mGroupBox = new JComboBox();
+ //mGroupBox.addItem("Admin group");
+ dummy1 = new JLabel(" ");
+ CMSAdminUtil.addEntryField(top, mGroupLbl, mGroupBox, dummy1, gbc);
+
+ mMembership = CMSAdminUtil.makeJLabel(mResource, PREFIX, "MEMBER", null);
+ //group membership table
+ mList = CMSAdminUtil.makeJList(mDataModel,6);
+ mScrollPane = new JScrollPane(mList,
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION );
+ mList.addMouseListener(this);
+ mScrollPane.setBackground(Color.white);
+
+ mScrollPane.setBorder(BorderFactory.createLoweredBevelBorder());
+ //setLabelCellRenderer(mTable,0);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.gridx = 0;
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ top.add( mMembership, gbc );
+
+ gbc.gridx++;
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.BOTH;
+ gbc.weightx = 0.5;
+ gbc.weighty=1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,CMSAdminUtil.COMPONENT_SPACE);
+ top.add( mScrollPane, gbc );
+
+ return top;
+ }
+
+ //=================================================
+ // RETRIEVE INFO FROM SERVER SIDE
+ //=================================================
+
+ //retrieve group information from the server
+ private void refresh() throws EAdminException {
+
+ //construct NVP
+ NameValuePairs config = new NameValuePairs();
+ config.put(Constants.PR_USER_FULLNAME, "");
+ config.put(Constants.PR_USER_EMAIL, "");
+ config.put(Constants.PR_USER_PHONE, "");
+ config.put(Constants.PR_USER_STATE, "");
+ config.put(Constants.PR_USER_GROUP, "");
+
+ NameValuePairs response;
+ response = mConnection.read(DestDef.DEST_USER_ADMIN,
+ ScopeDef.SC_USERS,
+ mUserName,
+ config);
+
+ //setup the ui
+ mUserNameField.setText(mUserName);
+ mFullNameField.setText(response.get(Constants.PR_USER_FULLNAME));
+ mEMailField.setText(response.get(Constants.PR_USER_EMAIL));
+ mPhoneField.setText(response.get(Constants.PR_USER_PHONE));
+ mStateField.setText(response.get(Constants.PR_USER_STATE));
+
+ //parse group entry
+ String userStr = response.get(Constants.PR_USER_GROUP);
+ if ( (userStr != null) && (!userStr.trim().equals("")) ) {
+ StringTokenizer tokenizer = new StringTokenizer(userStr, ",");
+ while (tokenizer.hasMoreTokens()) {
+ String groupstr = tokenizer.nextToken().trim();
+ mDataModel.addElement(groupstr);
+ }
+ }
+
+ }
+
+ private void addGroup() throws EAdminException {
+ NameValuePairs response = mConnection.search(DestDef.DEST_GROUP_ADMIN,
+ ScopeDef.SC_GROUPS, new NameValuePairs());
+ if (mGroupBox.getItemCount() > 0)
+ mGroupBox.removeAllItems();
+ for (String groupname : response.keySet()) {
+ mGroupBox.addItem(groupname.trim());
+ }
+
+ }
+
+ //add new group information
+ private void addUser() throws EAdminException {
+
+ //construct NVP
+ NameValuePairs config = new NameValuePairs();
+ config.put(Constants.PR_USER_FULLNAME, mFullNameField.getText().trim());
+ config.put(Constants.PR_USER_PASSWORD, mPasswordField.getText().trim());
+ config.put(Constants.PR_USER_EMAIL, mEMailField.getText().trim());
+ config.put(Constants.PR_USER_PHONE, mPhoneField.getText().trim());
+ config.put(Constants.PR_USER_STATE, mStateField.getText().trim());
+ config.put(Constants.PR_USER_GROUP, (String) mGroupBox.getSelectedItem());
+ config.put(Constants.PR_USER_TYPE, "");
+ //config.add(Constants.PR_USER_CERT,"");
+ //createCertEntry(config);
+
+ //send request
+ mConnection.add(DestDef.DEST_USER_ADMIN,
+ ScopeDef.SC_USERS,
+ mUserNameField.getText().trim(),
+ config);
+ }
+
+ //change new group information
+ private void modifyUser() throws EAdminException {
+
+ //construct NVP
+ NameValuePairs config = new NameValuePairs();
+ config.put(Constants.PR_USER_FULLNAME, mFullNameField.getText().trim());
+ config.put(Constants.PR_USER_PASSWORD, mPasswordField.getText().trim());
+ config.put(Constants.PR_USER_EMAIL, mEMailField.getText().trim());
+ config.put(Constants.PR_USER_PHONE, mPhoneField.getText().trim());
+ config.put(Constants.PR_USER_STATE, mStateField.getText().trim());
+ config.put(Constants.PR_USER_TYPE, "");
+ //createCertEntry(config);
+
+ //send request
+ mConnection.modify(DestDef.DEST_USER_ADMIN,
+ ScopeDef.SC_USERS,
+ mUserName,
+ config);
+
+ // #343872
+ // see if it is password change of the currently logged-in
+ // user. If it is the case, we need to update Console password
+ // cache
+ String pwd = mPasswordField.getText().trim();
+ if (!pwd.equals("")) {
+ BasicAuthenticator auth = (BasicAuthenticator)
+ mConnection.getAuthenticator();
+ if (mUserName.equals(auth.getUserid()) &&
+ !pwd.equals(auth.getPassword())) {
+ auth.setPassword(pwd);
+ }
+ }
+ }
+
+ //refresh the table content
+ private void refreshTable() {
+ mScrollPane.repaint(1);
+ }
+
+
+}
+
diff --git a/base/console/src/com/netscape/admin/certsrv/ug/UserListDataModel.java b/base/console/src/com/netscape/admin/certsrv/ug/UserListDataModel.java
new file mode 100644
index 000000000..e66c14d94
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/ug/UserListDataModel.java
@@ -0,0 +1,70 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.ug;
+
+import java.util.*;
+import javax.swing.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+
+/**
+ * User List Data model - represents the single column user
+ * table information
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public class UserListDataModel extends CMSContentTableModel
+ implements IDataProcessor
+{
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static String[] mColumns = {USERID};
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public UserListDataModel() {
+ super();
+ init(mColumns);
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public void processData(Object data) {
+ Vector v = new Vector();
+
+ //XXX NEED TO CHANGE if we are going to have multi-column table
+ v.addElement(new JLabel((String)data,
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_USER),
+ JLabel.LEFT));
+ addRow(v, data);
+ }
+
+ /**
+ * get user vector for comparison
+ */
+ public Vector getUsers() {
+ return (Vector) mObjectContainer.clone();
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/ug/UserListDialog.java b/base/console/src/com/netscape/admin/certsrv/ug/UserListDialog.java
new file mode 100644
index 000000000..6f0c6215b
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/ug/UserListDialog.java
@@ -0,0 +1,369 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.ug;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * User Listing Dialog - <p>
+ *
+ * This dialog support multiple user selection and displays
+ * only users that are not in the current group. This dialog
+ * will be created once and being reused per group editor.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.ug
+ */
+public class UserListDialog extends JDialog
+ implements ActionListener, MouseListener
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private String PREFIX = "USERLISTDIALOG";
+
+ private JFrame mParentFrame;
+ private AdminConnection mConnection;
+ private ResourceBundle mResource;
+ protected DefaultListModel mDataModel;
+ protected Vector mCurrentUsers;
+ protected Vector mSelectedUser;
+
+ private JScrollPane mScrollPane;
+ private JList mList;
+
+ private JButton mOK, mCancel;
+ private boolean mIsOk = false;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public UserListDialog(JFrame parent, AdminConnection conn) {
+ super(parent,true);
+ mParentFrame = parent;
+ mConnection = conn;
+ mSelectedUser = new Vector();
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ mDataModel = new DefaultListModel();
+ setSize(360, 216);
+ setTitle(mResource.getString(PREFIX+"_TITLE"));
+ setLocationRelativeTo(parent);
+ getRootPane().setDoubleBuffered(true);
+ setDisplay();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * show the windows
+ * @param users list of current users
+ */
+ public void showDialog(Vector users) {
+
+ mCurrentUsers = users;
+ mSelectedUser.removeAllElements();
+
+ //retrieve the cert record from the server
+ try {
+ refresh();
+ } catch (EAdminException ex) {
+ CMSAdminUtil.showMessageDialog(mParentFrame, mResource, PREFIX,
+ "SERVERERROR", CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+ setButtons();
+ mIsOk = false;
+ this.show();
+ }
+
+
+ /**
+ * if selection is ok, the user name will be returned
+ * otherwise, empty string will be returned.
+ * @return user name
+ */
+ public Vector getSelectedUser() {
+ return mSelectedUser;
+ }
+
+ /**
+ * get the exit code
+ * @return true if ok; otherwise false
+ */
+ public boolean isOK() {
+ return mIsOk;
+ }
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent evt) {
+ if (evt.getSource().equals(mOK)) {
+ //get selected user
+ int[] rowIndex = mList.getSelectedIndices();
+ //Debug.println("Rows Selected ="+rowIndex.length);
+ for (int j=0; j< rowIndex.length; j++)
+ mSelectedUser.addElement(
+ ((JLabel)mDataModel.elementAt(rowIndex[j])).getText());
+
+ //set return flag
+ mIsOk = true;
+ this.hide();
+ }
+
+ if (evt.getSource().equals(mCancel)) {
+ this.hide();
+ }
+ }
+
+ //==== MOUSELISTENER ======================
+ public void mouseClicked(MouseEvent e) {
+ setButtons();
+ }
+
+ public void mousePressed(MouseEvent e) {}
+ public void mouseReleased(MouseEvent e) {}
+
+ public void mouseEntered(MouseEvent e) {
+ setButtons();
+ }
+ public void mouseExited(MouseEvent e) {
+ setButtons();
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+
+ //set buttons
+ private void setButtons() {
+ if (mList.getSelectedIndex()< 0) {
+ mOK.setEnabled(false);
+ return;
+ }
+ mOK.setEnabled(true);
+ }
+
+ private void setDisplay() {
+ getContentPane().setLayout(new BorderLayout());
+ JPanel center = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ center.setLayout(gb);
+
+ //content panel
+ JPanel content = makeContentPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.fill = gbc.BOTH;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(content, gbc);
+ center.add(content);
+
+ //action panel
+ JPanel action = makeActionPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints(action, gbc);
+ center.add(action);
+
+ getContentPane().add("Center",center);
+ }
+
+ private JPanel makeActionPane() {
+ mOK = CMSAdminUtil.makeJButton(mResource, PREFIX, "OK", null, this);
+ mCancel = CMSAdminUtil.makeJButton(mResource, PREFIX, "CANCEL", null, this);
+ JButton[] buttons = { mOK, mCancel};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonPanel( buttons );
+ }
+
+ private JPanel makeContentPane() {
+ JPanel mListPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mListPanel.setLayout(gb);
+
+ mList = CMSAdminUtil.makeJList(mDataModel,9);
+ mScrollPane = new JScrollPane(mList,
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
+ mList.addMouseListener(this);
+ mScrollPane.setBackground(Color.white);
+ mScrollPane.setBorder(BorderFactory.createLoweredBevelBorder());
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gbc.fill = gbc.BOTH;
+ gb.setConstraints(mScrollPane, gbc);
+ mListPanel.add(mScrollPane);
+
+ return mListPanel;
+
+ /*
+ JPanel content = new JPanel();
+ GridBagLayout gb3 = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ content.setLayout(gb3);
+ //content.setBorder(CMSAdminUtil.makeEtchedBorder());
+
+ //left side certificate table
+ mTable = new JTable(mDataModel);
+ mScrollPane = JTable.createScrollPaneForTable(mTable);
+ //mScrollPane.setBorder(CMSAdminUtil.makeTitledBorder(mResource,PREFIX,"CERTIFICATE"));
+ mScrollPane.setHorizontalScrollBarPolicy(mScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mScrollPane.setVerticalScrollBarPolicy(mScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ int width = CMSAdminUtil.getTotalColumnWidth( mTable );
+ //Dimension d = new Dimension( width, mTable.getRowHeight()*14);
+ //mTable.setMinimumSize( d );
+ //mTable.setSize( d );
+ mTable.setAutoscrolls(true);
+ mTable.sizeColumnsToFit(true);
+ mTable.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
+ //mTable.getSelectionModel().addListSelectionListener(new StandardListSelectionListener());
+ //mTable.addMouseListener(this);
+ //mTable.setPreferredScrollableViewportSize(d);
+ setLabelCellRenderer(mTable,0);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ gbc.weightx = 1.0;
+ gb3.setConstraints(mScrollPane, gbc);
+ content.add(mScrollPane);
+
+ return content;
+ */
+ }
+
+ /*Set the first column's cellrender as label cell
+ protected void setLabelCellRenderer(JTable table, int index) {
+ table.getColumnModel().getColumn(index).setCellRenderer(new LabelCellRenderer(new JLabel()));
+ }
+ */
+
+ //=================================================
+ // RETRIEVE INFO FROM SERVER SIDE
+ //=================================================
+
+ //retrieve group information from the server
+ private void refresh() throws EAdminException {
+ mDataModel.removeAllElements();
+
+ NameValuePairs response;
+ try {
+ response = mConnection.search(DestDef.DEST_USER_ADMIN,
+ ScopeDef.SC_USERS,
+ new NameValuePairs());
+ } catch (EAdminException e) {
+ //display error dialog
+ CMSAdminUtil.showErrorDialog(mParentFrame, mResource,
+ e.getMessage(), CMSAdminUtil.ERROR_MESSAGE);
+ return;
+ }
+
+ //parse the data
+/*
+ Vector store = new Vector();
+ for (Enumeration e = response.getNames(); e.hasMoreElements() ;) {
+ String entry = ((String)e.nextElement()).trim();
+ if (mCurrentUsers.indexOf(entry)== -1)
+ store.addElement(entry);
+ }
+
+ String[] vals = new String[store.size()];
+ store.copyInto(vals);
+*/
+
+ String responseValue = response.get("userInfo");
+
+ StringTokenizer tokenizer = new StringTokenizer(responseValue, ";");
+ StringTokenizer subTokenizer = null;
+
+ Vector store = new Vector();
+ Hashtable table = new Hashtable();
+
+ while (tokenizer.hasMoreTokens()) {
+ String t = (String)tokenizer.nextToken();
+ subTokenizer = new StringTokenizer(t, ":");
+ int i=0;
+ String str1 = null;
+ String str2 = null;
+ while (subTokenizer.hasMoreTokens()) {
+ if (i == 0) {
+ str1 = (String)subTokenizer.nextToken();
+ store.addElement(str1);
+ } else {
+ str2 = (String)subTokenizer.nextToken();
+ table.put(str1, str2);
+ }
+ i++;
+ }
+ }
+
+ String[] vals = new String[store.size()];
+ store.copyInto(vals);
+
+ CMSAdminUtil.bubbleSort(vals);
+
+ for (int y=0; y< vals.length ; y++) {
+ mDataModel.addElement(new JLabel(vals[y],
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_USER),
+ JLabel.LEFT));
+ }
+
+ refreshTable();
+ }
+
+ //refresh the table content
+ private void refreshTable() {
+ //mTable.invalidate();
+ //mTable.validate();
+ //mTable.repaint(1);
+ //mScrollPane.invalidate();
+ //mScrollPane.validate();
+ //mScrollPane.repaint(1);
+ //repaint();
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/ug/UserTab.java b/base/console/src/com/netscape/admin/certsrv/ug/UserTab.java
new file mode 100644
index 000000000..78b7e5252
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/ug/UserTab.java
@@ -0,0 +1,374 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.ug;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+import com.netscape.management.client.util.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * User Tab - this UI component provides the user
+ * management functionality of the certificate server.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ *
+ * @see com.netscape.admin.certsrv.ug.CertImportDialog
+ * @see com.netscape.admin.certsrv.ug.CertManagementDialog
+ * @see com.netscape.admin.certsrv.ug.CertViewDialog
+ * @see com.netscape.admin.certsrv.ug.UserEditor
+ */
+public class UserTab extends CMSBaseUGTab {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PANEL_NAME = "USERTAB";
+ private AdminConnection mConnection;
+
+ protected JScrollPane mScrollPane;
+ protected JTable mTable; //table
+ protected UserDataModel mDataModel; //table model
+ protected UserEditor mEditor=null; //keep single copy
+ protected UserEditor mAddEditor=null; //keep single copy
+ protected CertManagementDialog mCertEditor=null; //single copy
+ protected JButton mRefresh, mEdit, mAdd, mDelete, mHelp, mCert;
+ private final static String HELPINDEX = "usersgroups-certsrv-users-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public UserTab(CMSBaseResourceModel model) {
+ super(PANEL_NAME, model);
+ mConnection = model.getServerInfo().getAdmin();
+ mDataModel = new UserDataModel();
+ mHelpToken = HELPINDEX;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * refresh the content of the tab
+ * IRefreshTab menthod
+ */
+ public void refresh() {
+ //Debug.println("refresh() user tab");
+
+ mDataModel.removeAllRows();
+ updateUser();
+ setButtons();
+ mTable.invalidate();
+ mTable.validate();
+ mScrollPane.invalidate();
+ mScrollPane.validate();
+ mScrollPane.repaint(1);
+ }
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mRefresh)) {
+ Debug.println("Refresh User");
+ refresh();
+ } else if (e.getSource().equals(mEdit)) {
+ if(mTable.getSelectedRow()< 0)
+ return;
+
+ Debug.println("Edit User");
+ String userName = (String)
+ mDataModel.getObjectValueAt(mTable.getSelectedRow());
+
+ mAddEditor = new UserEditor(mModel.getFrame(), mConnection,
+ false);
+ mAddEditor.showDialog(userName);
+ mAddEditor.dispose();
+ refresh();
+ } else if (e.getSource().equals(mAdd)) {
+ mAddEditor = new UserEditor(mModel.getFrame(), mConnection, true);
+ mAddEditor.showDialog("");
+ if (mAddEditor.isUserAdded())
+ refresh();
+ mAddEditor.dispose();
+ } else if (e.getSource().equals(mDelete)) {
+ Debug.println("Delete User");
+ if(mTable.getSelectedRow()< 0)
+ return;
+ int i = showConfirmDialog("DELETE");
+ if (i == JOptionPane.YES_OPTION) {
+ deleteUser();
+ Debug.println("User Deleted");
+ }
+ } else if (e.getSource().equals(mHelp)) {
+ helpCallback();
+ } else if (e.getSource().equals(mCert)) {
+ String userName = (String)
+ mDataModel.getObjectValueAt(mTable.getSelectedRow());
+ if (mCertEditor==null)
+ mCertEditor = new CertManagementDialog(mModel.getFrame(), mConnection);
+ mCertEditor.showDialog(userName);
+ Debug.println("Cert");
+ //refresh();
+ //XXX HELP
+ }
+ }
+
+ //==== MOUSELISTENER ======================
+ public void mouseClicked(MouseEvent e) {
+ //Debug.println("CertRepositoryPanel: mouseClicked() -"+e.toString());
+ setButtons();
+
+ //we track the double click action on the table entry - View op
+ if(mTable.getSelectedRow() >= 0) {
+ if(e.getClickCount() == 2) {
+ Debug.println("Edit User");
+ //editUser();
+ }
+ }
+ }
+
+ public void mouseReleased(MouseEvent e) {
+ setButtons();
+ }
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+
+ /**
+ * create the user action button panel
+ */
+ protected JPanel createUserButtonPanel() {
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mEdit = makeJButton("EDIT");
+ mAdd = makeJButton("ADD");
+ mDelete = makeJButton("DELETE");
+ mCert = makeJButton("CERT");
+ JButton[] buttons = {mAdd, mDelete, mEdit, mCert};
+ JButtonFactory.resize( buttons );
+ return CMSAdminUtil.makeJButtonVPanel( buttons );
+ }
+
+ protected JPanel createActionPanel() {
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+ mRefresh = makeJButton("REFRESH");
+ mHelp = makeJButton("HELP");
+ //JButton[] buttons = { mRefresh, mHelp };
+ JButton[] buttons = { mRefresh };
+ return makeJButtonPanel( buttons, true);
+ }
+
+ protected JPanel createListPanel() {
+ mListPanel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mListPanel.setLayout(gb);
+
+ //center table
+ mTable = new JTable(mDataModel);
+ mScrollPane = JTable.createScrollPaneForTable(mTable);
+ //mScrollPane.setBorder(CMSAdminUtil.makeTitledBorder(mResource,PANEL_NAME,"USERS"));
+ mScrollPane.setHorizontalScrollBarPolicy(mScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ mScrollPane.setVerticalScrollBarPolicy(mScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ mTable.setAutoscrolls(true);
+ mTable.sizeColumnsToFit(true);
+ mTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ mTable.getSelectionModel().addListSelectionListener(this);
+ mTable.addMouseListener(this);
+ mScrollPane.setBackground(Color.white);
+ setLabelCellRenderer(mTable,0);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = 1;
+ gbc.weightx = 1.0;
+ gbc.insets = EMPTY_INSETS;
+ gb.setConstraints(mScrollPane, gbc);
+ mListPanel.add(mScrollPane);
+
+ JPanel buttonPanel = createUserButtonPanel();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 0.0;
+ gbc.weighty = 1.0;
+ gbc.insets = EMPTY_INSETS;
+ gb.setConstraints(buttonPanel, gbc);
+ mListPanel.add(buttonPanel);
+
+ refresh();
+
+ return mListPanel;
+ }
+
+ //Set the first column's cellrender as label cell
+ protected void setLabelCellRenderer(JTable table, int index) {
+ table.getColumnModel().getColumn(index).setCellRenderer(new LabelCellRenderer(new JLabel()));
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+
+ /**
+ * set buttons - proactive verification
+ */
+ private void setButtons() {
+
+ //enable and diable buttons accordingly
+ if (mTable.getSelectionModel().isSelectionEmpty()) {
+ mDelete.setEnabled(false);
+ mEdit.setEnabled(false);
+ mCert.setEnabled(false);
+ return;
+ }
+
+ if(mDataModel.getRowCount()< 0) {
+ mDelete.setEnabled(false);
+ mEdit.setEnabled(false);
+ mCert.setEnabled(false);
+ return;
+ }
+
+ mDelete.setEnabled(true);
+ mEdit.setEnabled(true);
+ mCert.setEnabled(true);
+
+ }
+
+ //=============================================
+ // SEND REQUESTS TO THE SERVER SIDE
+ //=============================================
+
+ private void updateUser() {
+ //send request and parse data
+
+ NameValuePairs response;
+ mModel.progressStart();
+
+ try {
+ response = mConnection.search(DestDef.DEST_USER_ADMIN,
+ ScopeDef.SC_USERS,
+ new NameValuePairs());
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ mModel.progressStop();
+ return;
+ }
+
+ Debug.println(response.toString());
+
+ String responseValue = response.get("userInfo");
+
+ StringTokenizer tokenizer = new StringTokenizer(responseValue, ";");
+ StringTokenizer subTokenizer = null;
+
+ Vector store = new Vector();
+ Hashtable table = new Hashtable();
+
+ while (tokenizer.hasMoreTokens()) {
+ String t = (String)tokenizer.nextToken();
+ subTokenizer = new StringTokenizer(t, ":");
+ int i=0;
+ String str1 = null;
+ String str2 = null;
+ while (subTokenizer.hasMoreTokens()) {
+ if (i == 0) {
+ str1 = (String)subTokenizer.nextToken();
+ store.addElement(str1);
+ } else {
+ str2 = (String)subTokenizer.nextToken();
+ table.put(str1, str2);
+ }
+ i++;
+ }
+ }
+
+ String[] names = new String[store.size()];
+ store.copyInto(names);
+
+ if (names.length > 1) {
+ names = CMSAdminUtil.randomize(names);
+ CMSAdminUtil.quickSort(names, 0, names.length-1);
+ }
+
+ for (int y=0; y< names.length ; y++) {
+ String s = (String)table.get(names[y]);
+ mDataModel.processData(names[y], s);
+ }
+
+ if (mDataModel.getRowCount() >0)
+ mTable.setRowSelectionInterval(0,0);
+
+ mModel.progressStop();
+ }
+
+ private void deleteUser() {
+ //get entry name
+ String userName = (String)
+ mDataModel.getObjectValueAt(mTable.getSelectedRow());
+
+ mModel.progressStart();
+ //send comment to server for the removal of user
+ try {
+ mConnection.delete(DestDef.DEST_USER_ADMIN,
+ ScopeDef.SC_USERS,
+ userName);
+ } catch (EAdminException e) {
+ String str = e.toString();
+
+ if (str.indexOf("The user") == 0) {
+ int i =
+ JOptionPane.showConfirmDialog(new JFrame(), str,
+ "Information", JOptionPane.YES_NO_OPTION,
+ JOptionPane.INFORMATION_MESSAGE,
+ CMSAdminUtil.getImage(CMSAdminResources.IMAGE_INFO_ICON));
+ if (i == JOptionPane.YES_OPTION) {
+ Debug.println("User Deleted");
+ try {
+ mConnection.delete(DestDef.DEST_USER_ADMIN,
+ ScopeDef.SC_USERS,
+ userName+":true");
+ } catch (EAdminException ee) {
+ showErrorDialog(ee.getMessage());
+ }
+ }
+ }
+ }
+
+ mModel.progressStop();
+ //send comment to server and refetch the content
+ refresh();
+ }
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/wizard/ConfigServlet.java b/base/console/src/com/netscape/admin/certsrv/wizard/ConfigServlet.java
new file mode 100644
index 000000000..5ed3195b9
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/wizard/ConfigServlet.java
@@ -0,0 +1,24 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.wizard;
+
+import java.net.*;
+
+public interface ConfigServlet {
+ public boolean send(String s, WizardInfo wizardInfo);
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/wizard/IWizardDone.java b/base/console/src/com/netscape/admin/certsrv/wizard/IWizardDone.java
new file mode 100644
index 000000000..5576278c4
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/wizard/IWizardDone.java
@@ -0,0 +1,28 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.wizard;
+
+import javax.swing.*;
+
+public interface IWizardDone {
+
+ /**
+ * Called by WizardWidget when all panels are executed.
+ */
+ public void notify(WizardWidget w);
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/wizard/IWizardPanel.java b/base/console/src/com/netscape/admin/certsrv/wizard/IWizardPanel.java
new file mode 100644
index 000000000..1b729b70f
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/wizard/IWizardPanel.java
@@ -0,0 +1,98 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.wizard;
+
+import javax.swing.*;
+
+/**
+ * Interface for WizardWidget delegation.<p>
+ * The methods will be call in the following order: <br>
+ * <pre>
+ * initialize(WizardInfo);
+ * validate();
+ * conclude(WizardInfo);
+ * getUpdateInfo(WizardInfo);
+ * </pre>
+ * For example, you can assume the WizardPanel is validated already
+ * when getUpdateInfo() is called.<p>
+ * REMEMBER TO SET THE ERROR WHEN ERROR OCCURRED!<p>
+ *
+ * @author jpanchen
+ * @version %I%, %G%
+ * @date 12/02/97
+ * @see com.netscape.admin.certsrv.wizard
+ */
+public interface IWizardPanel {
+
+ /**
+ * Initialize the panel. Data are passed in
+ * as WinzardInfo. Class implements this interface is responsible
+ * for maintaining the state information. Usually, you just
+ * need to have a dummy function if you are not using
+ * information provided by the previous screen to config/generate
+ * this screen. If error occurred, return false and set error
+ * message to be retrieved by getErrorMessage().
+ * @return true if ok; otherwise, false.
+ */
+ public abstract boolean initializePanel(WizardInfo info);
+
+ /**
+ * Verify the panel. The implementation should check for
+ * errors at this time. If error found, return false, and
+ * set error message to be retrieved by getErrorMessage().
+ * @return true if ok; otherwise, false.
+ */
+ public abstract boolean validatePanel();
+
+ /**
+ * Performs post processing. This function is call after
+ * the panel is verified.
+ * Ususally the LAST IWizardPanel use this method to perform
+ * save/update operation on the server via cgi/rmi/ldap.
+ * Similar to validate(), if error found, return false and
+ * set error message to be retrieved by getErrorMessage().
+ * @return true if ok; otherwise, false.
+ */
+ public abstract boolean concludePanel(WizardInfo info);
+
+ /**
+ * Save panel information into the WizardInfo to be passed
+ * on to the next screen.
+ */
+ public abstract void getUpdateInfo(WizardInfo info);
+
+ /**
+ * Error Message delegation. This method should return
+ * an I18N supported string detailing the error.
+ * @return string represenation of error
+ */
+ public abstract String getErrorMessage();
+
+ /**
+ * Display Help for this page
+ */
+ public abstract void callHelp();
+
+ /**
+ * Get title for this page
+ */
+ public abstract String getTitle();
+
+ public boolean isLastPage();
+
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/wizard/WizardBasePanel.java b/base/console/src/com/netscape/admin/certsrv/wizard/WizardBasePanel.java
new file mode 100644
index 000000000..c31767d99
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/wizard/WizardBasePanel.java
@@ -0,0 +1,290 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.wizard;
+
+import java.awt.*;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseMotionListener;
+import java.util.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.management.client.util.*;
+import javax.swing.border.*;
+import java.net.*;
+import java.io.*;
+
+/**
+ * Wizard Base Panel
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class WizardBasePanel extends CMSBasePanel implements MouseMotionListener,
+ ConfigServlet {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ protected String mTitle;
+ protected String mErrorString;
+ protected String mNextString =
+ mResource.getString("GENERALWIZARD_LABEL_NEXT_LABEL");
+ protected String mPanelName;
+ public static long mSeed;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public WizardBasePanel(String name) {
+ super(name);
+ mTitle = mResource.getString(name+"_TITLE");
+ mPanelName = name;
+ addMouseMotionListener(this);
+ }
+
+ public WizardBasePanel(String name, ResourceBundle rb) {
+ super(name, rb);
+ mPanelName = name;
+ try {
+ mTitle = mResource.getString(name+"_TITLE");
+ } catch (MissingResourceException e) {
+ mTitle = "Missing Title";
+ }
+ addMouseMotionListener(this);
+ }
+
+ protected void init() {
+
+/*
+ GridBagConstraints gbc = new GridBagConstraints();
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.SOUTHWEST;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ JLabel nextLabel = new JLabel(mNextString);
+ add(nextLabel, gbc);
+
+ setBorder(makeTitledBorder(mPanelName));
+*/
+ }
+
+ protected JTextArea createTextArea(String str, int row, int col) {
+ JTextArea desc = new JTextArea(str, row, col);
+ desc.setBackground(getBackground());
+ desc.setEditable(false);
+ desc.setCaretColor(getBackground());
+
+ return desc;
+ }
+
+ protected JTextArea createTextArea(String str) {
+ JTextArea desc = new JTextArea(str);
+ desc.setBackground(getBackground());
+ desc.setEditable(false);
+ desc.setCaretColor(getBackground());
+ desc.setLineWrap(true);
+ desc.setWrapStyleWord(true);
+
+ return desc;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ /**
+ * Returns the title of the tab
+ * @return string representation of the title
+ */
+ public String getTitle() {
+ return mTitle;
+ }
+
+ /**
+ * Returns the error string
+ */
+ public String getErrorMessage() {
+ return mErrorString;
+ }
+
+ /**
+ * Set error string
+ */
+ public void setErrorMessage(String keyword) {
+ try {
+ String err = mResource.getString(mPanelName+"_DIALOG_"+keyword+"_MESSAGE");
+ mErrorString = err;
+ } catch (MissingResourceException e) {
+ mErrorString = keyword;
+ }
+ }
+
+ public void cleanUpWizardInfo(WizardInfo wizardInfo) {
+ wizardInfo.remove("NMC_WARNINFO");
+ wizardInfo.remove("NMC_ERRINFO");
+ wizardInfo.remove("NMC_STATUS");
+ }
+
+ public String getErrorMessage(WizardInfo wizardInfo) {
+ String value = (String)wizardInfo.get("NMC_ERRINFO");
+ if (value != null || value.trim().length() == 0)
+ return value;
+ value = (String)wizardInfo.get("NMC_WARNINFO");
+ if (value != null || value.trim().length() == 0)
+ return value;
+
+ return null;
+ }
+
+ public boolean send(String host, int port, String servlet, String rawData,
+ WizardInfo wizardInfo) {
+ try {
+ Socket socket = new Socket(host, port);
+ DataOutputStream dos = new DataOutputStream(socket.getOutputStream());
+ InputStream is = socket.getInputStream();
+ String spost = "POST "+servlet+" HTTP/1.0\r\n";
+ byte[] b = rawData.getBytes();
+ dos.writeBytes(spost);
+ dos.writeBytes("User-Agent: HTTPTool/1.0\r\n");
+ dos.writeBytes("Content-length: " + b.length + "\r\n");
+ dos.writeBytes("Content-Type: application/x-www-form-urlencoded\r\n");
+ dos.writeBytes("\r\n");
+ dos.write(b);
+ dos.writeBytes("\r\n");
+ dos.flush();
+
+ ByteArrayOutputStream bstream = new ByteArrayOutputStream(10000);
+ while (true)
+ {
+ int r = is.read();
+ if (r == -1)
+ break;
+ bstream.write(r);
+ }
+
+ socket.close();
+ String test = bstream.toString();
+
+ StringTokenizer tokenizer = new StringTokenizer(test, "\r\n");
+ while (tokenizer.hasMoreTokens()) {
+ String nvalue = tokenizer.nextToken();
+ System.out.println("tokenizer="+nvalue);
+ StringTokenizer tokenizer1 = new StringTokenizer(nvalue, ":");
+ int numTokens = tokenizer1.countTokens();
+ if (numTokens == 2) {
+ String name = tokenizer1.nextToken().trim();
+ String value = tokenizer1.nextToken().trim();
+ wizardInfo.put(name, value);
+ }
+ }
+ bstream.close();
+ String sendStatus = (String)wizardInfo.get("NMC_STATUS");
+ if (sendStatus.equals("0")) {
+ return true;
+ } else {
+ return false;
+ }
+ } catch (Exception e) {
+ }
+
+ return false;
+ }
+
+ public boolean send(String rawData, WizardInfo wizardInfo) {
+ try {
+ Socket socket = new Socket("droopy-linux.sfbay.redhat.com", 1924);
+ DataOutputStream dos = new DataOutputStream(socket.getOutputStream());
+ InputStream is = socket.getInputStream();
+ String servlet = "/config/configSubsystem";
+ String spost = "POST "+servlet+" HTTP/1.0\r\n";
+ byte[] b = rawData.getBytes();
+ dos.writeBytes(spost);
+ dos.writeBytes("User-Agent: HTTPTool/1.0\r\n");
+ dos.writeBytes("Content-length: " + b.length + "\r\n");
+ dos.writeBytes("Content-Type: application/x-www-form-urlencoded\r\n");
+ dos.writeBytes("\r\n");
+ dos.write(b);
+ dos.writeBytes("\r\n");
+ dos.flush();
+
+ ByteArrayOutputStream bstream = new ByteArrayOutputStream(10000);
+ while (true)
+ {
+ int r = is.read();
+ if (r == -1)
+ break;
+ bstream.write(r);
+ }
+
+ socket.close();
+ String test = bstream.toString();
+
+ StringTokenizer tokenizer = new StringTokenizer(test, "\r\n");
+ while (tokenizer.hasMoreTokens()) {
+ String nvalue = tokenizer.nextToken();
+ System.out.println("tokenizer="+nvalue);
+ StringTokenizer tokenizer1 = new StringTokenizer(nvalue, ":");
+ int numTokens = tokenizer1.countTokens();
+ if (numTokens == 2) {
+ String name = tokenizer1.nextToken().trim();
+ String value = tokenizer1.nextToken().trim();
+ wizardInfo.put(name, value);
+ }
+ }
+ bstream.close();
+ String sendStatus = (String)wizardInfo.get("NMC_STATUS");
+ if (sendStatus.equals("0")) {
+ return true;
+ } else {
+ return false;
+ }
+ } catch (Exception e) {
+ }
+
+ return false;
+ }
+
+ /*==========================================================
+ * EVENT HANDLER METHODS
+ *==========================================================*/
+
+ /*
+ * mouselistener events - for JPanel
+ */
+
+ /**
+ * This lets us know when someone move the mouse, so we can
+ * keep coordidate of mouse posion and use this value as a random seed
+ */
+ public void mouseDragged(MouseEvent e) {
+ // Do nothing for this
+ }
+
+ public void mouseMoved(MouseEvent e) {
+ // Keep tracking coordinate values
+ long x = e.getX();
+ long y = e.getY();
+
+ long top = mSeed >> 62;
+ mSeed = ((mSeed << 2) ^ top ^ (x<<8) ^ (y)) % Long.MAX_VALUE;
+ }
+}
diff --git a/base/console/src/com/netscape/admin/certsrv/wizard/WizardInfo.java b/base/console/src/com/netscape/admin/certsrv/wizard/WizardInfo.java
new file mode 100644
index 000000000..5085d43b4
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/wizard/WizardInfo.java
@@ -0,0 +1,88 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.wizard;
+
+import javax.swing.*;
+import java.util.Properties;
+
+/**
+ * Wizard Data Container
+ */
+public class WizardInfo extends Properties {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ protected JButton mBNext_Done, mBCancel, mBBack;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public WizardInfo() {
+ super();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public void addEntry(String name, Object entry) {
+ put(name, entry);
+ }
+
+ public Object getEntry(String name) {
+ return get(name);
+ }
+
+ /**
+ * access method to NEXT-DONE function buttons
+ */
+ public JButton getNextDoneButton() {
+ return mBNext_Done;
+ }
+
+ /**
+ * access method to CANCEL function buttons
+ */
+ public JButton getCancelButton() {
+ return mBCancel;
+ }
+
+ /**
+ * access method to BACK function buttons
+ */
+ public JButton getBackButton() {
+ return mBBack;
+ }
+
+ /*==========================================================
+ * package methods
+ *==========================================================*/
+
+ /**
+ * set function buttons. Called by the WizardWidget to set the
+ * button reference.
+ */
+ void setButtons(JButton next, JButton cancel, JButton back ) {
+ mBNext_Done = next;
+ mBCancel = cancel;
+ mBBack = back;
+ }
+}
+
+
+
diff --git a/base/console/src/com/netscape/admin/certsrv/wizard/WizardWidget.java b/base/console/src/com/netscape/admin/certsrv/wizard/WizardWidget.java
new file mode 100644
index 000000000..c98d37b51
--- /dev/null
+++ b/base/console/src/com/netscape/admin/certsrv/wizard/WizardWidget.java
@@ -0,0 +1,428 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.wizard;
+
+import java.util.*;
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.*;
+import com.netscape.admin.certsrv.config.install.*;
+import com.netscape.admin.certsrv.task.*;
+import com.netscape.management.client.console.*;
+
+/**
+ * WizardWidget provides the most fundamental functionalities
+ * of an wizard widget.
+ *
+ * @author jpanchen
+ * @version %I%, %G%
+ * @date 12/02/97
+ * @see com.netscape.admin.certsrv.wizard
+ */
+public class WizardWidget extends JDialog implements ActionListener
+{
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static final String PANELNAME = "WIZARD";
+ //static final Dimension DEFAULT_SIZE = new Dimension(460,520);
+ static final Dimension DEFAULT_SIZE = new Dimension(480,600);
+ static final Dimension BUTTON_MIN_SIZE = new Dimension(100,30);
+ static final int STRUT_SIZE = 10;
+
+ //private variables
+ private JButton mBNext_Done, mBCancel, mBBack, mBHelp;
+ private Stack mPrevScreen = new Stack();
+ private Stack mNextScreen = new Stack();
+ protected JPanel mCurrent = null;
+ protected JPanel mDisplay;
+ private String mDoneLabel, mNextLabel;
+
+ protected ResourceBundle mResource;
+ private WizardInfo mInfo;
+ private JFrame mParent;
+ private Dimension mSize;
+ private IWizardDone mWizDone;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+
+ /**
+ * Construct Wizard with specified title and parent frame.
+ * @param parent parent frame
+ * @param title string to be displayed on the dialog box title bar
+ * @param size specify wizard size
+ */
+ public WizardWidget(JFrame parent, Dimension size, IWizardDone wizDone) {
+ this(parent, wizDone);
+ mSize = size;
+ setSize(size.width, size.height);
+ }
+
+ /**
+ * Construct Wizard with specified title and parent frame.
+ * @param parent parent frame
+ * @title string to be displayed on the dialog box title bar
+ */
+ public WizardWidget(JFrame parent) {
+ this(parent, null);
+ }
+
+ public WizardWidget(JFrame parent, IWizardDone wizDone) {
+ //super(parent, title, true); XXX JDK 1.1.4 Bug
+ super(parent, true);
+ mSize = DEFAULT_SIZE;
+ mParent = parent;
+ getContentPane().setLayout(new BorderLayout());
+ setSize(mSize.width, mSize.height);
+ getRootPane().setDoubleBuffered(true);
+ setLocationRelativeTo(parent);
+ mInfo = new WizardInfo();
+ mWizDone = wizDone;
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+
+ mNextLabel = mResource.getString(CMSAdminResources.GENERAL_NEXT);
+ mDoneLabel = mResource.getString(CMSAdminResources.GENERAL_DONE);
+
+ //create display panel
+ mDisplay = new JPanel();
+ mDisplay.setLayout(new BorderLayout());
+ mDisplay.setBorder(new EmptyBorder(CMSAdminUtil.DIFFERENT_COMPONENT_SPACE,
+ CMSAdminUtil.DIFFERENT_COMPONENT_SPACE,
+ 0,CMSAdminUtil.DIFFERENT_COMPONENT_SPACE));
+/*
+ mDisplay.setBorder(new CompoundBorder(
+ new EmptyBorder(CMSAdminUtil.DIFFERENT_COMPONENT_SPACE,
+ CMSAdminUtil.DIFFERENT_COMPONENT_SPACE,
+ 0,CMSAdminUtil.DIFFERENT_COMPONENT_SPACE),
+ BorderFactory.createEtchedBorder()));
+*/
+ getContentPane().add("Center",mDisplay);
+
+ //create button panel
+
+ //buttonPanel.add(Box.createGlue());
+ getContentPane().add("South", createActionPanel());
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * get parent frame
+ * @return parent frame
+ */
+ public JFrame getFrame() {
+ return mParent;
+ }
+
+ /**
+ * Add a IWizardPanel into wizard. Note the sequence you add
+ * will the be the sequence it will appear.
+ * @param page IWizardPanel to be displayed
+ */
+ public void addPage(JPanel page) {
+ if (mCurrent == null) {
+ mCurrent = page;
+ mDisplay.add("Center",page);
+ initializeWizardPanel();
+ } else {
+ mNextScreen.insertElementAt(page, 0);
+ }
+ }
+
+ /**
+ * Action Performed when button pressed. ActionListener implementation.
+ * @param event
+ */
+ public void actionPerformed(ActionEvent e) {
+
+ //DONE or NEXT Pressed
+ if (e.getSource().equals(mBNext_Done)) {
+
+ if (!validateWizardPanel()) {
+ return;
+ }
+
+ if (concludeWizardPanel()) {
+
+ if (mNextScreen.empty() || mBNext_Done.getText().equals("Done")) {
+ //killDaemon();
+ this.dispose();
+ if (mWizDone != null) {
+ mWizDone.notify(this);
+ }
+ return;
+ } else {
+ updateWizardInfo();
+ mPrevScreen.push(mCurrent);
+ mDisplay.remove(mCurrent);
+ mCurrent = (JPanel)(mNextScreen.pop());
+ while (!initializeWizardPanel()) {
+ //move to next
+ if (mNextScreen.empty()) {
+ this.dispose();
+ return;
+ }
+ mPrevScreen.push(mCurrent);
+ mCurrent = (JPanel)(mNextScreen.pop());
+ }
+ mDisplay.add("Center",mCurrent);
+ mDisplay.invalidate();
+ mDisplay.validate();
+ mDisplay.repaint(1);
+ getRootPane().paintImmediately(getRootPane().getVisibleRect());
+ }
+
+ } else {
+ return;
+ }
+ }
+
+ //Cancel Pressed
+ if (e.getSource().equals(mBCancel)) {
+ //prompt for confirm
+ int option = CMSAdminUtil.showConfirmDialog(mParent, mResource,
+ PANELNAME, "EXIT",
+ JOptionPane.YES_NO_OPTION);
+ if (option == JOptionPane.YES_OPTION) {
+ //killDaemon();
+ this.dispose();
+ }
+ }
+
+ //Back Pressed
+ if (e.getSource().equals(mBBack)) {
+ back_cb(mInfo);
+ //move back to previous page
+ if (!(mPrevScreen.empty())) {
+ mNextScreen.push(mCurrent);
+ mDisplay.remove(mCurrent);
+ mCurrent = (JPanel)(mPrevScreen.pop());
+ while (!initializeWizardPanel()) {
+ //move to prev
+ if (mPrevScreen.empty()) {
+ return;
+ }
+ mNextScreen.push(mCurrent);
+ mCurrent = (JPanel)(mPrevScreen.pop());
+ }
+ mDisplay.add("Center",mCurrent);
+ mDisplay.invalidate();
+ mDisplay.validate();
+ mDisplay.repaint(1);
+ getRootPane().paintImmediately(getRootPane().getVisibleRect());
+ }
+ }
+
+ //Help Pressed
+ if (e.getSource().equals(mBHelp)) {
+ callHelp();
+ }
+
+ changeButton();
+ }
+
+ /**
+ * This method is only for installation wizard.
+ */
+/*
+ private void killDaemon() {
+ if (mInfo instanceof InstallWizardInfo) {
+ InstallWizardInfo wizardInfo = (InstallWizardInfo)mInfo;
+ ConsoleInfo consoleInfo = wizardInfo.getAdminConsoleInfo();
+ CMSConfigCert configCertCgi = new CMSConfigCert();
+ configCertCgi.initialize(wizardInfo);
+ Hashtable data = new Hashtable();
+ data.put(ConfigConstants.TASKID, TaskId.TASK_EXIT);
+ data.put(ConfigConstants.OPTYPE, OpDef.OP_MODIFY);
+ data.put(ConfigConstants.PR_CERT_INSTANCE_NAME,
+ consoleInfo.get(ConfigConstants.PR_CERT_INSTANCE_NAME));
+ data.put(ConfigConstants.PR_SERVER_ROOT,
+ consoleInfo.get(ConfigConstants.PR_SERVER_ROOT));
+ boolean ready = configCertCgi.configCert(data);
+ data.clear();
+ data = null;
+ }
+ }
+*/
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+
+ protected JPanel createActionPanel() {
+ //edit, add, delete, help buttons required
+ //actionlister to this object
+
+ mBBack = new JButton();
+ mBBack.setText(mResource.getString(CMSAdminResources.GENERAL_BACK));
+ mBBack.addActionListener(this);
+ mBBack.setEnabled(false);
+
+ mBNext_Done = new JButton();
+ mBNext_Done.setText(mNextLabel);
+ mBNext_Done.addActionListener(this);
+
+ mBCancel = new JButton();
+ mBCancel.setText(mResource.getString(CMSAdminResources.GENERAL_CANCEL));
+ mBCancel.addActionListener(this);
+
+ mBHelp = new JButton();
+ mBHelp.setText(mResource.getString(CMSAdminResources.GENERAL_HELP));
+ mBHelp.addActionListener(this);
+
+ //JButton[] buttons = {mBBack, mBNext_Done, mBCancel, mBHelp };
+ JButton[] buttons = {mBBack, mBNext_Done, mBCancel};
+
+ //pass the buttons reference to wizardinfo
+ mInfo.setButtons(mBNext_Done, mBCancel, mBBack);
+
+ return CMSAdminUtil.makeJButtonPanel( buttons, true);
+ }
+
+
+ /**
+ * Returns wizard data container
+ */
+ protected WizardInfo getWizardInfo() {
+ return mInfo;
+ }
+
+ /**
+ * set wizard data container
+ */
+ protected void setWizardInfo(WizardInfo info) {
+ mInfo = info;
+ }
+
+ /**
+ * Initialize currently displayed panel
+ * Implemetation is delegated to initialize() method
+ * of IWizardPanel. It retruns false, if the panel is
+ * to be skipped.
+ */
+ protected boolean initializeWizardPanel() {
+
+ if (mCurrent instanceof IWizardPanel) {
+ boolean status = ((IWizardPanel)mCurrent).initializePanel(mInfo);
+ setTitle( ((IWizardPanel)mCurrent).getTitle() );
+ return status;
+ }
+ return true;
+ }
+
+ /**
+ * Verify if a page is complete. It means all the
+ * require fields are fill out. It delegates implementation
+ * details to validate() method of the IWizardPanel obejct.
+ * If failed, error dialog is displayed but not terminated.
+ */
+ boolean validateWizardPanel() {
+ boolean complete = true;
+
+ if (mCurrent instanceof IWizardPanel) {
+ if (!( (IWizardPanel)mCurrent ).validatePanel()) {
+ String msg = ((IWizardPanel)mCurrent).getErrorMessage();
+ if (msg != null && !msg.equals(""))
+ CMSAdminUtil.showErrorDialog(mParent, mResource, msg,
+ JOptionPane.ERROR_MESSAGE);
+ complete = false;
+ }
+ }
+
+ return complete;
+ }
+
+ /**
+ * Some panel may require post-processing before moving to next stage.
+ * Ususally the last IWizardPanel use this method to perform
+ * save/update operation on the server via cgi/rmi/ldap.
+ * If error occurred, wizard will be terminated.
+ */
+ boolean concludeWizardPanel() {
+ boolean complete = true;
+ if(mCurrent instanceof IWizardPanel) {
+ if (!((IWizardPanel)mCurrent).concludePanel(mInfo)) {
+ CMSAdminUtil.showErrorDialog(mParent, mResource,
+ ((IWizardPanel)mCurrent).getErrorMessage(),
+ JOptionPane.ERROR_MESSAGE);
+ complete = false;
+ }
+ }
+ return complete;
+ }
+
+ /**
+ * Retrieve the update information from the
+ * IWizardPanel into WizardInfo.
+ */
+ void updateWizardInfo() {
+ if(mCurrent instanceof IWizardPanel) {
+ ((IWizardPanel)mCurrent).getUpdateInfo(mInfo);
+ }
+ }
+
+ protected void callHelp() {
+ Debug.println("Overwrite this method");
+ }
+
+ protected void back_cb(WizardInfo info) {
+ Debug.println("Overwrite this method");
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+
+ /**
+ * Button enable/disable and label changes
+ */
+ private void changeButton() {
+
+ if (mPrevScreen.size()==0) {
+ mBBack.setEnabled(false);
+ mBBack.repaint();
+ } else {
+ mBBack.setEnabled(true);
+ mBBack.repaint();
+ }
+
+ boolean lastPage = ((IWizardPanel)mCurrent).isLastPage();
+ if ((mNextScreen.size()==0) || (lastPage)) {
+ mBNext_Done.setText(mDoneLabel);
+ mBCancel.setEnabled(false);
+ mBBack.setEnabled(false);
+ } else {
+ mBNext_Done.setText(mNextLabel);
+ mBCancel.setEnabled(true);
+ }
+ mBNext_Done.repaint();
+ mBCancel.repaint();
+ mBBack.repaint();
+ }
+}
+
+
diff --git a/base/console/src/com/netscape/certsrv/common/ConfigConstants.java b/base/console/src/com/netscape/certsrv/common/ConfigConstants.java
new file mode 100644
index 000000000..437974f13
--- /dev/null
+++ b/base/console/src/com/netscape/certsrv/common/ConfigConstants.java
@@ -0,0 +1,333 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.certsrv.common;
+
+
+/**
+ * Constants that are used by daemon and UI configuration.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ */
+public interface ConfigConstants {
+ public static final String TRUE = "true";
+ public static final String FALSE = "false";
+ public static final String OPTYPE = "opType";
+ public static final String TASKID = "taskID";
+
+ // Stages
+ public static final String STAGES = "stages";
+ public static final String STAGE_CONNECT_DB = "stageConnectDB";
+ public static final String STAGE_INTERNAL_DB = "stageInternalDB";
+ public static final String STAGE_SETUP_PORTS = "stageSetupPorts";
+ public static final String STAGE_SETUP_ADMINISTRATOR = "stageSetupAdmin";
+ public static final String STAGE_SETUP_SUBSYSTEMS = "stageSubsystems";
+ public static final String STAGE_DATA_MIGRATION = "stageDataMigration";
+ public static final String STAGE_CA_SELFSIGNED_CERT = "stageCASelfSignedCert";
+ public static final String STAGE_CA_CERT_REQUEST = "stageCACertRequest";
+ public static final String STAGE_CA_CERT_INSTALL = "stageCACertInstall";
+ public static final String STAGE_RA_LOCAL_CERT = "stageRALocalCert";
+ public static final String STAGE_RA_CERT_REQUEST = "stageRACertRequest";
+ public static final String STAGE_RA_CERT_INSTALL = "stageRACertInstall";
+ public static final String STAGE_KRA_LOCAL_CERT = "stageKRALocalCert";
+ public static final String STAGE_KRA_CERT_REQUEST = "stageKRACertRequest";
+ public static final String STAGE_KRA_CERT_INSTALL = "stageKRACertInstall";
+ public static final String STAGE_SSL_LOCAL_CERT = "stageSSLLocalCert";
+ public static final String STAGE_SSL_CERT_REQUEST = "stageSSLCertRequest";
+ public static final String STAGE_SSL_CERT_INSTALL = "stageSSLCertInstall";
+ public static final String STAGE_OCSP_LOCAL_CERT = "stageOCSPLocalCert";
+ public static final String STAGE_OCSP_CERT_REQUEST = "stageOCSPCertRequest";
+ public static final String STAGE_OCSP_CERT_INSTALL = "stageOCSPCertInstall";
+ public static final String STAGE_CA_CERTCHAIN_IMPORT = "stageCACertChain";
+ public static final String STAGE_RA_CERTCHAIN_IMPORT = "stageRACertChain";
+ public static final String STAGE_OCSP_CERTCHAIN_IMPORT = "stageOCSPCertChain";
+ public static final String STAGE_KRA_CERTCHAIN_IMPORT = "stageKRACertChain";
+ public static final String STAGE_SSL_CERTCHAIN_IMPORT = "stageSSLCertChain";
+ public static final String STAGE_OCSP_SERVICE_ADDED = "stageOCSPService";
+ public static final String STAGE_CONFIG_WEBSERVER = "stageConfigWebserver";
+ public static final String STAGE_REPLICATION_AGREEMENT = "stageReplicationAgreement";
+ public static final String PR_ENABLE_REPLICATION = "enableReplication";
+
+ public static final String CA_CERT_REQUEST = "CACertRequest";
+ public static final String RA_CERT_REQUEST = "RACertRequest";
+ public static final String OCSP_CERT_REQUEST = "OCSPCertRequest";
+ public static final String KRA_CERT_REQUEST = "KRACertRequest";
+ public static final String SSL_CERT_REQUEST = "SSLCertRequest";
+ public static final String STAGE_CA_REQ_SUCCESS = "stageCAReqSuccess";
+ public static final String STAGE_RA_REQ_SUCCESS = "stageRAReqSuccess";
+ public static final String STAGE_KRA_REQ_SUCCESS = "stageKRAReqSuccess";
+ public static final String STAGE_SSL_REQ_SUCCESS = "stageSSLReqSuccess";
+ public static final String STAGE_OCSP_REQ_SUCCESS = "stageOCSPReqSuccess";
+
+ public static final String STAGE_KRA_NM_SCHEME = "stageKRANMScheme";
+ public static final String STAGE_CACLONING = "stageCACloning";
+ public static final String STAGE_RACLONING = "stageRACloning";
+ public static final String STAGE_KRACLONING = "stageKRACloning";
+ public static final String STAGE_SSLCLONING = "stageSSLCloning";
+ public static final String STAGE_OCSPCLONING = "stageOCSPCloning";
+ public static final String STAGE_TKSCLONING = "stageTKSCloning";
+ public static final String STAGE_CLONEMASTER = "stageCloneMaster";
+ public static final String STAGE_UPDATE_DB_INFO = "stageUpdateDBInfo";
+
+ public static final String CA_CERT_REQUEST_BACK = "CACertRequestBack";
+ public static final String RA_CERT_REQUEST_BACK = "RACertRequestBack";
+ public static final String OCSP_CERT_REQUEST_BACK = "OCSPCertRequestBack";
+ public static final String KRA_CERT_REQUEST_BACK = "KRACertRequestBack";
+ public static final String SSL_CERT_REQUEST_BACK = "SSLCertRequestBack";
+
+ // Error messages
+ public static final String PR_ERROR_MESSAGE = "errorMsg";
+
+ // Certificate server instance
+ public static final String PR_CERT_INSTANCE_NAME = "instanceID";
+
+ // Admin server info
+ public static final String PR_HOST = "host";
+ public static final String PR_LDAP_DB_NAME = "ldapServerDB";
+ public static final String PR_SERVER_ROOT = "serverRoot";
+ public static final String PR_SIE_URL = "sieURL";
+ public static final String PR_ADMIN_PASSWD = "AdminUserPassword";
+ public static final String PR_ADMIN_UID = "adminUID";
+ public static final String PR_ADMIN_DOMAIN = "adminDomain";
+ public static final String PR_MACHINE_NAME = "machineName";
+
+ public static final String PR_CA_OCSP_SERVICE = "CAOCSPService";
+
+ // Daemon
+ public static final String PR_DAEMON_PORT = "daemonPort";
+ public static final String PR_DELETE_PASSWD_CONF = "deletePasswdConf";
+
+ // Internal Database
+ public static final String PR_DB_SCHEMA = "db.schema";
+ public static final String PR_DB_MODE = "db.mode";
+ public static final String PR_DB_PORT = "internaldb.ldapconn.port";
+ public static final String PR_DB_HOST = "internaldb.ldapconn.host";
+ public static final String PR_DB_BINDDN = "internaldb.ldapauth.bindDN";
+ public static final String PR_DB_BINDPWD = "internaldb.ldapauth.bindPWPrompt";
+ public static final String PR_DB_PWD = "db.password";
+ public static final String PR_DB_LOCAL = "db.local";
+ public static final String PR_DB_NAME = "db.instanceName";
+ public static final String PR_CLONEDDB_NAME = "db.cloned.instanceName";
+ public static final String PR_IS_DBCREATED = "db.isCreated";
+ public static final String PR_IS_CLONEDDB_CREATED = "db.cloned.isCreated";
+ public static final String PR_NEXT_AVAIL_PORT = "nextAvailPort";
+
+ // Network Ports
+ public static final String PR_ENABLE = "enabled";
+ public static final String PR_EE_PORT = "eeGateway.http.port";
+ public static final String PR_EE_SECURE_PORT = "eeGateway.https.port";
+ public static final String PR_AGENT_PORT = "agentGateway.https.port";
+ public static final String PR_RADM_PORT = "radm.https.port";
+ public static final String PR_EE_PORT_ENABLE = "eeGateway.http.enable";
+ public static final String PR_EE_PORTS_ENABLE = "eePortsEnable";
+
+ // Certificate server administrator
+ public static final String PR_CERT_ADMINNAME = "cert.admin.name";
+ public static final String PR_CERT_ADMINUID = "cert.admin.uid";
+ public static final String PR_CERT_ADMINPASSWD = "cert.admin.passwd";
+
+ // Subsystems
+ public static final String PR_SUBSYSTEMS = "subsystems";
+ public static final String PR_CA = "ca";
+ public static final String PR_RA = "ra";
+ public static final String PR_KRA = "kra";
+ public static final String PR_TKS = "tks";
+ public static final String PR_OCSP = "ocsp";
+ public static final String CA_HOST = "caHostname";
+ public static final String CA_PORT = "caPortnum";
+ public static final String CA_TIMEOUT = "caTimeout";
+ public static final String KRA_HOST = "kraHostname";
+ public static final String KRA_PORT = "kraPortnum";
+ public static final String KRA_TIMEOUT = "kraTimeout";
+ public static final String REMOTE_KRA_ENABLED = "remoteKRA";
+
+ // Clone Master (CLA)
+ public static final String CLA_HOST = "claHostname";
+ public static final String CLA_PORT = "claPortnum";
+ public static final String CLA_PORT_EE = "claPortnumEE";
+ public static final String CLA_TIMEOUT = "claTimeout";
+ public static final String CLONE_CA = "cloning";
+ public static final String PR_CLONE_SETTING_DONE = "cloneSettingDone";
+
+ // Data Migration
+ public static final String PR_ENABLE_MIGRATION = "migrationEnable";
+ public static final String PR_OUTPUT_PATH = "outputPath";
+ public static final String PR_ADD_LDIF_PATH = "addLdifPath";
+ public static final String PR_MOD_LDIF_PATH = "modLdifPath";
+ public static final String PR_SIGNING_KEY_MIGRATION_TOKEN =
+ "signingKeyMigrationToken";
+ public static final String PR_SSL_KEY_MIGRATION_TOKEN =
+ "sslKeyMigrationToken";
+ public static final String PR_SIGNING_KEY_MIGRATION_TOKEN_PASSWD =
+ "signingKeyMigrationTokenPasswd";
+ public static final String PR_SIGNING_KEY_MIGRATION_TOKEN_SOPPASSWD =
+ "signingKeyMigrationTokenSOPPasswd";
+ public static final String PR_SSL_KEY_MIGRATION_TOKEN_PASSWD =
+ "sslKeyMigrationTokenPasswd";
+ public static final String PR_SSL_KEY_MIGRATION_TOKEN_SOPPASSWD =
+ "sslKeyMigrationTokenSOPPasswd";
+ public static final String PR_NUM_MIGRATION_WARNINGS =
+ "numMigrationWarnings";
+ public static final String PR_MIGRATION_WARNING = "migrationWarning";
+ public static final String PR_CA_KEY_TYPE = "caKeyType";
+ public static final String PR_LDAP_PASSWORD = "ldapPassword";
+ public static final String PR_MIGRATION_PASSWORD = "migrationPassword";
+
+ // Key and Cert
+ public static final String PR_HARDWARE_SPLIT = "hardwareSplit";
+ public static final String PR_TOKEN_LIST = "tokenList";
+ public static final String PR_TOKEN_NAME = "tokenName";
+ public static final String PR_SUBJECT_NAME = "subjectName";
+ public static final String PR_CA_SUBJECT_NAME = "caSubjectName";
+ public static final String PR_RA_SUBJECT_NAME = "raSubjectName";
+ public static final String PR_OCSP_SUBJECT_NAME = "ocspSubjectName";
+ public static final String PR_KRA_SUBJECT_NAME = "kraSubjectName";
+ public static final String PR_SSL_SUBJECT_NAME = "sslSubjectName";
+ public static final String PR_KEY_TYPE = "keyType";
+ public static final String PR_KEY_LENGTH = "keyLength";
+ public static final String PR_KEY_CURVENAME = "keyCurveName";
+ public static final String PR_CERT_REQUEST = "certReq";
+ public static final String PR_REQUEST_ID = "ReqID";
+ public static final String PR_REQUEST_FORMAT = "ReqFormat";
+ public static final String PR_REQUEST_PKCS10 = "PKCS10";
+ public static final String PR_REQUEST_CMC = "CMC";
+ public static final String PR_CERTIFICATE_TYPE = "certType";
+ public static final String PR_CACERT_LOCALCA = "ca_isLocalCA";
+ public static final String PR_RACERT_LOCALCA = "ra_isLocalCA";
+ public static final String PR_KRACERT_LOCALCA = "kra_isLocalCA";
+ public static final String PR_SSLCERT_LOCALCA = "ssl_isLocalCA";
+ public static final String PR_OCSPCERT_LOCALCA = "ocsp_isLocalCA";
+ public static final String PR_CERT_CONTENT_ORDER = "contentOrder";
+ public static final String PR_CERTIFICATE_EXTENSION = "certificateExtension";
+ public static final String CA_REQUEST_DISPLAYED = "caReqDisplayed";
+ public static final String RA_REQUEST_DISPLAYED = "raReqDisplayed";
+ public static final String OCSP_REQUEST_DISPLAYED = "ocspReqDisplayed";
+ public static final String KRA_REQUEST_DISPLAYED = "kraReqDisplayed";
+ public static final String SSL_REQUEST_DISPLAYED = "sslReqDisplayed";
+
+ // KRA Storage Key Generation
+ public static final String PR_KEY_LEN = "keyLength";
+ public static final String PR_KEY_ALG = "keyAlg";
+ public static final String PR_STORAGE_TOKEN_PWD = "storageTokenPwd";
+ public static final String PR_STORAGE_HARDWARE = "storageHardware";
+
+ // KRA Agents
+ public static final String PR_AGENT_N = "n";
+ public static final String PR_AGENT_M = "m";
+ public static final String PR_AGENT_UID = "uid";
+ public static final String PR_AGENT_PWD = "pwd";
+
+ // Token Info
+ public static final String PR_TOKEN_NAMES = "tokenNames";
+ public static final String PR_TOKEN_INITIALIZED = "tokenInitialized";
+ public static final String PR_TOKEN_LOGGED_IN = "tokenLoggedIn";
+ public static final String PR_TOKEN_PASSWD = "tokenPasswd";
+ public static final String PR_TOKEN_SOP = "sopPasswd";
+ public static final String PR_CLONE_SUBSYSTEM = "cloneSubsystem";
+ public static final String PR_CLONE_CA_TOKEN_NAME = "cloneCATokenName";
+ public static final String PR_CLONE_OCSP_TOKEN_NAME = "cloneOCSPTokenName";
+ public static final String PR_CLONE_RA_TOKEN_NAME = "cloneRATokenName";
+ public static final String PR_CLONE_KRA_TOKEN_NAME = "cloneKRATokenName";
+ public static final String PR_CLONE_STORAGE_TOKEN_NAME = "cloneStorageTokenName";
+ public static final String PR_CLONE_SSL_TOKEN_NAME = "cloneSSLTokenName";
+ public static final String PR_CLONE_CA_NICKNAME = "cloneCANickname";
+ public static final String PR_CLONE_OCSP_NICKNAME = "cloneOCSPNickname";
+ public static final String PR_CLONE_RA_NICKNAME = "cloneRANickname";
+ public static final String PR_CLONE_KRA_NICKNAME = "cloneKRANickname";
+ public static final String PR_CLONE_STORAGE_NICKNAME = "cloneStorageNickname";
+ public static final String PR_CLONE_SSL_NICKNAME = "cloneSSLNickname";
+ public static final String PR_TOKEN_LOGONLIST = "tokenLogonList";
+ public static final String PR_TOKEN_LOGON_PWDS = "tokenLogonPasswords";
+ public static final String PR_SUBSYSTEM = "subsystem";
+
+ // Single Signon
+ public static final String PR_SINGLE_SIGNON = "singleSignon";
+ public static final String PR_SINGLE_SIGNON_PASSWORD = "singleSignonPwd";
+ public static final String PR_SINGLE_SIGNON_PW_TAGS = "singleSignonPWTags";
+
+ public static final String PR_CERT_CHAIN = "certChain";
+
+ // Token Subsystem Info
+ public static final String PR_CA_TOKEN = "caToken";
+ public static final String PR_RA_TOKEN = "raToken";
+ public static final String PR_KRA_TOKEN = "kraToken";
+ public static final String PR_SSL_TOKEN = "sslToken";
+ //public static final String PR_SUBSYSTEMS = "subsystems";
+
+ // Key Length
+ public static final String PR_RSA_MIN_KEYLENGTH = "RSAMinKeyLength";
+ public static final String PR_CA_KEYTYPE = "ca_keyType";
+ public static final String PR_HASH_TYPE = "hashType";
+ public static final String PR_SIGNEDBY_TYPE = "signedBy";
+ public static final String PR_NOTAFTER = "notAfter";
+ public static final String PR_CA_O_COMPONENT = "caOComponent";
+ public static final String PR_CA_C_COMPONENT = "caCComponent";
+ public static final String PR_RA_O_COMPONENT = "raOComponent";
+ public static final String PR_RA_C_COMPONENT = "raCComponent";
+ public static final String PR_OCSP_O_COMPONENT = "ocspOComponent";
+ public static final String PR_OCSP_C_COMPONENT = "ocspCComponent";
+
+ // Subject DN
+ public static final String PR_OU_COMPONENT = "OU_Component";
+ public static final String PR_O_COMPONENT = "O_Component";
+ public static final String PR_L_COMPONENT = "L_Component";
+ public static final String PR_ST_COMPONENT = "ST_Component";
+ public static final String PR_C_COMPONENT = "C_Component";
+
+ // CA serial number
+ public static final String PR_CA_SERIAL_NUMBER = "caSerialNumber";
+ public static final String PR_CA_ENDSERIAL_NUMBER = "caEndSerialNumber";
+
+ // KRA serial number
+ public static final String PR_REQUEST_NUMBER = "requestNumber";
+ public static final String PR_ENDREQUEST_NUMBER = "endRequestNumber";
+ public static final String PR_SERIAL_REQUEST_NUMBER = "serialRequestNumber";
+
+ // Cloning
+ public static final String PR_CLONING_INSTANCE = "cloningInstance";
+ public static final String PR_CLONE_CERTIFICATES = "clonedCertificates";
+
+ // Cert request
+ public static final String CA_EEPORT = "caEEPort";
+ public static final String CA_EETYPE = "caEEType";
+
+ // Certificate chain
+ public static final String NOT_IMPORT_CHAIN = "notImportChain";
+
+ public static final String OVERRIDE_VALIDITY = "overrideValidity";
+
+ // request status: should be consistent with RequestStatus.java
+ public static String BEGIN_STRING = "begin";
+ public static String PENDING_STRING = "pending";
+ public static String APPROVED_STRING = "approved";
+ public static String SVC_PENDING_STRING = "svc_pending";
+ public static String CANCELED_STRING = "canceled";
+ public static String REJECTED_STRING = "rejected";
+ public static String COMPLETE_STRING = "complete";
+
+ public static String PR_CMS_SEED = "cmsSeed";
+
+ public static String PR_WEB_SERVERROOT = "webServerRoot";
+ public static String PR_USER_ID = "webUserId";
+
+ public static final String PR_AGREEMENT_NAME_1 = "agreementName1";
+ public static final String PR_REPLICATION_MANAGER_PASSWD_1 = "replicationManagerPwd1";
+ public static final String PR_AGREEMENT_NAME_2 = "agreementName2";
+ public static final String PR_REPLICATION_MANAGER_PASSWD_2 = "replicationManagerPwd2";
+}
+
diff --git a/base/console/src/com/netscape/certsrv/common/Constants.java b/base/console/src/com/netscape/certsrv/common/Constants.java
new file mode 100644
index 000000000..6f3e3acdf
--- /dev/null
+++ b/base/console/src/com/netscape/certsrv/common/Constants.java
@@ -0,0 +1,749 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.certsrv.common;
+
+
+/**
+ * Constants that are shared by certificate server
+ * and its client SDK.
+ *
+ * @author Jack Pan-Chen
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ */
+public interface Constants {
+
+ /*=======================================================
+ * MESSAGE FORMAT CONSTANTS
+ *=======================================================*/
+ public static final String PASSWORDTYPE = "PasswordField";
+ public static final String TEXTTYPE = "TextField";
+ public static final String CHECKBOXTYPE = "CheckBox";
+ public static final String COMBOTYPE = "ComboBox";
+ public final static String TRUE = "true";
+ public final static String FALSE = "false";
+ public final static String VIEW = "view";
+ public final static String EDIT = "edit";
+
+ public final static String OP_TYPE = "OP_TYPE";
+ public final static String OP_SCOPE = "OP_SCOPE";
+
+ //STATIC RESOURCE IDENTIFIERS
+ public final static String RS_ID = "RS_ID";
+ public final static String RS_ID_CONFIG = "RS_ID_CONFIG";
+ public final static String RS_ID_ORDER = "RS_ID_ORDER";
+
+ //STATIC UI TYPE
+ public final static String TYPE_PASSWORD = "password";
+
+ /**********************************************************
+ * PROPERTY NAME LISTED BELOW
+ **********************************************************/
+
+ /*========================================================
+ * General
+ *========================================================*/
+ public final static String PR_PORT = "port";
+ public final static String PR_SSLPORT = "sslPort";
+
+ /*========================================================
+ * Tasks
+ *========================================================*/
+ public final static String PR_SERVER_START = "start";
+ public final static String PR_SERVER_STOP = "stop";
+ public final static String PR_SERVER_RESTART = "restart";
+
+ /*========================================================
+ * Networks
+ *========================================================*/
+ public final static String PR_ADMIN_S_PORT = "admin.https.port";
+ public final static String PR_AGENT_S_PORT = "agent.https.port";
+ public final static String PR_GATEWAY_S_PORT = "gateway.https.port";
+ public final static String PR_GATEWAY_PORT = "gateway.http.port";
+ public final static String PR_DOC_ROOT = "docroot";
+ public final static String PR_ADMIN_S_BACKLOG = "admin.https.backlog";
+ public final static String PR_AGENT_S_BACKLOG = "agent.https.backlog";
+ public final static String PR_GATEWAY_S_BACKLOG = "gateway.https.backlog";
+ public final static String PR_GATEWAY_BACKLOG = "gateway.http.backlog";
+ public final static String PR_GATEWAY_PORT_ENABLED =
+ "gateway.http.enable";
+ public final static String PR_MASTER_AGENT_PORT = "master.ca.agent.port";
+ public final static String PR_MASTER_AGENT_HOST = "master.ca.agent.host";
+
+ /*========================================================
+ * SMTP
+ *========================================================*/
+ public final static String PR_SERVER_NAME = "server";
+
+ /*========================================================
+ * SNMP
+ *========================================================*/
+ public final static String PR_SNMP_ENABLED = "on";
+ public final static String PR_SNMP_MASTER_HOST = "master.host";
+ public final static String PR_SNMP_MASTER_PORT = "master.port";
+ public final static String PR_SNMP_DESC = "desc";
+ public final static String PR_SNMP_ORGN = "orgn";
+ public final static String PR_SNMP_LOC = "loc";
+ public final static String PR_SNMP_CONTACT = "contact";
+
+ /*========================================================
+ * Self Tests
+ *========================================================*/
+ public final static String PR_RUN_SELFTESTS_ON_DEMAND = "run";
+ public final static String PR_RUN_SELFTESTS_ON_DEMAND_CLASS = "class";
+ public final static String PR_RUN_SELFTESTS_ON_DEMAND_CONTENT = "runContent";
+
+ /*========================================================
+ * Users and Groups
+ *========================================================*/
+
+ //group properties
+ public final static String PR_GROUP_DESC = "desc";
+ public final static String PR_GROUP_USER = "user";
+ public final static String PR_GROUP_GROUP = "group";
+
+ //user properties
+ public final static String PR_USER_FULLNAME = "fullname";
+ public final static String PR_USER_PASSWORD = "password";
+ public final static String PR_USER_EMAIL = "email";
+ public final static String PR_USER_PHONE = "phone";
+ public final static String PR_USER_STATE = "state";
+ public final static String PR_USER_CERT = "cert";
+ public final static String PR_USER_GROUP = "groups";
+ public final static String PR_MULTIROLES = "multiroles";
+
+ /*========================================================
+ * Authentication
+ *========================================================*/
+ public final static String PR_PING = "ping";
+ public final static String PR_AUTH_CLASS = "class";
+ public final static String PR_AUTH_IMPL_NAME = "implName";
+ public final static String PR_AUTH_HOST = "ldapconn.host";
+ public final static String PR_AUTH_PORT = "ldapconn.port";
+ public final static String PR_AUTH_BASEDN = "basedn";
+ public final static String PR_AUTH_ADMIN_DN = "ldapauth.bindDN";
+ public final static String PR_AUTH_ADMIN_PWD = "ldapauth.bindPassword";
+
+ /*========================================================
+ * Job Scheduler
+ *========================================================*/
+ public final static String PR_JOBS_CLASS = "class";
+ public final static String PR_JOBS_IMPL_NAME = "implName";
+ public final static String PR_JOBS_FREQUENCY = "frequency";
+
+ /*========================================================
+ * Notification
+ *========================================================*/
+ public final static String PR_NOTIFICATION_FORM_NAME = "emailTemplate";
+ public final static String PR_NOTIFICATION_SUBJECT =
+ "emailSubject";
+ public final static String PR_NOTIFICATION_SENDER = "senderEmail";
+ public final static String PR_NOTIFICATION_RECEIVER = "recipientEmail";
+
+ /*========================================================
+ * Logs
+ *========================================================*/
+ public static final String PR_LOG_IMPL_NAME = "implName";
+ public static final String PR_EXT_PLUGIN_IMPLTYPE_LOG = "log";
+ public final static String PR_LOG_CLASS = "class";
+ public final static String PR_LOG_INSTANCE = "instanceName";
+ public final static String PR_LOG_ONE = "entry";
+ public final static String PR_LOG_ENTRY = "maxentry";
+ public final static String PR_LOG_SOURCE = "source";
+ public final static String PR_LOG_LEVEL = "level";
+ public final static String PR_LOG_ENABLED = "on";
+ public final static String PR_LOG_BUFFERSIZE = "bufferSize";
+ public final static String PR_LOG_EXPIRED_TIME = "expirationTime";
+ public final static String PR_LOG_FILENAME = "fileName";
+ public final static String PR_LOG_FLUSHINTERVAL = "flushInterval";
+ public final static String PR_LOG_MAXFILESIZE = "maxFileSize";
+ public final static String PR_LOG_ROLLEROVER_INTERVAL = "rolloverInterval";
+ public final static String PR_LOG_TYPE = "type";
+ public static final String PR_LOGSOURCE_KRA = "KRA";
+ public static final String PR_LOGSOURCE_RA = "RA";
+ public static final String PR_LOGSOURCE_CA = "CA";
+ public static final String PR_LOGSOURCE_HTTP = "HTTP";
+ public static final String PR_LOGSOURCE_DB = "DB";
+ public static final String PR_LOGSOURCE_AUTH = "AUTH";
+ public static final String PR_LOGSOURCE_ADMIN = "ADMIN";
+ public static final String PR_LOG_NAME = "logname";
+ public static final String PR_CURRENT_LOG = "current";
+
+ public static final String PR_AUTO_CRL = "auto";
+ public static final String PR_LOG_SIGNED_AUDIT = "SignedAudit";
+ public static final String PR_LOG_TRANSACTIONS = "Transactions";
+ public static final String PR_LOG_SYSTEM = "System";
+
+ public static final String PR_DEBUG_LOG_SHOWCALLER = "debug.showcaller";
+ public static final String PR_DEBUG_LOG_ENABLE = "debug.enabled";
+ public static final String PR_DEBUG_LOG_LEVEL = "debug.level";
+
+ /*========================================================
+ * LDAP Publishing
+ *========================================================*/
+
+ // publishing properties
+ public final static String PR_BASIC_AUTH = "BasicAuth";
+ public final static String PR_SSL_AUTH = "SslClientAuth";
+ public final static String PR_AUTH_TYPE = "ldapauth.authtype";
+ public final static String PR_BINDPWD_PROMPT = "ldapauth.bindPWPrompt";
+ public final static String PR_CERT_NAMES = "ldapauth.nicknames";
+ public final static String PR_LDAP_CLIENT_CERT = "ldapauth.clientCertNickname";
+ public final static String PR_DIRECTORY_MANAGER_PWD = "directoryManagerPwd";
+
+ // crl settings
+ public final static String PR_ENABLE_CRL = "enableCRLUpdates";
+ public final static String PR_UPDATE_SCHEMA = "updateSchema";
+ public final static String PR_EXTENDED_NEXT_UPDATE = "extendedNextUpdate";
+ public final static String PR_UPDATE_ALWAYS = "alwaysUpdate";
+ public final static String PR_ENABLE_DAILY = "enableDailyUpdates";
+ public final static String PR_DAILY_UPDATES = "dailyUpdates";
+ public final static String PR_ENABLE_FREQ = "enableUpdateInterval";
+ public final static String PR_UPDATE_FREQ = "autoUpdateInterval";
+ public final static String PR_GRACE_PERIOD = "nextUpdateGracePeriod";
+ public final static String PR_ENABLE_CACHE = "enableCRLCache";
+ public final static String PR_CACHE_FREQ = "cacheUpdateInterval";
+ public final static String PR_CACHE_RECOVERY = "enableCacheRecovery";
+ public final static String PR_CACHE_TESTING = "enableCacheTesting";
+ public final static String PR_EXTENSIONS = "allowExtensions";
+ public final static String PR_INCLUDE_EXPIREDCERTS = "includeExpiredCerts";
+ public final static String PR_INCLUDE_EXPIREDCERTS_ONEEXTRATIME = "includeExpiredCertsOneExtraTime";
+ public final static String PR_CA_CERTS_ONLY = "caCertsOnly";
+ public final static String PR_PROFILE_CERTS_ONLY = "profileCertsOnly";
+ public final static String PR_PROFILE_LIST = "profileList";
+ public final static String PR_SIGNING_ALGORITHM = "signingAlgorithm";
+ public final static String PR_MD2_RSA = "MD2withRSA";
+ public final static String PR_MD5_RSA = "MD5withRSA";
+ public final static String PR_SHA1_RSA = "SHA1withRSA";
+ public final static String PR_SHA1_DSA = "SHA1withDSA";
+ public final static String PR_DESCRIPTION = "description";
+ public final static String PR_CLASS = "class";
+
+ // ldap settings
+ public final static String PR_ENABLE = "enable";
+ public final static String PR_PUBLISHING_ENABLE = "publishingEnable";
+ public final static String PR_HOST_NAME = "ldapconn.host";
+ public final static String PR_SECURE_PORT_ENABLED = "ldapconn.secureConn";
+ public final static String PR_LDAP_PORT = "ldapconn.port";
+ public final static String PR_LDAP_VERSION = "ldapconn.version";
+ public final static String PR_BIND_DN = "ldapauth.bindDN";
+ public final static String PR_BIND_PASSWD = "ldapauth.bindPassword";
+ public final static String PR_BIND_PASSWD_AGAIN = "bindPasswdAgain";
+ public final static String PR_LDAP_MAX_CONNS = "maxConns";
+ public final static String PR_LDAP_MIN_CONNS = "minConns";
+ public final static String PR_PUBLISHING_QUEUE_ENABLE = "queue.enable";
+ public final static String PR_PUBLISHING_QUEUE_THREADS = "queue.maxNumberOfThreads";
+ public final static String PR_PUBLISHING_QUEUE_PAGE_SIZE = "queue.pageSize";
+ public final static String PR_PUBLISHING_QUEUE_PRIORITY = "queue.priorityLevel";
+ public final static String PR_PUBLISHING_QUEUE_STATUS = "queue.saveStatus";
+
+ public final static String PR_BASE_DN = "baseDN";
+ public final static String PR_DNCOMPS = "dnComps";
+ public final static String PR_FILTERCOMPS = "filterComps";
+
+ // ldap connection test
+ public final static String PR_CONN_INITED = "connInited";
+ public final static String PR_CONN_INIT_FAIL = "connInitFail";
+ public final static String PR_CONN_OK = "connOk";
+ public final static String PR_CONN_FAIL = "connFail";
+ public final static String PR_AUTH_OK = "authOk";
+ public final static String PR_AUTH_FAIL = "authFail";
+ public final static String PR_SAVE_OK = "saveOk";
+ public final static String PR_SAVE_NOT = "saveOrNot";
+
+ /*========================================================
+ * Plugin
+ *========================================================*/
+ public final static String PR_PLUGIN_IMP = "imp";
+ public final static String PR_PLUGIN_INSTANCE = "instance";
+
+ /*========================================================
+ * Policy
+ *========================================================*/
+ public final static String PR_POLICY_CLASS = "class";
+ public final static String PR_POLICY_IMPL_NAME = "implName";
+ public final static String PR_CRLDP_NAME = "crldpName";
+ public final static String PR_POLICY_DESC = "desc";
+ public final static String PR_POLICY_ORDER = "order";
+ public final static String PR_POLICY_ENABLE = "enable";
+ public final static String PR_POLICY_PREDICATE = "predicate";
+
+ /*========================================================
+ * Publish
+ *========================================================*/
+ public final static String PR_PUBLISHER = "publisher";
+ public final static String PR_PUBLISHER_CLASS = "class";
+ public final static String PR_PUBLISHER_IMPL_NAME = "implName";
+ public final static String PR_PUBLISHER_DESC = "desc";
+ public final static String PR_PUBLISHER_ORDER = "order";
+ public final static String PR_PUBLISHER_ENABLE = "enable";
+
+ public final static String PR_MAPPER = "mapper";
+ public final static String PR_MAPPER_CLASS = "class";
+ public final static String PR_MAPPER_IMPL_NAME = "implName";
+ public final static String PR_MAPPER_DESC = "desc";
+ public final static String PR_MAPPER_ORDER = "order";
+ public final static String PR_MAPPER_ENABLE = "enable";
+
+ public final static String PR_RULE = "rule";
+ public final static String PR_RULE_CLASS = "class";
+ public final static String PR_RULE_IMPL_NAME = "implName";
+ public final static String PR_RULE_DESC = "desc";
+ public final static String PR_RULE_ORDER = "order";
+ public final static String PR_RULE_ENABLE = "enable";
+
+ public final static String PR_CRLEXT = "crlExt";
+ public final static String PR_CRLEXT_CLASS = "class";
+ public final static String PR_CRLEXT_IMPL_NAME = "implName";
+ public final static String PR_CRLEXT_DESC = "desc";
+ public final static String PR_CRLEXT_ORDER = "order";
+ public final static String PR_CRLEXT_ENABLE = "enable";
+
+ public final static String PR_OCSPSTORE_IMPL_NAME = "implName";
+
+ /*========================================================
+ * Registration Authority
+ *========================================================*/
+ public final static String PR_EE_ENABLED = "eeEnabled";
+ public final static String PR_OCSP_ENABLED = "ocspEnabled";
+ public final static String PR_RA_ENABLED = "raEnabled";
+ public final static String PR_RENEWAL_ENABLED = "renewal.enabled";
+ public final static String PR_RENEWAL_VALIDITY = "renewal.validity";
+ public final static String PR_RENEWAL_EMAIL = "renewal.email";
+ public final static String PR_RENEWAL_EXPIREDNOTIFIEDENABLED =
+ "renewal.expired.notification.enabled";
+ public final static String PR_RENEWAL_NUMNOTIFICATION =
+ "renewal.numNotification";
+ public final static String PR_RENEWAL_INTERVAL = "renewal.interval";
+ public final static String PR_SERVLET_CLASS = "class";
+ public final static String PR_SERVLET_URI = "uri";
+ public final static String PR_IMPL_NAME = "implName";
+ public final static String PR_LOCAL = "local";
+ public final static String PR_ID = "id";
+ public final static String PR_HOST = "host";
+ public final static String PR_URI = "uri";
+ public final static String PR_ENABLED = "enable";
+
+ /*========================================================
+ * Certificate Authority
+ *========================================================*/
+ public final static String PR_VALIDITY = "validity";
+ public final static String PR_DEFAULT_ALGORITHM = "defaultSigningAlgorithm";
+ public final static String PR_ALL_ALGORITHMS = "allSigningAlgorithms";
+ public final static String PR_SERIAL = "startSerialNumber";
+ public final static String PR_MAXSERIAL = "maxSerialNumber";
+
+ /*========================================================
+ * Access Control
+ *========================================================*/
+ public final static String PR_ACL_OPS = "aclOperations";
+ public final static String PR_ACI = "aci";
+ public final static String PR_ACL_CLASS = "class";
+ public final static String PR_ACL_DESC = "desc";
+ public final static String PR_ACL_RIGHTS = "rights";
+
+ /*========================================================
+ * Key Recovery
+ *========================================================*/
+ public final static String PR_AUTO_RECOVERY_ON = "autoRecoveryOn";
+ public final static String PR_RECOVERY_N = "recoveryN";
+ public final static String PR_RECOVERY_M = "recoveryM";
+ public final static String PR_OLD_RECOVERY_AGENT = "oldRecoveryAgent";
+ public final static String PR_RECOVERY_AGENT = "recoveryAgent";
+ public final static String PR_OLD_AGENT_PWD = "oldAgentPwd";
+ public final static String PR_AGENT_PWD = "agentPwd";
+ public final static String PR_NO_OF_REQUIRED_RECOVERY_AGENTS = "noOfRequiredRecoveryAgents";
+
+ /*========================================================
+ * Status
+ *========================================================*/
+ public final static String PR_STAT_STARTUP = "startup";
+ public final static String PR_STAT_TIME = "time";
+ public final static String PR_STAT_VERSION = "cms.version";
+ public final static String PR_STAT_INSTALLDATE = "installDate";
+ public final static String PR_STAT_INSTANCEID = "instanceId";
+
+ /*========================================================
+ * Server Instance
+ *========================================================*/
+ public final static String PR_INSTALL = "install";
+ public final static String PR_INSTANCES_INSTALL = "instancesInstall";
+ public final static String PR_CA_INSTANCE = "ca";
+ public final static String PR_OCSP_INSTANCE = "ocsp";
+ public final static String PR_RA_INSTANCE = "ra";
+ public final static String PR_KRA_INSTANCE = "kra";
+ public final static String PR_TKS_INSTANCE = "tks";
+
+ /*
+ * Certificate info
+ */
+ public final static String PR_CA_SIGNING_NICKNAME = "caSigningCert";
+ public final static String PR_PKCS10 = "pkcs10";
+ public final static String PR_CERT_SUBJECT_NAME = "certSubjectName";
+ public final static String PR_ISSUER_NAME = "issuerName";
+ public final static String PR_SERIAL_NUMBER = "serialNumber";
+ public final static String PR_BEFORE_VALIDDATE = "beforeValidDate";
+ public final static String PR_AFTER_VALIDDATE = "afterValidDate";
+ public final static String PR_CERT_FINGERPRINT = "certFingerPrint";
+ public final static String PR_SIGNATURE_ALGORITHM = "signatureAlg";
+ public final static String PR_ALGORITHM_ID = "algorithmId";
+ public final static String PR_NICKNAME = "nickname";
+ public final static String PR_ADD_CERT = "addCert";
+ public final static String PR_CERT_CONTENT = "certContent";
+
+ /*
+ * Certificate type
+ */
+ public final static String PR_CERTIFICATE_TYPE = "certType";
+ public final static String PR_CERTIFICATE_SUBTYPE = "certSubType";
+ public final static String PR_CA_SIGNING_CERT = "caSigningCert";
+ public final static String PR_RA_SIGNING_CERT = "raSigningCert";
+ public final static String PR_OCSP_SIGNING_CERT = "ocspSigningCert";
+ public final static String PR_KRA_TRANSPORT_CERT = "kraTransportCert";
+ public final static String PR_SERVER_CERT = "serverCert";
+ public final static String PR_SUBSYSTEM_CERT = "subsystemCert";
+ public final static String PR_SERVER_CERT_RADM = "serverCertRadm";
+ public final static String PR_CROSS_CERT = "crossCert";
+ public final static String PR_OTHER_CERT = "otherCert";
+ public final static String PR_SERVER_CERT_CHAIN = "serverCertChain";
+ public final static String PR_TRUSTED_CA_CERT = "trustedCACert";
+ public final static String PR_TRUSTED_CERT = "trustedCert";
+ public final static String PR_AUDIT_SIGNING_CERT = "auditSigningCert";
+
+ /*
+ * Extensions
+ */
+ public final static String PR_VALIDITY_PERIOD = "validityPeriod";
+ public final static String PR_BEGIN_YEAR = "beginYear";
+ public final static String PR_BEGIN_MONTH = "beginMonth";
+ public final static String PR_BEGIN_DATE = "beginDate";
+ public final static String PR_BEGIN_HOUR = "beginHour";
+ public final static String PR_BEGIN_MIN = "beginMin";
+ public final static String PR_BEGIN_SEC = "beginSec";
+ public final static String PR_AFTER_YEAR = "afterYear";
+ public final static String PR_AFTER_MONTH = "afterMonth";
+ public final static String PR_AFTER_DATE = "afterDate";
+ public final static String PR_AFTER_HOUR = "afterHour";
+ public final static String PR_AFTER_MIN = "afterMin";
+ public final static String PR_AFTER_SEC = "afterSec";
+ public final static String PR_AIA = "aia";
+ public final static String PR_AKI = "aki";
+ public final static String PR_OCSP_SIGNING = "ocspSigning";
+ public final static String PR_OCSP_NOCHECK = "ocspNoCheck";
+ public final static String PR_SKI = "ski";
+ public final static String PR_KEY_USAGE = "keyUsage";
+ public final static String PR_DER_EXTENSION = "derExtension";
+ public final static String PR_IS_CA = "isCA";
+ public final static String PR_CERT_LEN = "certLen";
+ public final static String PR_SSL_CLIENT_BIT = "sslClientBit";
+ public final static String PR_SSL_SERVER_BIT = "sslServerBit";
+ public final static String PR_SSL_MAIL_BIT = "sslMailBit";
+ public final static String PR_SSL_CA_BIT = "sslCABit";
+ public final static String PR_OBJECT_SIGNING_BIT = "objectSigningBit";
+ public final static String PR_MAIL_CA_BIT = "mailCABit";
+ public final static String PR_OBJECT_SIGNING_CA_BIT = "objectSigningCABit";
+ public final static String PR_TIMESTAMPING_BIT = "timeStampingBit";
+ public final static String PR_CA_KEYID = "caKeyid";
+ public final static String PR_CA_KEYPAIR = "caKeyPair";
+
+ /**
+ * Trust database
+ */
+ public final static String PR_TRUST = "trust";
+
+ /*========================================================
+ * Security
+ *========================================================*/
+
+ //functionality
+ public final static String PR_CERT_SERVER = "SERVER";
+ public final static String PR_CERT_ADMIN = "ADMIN";
+ public final static String PR_CERT_AGENT = "AGENT";
+ public final static String PR_CERT_EE = "EE";
+ public final static String PR_CERT_CA = "CA";
+ public final static String PR_CERT_RA = "RA";
+ public final static String PR_CERT_POA = "POA";
+ public final static String PR_CERT_TRANS = "TRANS";
+
+ // key and certificate management
+ public final static String PR_OPERATION_TYPE = "operationtype";
+ public final static String PR_INSTALL_TYPE = "install";
+ public final static String PR_REQUEST_TYPE = "request";
+ //public final static String PR_CA_SIGNING_CERT = "cacert";
+ //public final static String PR_SERVER_CERT = "servercert";
+ public final static String PR_CLIENT_CERT = "clientcert";
+ public final static String PR_FULL_INTERNAL_TOKEN_NAME="Internal Key Storage Token";
+ public final static String PR_INTERNAL_TOKEN_NAME =
+ "internal";
+ public final static String PR_TOKEN_NAME = "tokenName";
+ public final static String PR_TOKEN_PASSWD = "tokenPwd";
+ public final static String PR_KEY_LENGTH = "keyLength";
+ public final static String PR_KEY_CURVENAME = "keyCurveName";
+ public static final String PR_SIGNEDBY_TYPE = "signedBy";
+ public final static String PR_KEY_TYPE = "keyType";
+ public final static String PR_PQGPARAMS = "pqgParams";
+ public final static String PR_CERT_REQUEST = "certReq";
+ public final static String PR_CERT_REQUEST_DIR = "certReqDir";
+ public final static String PR_CERT_CONFIG_DIR = "certConfigDir";
+ public final static String PR_IMPORT_CERT = "importCert";
+ public final static String PR_SUBJECT_NAME = "subjectName";
+ public final static String PR_CSR = "csr";
+
+ //encryption
+
+ /* Cipher Version: domestic or export */
+ public final static String PR_CIPHER_VERSION = "cipherversion";
+ public final static String PR_CIPHER_VERSION_DOMESTIC = "cipherdomestic";
+ public final static String PR_CIPHER_VERSION_EXPORT = "cipherexport";
+
+ /* Cipher Fortezza: true, false */
+ public final static String PR_CIPHER_FORTEZZA = "cipherfortezza";
+
+ /* Token and Certificates */
+ public final static String PR_TOKEN_LIST = "tokenlist";
+ public final static String PR_TOKEN_PREFIX = "token_";
+ public final static String PR_INTERNAL_TOKEN = "internal";
+ public final static String PR_KEY_LIST = "keylist";
+
+ /* SSL Cipher Preferences */
+ public final static String PR_CIPHER_PREF = "cipherpref";
+
+ /* values for SSL cipher preferences */
+ public final static String
+ PR_SSL2_RC4_128_WITH_MD5 = "rc4";
+ public final static String
+ PR_SSL2_RC4_128_EXPORT40_WITH_MD5 = "rc4export";
+ public final static String
+ PR_SSL2_RC2_128_CBC_WITH_MD5 = "rc2";
+ public final static String
+ PR_SSL2_RC2_128_CBC_EXPORT40_WITH_MD5 = "rc2export";
+ public final static String
+ PR_SSL2_DES_64_CBC_WITH_MD5 = "des";
+ public final static String
+ PR_SSL2_DES_192_EDE3_CBC_WITH_MD5 = "desede3";
+ public final static String
+ PR_SSL3_RSA_WITH_NULL_MD5 = "rsa_null_md5";
+ public final static String
+ PR_SSL3_RSA_EXPORT_WITH_RC4_40_MD5 = "rsa_rc4_40_md5";
+ public final static String
+ PR_SSL3_RSA_WITH_RC4_128_MD5 = "rsa_rc4_128_md5";
+ public final static String
+ PR_SSL3_RSA_EXPORT_WITH_RC2_CBC_40_MD5 = "rsa_rc2_40_md5";
+ public final static String
+ PR_SSL3_RSA_WITH_DES_CBC_SHA = "rsa_des_sha";
+ public final static String
+ PR_SSL3_RSA_WITH_3DES_EDE_CBC_SHA = "rsa_3des_sha";
+ public final static String
+ PR_SSL3_FORTEZZA_DMS_WITH_FORTEZZA_CBC_SHA = "fortezza";
+ public final static String
+ PR_SSL3_FORTEZZA_DMS_WITH_RC4_128_SHA = "fortezza_rc4_128_sha";
+ public final static String
+ PR_SSL_RSA_FIPS_WITH_3DES_EDE_CBC_SHA = "rsa_fips_3des_sha";
+ public final static String
+ PR_SSL_RSA_FIPS_WITH_DES_CBC_SHA = "rsa_fips_des_sha";
+ public final static String
+ PR_TLS_RSA_EXPORT1024_WITH_RC4_56_SHA = "tls_rsa_rc4_56_sha";
+ public final static String
+ PR_TLS_RSA_EXPORT1024_WITH_DES_CBC_SHA = "tls_rsa_des_sha";
+
+ /*========================================================
+ * Watchdog and Server State Messages
+ *========================================================*/
+
+ public final static String SERVER_STARTUP_WARNING_MESSAGE = "CMS Warning: ";
+ public final static String SERVER_STARTUP_MESSAGE = "Server is started.";
+ public final static String SERVER_SHUTDOWN_MESSAGE = "Shutting down.";
+ public final static String SERVER_SHUTDOWN_ERROR_MESSAGE = "Error Starting CMS: ";
+ public final static String SERVER_SHUTDOWN_EXTENDED_ERROR_MESSAGE = "Extended error information: ";
+
+ /*============================================================
+ * THE FOLLOWING LIST WILL BE REMOVED
+ *============================================================*/
+
+ // parameter types
+ public final static String PT_OP = "op";
+ public final static String PT_MOD_TYPE = "modType";
+ public final static String PT_MOD_OP = "modOp";
+ public final static String MOD_REPLACE = "modOpReplace";
+ public final static String MOD_ADD = "modOpAdd";
+ public final static String MOD_DELETE = "modOpDelete";
+ public final static String PT_MOD_VALUE = "modValue";
+
+ // generic operations
+ public final static String OP_SET = "set";
+ public final static String OP_GET = "get";
+ public final static String OP_LIST = "list";
+
+ // certificate server operations
+ public final static String CERTSRV_ID = "certsrv";
+
+ public final static String PT_PORT = "http.http.port";
+ public final static String PT_SSL_PORT = "http.https.port";
+ public final static String PT_MAPPING = "mapping";
+ public final static String PT_DN = "dn";
+
+ public final static String PV_SYSTEM_ADMINISTRATORS =
+ "SystemAdministrators";
+ public final static String PV_CERTIFICATE_ADMINISTRATORS =
+ "CertificateAdministrators";
+
+ public final static String OP_AUTHENTICATE = "authenticate";
+ public final static String OP_RESTART = "restart";
+ public final static String OP_STOP = "stop";
+
+ // access manager operation
+ public final static String PT_ACLS = "acls";
+ public final static String OP_GET_ACLS = "getACLs";
+
+ // authentication operations
+ public final static String AUTH_ID = "auth";
+ public final static String OP_FIND_USERS = "findUsers";
+ public final static String OP_FIND_GROUPS = "findGroups";
+ public final static String OP_GET_USER = "getUser";
+ public final static String OP_GET_GROUP = "getGroup";
+ public final static String OP_ADD_USER = "addUser";
+ public final static String OP_ADD_GROUP = "addGroup";
+ public final static String OP_MODIFY_USER = "modifyUser";
+ public final static String OP_MODIFY_GROUP = "modifyGroup";
+
+ public final static String PT_USER = "user";
+ public final static String PT_GROUP = "group";
+
+ // common operations
+ public final static String OP_LOCK_REQUEST = "lockRequest";
+ public final static String OP_MODIFY_REQUEST = "modifyRequest";
+ public final static String OP_EXECUTE_REQUEST = "executeRequest";
+ public final static String OP_ACCEPT_REQUEST = "acceptRequest";
+ public final static String OP_REJECT_REQUEST = "rejectRequest";
+ public final static String OP_CANCEL_REQUEST = "cancelRequest";
+
+ // certificate authority operations
+ public final static String PT_PUBLISH_DN = "ldappublish.ldap.admin-dn";
+ public final static String PT_PUBLISH_PWD =
+ "ldappublish.ldap.admin-password";
+ public final static String PT_PUBLISH_FREQ =
+ "crl.crl0.autoUpdateInterval";
+ public final static String PT_SERIALNO = "serialno";
+ public final static String PT_NAMES = "names";
+ public final static String PT_CERTIFICATES = "certificates";
+ public final static String PT_CERT_RECORDS = "certRecords";
+ public final static String PT_REQUESTS = "requests";
+ public final static String PT_REQUEST = "request";
+ public final static String PT_EXTENSIONS = "extensions";
+ public final static String PT_FILTER = "filter";
+ public final static String PT_ATTRS = "attrs";
+ public final static String PT_RESULT_ID = "resultId";
+ public final static String PT_START_NO = "startNo";
+ public final static String PT_END_NO = "endNo";
+ public final static String PT_SIZE = "size";
+ public final static String PT_RELEASE = "release";
+ public final static String PT_CERTREC = "certrec";
+ public final static String PT_COMMENT = "comment";
+ public final static String PT_REASON_NO = "reasonNo";
+
+ public final static String OP_CRL_PUBLISH = "publish_now";
+ public final static String OP_FIND_CERTIFICATES = "findCertificates";
+ public final static String OP_FIND_CERT_RECORDS = "findCertRecords";
+ public final static String OP_FIND_REQUESTS = "findRequests";
+ public final static String OP_LOCK_CERT_RECORD = "lockCertRecord";
+ public final static String OP_MODIFY_CERT_RECORD = "modifyCertRecord";
+ public final static String OP_GET_EXTENSIONS = "getExtensions";
+ public final static String OP_REVOKE_CERT = "revokeCert";
+ public final static String OP_RENEW_CERT = "renewCert";
+ public final static String OP_GET_CACERT_CHAIN = "getCACertChain";
+
+ // escrow authority operations
+ public final static String PT_OLD_PASSWORD = "oldpassword";
+ public final static String PT_NEW_PASSWORD = "newpassword";
+ public final static String PT_KEY_RECORD = "keyRecord";
+
+ public final static String OP_FIND_KEY_RECORDS = "findKeyRecords";
+ public final static String OP_LOCK_KEY_RECORD = "lockKeyRecord";
+ public final static String OP_MODIFY_KEY_RECORD = "modifyKeyRecord";
+ public final static String OP_RECOVER_KEY = "recoverKey";
+
+ // centralized cetificate management operations
+ public final static String PT_NOTIF_EMAIL = "notificationEmail";
+ public final static String PT_NOTIF_ENABLE = "notificationEnable";
+ public final static String PT_NOTIF_EXPIRE = "notificationExpiration";
+ public final static String PT_NOTIF_RENEWAL = "notificationRewnewal";
+ public final static String PT_DIST_STORE = "storeUserPassword";
+ public final static String PT_DIST_EMAIL = "emailUserPassword";
+ public final static String PT_REQUEST_LOG = "requestLog";
+ public final static String PT_ACCESS_LOG = "accessLog";
+ public final static String PT_ERROR_LOG = "errorLog";
+ public final static String PR_NT_EVENT_SOURCE = "NTEventSourceName";
+ public final static String PR_NT_LOG_LEVEL = "level";
+ public final static String PR_NT_LOG_ENABLED = "on";
+
+ public final static String OP_GET_ACCESS_LOG = "getAccessLog";
+ public final static String OP_GET_ERROR_LOG = "getErrorLog";
+ public final static String OP_GET_REQUEST_LOG = "getRequestLog";
+
+ public final static String PR_NICK_NAME = "nickName"; // capital N
+ public final static String PR_LOGGED_IN = "isLoggedIn";
+
+ // User Type
+ public final static String PR_USER_TYPE = "userType";
+ public final static String PR_ADMIN_TYPE = "adminType";
+ public final static String PR_AGENT_TYPE = "agentType";
+ public final static String PR_SUBSYSTEM_TYPE = "subsystemType";
+
+ // Extended plugin information
+ public final static String PR_EXT_PLUGIN_IMPLNAME = "implName";
+ public final static String PR_EXT_PLUGIN_IMPLTYPE = "implType";
+ public final static String PR_EXT_PLUGIN_IMPLTYPE_POLICY = "policy";
+ public final static String PR_EXT_PLUGIN_IMPLTYPE_JOBS = "jobs";
+ public final static String PR_EXT_PLUGIN_IMPLTYPE_AUTH = "auth";
+ public final static String PR_EXT_PLUGIN_IMPLTYPE_LISTENER = "listener";
+ public final static String PR_EXT_PLUGIN_IMPLTYPE_PUBLISHRULE = "publishrule";
+ public final static String PR_EXT_PLUGIN_IMPLTYPE_PUBLISHER = "publisher";
+ public final static String PR_EXT_PLUGIN_IMPLTYPE_MAPPER = "mapperrule";
+ public final static String PR_EXT_PLUGIN_IMPLTYPE_CRLEXTSRULE = "crlExtensions";
+ public final static String PR_EXT_PLUGIN_IMPLTYPE_OCSPSTORESRULE = "ocspStores";
+
+ // Miscellaneous
+ public final static String PR_CERT_FILEPATH = "certFilePath";
+ public final static String PR_SERVER_ROOT = "serverRoot";
+ public final static String PR_SERVER_ID = "serverID";
+ public final static String PR_NT = "NT";
+ public final static String PR_TIMEOUT = "timeout";
+ public final static String PR_ALL_NICKNAMES = "allNicknames";
+
+ // request status
+ public final static String PR_REQUEST_SUCCESS = "2";
+ public final static String PR_REQUEST_PENDING = "3";
+ public final static String PR_REQUEST_SVC_PENDING = "4";
+ public final static String PR_REQUEST_REJECTED = "5";
+
+ //Profile
+ public final static String PR_CONSTRAINTS_LIST = "constraintPolicy";
+
+ //Replication
+ public final static String PR_REPLICATION_ENABLED = "replication.enabled";
+ public final static String PR_REPLICATION_AGREEMENT_NAME_1 = "replication.master1.name";
+ public final static String PR_REPLICATION_HOST_1 = "replication.master1.hostname";
+ public final static String PR_REPLICATION_PORT_1 = "replication.master1.port";
+ public final static String PR_REPLICATION_BINDDN_1 = "replication.master1.binddn";
+ public final static String PR_REPLICATION_CHANGELOGDB_1 = "replication.master1.changelogdb";
+ public final static String PR_REPLICATION_AGREEMENT_NAME_2 = "replication.master2.name";
+ public final static String PR_REPLICATION_HOST_2 = "replication.master2.hostname";
+ public final static String PR_REPLICATION_PORT_2 = "replication.master2.port";
+ public final static String PR_REPLICATION_BINDDN_2 = "replication.master2.binddn";
+ public final static String PR_REPLICATION_CHANGELOGDB_2 = "replication.master2.changelogdb";
+}
diff --git a/base/console/src/com/netscape/certsrv/common/DestDef.java b/base/console/src/com/netscape/certsrv/common/DestDef.java
new file mode 100644
index 000000000..313ed9d22
--- /dev/null
+++ b/base/console/src/com/netscape/certsrv/common/DestDef.java
@@ -0,0 +1,57 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.certsrv.common;
+
+
+/**
+ * This interface defines all the operation destination
+ * currently in use.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public interface DestDef {
+
+ public final static String DEST_CA_ADMIN = "caadmin";
+ public final static String DEST_OCSP_ADMIN = "ocsp";
+ public final static String DEST_RA_ADMIN = "ra";
+ public final static String DEST_KRA_ADMIN = "kra";
+ public final static String DEST_CA_SERVLET_ADMIN = "caservlet";
+ public final static String DEST_KRA_SERVLET_ADMIN = "kraservlet";
+ public final static String DEST_RA_SERVLET_ADMIN = "raservlet";
+ public final static String DEST_REGISTRY_ADMIN = "registry";
+ public final static String DEST_CA_PROFILE_ADMIN = "caprofile";
+ public final static String DEST_RA_PROFILE_ADMIN = "raprofile";
+ public final static String DEST_CA_POLICY_ADMIN = "capolicy";
+ public final static String DEST_RA_POLICY_ADMIN = "rapolicy";
+ public final static String DEST_KRA_POLICY_ADMIN = "krapolicy";
+ public final static String DEST_LOG_ADMIN = "log";
+ public final static String DEST_GROUP_ADMIN = "ug";
+ public final static String DEST_USER_ADMIN = "ug";
+ public final static String DEST_AUTH_ADMIN = "auths";
+ public final static String DEST_JOBS_ADMIN = "jobsScheduler";
+ public final static String DEST_NOTIFICATION_ADMIN = "notification";
+ public final static String DEST_SERVER_ADMIN = "server";
+ public final static String DEST_ACL_ADMIN = "acl";
+ public final static String DEST_CA_PUBLISHER_ADMIN = "capublisher";
+ public final static String DEST_RA_PUBLISHER_ADMIN = "rapublisher";
+ public final static String DEST_CA_MAPPER_ADMIN = "camapper";
+ public final static String DEST_RA_MAPPER_ADMIN = "ramapper";
+ public final static String DEST_CA_RULE_ADMIN = "carule";
+ public final static String DEST_RA_RULE_ADMIN = "rarule";
+}
diff --git a/base/console/src/com/netscape/certsrv/common/NameValuePairs.java b/base/console/src/com/netscape/certsrv/common/NameValuePairs.java
new file mode 100644
index 000000000..5e7d79cde
--- /dev/null
+++ b/base/console/src/com/netscape/certsrv/common/NameValuePairs.java
@@ -0,0 +1,80 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.certsrv.common;
+
+import java.util.LinkedHashMap;
+import java.util.StringTokenizer;
+
+/**
+ * A class represents an ordered list of name
+ * value pairs.
+ *
+ * @version $Revision$, $Date$
+ */
+public class NameValuePairs extends LinkedHashMap<String, String> {
+
+ /**
+ * Constructs name value pairs.
+ */
+ public NameValuePairs() {
+ }
+
+ /**
+ * Show the content of this name value container as
+ * string representation.
+ *
+ * @return string representation
+ */
+ public String toString() {
+ StringBuffer buf = new StringBuffer();
+
+ for (String name : keySet()) {
+ String value = get(name);
+
+ buf.append(name + "=" + value);
+ buf.append("\n");
+ }
+
+ return buf.toString();
+ }
+
+ /**
+ * Parses a string into name value pairs.
+ *
+ * @param s string
+ * @param nvp name value pairs
+ * @return true if successful
+ */
+ public static boolean parseInto(String s, NameValuePairs nvp) {
+ StringTokenizer st = new StringTokenizer(s, "&");
+
+ while (st.hasMoreTokens()) {
+ String t = st.nextToken();
+ int i = t.indexOf("=");
+
+ if (i == -1) {
+ return false;
+ }
+ String n = t.substring(0, i);
+ String v = t.substring(i + 1);
+
+ nvp.put(n, v);
+ }
+ return true;
+ }
+}
diff --git a/base/console/src/com/netscape/certsrv/common/OpDef.java b/base/console/src/com/netscape/certsrv/common/OpDef.java
new file mode 100644
index 000000000..734cd75d3
--- /dev/null
+++ b/base/console/src/com/netscape/certsrv/common/OpDef.java
@@ -0,0 +1,39 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.certsrv.common;
+
+
+/**
+ * This interface defines all the administration operations
+ * currently in use.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public interface OpDef {
+
+ public final static String OP_ADD = "OP_ADD";
+ public final static String OP_DELETE = "OP_DELETE";
+ public final static String OP_MODIFY = "OP_MODIFY";
+ public final static String OP_READ = "OP_READ";
+ public final static String OP_SEARCH = "OP_SEARCH";
+ public final static String OP_AUTH = "OP_AUTH";
+ public final static String OP_JOBS = "OP_JOBS";
+ public final static String OP_PROCESS = "OP_PROCESS";
+ public final static String OP_VALIDATE = "OP_VALIDATE";
+}
diff --git a/base/console/src/com/netscape/certsrv/common/PrefixDef.java b/base/console/src/com/netscape/certsrv/common/PrefixDef.java
new file mode 100644
index 000000000..b4476a9d9
--- /dev/null
+++ b/base/console/src/com/netscape/certsrv/common/PrefixDef.java
@@ -0,0 +1,41 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.certsrv.common;
+
+
+/**
+ * This interface defines all the prefix tags
+ * currently in use.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public interface PrefixDef {
+
+ //user and group
+ public final static String PX_GROUP = "group";
+ public final static String PX_USER = "user";
+ public final static String PX_CERT = "cert";
+ public final static String PX_SYS = "SYS_";
+ public final static String PX_DEF = "DEF_";
+ public final static String PX_PP = "CERT_PP";
+
+ //log content
+ public final static String PX_LOG = "log";
+
+}
diff --git a/base/console/src/com/netscape/certsrv/common/ScopeDef.java b/base/console/src/com/netscape/certsrv/common/ScopeDef.java
new file mode 100644
index 000000000..b3e4a79a6
--- /dev/null
+++ b/base/console/src/com/netscape/certsrv/common/ScopeDef.java
@@ -0,0 +1,193 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.certsrv.common;
+
+
+/**
+ * This interface defines all the operation scope
+ * currently in use.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ */
+public interface ScopeDef {
+
+ // users and groups
+ public final static String SC_GROUPS = "groups";
+ public final static String SC_USERS = "users";
+ public final static String SC_USER_CERTS = "certs";
+
+ public final static String SC_SNMP = "snmp";
+ public final static String SC_SMTP = "smtp";
+ public final static String SC_SUBSYSTEM = "subsystem";
+ public final static String SC_ENCRYPTION = "encryption";
+ public final static String SC_GATEWAY = "gateway";
+ public final static String SC_ADMIN = "admin";
+ public final static String SC_NETWORK = "network";
+
+ // profile
+ public final static String SC_PROFILE_IMPLS = "profile";
+ public final static String SC_PROFILE_RULES = "rules";
+ public final static String SC_PROFILE_DEFAULT_POLICY = "defaultPolicy";
+ public final static String SC_PROFILE_CONSTRAINT_POLICY = "constraintPolicy";
+ public final static String SC_PROFILE_POLICIES = "policies";
+ public final static String SC_PROFILE_POLICY_CONFIG = "config";
+ public final static String SC_PROFILE_INPUT = "profileInput";
+ public final static String SC_PROFILE_INPUT_CONFIG = "profileInputConfig";
+ public final static String SC_PROFILE_OUTPUT = "profileOutput";
+ public final static String SC_PROFILE_OUTPUT_CONFIG = "profileOutputConfig";
+
+ // policy management
+ public final static String SC_POLICY_RULES = "rules";
+ public final static String SC_POLICY_IMPLS = "impls";
+ public final static String SC_POLICY_CRLDPS = "crldps";
+
+ // publisher management
+ public final static String SC_PUBLISHER_RULES = "publisherRules";
+ public final static String SC_PUBLISHER_IMPLS = "publisherImpls";
+ public final static String SC_MAPPER_RULES = "mapperRules";
+ public final static String SC_MAPPER_IMPLS = "mapperImpls";
+ public final static String SC_RULE_RULES = "ruleRules";
+ public final static String SC_RULE_IMPLS = "ruleImpls";
+
+ // self tests
+ public final static String SC_SELFTESTS = "selftests";
+
+ // log config
+ public final static String SC_AUDITLOG = "transactionsLog";
+ public final static String SC_NTAUDITLOG = "ntTransactionsLog";
+ public final static String SC_ERRORLOG = "errorLog";
+ public final static String SC_SYSTEMLOG = "systemLog";
+ public final static String SC_NTSYSTEMLOG = "ntSystemLog";
+ public final static String SC_LOG_ARCH = "logArch";
+ public final static String SC_LOG_RULES = "logRule";
+ public final static String SC_LOG_IMPLS = "logImpls";
+
+ // log contents
+ public final static String SC_LOG_INSTANCES = "log_instances";
+ public final static String SC_LOG_CONTENT = "log_content";
+ public final static String SC_AUDITLOG_CONTENT = "transactionsLog_content";
+ public final static String SC_ERRORLOG_CONTENT = "errorLog_content";
+ public final static String SC_SYSTEMLOG_CONTENT = "systemLog_content";
+
+ //LDAP publishing
+ public final static String SC_LDAP = "ldap";
+ public final static String SC_CRL = "crl";
+ public final static String SC_USERCERT = "userCert";
+ public final static String SC_CACERT = "caCert";
+ public final static String SC_CAMAPPER = "caMapper";
+ public final static String SC_CAPUBLISHER = "caPublisher";
+ public final static String SC_USERMAPPER = "userMapper";
+ public final static String SC_USERPUBLISHER = "userPublisher";
+
+ // CRL issuing points
+ public final static String SC_CRLIPS = "crlIPs";
+
+ // CRL extensions
+ public final static String SC_CRLEXTS_RULES = "crlExtsRules";
+
+ public final static String SC_OCSPSTORES_RULES = "ocspStoresRules";
+ public final static String SC_OCSPSTORE_DEFAULT = "ocspStoreDef";
+
+ // KRA
+ public final static String SC_AUTO_RECOVERY = "autoRecovery";
+ public final static String SC_RECOVERY = "recovery";
+ public final static String SC_AGENT_PWD = "agentPwd";
+ public final static String SC_MNSCHEME = "mnScheme";
+
+ //stat
+ public final static String SC_STAT = "stat";
+
+ // RA
+ public final static String SC_GENERAL = "general";
+ public final static String SC_CLM = "clm";
+ public final static String SC_PKIGW = "pkigw";
+ public final static String SC_SERVLET = "servlet";
+ public final static String SC_CONNECTOR = "connector";
+
+ //tasks
+ public final static String SC_TASKS = "tasks";
+
+ //authentication
+ public final static String SC_AUTH = "auths";
+ public final static String SC_AUTHTYPE = "authType";
+ public final static String SC_AUTH_IMPLS = "impl";
+ public final static String SC_AUTH_MGR_INSTANCE = "instance";
+
+ //jobs scheduler
+ public final static String SC_JOBS = "jobScheduler";
+ public final static String SC_JOBS_IMPLS = "impl";
+ public final static String SC_JOBS_INSTANCE = "job";
+ public final static String SC_JOBS_RULES = "rules";
+
+ //notification
+ public final static String SC_NOTIFICATION_REQ_COMP = "notificationREQC";
+ public final static String SC_NOTIFICATION_REV_COMP = "notificationREVC";
+ public final static String SC_NOTIFICATION_RIQ = "notificationRIQ";
+
+ // acl
+ public final static String SC_ACL_IMPLS = "impl";
+ public final static String SC_ACL = "acls";
+ public final static String SC_EVALUATOR_TYPES = "evaluatorTypes";
+
+ // token
+ public final static String SC_TOKEN = "token";
+
+ // keycert
+ public final static String SC_CA_SIGNINGCERT = "caSigningCert";
+ public final static String SC_RA_SIGNINGCERT = "raSigningCert";
+ public final static String SC_KRA_TRANSPORTCERT = "kraTransportCert";
+ public final static String SC_SERVER_CERT = "serverCert";
+ public final static String SC_SERVER_CERTCHAIN = "serverCertChain";
+ public final static String SC_TRUSTED_CACERT = "trustedCACert";
+ public final static String SC_TRUSTED_CERT = "trustedCert";
+ public final static String SC_SUBJECT_NAME = "subjectName";
+ public final static String SC_CERTINFO = "certInfo";
+ public final static String SC_CERT_REQUEST = "certRequest";
+ public final static String SC_IMPORT_CROSS_CERT = "importXCert";
+ public final static String SC_ISSUE_IMPORT_CERT = "issueImportCert";
+ public final static String SC_INSTALL_CERT = "installCert";
+ public final static String SC_CA_CERTLIST = "caCertList";
+ public final static String SC_ALL_CERTLIST = "allCertList";
+ public final static String SC_DELETE_CERTS = "deleteCert";
+ public final static String SC_CERT_PRETTY_PRINT = "certPrint";
+ public final static String SC_TRUST = "trust";
+
+ // Key Pair
+ public final static String SC_KEY_LENGTH = "keyLength";
+ public final static String SC_KEY_CURVENAME = "keyCurveName";
+ public final static String SC_CERTIFICATE_EXTENSION = "certificateExt";
+ public final static String SC_TOKEN_STATUS = "tokenStatus";
+ public final static String SC_TOKEN_LOGON = "tokenLogon";
+
+ public final static String SC_EXTENDED_PLUGIN_INFO = "extendedPluginInfo";
+
+ public final static String SC_USER_TYPE = "userType";
+ public final static String SC_PLATFORM = "platform";
+
+ public final static String SC_GET_NICKNAMES = "getNicknames";
+
+ // Profile
+ public final static String SC_SUPPORTED_CONSTRAINTPOLICIES = "supportedConstraintPolicies";
+
+ // Manage certificate admin
+ public final static String SC_USERCERTSLIST = "userCertsList";
+ public final static String SC_TKSKEYSLIST = "tksKeysList";
+ public final static String SC_ROOTCERTSLIST = "rootCertsList";
+ public final static String SC_ROOTCERT_TRUSTBIT = "rootTrustBit";
+}
diff --git a/base/console/src/com/netscape/certsrv/common/TaskId.java b/base/console/src/com/netscape/certsrv/common/TaskId.java
new file mode 100644
index 000000000..6e093d5eb
--- /dev/null
+++ b/base/console/src/com/netscape/certsrv/common/TaskId.java
@@ -0,0 +1,129 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.certsrv.common;
+
+
+/**
+ * This interface defines all the tasks currently in use for the
+ * certificate server configuration.
+ *
+ * @author Christine Ho
+ * @version $Revision$, $Date$
+ */
+public interface TaskId {
+ // list out all the previously performed tasks
+ public final static String TASK_LIST_PREVIOUS_STAGES = "listPreviousStages";
+
+ // retrieve all information in the previously performed tasks
+ public final static String TASK_GET_DEFAULT_INFO = "getStagesInfo";
+
+ // retrieve all information to setup the wizardInfo
+ public final static String TASK_SETUP_WIZARDINFO = "setupWizardInfo";
+
+ // services to be installed: ca, kra, ra
+ public final static String TASK_INSTALL_SUBSYSTEMS = "installSubsystems";
+
+ // create the internal database
+ public final static String TASK_CREATE_INTERNALDB = "createInternalDB";
+
+ // configure network ports
+ public final static String TASK_CONFIGURE_NETWORK = "configureNetwork";
+
+ // setup certificate administrator
+ public final static String TASK_SETUP_ADMINISTRATOR = "setupAdmin";
+
+ // select subsystems
+ public final static String TASK_SELECT_SUBSYSTEMS = "selectSubsystems";
+
+ // data migration
+ public final static String TASK_MIGRATION = "migration";
+
+ // create certificate
+ public final static String TASK_CREATE_CERT = "createCert";
+
+ // kra storage key
+ public final static String TASK_STORAGE_KEY = "storageKey";
+
+ // kra agents
+ public final static String TASK_AGENTS = "agents";
+
+ // get information about all cryptotokens
+ public final static String TASK_TOKEN_INFO = "tokenInfo";
+
+ // get master or clone setting
+ public final static String TASK_MASTER_OR_CLONE = "SetMasterOrClone";
+
+ // single signon
+ public final static String TASK_SINGLE_SIGNON = "singleSignon";
+
+ // init token
+ public final static String TASK_INIT_TOKEN = "initToken";
+
+ // certificate request
+ public final static String TASK_CERT_REQUEST = "certRequest";
+
+ // certificate request submited successfully
+ public final static String TASK_REQUEST_SUCCESS = "reqSuccess";
+
+ // certificate content
+ public final static String TASK_GET_CERT_CONTENT = "certContent";
+
+ public final static String TASK_IMPORT_CERT_CHAIN = "importCertChain";
+
+ // install certificate
+ public final static String TASK_INSTALL_CERT = "installCert";
+
+ public final static String TASK_CHECK_DN = "checkDN";
+
+ // miscellaneous things
+ public final static String TASK_MISCELLANEOUS = "doMiscStuffs";
+
+ // validate directory manager password
+ public final static String TASK_VALIDATE_DSPASSWD = "validateDSPassword";
+
+ // set CA starting serial number
+ public final static String TASK_SET_CA_SERIAL = "setCASerial";
+
+ // set KRA request and key starting and ending number
+ public final static String TASK_SET_KRA_NUMBER = "setKRANumber";
+
+ // check key length
+ public final static String TASK_CHECK_KEYLENGTH = "checkKeyLength";
+
+ // check certificate extension
+ public final static String TASK_CHECK_EXTENSION = "checkExtension";
+
+ // check validity period: make sure the notAfterDate of the certificate
+ // will not go beyond the notAfterDate of the CA cert which signs the certificate.
+ public final static String TASK_VALIDITY_PERIOD = "checkValidityPeriod";
+
+ public final static String TASK_CLONING = "taskCloning";
+ public final static String TASK_CLONE_MASTER = "taskCloneMaster";
+
+ // daemon exit
+ public final static String TASK_EXIT = "exit";
+
+ public final static String TASK_ADD_OCSP_SERVICE = "addOCSPService";
+
+ public final static String TASK_CONFIG_WEB_SERVER = "configWebServer";
+
+ public final static String TASK_CREATE_REPLICATION_AGREEMENT = "createReplAgreement";
+ public final static String TASK_LOGON_ALL_TOKENS = "logonAllTokens";
+ public final static String TASK_UPDATE_DB_INFO = "updateDBInfo";
+ public final static String TASK_ADD_DBSCHEMA_INDEXES = "addDBSchemaIndexes";
+}
diff --git a/base/console/templates/CMakeLists.txt b/base/console/templates/CMakeLists.txt
new file mode 100644
index 000000000..7978c7491
--- /dev/null
+++ b/base/console/templates/CMakeLists.txt
@@ -0,0 +1,12 @@
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/pki_console_wrapper ${CMAKE_CURRENT_BINARY_DIR}/pkiconsole COPYONLY)
+
+install(
+ FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/pkiconsole
+ DESTINATION
+ ${BIN_INSTALL_DIR}
+ PERMISSIONS
+ OWNER_EXECUTE OWNER_WRITE OWNER_READ
+ GROUP_EXECUTE GROUP_READ
+ WORLD_EXECUTE WORLD_READ
+)
diff --git a/base/console/templates/pki_console_wrapper b/base/console/templates/pki_console_wrapper
new file mode 100755
index 000000000..eec4725b6
--- /dev/null
+++ b/base/console/templates/pki_console_wrapper
@@ -0,0 +1,167 @@
+#!/bin/sh
+#
+# --- BEGIN COPYRIGHT BLOCK ---
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Copyright (C) 2007 Red Hat, Inc.
+# All rights reserved.
+# --- END COPYRIGHT BLOCK ---
+#
+
+# Check to insure that this script's original invocation directory
+# has not been deleted!
+CWD=`/bin/pwd > /dev/null 2>&1`
+if [ $? -ne 0 ] ; then
+ echo "Cannot invoke '$0' from non-existent directory!"
+ exit 255
+fi
+
+
+###############################################################################
+## (1) Specify variables used by this script. ##
+###############################################################################
+
+PRODUCT="pki"
+
+
+###############################################################################
+## (2) Check for valid usage of this command wrapper. ##
+###############################################################################
+
+usage() {
+ echo "Usage: $0 <url>"
+ echo
+ echo " where <url> is the url to the administration port of your"
+ echo " Certificate Subsystem. For example:"
+ echo
+ echo " https://<hostname>:9445/ca"
+ echo
+}
+
+if [ $# -ne 1 ] ; then
+ usage
+ exit 255
+fi
+
+
+###############################################################################
+## (3) Define helper functions. ##
+###############################################################################
+
+invalid_operating_system() {
+ echo
+ echo "ERROR: '$0' does not execute on the '$1' operating system!"
+ echo
+}
+
+invalid_architecture() {
+ echo
+ echo "ERROR: '$0' does not execute on the '$1' architecture!"
+ echo
+}
+
+
+###############################################################################
+## (4) Set the LD_LIBRARY_PATH environment variable to determine the ##
+## search order this command wrapper uses to find shared libraries. ##
+###############################################################################
+
+OS=`uname -s`
+ARCHITECTURE=""
+
+if [ "${OS}" = "Linux" ] ; then
+ ARCHITECTURE=`uname -i`
+ JAVA="java"
+ JAVA_OPTIONS=""
+
+ if [ "${ARCHITECTURE}" = "i386" ] ; then
+ LD_LIBRARY_PATH=/usr/lib:/lib
+ LD_LIBRARY_PATH=/usr/lib/jss:${LD_LIBRARY_PATH}
+ export LD_LIBRARY_PATH
+ elif [ "${ARCHITECTURE}" = "x86_64" ] ; then
+ LD_LIBRARY_PATH=/usr/lib:/lib
+ LD_LIBRARY_PATH=/usr/lib64:/lib64:${LD_LIBRARY_PATH}
+ LD_LIBRARY_PATH=/usr/lib64/jss:${LD_LIBRARY_PATH}
+ export LD_LIBRARY_PATH
+ else
+ invalid_architecture "${ARCHITECTURE}"
+ exit 255
+ fi
+elif [ "${OS}" = "SunOS" ] ; then
+ ARCHITECTURE=`uname -p`
+ if [ "${ARCHITECTURE}" = "sparc" ] &&
+ [ -d "/usr/lib/sparcv9/" ] ; then
+ ARCHITECTURE="sparcv9"
+ fi
+ if [ "${ARCHITECTURE}" = "sparc" ] ; then
+ JAVA="/usr/jdk/instances/jdk1.5.0/jre/bin/java"
+ JAVA_OPTIONS=""
+
+ LD_LIBRARY_PATH=/usr/lib:/lib
+ LD_LIBRARY_PATH=/usr/lib/dirsec:${LD_LIBRARY_PATH}
+ LD_LIBRARY_PATH=/usr/lib/${PRODUCT}:${LD_LIBRARY_PATH}
+ export LD_LIBRARY_PATH
+ elif [ "${ARCHITECTURE}" = "sparcv9" ] ; then
+ JAVA="/usr/jdk/instances/jdk1.5.0/jre/bin/java"
+ JAVA_OPTIONS="-d64"
+
+ LD_LIBRARY_PATH=/usr/lib:/lib
+ LD_LIBRARY_PATH=/usr/lib/dirsec:${LD_LIBRARY_PATH}
+ LD_LIBRARY_PATH=/usr/lib/${PRODUCT}:${LD_LIBRARY_PATH}
+ LD_LIBRARY_PATH=/usr/lib/sparcv9:/lib/sparcv9:${LD_LIBRARY_PATH}
+ LD_LIBRARY_PATH=/usr/lib/sparcv9/dirsec:${LD_LIBRARY_PATH}
+ LD_LIBRARY_PATH=/usr/lib/sparcv9/${PRODUCT}:${LD_LIBRARY_PATH}
+ export LD_LIBRARY_PATH
+ else
+ invalid_architecture "${ARCHITECTURE}"
+ exit 255
+ fi
+else
+ invalid_operating_system "${OS}"
+ exit 255
+fi
+
+
+###############################################################################
+## (5) Set the CP environment variable to determine the search ##
+## order this command wrapper uses to find jar files. ##
+###############################################################################
+
+CP=/usr/lib/java/jss4.jar
+CP=/usr/lib/java/dirsec/jss4.jar:${CP}
+if [ "${OS}" = "Linux" ] &&
+ [ "${ARCHITECTURE}" = "x86_64" ] ; then
+ # Fedora 16+
+ CP=/usr/lib64/java/jss4.jar
+fi
+CP=/usr/share/java/ldapjdk.jar:${CP}
+CP=/usr/share/java/idm-console-nmclf.jar:${CP}
+CP=/usr/share/java/idm-console-nmclf_en.jar:${CP}
+CP=/usr/share/java/idm-console-mcc.jar:${CP}
+CP=/usr/share/java/idm-console-mcc_en.jar:${CP}
+CP=/usr/share/java/idm-console-base.jar:${CP}
+CP=/usr/share/java/389-console_en.jar:${CP}
+CP=/usr/share/java/${PRODUCT}/pki-console-theme.jar:${CP}
+CP=/usr/share/java/${PRODUCT}/pki-console.jar:${CP}
+export CP
+
+
+###############################################################################
+## (6) Execute the java command specified by this java command wrapper ##
+## based upon the preset LD_LIBRARY_PATH and CP environment variables. ##
+###############################################################################
+
+${JAVA} ${JAVA_OPTIONS} -cp ${CP} -Djava.util.prefs.systemRoot=/tmp/.java -Djava.util.prefs.userRoot=/tmp/java com.netscape.admin.certsrv.Console -s instanceID -a $1
+exit $?
+