Better handle temporary (i.e. not serialized) configuration settings.
| 800 | 950 | |
|---|---|---|
| 30 | 30 | protected static Properties soleProperty = new Properties(); |
| 31 | 31 | protected static Properties displayProperty = null; |
| 32 | 32 | protected static Properties mAuxProps = null; |
| 33 | protected static Properties mTempProps = null; | |
| 33 | 34 | protected static Runtime curRuntime = Runtime.getRuntime(); |
| 34 | 35 | |
| 35 | 36 | protected static String _configFileName = null; |
| --- | --- | |
| 383 | 384 | public static void saveConfiguration(String outFile) { |
| 384 | 385 | _configFileName = outFile; |
| 385 | 386 | passwordFixup(soleProperty); |
| 386 | killAll("temp."); | |
| 387 | 387 | |
| 388 | 388 | if (_configFileName != null) { |
| 389 | 389 | saveArbitrary(_configFileName, soleProperty); |
| --- | --- | |
| 549 | 549 | } |
| 550 | 550 | |
| 551 | 551 | public static void setConfiguration(String key, String value) { |
| 552 | _anyUpdates = true; | |
| 553 | soleProperty.setProperty(key, value); | |
| 552 | if(key.startsWith("temp.")) { | |
| 553 | if(mTempProps == null) mTempProps = new Properties(); | |
| 554 | mTempProps.setProperty(key, value); | |
| 555 | } else { | |
| 556 | _anyUpdates = true; | |
| 557 | soleProperty.setProperty(key, value); | |
| 558 | } | |
| 554 | 559 | } |
| 555 | 560 | |
| 556 | 561 | public static String queryConfiguration(String query, String inDefault) { |
| --- | --- | |
| 564 | 569 | if(soleProperty.getProperty("config.logging", "false").equals("true")) { |
| 565 | 570 | System.out.println("Query: " + query); |
| 566 | 571 | } |
| 572 | if(query.startsWith("temp.")) { | |
| 573 | return mTempProps.getProperty(query, null); | |
| 574 | } | |
| 567 | 575 | return soleProperty.getProperty(query, null); |
| 568 | 576 | } |
| 569 | 577 | |
