--- /dev/null
+/*
+ * Sone - SoneDatabase.java - Copyright © 2011 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
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package net.pterodactylus.sone.database;
+
+import net.pterodactylus.sone.data.Sone;
+
+/**
+ * Interface for the Sone database.
+ *
+ * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
+ */
+public interface SoneDatabase {
+
+ /**
+ * Returns the Sone with the given ID, creating a new Sone if a Sone with
+ * the given ID does not exist and {@code create} is {@code true}.
+ *
+ * @param id
+ * The ID of the new Sone
+ * @param create
+ * {@code true} to create a new Sone if a Sone with the given ID
+ * does not exist, {@code false} to return {@code null} if a Sone
+ * with the given ID does not exist
+ * @return The created Sone
+ * @throws IllegalArgumentException
+ * if {@code id} is {@code null}
+ * @throws DatabaseException
+ * if a database error occurs
+ */
+ public Sone getSone(String id, boolean create) throws DatabaseException;
+
+ /**
+ * Stores the given Sone. The given Sone has to be an object that was
+ * returned by a previous call to {@link #getSone(String, boolean)}.
+ *
+ * @param sone
+ * The Sone to store
+ * @throws IllegalArgumentException
+ * if {@code sone} is {@code null}, or the Sone was not
+ * retrieved by a call to {@link #getSone(String, boolean)}
+ * @throws DatabaseException
+ * if a database error occurs
+ */
+ public void saveSone(Sone sone) throws DatabaseException;
+
+}