View Javadoc
1   /*******************************************************************************
2    *   Gisgraphy Project 
3    * 
4    *   This library is free software; you can redistribute it and/or
5    *   modify it under the terms of the GNU Lesser General Public
6    *   License as published by the Free Software Foundation; either
7    *   version 2.1 of the License, or (at your option) any later version.
8    * 
9    *   This library is distributed in the hope that it will be useful,
10   *   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12   *   Lesser General Public License for more details.
13   * 
14   *   You should have received a copy of the GNU Lesser General Public
15   *   License along with this library; if not, write to the Free Software
16   *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
17   * 
18   *  Copyright 2008  Gisgraphy project 
19   *  David Masclet <davidmasclet@gisgraphy.com>
20   *  
21   *  
22   *******************************************************************************/
23  package com.gisgraphy.importer;
24  
25  import java.util.List;
26  
27  import com.gisgraphy.domain.valueobject.ImporterStatusDto;
28  
29  public interface IImporterManager {
30  
31      /**
32       * synchronized method to Import all the GisFeatures according the
33       * {@link ImporterConfig} and the several importers define in the
34       * applicationContext-geoloc file.
35       */
36      public void importAll();
37  
38      /**
39       * @return the importerConfig
40       */
41      public ImporterConfig getImporterConfig();
42  
43      /**
44       * @return the importers
45       */
46      public List<IImporterProcessor> getImporters();
47  
48      /**
49       * @return Wether an import is in Progress
50       */
51      public boolean isInProgress();
52  
53      /**
54       * @return Wether the import has already been done (error or successful)
55       * @throws ImporterMetaDataException 
56       */
57      public boolean isAlreadyDone() throws ImporterMetaDataException;
58  
59      /**
60       * @return the time the last import took. If the import is in progress,
61       *         returns the time it took from the beginning. If the import has
62       *         not been started yet return 0.
63       */
64      public long getTimeElapsed();
65  
66      /**
67       * @return The human readable elapsed time .
68       * 
69       */
70      public String getFormatedTimeElapsed();
71  
72      /**
73       * /!\ USE THIS METHOD VERY CAREFULLY /!\ : If you call this function, all
74       * the imported data will be deleted clear all the tables with GisFeature
75       * (and subclass, adm, languages, country,...), delete alternatenames,
76       * delete all the fulltext search engine entries, in order to re-run a new
77       * import from scratch
78       * 
79       * @return a list with the SQL Errors and warnings. note
80       *         that you can have warning but the reset can be successful
81       * 
82       * @throws Exception
83       */
84      public List<String> resetImport() throws Exception;
85  
86      /**
87       * @return a list of DTO for each importers
88       */
89      public List<ImporterStatusDto> getStatusDtoList();
90  
91  }