/** @param config */ @Override public void saveProperties() { AppConfig.getInstance().setProperty("db.engine", comboValue(jcboDBDriver.getSelectedItem())); AppConfig.getInstance().setProperty("db.driverlib", jtxtDbDriverLib.getText()); AppConfig.getInstance().setProperty("db.driver", jtxtDbDriver.getText()); AppConfig.getInstance().setProperty("db.URL", jtxtDbURL.getText()); AppConfig.getInstance().setProperty("db.user", jtxtDbUser.getText()); AltEncrypter cypher = new AltEncrypter("cypherkey" + jtxtDbUser.getText()); AppConfig.getInstance() .setProperty( "db.password", "crypt:" + cypher.encrypt(new String(jtxtDbPassword.getPassword()))); dirty.setDirty(false); }
/** @param config */ @Override public void loadProperties() { jcboDBDriver.setSelectedItem(AppConfig.getInstance().getProperty("db.engine")); jtxtDbDriverLib.setText(AppConfig.getInstance().getProperty("db.driverlib")); jtxtDbDriver.setText(AppConfig.getInstance().getProperty("db.driver")); jtxtDbURL.setText(AppConfig.getInstance().getProperty("db.URL")); String sDBUser = AppConfig.getInstance().getProperty("db.user"); String sDBPassword = AppConfig.getInstance().getProperty("db.password"); if (sDBUser != null && sDBPassword != null && sDBPassword.startsWith("crypt:")) { // La clave esta encriptada. AltEncrypter cypher = new AltEncrypter("cypherkey" + sDBUser); sDBPassword = cypher.decrypt(sDBPassword.substring(6)); } jtxtDbUser.setText(sDBUser); jtxtDbPassword.setText(sDBPassword); dirty.setDirty(false); }
/** @return */ @Override public boolean hasChanged() { return dirty.isDirty(); }