001package fr.ifremer.adagio.synchro.service.referential;
002
003/*
004 * #%L
005 * Tutti :: Persistence
006 * $Id: ReferentialSynchroService.java 1573 2014-02-04 16:41:40Z tchemit $
007 * $HeadURL: http://svn.forge.codelutin.com/svn/tutti/trunk/tutti-persistence/src/main/java/fr/ifremer/adagio/core/service/technical/synchro/ReferentialSynchroService.java $
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
026import java.io.File;
027import java.util.Properties;
028
029import org.springframework.transaction.annotation.Propagation;
030import org.springframework.transaction.annotation.Transactional;
031
032import fr.ifremer.adagio.synchro.service.SynchroContext;
033
034/**
035 * Created on 1/14/14.
036 * 
037 * @author Tony Chemit <chemit@codelutin.com>
038 * @since 3.0
039 */
040public interface ReferentialSynchroService {
041
042    /**
043     * Create a synchro context, from a source database directory (HSQLDB only).
044     * This use local connection properties as source properties, but change JDBC URL to use the given directory
045     * 
046     * @param sourceDbDirectory
047     *            a directory with a HSQLDB directory.
048     * @return a new context for synchronization
049     */
050    SynchroContext createSynchroContext(File sourceDbDirectory);
051
052    /**
053     * Create a synchro context, using configuration properties for target and source properties.
054     * 
055     * @param sourceConnectionProperties
056     *            Properties to use as source connection (could be Oracle, HSQLDB...)
057     * @return a new context for synchronization
058     */
059    SynchroContext createSynchroContext(Properties sourceConnectionProperties);
060
061    /**
062     * Prepare the synchronize operation from the local data database supported
063     * by this service, says just compute nb rows to update for each table and
064     * update the result model.
065     * 
066     * @param synchroContext
067     *            context of synchro operation
068     */
069    void prepare(SynchroContext synchroContext);
070
071    /**
072     * Launch the synchronize operation from the local data database supported
073     * by this service.
074     * 
075     * @param synchroContext
076     *            context of synchro operation
077     */
078    void synchronize(SynchroContext synchroContext);
079}