001package fr.ifremer.adagio.synchro.service.data; 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 5/13/14. 036 * 037 * @author Benoit Lavenier <benoit.lavenier@e-is.pro> 038 * @since 3.5.2 039 */ 040@Transactional(readOnly = true, propagation = Propagation.NOT_SUPPORTED) 041public interface DataSynchroService { 042 043 /** 044 * Create a synchro context, from a source database directory (HSQLDB only). 045 * This use local connection properties as source properties, but change JDBC URL to use the given directory 046 * 047 * @param sourceDbDirectory 048 * a directory with a HSQLDB directory. 049 * @return a new context for synchronization 050 */ 051 SynchroContext createSynchroContext(File sourceDbDirectory); 052 053 /** 054 * Create a synchro context, using configuration properties for target and source properties. 055 * 056 * @param sourceConnectionProperties 057 * Properties to use as source connection (could be Oracle, HSQLDB...) 058 * @return a new context for synchronization 059 */ 060 SynchroContext createSynchroContext(Properties sourceConnectionProperties); 061 062 /** 063 * Prepare the synchronize operation from the target data database supported 064 * by this service, says just compute nb rows to update for each table and 065 * update the result model. 066 * 067 * @param synchroContext 068 * Context of synchronization 069 */ 070 void prepare(SynchroContext synchroContext); 071 072 /** 073 * Launch the synchronize operation from the target data database supported 074 * by this service. 075 * 076 * @param synchroContext 077 * Context of synchronization 078 */ 079 @Transactional(readOnly = false, propagation = Propagation.REQUIRED) 080 void synchronize(SynchroContext synchroContext); 081}