Statistics
| Revision:

root / tmp / org.txm.tigersearch.rcp / groovy / org / txm / importer / tigersearch / TSImporter.groovy @ 966

History | View | Annotate | Download (1.2 kB)

1
package org.txm.importer.tigersearch
2

    
3
import org.txm.Toolbox
4
import org.txm.importer.xtz.ImportModule;
5
import org.txm.importer.xtz.XTZImporter
6
import org.txm.metadatas.Metadatas
7
import org.txm.utils.io.FileCopy
8

    
9
/**
10
 * Only build the Metadatas object since all XML-TXM files already exists.
11
 * Metadatas is used to build text order.
12
 * 
13
 * 
14
 * @author mdecorde
15
 *
16
 */
17
class TSImporter extends XTZImporter {
18

    
19
        public TSImporter(ImportModule module) {
20
                super(module);
21
        }
22
        
23
        @Override
24
        public void process() {
25
                File binDir = module.getBinaryDirectory();
26
                
27
                //prepare metadata if any
28
                File allmetadatafile = Metadatas.findMetadataFile(inputDirectory);
29
                println allmetadatafile
30
                if (allmetadatafile.exists()) {
31
                        File copy = new File(binDir, allmetadatasfile.getName())
32
                        if (!FileCopy.copy(allmetadatafile, copy)) {
33
                                println "Error: could not create a copy of the metadata file "+allmetadatafile.getAbsoluteFile();
34
                                return;
35
                        }
36
                        this.metadata = new Metadatas(copy,
37
                                        Toolbox.getPreference(Toolbox.METADATA_ENCODING),
38
                                        Toolbox.getPreference(Toolbox.METADATA_COLSEPARATOR),
39
                                        Toolbox.getPreference(Toolbox.METADATA_TXTSEPARATOR), 1)
40
                }
41
                isSuccessFul = true;
42
        }
43
}