View Javadoc
1   package fr.ifremer.adagio.synchro.service.referential;
2   
3   /*
4    * #%L
5    * Tutti :: Persistence
6    * $Id: ReferentialSynchroService.java 1573 2014-02-04 16:41:40Z tchemit $
7    * $HeadURL: http://svn.forge.codelutin.com/svn/tutti/trunk/tutti-persistence/src/main/java/fr/ifremer/adagio/core/service/technical/synchro/ReferentialSynchroService.java $
8    * %%
9    * Copyright (C) 2012 - 2014 Ifremer
10   * %%
11   * This program is free software: you can redistribute it and/or modify
12   * it under the terms of the GNU Affero General Public License as published by
13   * the Free Software Foundation, either version 3 of the License, or
14   * (at your option) any later version.
15   * 
16   * This program is distributed in the hope that it will be useful,
17   * but WITHOUT ANY WARRANTY; without even the implied warranty of
18   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19   * GNU General Public License for more details.
20   * 
21   * You should have received a copy of the GNU Affero General Public License
22   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
23   * #L%
24   */
25  
26  import java.io.File;
27  import java.util.Properties;
28  
29  import org.springframework.transaction.annotation.Propagation;
30  import org.springframework.transaction.annotation.Transactional;
31  
32  import fr.ifremer.adagio.synchro.service.SynchroContext;
33  
34  /**
35   * Created on 1/14/14.
36   * 
37   * @author Tony Chemit <chemit@codelutin.com>
38   * @since 3.0
39   */
40  public interface ReferentialSynchroService {
41  
42  	/**
43  	 * Create a synchro context, from a source database directory (HSQLDB only).
44  	 * This use local connection properties as source properties, but change JDBC URL to use the given directory
45  	 * 
46  	 * @param sourceDbDirectory
47  	 *            a directory with a HSQLDB directory.
48  	 * @return a new context for synchronization
49  	 */
50  	SynchroContext createSynchroContext(File sourceDbDirectory);
51  
52  	/**
53  	 * Create a synchro context, using configuration properties for target and source properties.
54  	 * 
55  	 * @param sourceConnectionProperties
56  	 *            Properties to use as source connection (could be Oracle, HSQLDB...)
57  	 * @return a new context for synchronization
58  	 */
59  	SynchroContext createSynchroContext(Properties sourceConnectionProperties);
60  
61  	/**
62  	 * Prepare the synchronize operation from the local data database supported
63  	 * by this service, says just compute nb rows to update for each table and
64  	 * update the result model.
65  	 * 
66  	 * @param synchroContext
67  	 *            context of synchro operation
68  	 */
69  	void prepare(SynchroContext synchroContext);
70  
71  	/**
72  	 * Launch the synchronize operation from the local data database supported
73  	 * by this service.
74  	 * 
75  	 * @param synchroContext
76  	 *            context of synchro operation
77  	 */
78  	void synchronize(SynchroContext synchroContext);
79  }