Revision 2080 tmp/org.txm.tigersearch.rcp/groovy/org/txm/scripts/importer/tigersearch/tigersearchLoader.groovy

tigersearchLoader.groovy (revision 2080)
19 19
// Public License along with the TXM platform. If not, see
20 20
// http://www.gnu.org/licenses.
21 21
//
22
//
23
//
22 24
// $LastChangedDate: 2015-06-03 15:04:53 +0200 (mer., 03 juin 2015) $
23 25
// $LastChangedRevision: 2984 $
24 26
// $LastChangedBy: mdecorde $
25 27
//
26 28
package org.txm.scripts.importer.tigersearch;
27 29

  
28
import javax.xml.stream.XMLStreamReader;
30
import javax.xml.stream.*
29 31

  
30
import org.txm.scripts.importer.RemoveTag;
31
import org.txm.importer.ApplyXsl2;
32
import org.txm.importer.ValidateXml;
33
import org.txm.objects.*;
34
import org.txm.tokenizer.TokenizerClasses;
35
import org.txm.utils.*;
36
import org.txm.*;
37
import org.txm.importer.xmltxm.*;
38
import org.txm.utils.i18n.*;
39
import org.txm.metadatas.*;
40
import javax.xml.stream.*;
41
import org.w3c.dom.Element
42
import org.txm.utils.xml.DomUtils;
32
import org.txm.*
33
import org.txm.metadatas.*
34
import org.txm.objects.*
35
import org.txm.importer.scripts.xmltxm.*
36
import org.txm.tokenizer.TokenizerClasses
37
import org.txm.utils.*
38
import org.txm.utils.i18n.*
43 39
import org.txm.importer.xtz.*
44 40

  
45 41
String userDir = System.getProperty("user.home");
46 42

  
47 43
def MONITOR;
48
boolean debug = org.txm.utils.logger.Log.isPrintingErrors();
49
BaseParameters params;
50
try {params = paramsBinding;MONITOR=monitor} catch (Exception)
51
{	println "DEV MODE";//exception means we debug
52
	debug = true
53
	params = new BaseParameters(new File(userDir, "xml/roland/import.xml"))
54
	params.load()
55
}
44
Project project;
56 45

  
57
if (params == null) { println "no parameters. Aborting"; return; }
46
try {project=projectBinding;MONITOR=monitor} catch (Exception)
47
{	}
48
if (project == null) { println "no project set. Aborting"; return; }
58 49

  
59
//params.getKeyValueParameters().put(ImportKeys.CLEAN, "false")
60
//params.getKeyValueParameters().put(ImportKeys.MULTITHREAD, "false")
61
//params.getKeyValueParameters().put(ImportKeys.DEBUG, "false")
62
//params.getKeyValueParameters().put(ImportKeys.UPDATECORPUS, "false")
63

  
64
TSImport i = new TSImport(params);
50
TSImport i = new TSImport(project);
51
/*
52
 * To customize the XTZ import, replace the importer, compiler, annotater or pager objects before calling process()
53
		i.importer = new XTZImporter(i)
54
		i.compiler = new XTZCompiler(i)
55
		i.annotater = new TTAnnotater(i);
56
		i.pager = new XTZPager(i)
57
 */
65 58
i.process();
66
readyToLoad = i.isSuccessful
59
readyToLoad = i.successFul && project.save()

Also available in: Unified diff