1 /*******************************************************************************
2 * Copyright (c) 2017 hangum.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the GNU Lesser Public License v2.1
5 * which accompanies this distribution, and is available at
6 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
9 * hangum - initial API and implementation
10 ******************************************************************************/
11 package com
.hangum
.tadpole
.engine
.security
;
13 import java
.util
.HashMap
;
16 import org
.apache
.log4j
.Logger
;
17 import org
.eclipse
.jface
.dialogs
.Dialog
;
18 import org
.eclipse
.jface
.dialogs
.MessageDialog
;
19 import org
.eclipse
.swt
.widgets
.Shell
;
20 import org
.eclipse
.swt
.widgets
.Text
;
22 import com
.hangum
.tadpole
.commons
.libs
.core
.define
.PublicTadpoleDefine
;
23 import com
.hangum
.tadpole
.commons
.libs
.core
.message
.CommonMessages
;
24 import com
.hangum
.tadpole
.engine
.manager
.TadpoleSQLManager
;
25 import com
.hangum
.tadpole
.engine
.query
.dao
.system
.UserDBDAO
;
26 import com
.hangum
.tadpole
.ext
.appm
.APPMHandler
;
27 import com
.hangum
.tadpole
.preference
.define
.GetAdminPreference
;
28 import com
.hangum
.tadpole
.session
.manager
.SessionManager
;
36 public abstract class PasswordDialog
extends Dialog
{
37 private static final Logger logger
= Logger
.getLogger(PasswordDialog
.class);
39 protected UserDBDAO userDB
;
40 protected Text textPassword
;
48 protected PasswordDialog(Shell parentShell
, UserDBDAO userDB
) {
56 protected void initUI() {
58 String strCacchPassword
= null;
59 if(PublicTadpoleDefine
.YES_NO
.YES
.name().equals(GetAdminPreference
.getIsPasswdCacheUse())) {
60 strCacchPassword
= TadpoleSQLManager
.getPassword(userDB
);
63 if(strCacchPassword
!= null) {
64 textPassword
.setText(strCacchPassword
);
66 Map
<String
, String
> mapAppm
= new HashMap
<String
, String
>();
67 mapAppm
.put("ip", userDB
.getHost());
68 mapAppm
.put("port", userDB
.getPort());
69 mapAppm
.put("account", userDB
.getUsers());
70 mapAppm
.put("session.user", SessionManager
.getEMAIL());
72 String strAMMPPassword
= APPMHandler
.getInstance().getPassword(mapAppm
);
73 textPassword
.setText(strAMMPPassword
);
75 } catch (Exception e
) {
76 TadpoleSQLManager
.removePassword(userDB
);
78 logger
.error("appm error", e
);
79 MessageDialog
.openInformation(getShell(), CommonMessages
.get().Error
, "APPM interface error :" + e
.getMessage());
81 textPassword
.setText("");