|
|
| 951 |
954 |
|
| 1 | 1 | package com.jbidwatcher.ui.config; |
| 2 | 2 | |
| 3 | 3 | import com.jbidwatcher.util.config.JConfig; |
| 4 | import com.jbidwatcher.ui.util.OptionUI; |
| 4 | 5 | |
| 5 | 6 | import javax.swing.*; |
| 6 | 7 | import java.awt.event.ActionListener; |
| --- | --- | |
| 19 | 20 | public class JConfigDatabaseTab extends JConfigTab { |
| 20 | 21 | private JRadioButton defaultDerbyDB; |
| 21 | 22 | private JRadioButton mysqlDB; |
| 23 | private OptionUI mOui = null; |
| 22 | 24 | |
| 23 | 25 | private JTextField mysqlHost, mysqlPort; |
| 24 | 26 | private JTextField mysqlDatabase; |
| --- | --- | |
| 61 | 63 | updateValues(); |
| 62 | 64 | } |
| 63 | 65 | |
| 64 | | // |
| 65 | | // Apply all changes made to the firewall options. This does NOT |
| 66 | | // immediately open a SOCKS server, or a web proxy for all future |
| 67 | | // transactions. It should. HACKHACK -- mrs: 14-August-2001 01:44 |
| 68 | | // |
| 69 | 66 | public boolean apply() { |
| 70 | 67 | if (defaultDerbyDB.isSelected()) { |
| 71 | | JConfig.kill("db.protocol"); |
| 72 | | JConfig.kill("db.driver"); |
| 73 | | JConfig.kill("db.user"); |
| 74 | | JConfig.kill("db.pass"); |
| 68 | if(JConfig.queryConfiguration("temp.db.switch2derby") != null) JConfig.kill("temp.db.switch2derby"); |
| 69 | if(JConfig.queryConfiguration("db.protocol", "jdbc:derby:").contains("mysql")) { |
| 70 | JConfig.setConfiguration("temp.db.switch2derby", "true"); |
| 71 | } |
| 72 | JConfig.kill("temp.db.protocol"); |
| 73 | JConfig.kill("temp.db.driver"); |
| 74 | JConfig.kill("temp.db.user"); |
| 75 | JConfig.kill("temp.db.pass"); |
| 75 | 76 | } else if (mysqlDB.isSelected()) { |
| 77 | if(!JConfig.queryConfiguration("db.protocol", "jdbc:derby:").contains("mysql")) { |
| 78 | JConfig.setConfiguration("temp.db.switch2derby", "false"); |
| 79 | } |
| 76 | 80 | String host = mysqlHost.getText(); |
| 77 | 81 | |
| 78 | 82 | String port = mysqlPort.getText(); |
| --- | --- | |
| 95 | 99 | JConfig.setConfiguration("temp.db.pass", new String(mysqlPassword.getPassword())); |
| 96 | 100 | } |
| 97 | 101 | |
| 102 | if(JConfig.queryConfiguration("temp.db.switch2derby") != null) { |
| 103 | if(mOui == null) mOui = new OptionUI(); |
| 104 | mOui.promptWithCheckbox(null, "You will have to shut down JBidwatcher and restart for the database change to take effect.", "JBidwatcher restart required", "prompt.db_change_restart"); |
| 105 | } |
| 106 | |
| 98 | 107 | return true; |
| 99 | 108 | } |
| 100 | 109 | |