]> git.mxchange.org Git - jcore.git/blobdiff - src/org/mxchange/jcore/database/backend/DatabaseBackend.java
Added thrown exception (from some method)
[jcore.git] / src / org / mxchange / jcore / database / backend / DatabaseBackend.java
index 26a6c4ca2153fb9e6481b591ebad2c80814ed7fc..a787304317422d9453fccfb8bb84c22f9decd783 100644 (file)
  */
 package org.mxchange.jcore.database.backend;
 
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
 import java.sql.SQLException;
+import java.util.Map;
+import javax.naming.NamingException;
 import org.mxchange.jcore.FrameworkInterface;
-import org.mxchange.jcore.criteria.searchable.SearchableCritera;
+import org.mxchange.jcore.criteria.searchable.SearchableCriteria;
 import org.mxchange.jcore.database.result.Result;
 import org.mxchange.jcore.database.storage.Storeable;
+import org.mxchange.jcore.exceptions.BadTokenException;
+import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException;
 
 /**
  * A generic interface for database frontends
@@ -33,21 +39,54 @@ public interface DatabaseBackend extends FrameworkInterface {
         * Tries a connection to the database
         * 
         * @throws java.sql.SQLException If the connection attempt fails
+        * @throws javax.naming.NamingException May be thrown by a backend implementation
         */
-       public void connectToDatabase () throws SQLException;
+       public void connectToDatabase () throws SQLException, NamingException;
+
+       /**
+        * Inserts given dataset instance and returns a Result instance on success.
+        * The callee should not modify any content of the dataset instance.
+        *
+        * @param dataset A dataset instance
+        * @return An instance of Result
+        * @throws java.sql.SQLException If any SQL error occurs
+        * @throws java.io.IOException If an IO error occurs
+        */
+       public Result<? extends Storeable> doInsertDataSet (final Map<String, Object> dataset) throws SQLException, IOException;
 
        /**
         * Run a "SELECT" statement with given criteria and always return a Result
         * instance. The result instance then provides methods to iterate over all
         * found entries.
         *
+        * The callee should not modify any content of the criteria instance.
+        *
         * @param critera Search critera
         * @return A result instance
+        * @throws java.io.IOException If any IO error occurs
+        * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
+        * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If the file is badly damaged
+        * @throws java.sql.SQLException If any SQL error occurs
+        * @throws java.lang.NoSuchMethodException If a method was not found
+        * @throws java.lang.IllegalAccessException If the method cannot be accessed
+        * @throws java.lang.reflect.InvocationTargetException Any other problems?
         */
-       public Result<? extends Storeable> doSelectByCriteria (final SearchableCritera critera);
+       public Result<? extends Storeable> doSelectByCriteria (final SearchableCriteria critera) throws IOException, BadTokenException, CorruptedDatabaseFileException, SQLException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException;
 
        /**
         * Shuts down this backend
+        *
+        * @throws java.sql.SQLException If any SQL error occurs
+        * @throws java.io.IOException If any IO error occurs
+        */
+       public void doShutdown () throws SQLException, IOException;
+
+       /**
+        * Some getter for total rows
+        *
+        * @return Total rows
+        * @throws java.io.IOException If an IO error occurs
+        * @throws java.sql.SQLException If any SQL error occurs
         */
-       public void doShutdown ();
+       public int getTotalRows () throws IOException, SQLException;
 }