/*
- * FreenetSone - PluginStoreConfigurationBackend.java - Copyright © 2010 David Roden
+ * Sone - PluginStoreConfigurationBackend.java - Copyright © 2010–2013 David Roden
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
package net.pterodactylus.sone.freenet;
-import java.util.logging.Level;
+import static java.util.logging.Logger.getLogger;
+
import java.util.logging.Logger;
import net.pterodactylus.util.config.AttributeNotFoundException;
import net.pterodactylus.util.config.Configuration;
import net.pterodactylus.util.config.ConfigurationException;
import net.pterodactylus.util.config.ExtendedConfigurationBackend;
-import net.pterodactylus.util.logging.Logging;
import freenet.client.async.DatabaseDisabledException;
import freenet.pluginmanager.PluginRespirator;
import freenet.pluginmanager.PluginStore;
public class PluginStoreConfigurationBackend implements ExtendedConfigurationBackend {
/** The logger. */
- private static final Logger logger = Logging.getLogger(PluginStoreConfigurationBackend.class);
+ @SuppressWarnings("unused")
+ private static final Logger logger = getLogger("Sone.Fred");
/** The plugin respirator. */
private final PluginRespirator pluginRespirator;
public PluginStoreConfigurationBackend(PluginRespirator pluginRespirator) throws DatabaseDisabledException {
this.pluginRespirator = pluginRespirator;
this.pluginStore = pluginRespirator.getStore();
+ if (this.pluginStore == null) {
+ throw new DatabaseDisabledException();
+ }
}
/**
save();
}
- //
- // PRIVATE METHODS
- //
-
/**
- * Saves the configuration to the plugin store.
+ * {@inheritDoc}
*/
- private void save() {
+ @Override
+ public void save() throws ConfigurationException {
try {
pluginRespirator.putStore(pluginStore);
} catch (DatabaseDisabledException dde1) {
- logger.log(Level.WARNING, "Could not store plugin store, database is disabled.", dde1);
+ throw new ConfigurationException("Could not store plugin store, database is disabled.", dde1);
}
}