+ boolean firstStart = configuration.getBooleanValue("FirstStart").getValue(true);
+ if (firstStart) {
+ logger.log(Level.INFO, "First start of Sone, adding a couple of default Sones…");
+ addDefaultSones();
+ try {
+ configuration.getBooleanValue("FirstStart").setValue(false);
+ } catch (ConfigurationException ce1) {
+ logger.log(Level.WARNING, "Could not clear “first start” flag!");
+ }
+ }
+
+ options.addIntegerOption("InsertionDelay", new DefaultOption<Integer>(60, new OptionWatcher<Integer>() {
+
+ @Override
+ public void optionChanged(Option<Integer> option, Integer oldValue, Integer newValue) {
+ SoneInserter.setInsertionDelay(newValue);
+ }
+
+ }));
+
+ options.addBooleanOption("ClearOnNextRestart", new DefaultOption<Boolean>(false));
+ options.addBooleanOption("ReallyClearOnNextRestart", new DefaultOption<Boolean>(false));
+
+ if (firstStart) {
+ return;
+ }
+
+ options.getBooleanOption("ClearOnNextRestart").set(configuration.getBooleanValue("Option/ClearOnNextRestart").getValue(null));
+ options.getBooleanOption("ReallyClearOnNextRestart").set(configuration.getBooleanValue("Option/ReallyClearOnNextRestart").getValue(null));
+ boolean clearConfiguration = options.getBooleanOption("ClearOnNextRestart").get() && options.getBooleanOption("ReallyClearOnNextRestart").get();
+ options.getBooleanOption("ClearOnNextRestart").set(null);
+ options.getBooleanOption("ReallyClearOnNextRestart").set(null);
+ if (clearConfiguration) {
+ /* stop loading the configuration. */
+ addDefaultSones();
+ return;
+ }
+
+ options.getIntegerOption("InsertionDelay").set(configuration.getIntValue("Option/InsertionDelay").getValue(null));
+