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.ImporterStatus;
28  import com.gisgraphy.domain.valueobject.NameValueDTO;
29  
30  /**
31   * Interface for Geonames processor
32   * 
33   * @author <a href="mailto:david.masclet@gisgraphy.com">David Masclet</a>
34   */
35  public interface IImporterProcessor {
36  
37      /**
38       * Do the stuff...
39       */
40      public void process();
41  
42      /**
43       * The number of read line for the current processed file
44       * 
45       * @see #getTotalReadLine()
46       */
47      public long getReadFileLine();
48  
49      /**
50       * The number of read line for all the processed file
51       * 
52       * @see #getReadFileLine()
53       */
54      public long getTotalReadLine();
55  
56      /**
57       * @return The name of the file currently processed or null if no file is
58       *         processed
59       */
60      public String getCurrentFileName();
61  
62      /**
63       * @return The number of line the processor will process. (it is not the
64       *         number of lines left!)
65       */
66      public long getNumberOfLinesToProcess();
67  
68      /**
69       * @return The current status of the importer
70       */
71      public ImporterStatus getStatus();
72  
73      /**
74       * @return A text Message for the importer
75       */
76      public String getStatusMessage();
77  
78      /**
79       * /!\ USE THIS METHOD VERY CAREFULLY /!\ : If you call this function, all
80       * the imported data for the specified importer will be deleted
81       * 
82       * @return a {@linkplain NameValueDTO} with the name of the deleted object
83       *         and the number of deleted Object. No entry will be return for
84       *         Object that were 0 object will be deleted except if an error occurred during the deletion.
85       */
86      public List<NameValueDTO<Integer>> rollback();
87  
88      /**
89       * @return true if the processor should Not be executed
90       */
91      public boolean shouldBeSkipped();
92  
93      /**
94       * Reset status fields, it should be done when the import has been canceled
95       */
96      public void resetStatus();
97  
98  }