X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ffreenet%2FPluginStoreConfigurationBackend.java;h=a0690a4e7a7164e1ba04887ac368ab54bbaffa1f;hb=d35ab97a494fd187d3b8fe6b3253b65e3427a077;hp=68153710c18fa71c5d017a6267069ec98adb3653;hpb=ae86f20b9267b6ea04b61da01f12bca742b35eba;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/freenet/PluginStoreConfigurationBackend.java b/src/main/java/net/pterodactylus/sone/freenet/PluginStoreConfigurationBackend.java index 6815371..a0690a4 100644 --- a/src/main/java/net/pterodactylus/sone/freenet/PluginStoreConfigurationBackend.java +++ b/src/main/java/net/pterodactylus/sone/freenet/PluginStoreConfigurationBackend.java @@ -1,5 +1,5 @@ /* - * 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 @@ -17,7 +17,6 @@ package net.pterodactylus.sone.freenet; -import java.util.logging.Level; import java.util.logging.Logger; import net.pterodactylus.util.config.AttributeNotFoundException; @@ -37,6 +36,7 @@ import freenet.pluginmanager.PluginStore; public class PluginStoreConfigurationBackend implements ExtendedConfigurationBackend { /** The logger. */ + @SuppressWarnings("unused") private static final Logger logger = Logging.getLogger(PluginStoreConfigurationBackend.class); /** The plugin respirator. */ @@ -61,9 +61,6 @@ public class PluginStoreConfigurationBackend implements ExtendedConfigurationBac } } - /** - * {@inheritDoc} - */ @Override public String getValue(String attribute) throws ConfigurationException { if (!pluginStore.strings.containsKey(attribute)) { @@ -72,18 +69,12 @@ public class PluginStoreConfigurationBackend implements ExtendedConfigurationBac return pluginStore.strings.get(attribute); } - /** - * {@inheritDoc} - */ @Override public void putValue(String attribute, String value) throws ConfigurationException { pluginStore.strings.put(attribute, value); save(); } - /** - * {@inheritDoc} - */ @Override public Boolean getBooleanValue(String attribute) throws ConfigurationException { if (!pluginStore.booleans.containsKey(attribute)) { @@ -92,18 +83,12 @@ public class PluginStoreConfigurationBackend implements ExtendedConfigurationBac return pluginStore.booleans.get(attribute); } - /** - * {@inheritDoc} - */ @Override public void setBooleanValue(String attribute, Boolean value) throws ConfigurationException { pluginStore.booleans.put(attribute, value); save(); } - /** - * {@inheritDoc} - */ @Override public Double getDoubleValue(String attribute) throws ConfigurationException { if (!pluginStore.strings.containsKey(attribute)) { @@ -120,18 +105,12 @@ public class PluginStoreConfigurationBackend implements ExtendedConfigurationBac } } - /** - * {@inheritDoc} - */ @Override public void setDoubleValue(String attribute, Double value) throws ConfigurationException { pluginStore.strings.put(attribute, String.valueOf(value)); save(); } - /** - * {@inheritDoc} - */ @Override public Integer getIntegerValue(String attribute) throws ConfigurationException { if (!pluginStore.integers.containsKey(attribute)) { @@ -140,18 +119,12 @@ public class PluginStoreConfigurationBackend implements ExtendedConfigurationBac return pluginStore.integers.get(attribute); } - /** - * {@inheritDoc} - */ @Override public void setIntegerValue(String attribute, Integer value) throws ConfigurationException { pluginStore.integers.put(attribute, value); save(); } - /** - * {@inheritDoc} - */ @Override public Long getLongValue(String attribute) throws ConfigurationException { if (!pluginStore.longs.containsKey(attribute)) { @@ -160,27 +133,18 @@ public class PluginStoreConfigurationBackend implements ExtendedConfigurationBac return pluginStore.longs.get(attribute); } - /** - * {@inheritDoc} - */ @Override public void setLongValue(String attribute, Long value) throws ConfigurationException { pluginStore.longs.put(attribute, value); save(); } - // - // PRIVATE METHODS - // - - /** - * Saves the configuration to the plugin store. - */ - 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); } }