|
|
@@ -1,72 +1,20 @@
|
|
|
package uk.ac.ic.wlgitbridge.data.model.db;
|
|
|
|
|
|
-import uk.ac.ic.wlgitbridge.data.model.db.sql.SQLiteWLDatabase;
|
|
|
-
|
|
|
-import java.io.File;
|
|
|
-import java.sql.SQLException;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
- * Created by Winston on 19/11/14.
|
|
|
+ * Created by m on 20/11/15.
|
|
|
*/
|
|
|
-public class PersistentStore {
|
|
|
-
|
|
|
- private final SQLiteWLDatabase database;
|
|
|
-
|
|
|
- public PersistentStore(File rootGitDirectory) {
|
|
|
- try {
|
|
|
- database = new SQLiteWLDatabase(rootGitDirectory);
|
|
|
- } catch (SQLException e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
- } catch (ClassNotFoundException e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
- }
|
|
|
- }
|
|
|
+public interface PersistentStore {
|
|
|
+ List<String> getProjectNames();
|
|
|
|
|
|
- public List<String> getProjectNames() {
|
|
|
- try {
|
|
|
- return database.getProjectNames();
|
|
|
- } catch (SQLException e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
- }
|
|
|
- }
|
|
|
- public void setLatestVersionForProject(String project, int versionID) {
|
|
|
- try {
|
|
|
- database.setVersionIDForProject(project, versionID);
|
|
|
- } catch (SQLException e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
- }
|
|
|
- }
|
|
|
+ void setLatestVersionForProject(String project, int versionID);
|
|
|
|
|
|
- public int getLatestVersionForProject(String project) {
|
|
|
- try {
|
|
|
- return database.getVersionIDForProjectName(project);
|
|
|
- } catch (SQLException e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
- }
|
|
|
- }
|
|
|
+ int getLatestVersionForProject(String project);
|
|
|
|
|
|
- public void addURLIndexForProject(String projectName, String url, String path) {
|
|
|
- try {
|
|
|
- database.addURLIndex(projectName, url, path);
|
|
|
- } catch (SQLException e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
- }
|
|
|
- }
|
|
|
+ void addURLIndexForProject(String projectName, String url, String path);
|
|
|
|
|
|
- public void deleteFilesForProject(String project, String... files) {
|
|
|
- try {
|
|
|
- database.deleteFilesForProject(project, files);
|
|
|
- } catch (SQLException e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
- }
|
|
|
- }
|
|
|
- public String getPathForURLInProject(String projectName, String url) {
|
|
|
- try {
|
|
|
- return database.getPathForURLInProject(projectName, url);
|
|
|
- } catch (SQLException e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
- }
|
|
|
- }
|
|
|
+ void deleteFilesForProject(String project, String... files);
|
|
|
|
|
|
+ String getPathForURLInProject(String projectName, String url);
|
|
|
}
|