001package fr.ifremer.adagio.core.service;
002
003/*
004 * #%L
005 * SIH-Adagio :: Shared
006 * $Id:$
007 * $HeadURL:$
008 * %%
009 * Copyright (C) 2012 - 2014 Ifremer
010 * %%
011 * This program is free software: you can redistribute it and/or modify
012 * it under the terms of the GNU Affero General Public License as published by
013 * the Free Software Foundation, either version 3 of the License, or
014 * (at your option) any later version.
015 * 
016 * This program is distributed in the hope that it will be useful,
017 * but WITHOUT ANY WARRANTY; without even the implied warranty of
018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
019 * GNU General Public License for more details.
020 * 
021 * You should have received a copy of the GNU Affero General Public License
022 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
023 * #L%
024 */
025
026
027
028import java.io.File;
029import java.io.IOException;
030
031import org.nuiton.util.Version;
032import org.springframework.transaction.annotation.Transactional;
033
034@Transactional(readOnly = true)
035public interface DatabaseSchemaService {
036
037    Version getDbVersion();
038
039    Version getApplicationVersion();
040
041    @Transactional(readOnly = false)
042    void updateSchema();
043    
044    /**
045     * Check if connection could be open.
046     * If a validation query has been set in configuration, test it
047     * @return if db is loaded
048     */
049    boolean isDbLoaded();
050    
051    /**
052     * Check if db files exists. If not a database file, return true
053     * @return if db files exists
054     */
055    boolean isDbExists();
056    
057    /**
058     * Report into a file the liquibase status of database 
059     */
060    public void generateStatusReport(File outputFile) throws IOException;
061    
062    /**
063     * Generate a diff report, from Hibernate model to database 
064     */
065    public void generateDiffReport(File outputFile) throws IOException;
066    
067    /**
068     * Generate a diff changelog, from Hibernate model to database 
069     */
070    public void generateDiffChangeLog(File outputFile) throws IOException;
071}