]> git.mxchange.org Git - jcore.git/blob - src/org/mxchange/jcore/database/backend/DatabaseBackend.java
26a6c4ca2153fb9e6481b591ebad2c80814ed7fc
[jcore.git] / src / org / mxchange / jcore / database / backend / DatabaseBackend.java
1 /*
2  * Copyright (C) 2015 Roland Haeder
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17 package org.mxchange.jcore.database.backend;
18
19 import java.sql.SQLException;
20 import org.mxchange.jcore.FrameworkInterface;
21 import org.mxchange.jcore.criteria.searchable.SearchableCritera;
22 import org.mxchange.jcore.database.result.Result;
23 import org.mxchange.jcore.database.storage.Storeable;
24
25 /**
26  * A generic interface for database frontends
27  *
28  * @author Roland Haeder
29  */
30 public interface DatabaseBackend extends FrameworkInterface {
31
32         /**
33          * Tries a connection to the database
34          * 
35          * @throws java.sql.SQLException If the connection attempt fails
36          */
37         public void connectToDatabase () throws SQLException;
38
39         /**
40          * Run a "SELECT" statement with given criteria and always return a Result
41          * instance. The result instance then provides methods to iterate over all
42          * found entries.
43          *
44          * @param critera Search critera
45          * @return A result instance
46          */
47         public Result<? extends Storeable> doSelectByCriteria (final SearchableCritera critera);
48
49         /**
50          * Shuts down this backend
51          */
52         public void doShutdown ();
53 }