Révision 1135
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZImport.groovy (revision 1135) | ||
---|---|---|
12 | 12 |
import org.txm.objects.BaseParameters |
13 | 13 |
import org.txm.utils.io.FileCopy; |
14 | 14 |
import org.txm.* |
15 |
import org.txm.objects.* |
|
15 | 16 |
import org.w3c.dom.Element |
16 | 17 |
import org.txm.importer.xtz.* |
17 | 18 |
|
... | ... | |
21 | 22 |
super(importParametersFile); |
22 | 23 |
} |
23 | 24 |
|
24 |
public XTZImport(BaseParameters importParameters) {
|
|
25 |
super(importParameters);
|
|
25 |
public XTZImport(Project p) {
|
|
26 |
super(p);
|
|
26 | 27 |
} |
27 | 28 |
|
28 | 29 |
@Override |
29 |
public void init(BaseParameters p) {
|
|
30 |
public void init(Project p) {
|
|
30 | 31 |
super.init(p); |
31 | 32 |
|
32 | 33 |
importer = new XTZImporter(this) |
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZImporter.groovy (revision 1135) | ||
---|---|---|
21 | 21 |
import org.xml.sax.XMLReader |
22 | 22 |
import org.txm.utils.xml.DomUtils |
23 | 23 |
import org.txm.metadatas.Metadatas |
24 |
import org.txm.objects.BaseParameters
|
|
24 |
import org.txm.objects.*
|
|
25 | 25 |
import org.txm.importer.scripts.xmltxm.Xml2Ana |
26 | 26 |
import org.txm.stat.utils.ConsoleProgressBar |
27 | 27 |
import org.txm.utils.io.* |
... | ... | |
54 | 54 |
|
55 | 55 |
public void process() { |
56 | 56 |
|
57 |
BaseParameters params = module.getParameters();
|
|
57 |
Project project = module.getProject();
|
|
58 | 58 |
File binDir = module.getBinaryDirectory(); |
59 | 59 |
|
60 |
String corpusname = params.getCorpusName(); |
|
61 |
Element corpusElem = params.corpora.get(corpusname); |
|
60 |
String corpusname = project.getName(); |
|
62 | 61 |
|
63 | 62 |
def srcFiles = []; |
64 | 63 |
def files = inputDirectory.listFiles(); |
... | ... | |
94 | 93 |
} |
95 | 94 |
|
96 | 95 |
// prepare front XSL if any |
97 |
xslPath = params.getXsltElement(corpusElem).getAttribute("xsl")
|
|
98 |
xslParams = params.getXsltParams(corpusElem);
|
|
96 |
xslPath = project.getFrontXSL()
|
|
97 |
xslParams = project.getXsltParameters()
|
|
99 | 98 |
|
100 |
lang = corpusElem.getAttribute("lang");
|
|
99 |
lang = project.getLang();
|
|
101 | 100 |
|
102 |
wordTag = module.getParameters().getWordElement().getTextContent()
|
|
101 |
wordTag = project.getTokenizerParameter(name, defaultvalue)
|
|
103 | 102 |
this.skipDoTokenizeStep = module.getParameters().getSkipTokenization() |
104 | 103 |
|
105 | 104 |
//prepare metadata if any |
tmp/org.txm.groovy.core/src/java/org/txm/groovy/core/GroovyScriptedImportEngine.java (revision 1135) | ||
---|---|---|
1 | 1 |
package org.txm.groovy.core; |
2 | 2 |
|
3 | 3 |
import java.io.File; |
4 |
import java.util.Collection; |
|
5 |
import java.util.List; |
|
4 | 6 |
import java.util.logging.Level; |
5 | 7 |
|
6 | 8 |
import org.eclipse.core.runtime.IProgressMonitor; |
... | ... | |
11 | 13 |
import org.txm.core.engines.Engine; |
12 | 14 |
import org.txm.core.engines.EngineType; |
13 | 15 |
import org.txm.core.engines.ScriptedImportEngine; |
16 |
import org.txm.core.results.TXMResult; |
|
17 |
import org.txm.objects.CorpusBuild; |
|
18 |
import org.txm.objects.Edition; |
|
14 | 19 |
import org.txm.objects.Project; |
20 |
import org.txm.objects.Text; |
|
15 | 21 |
import org.txm.searchengine.cqp.CQPSearchEngine; |
16 | 22 |
import org.txm.tokenizer.TokenizerClasses; |
17 | 23 |
import org.txm.utils.ExecTimer; |
... | ... | |
49 | 55 |
return Status.CANCEL_STATUS; |
50 | 56 |
} |
51 | 57 |
} |
58 |
|
|
59 |
if (project.getDoUpdate()) { |
|
60 |
// drop CorpusBuild and Editions |
|
61 |
List<? extends CorpusBuild> corpora = project.getCorpora(); |
|
62 |
while (corpora.size() > 0) { |
|
63 |
CorpusBuild c = corpora.get(0); |
|
64 |
c.delete(); |
|
65 |
} |
|
66 |
|
|
67 |
List<Text> texts = project.getTexts(); |
|
68 |
for (Text t : texts) { |
|
69 |
List<Edition> editions = t.getEditions(); |
|
70 |
while (editions.size() > 0) { |
|
71 |
Edition ed = editions.get(0); |
|
72 |
ed.delete(); |
|
73 |
} |
|
74 |
} |
|
75 |
|
|
76 |
} else { |
|
77 |
// clear all children |
|
78 |
while (project.getChildren().size() > 0) { |
|
79 |
TXMResult child = project.getChildren().get(0); |
|
80 |
child.delete(); |
|
81 |
} |
|
52 | 82 |
|
83 |
} |
|
84 |
|
|
53 | 85 |
// the binary directory which is going to be created |
54 | 86 |
|
55 |
final File basedir = project.getProjectDirectory(); |
|
87 |
// final File basedir = project.getProjectDirectory();
|
|
56 | 88 |
// final File tempBinDirectory = new File(basedir.getAbsolutePath()+"_temp"); //$NON-NLS-1$ |
57 | 89 |
// final File errorBinDirectory = new File(basedir.getAbsolutePath()+"_error"); //$NON-NLS-1$ |
58 | 90 |
// if (tempBinDirectory.exists()) DeleteDir.deleteDirectory(tempBinDirectory); |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/EditionSection.java (revision 1135) | ||
---|---|---|
236 | 236 |
imageDirectoryText.setEnabled(buildFacsEditionCheckButton.getSelection()); |
237 | 237 |
|
238 | 238 |
String imageDirectory = edition_params.getImagesDirectory(); //$NON-NLS-1$ |
239 |
if (imageDirectoryText != null) |
|
239 |
if (imageDirectoryText != null && imageDirectory != null)
|
|
240 | 240 |
imageDirectoryText.setText(imageDirectory); |
241 | 241 |
} |
242 | 242 |
} |
tmp/org.txm.core/src/java/org/txm/objects/Project.java (revision 1135) | ||
---|---|---|
63 | 63 |
import org.txm.core.results.Parameter; |
64 | 64 |
import org.txm.core.results.TXMParameters; |
65 | 65 |
import org.txm.core.results.TXMResult; |
66 |
import org.txm.importer.xtz.ImportKeys; |
|
66 | 67 |
import org.txm.stat.utils.ConsoleProgressBar; |
67 | 68 |
import org.txm.utils.logger.Log; |
68 | 69 |
import org.txm.utils.zip.Zip; |
... | ... | |
808 | 809 |
rcpProject.move(destination, true, null); |
809 | 810 |
} |
810 | 811 |
|
811 |
// clear all children |
|
812 |
while (getChildren().size() > 0) { |
|
813 |
TXMResult child = getChildren().get(0); |
|
814 |
child.delete(); |
|
815 |
} |
|
816 |
|
|
817 | 812 |
ImportEngines engines = Toolbox.getImportEngines(); |
818 | 813 |
System.out.println("RUNNING IMPORT MODULE WITH NAME="+getImportModuleName()); |
819 | 814 |
//File scriptfile = new File(Toolbox.getTxmHomePath(), "scripts/groovy/user/org/txm/scripts/importer/"+importName+"/"+importName+"Loader.groovy"); //$NON-NLS-1$ |
... | ... | |
995 | 990 |
return params.get(name, defaultvalue); |
996 | 991 |
} |
997 | 992 |
|
993 |
public String getTokenizerWordElement() { |
|
994 |
IEclipsePreferences params = this.getPreferencesScope().getNode("Tokenizer"); |
|
995 |
return params.get("wordelement", "w"); |
|
996 |
} |
|
997 |
|
|
998 | 998 |
public boolean getDoTokenizerStep() { |
999 | 999 |
IEclipsePreferences params = this.getPreferencesScope().getNode("Tokenizer"); |
1000 | 1000 |
return params.getBoolean("doTokenizeStep", true); |
... | ... | |
1052 | 1052 |
return "project/" + this.rcpProject.getName() + "/"; |
1053 | 1053 |
} |
1054 | 1054 |
|
1055 |
public Collection<? extends CorpusBuild> getCorpora() {
|
|
1055 |
public List<? extends CorpusBuild> getCorpora() {
|
|
1056 | 1056 |
ArrayList<CorpusBuild> l = new ArrayList<>(); |
1057 | 1057 |
for (TXMResult r : getChildren()) { |
1058 | 1058 |
if (r instanceof CorpusBuild) { |
... | ... | |
1061 | 1061 |
} |
1062 | 1062 |
return l; |
1063 | 1063 |
} |
1064 |
|
|
1065 |
public boolean getDoUpdate() { |
|
1066 |
return this.getPreferencesScope().getNode("import").getBoolean(ImportKeys.UPDATECORPUS, false); |
|
1067 |
} |
|
1068 |
|
|
1069 |
public boolean getDoMultiThread() { |
|
1070 |
return this.getPreferencesScope().getNode("import").getBoolean(ImportKeys.MULTITHREAD, false); |
|
1071 |
} |
|
1064 | 1072 |
} |
tmp/org.txm.core/src/java/org/txm/importer/xtz/ImportModule.java (revision 1135) | ||
---|---|---|
61 | 61 |
return updateCorpus; |
62 | 62 |
} |
63 | 63 |
|
64 |
protected void init(Project p) {
|
|
64 |
public void init(Project p) {
|
|
65 | 65 |
this.project = p; |
66 | 66 |
corpusName = project.getName(); |
67 | 67 |
//this.debug = "true".equals(project.getKeyValueParameters().get(ImportKeys.DEBUG)); |
... | ... | |
69 | 69 |
if (Log.getLevel().intValue() < Level.WARNING.intValue()) { |
70 | 70 |
debug = true; |
71 | 71 |
} |
72 |
this.multithread = project.getPreferencesScope().getNode("import").getBoolean(ImportKeys.MULTITHREAD, false);
|
|
73 |
this.updateCorpus = project.getPreferencesScope().getNode("import").getBoolean(ImportKeys.UPDATECORPUS, false);
|
|
72 |
this.multithread = project.getDoMultiThread();
|
|
73 |
this.updateCorpus = project.getDoUpdate();
|
|
74 | 74 |
|
75 | 75 |
|
76 | 76 |
this.sourceDirectory = project.getSrcdir(); |
tmp/org.txm.partition.rcp/src/org/txm/partition/rcp/editors/PartitionDimensionsEditor.java (revision 1135) | ||
---|---|---|
39 | 39 |
this.sortByPartSize.setToolTipText(PartitionUIMessages.PreferencesPage_DIMENSIONS_SORT_BY_PARTS_SIZE); |
40 | 40 |
|
41 | 41 |
this.sortByPartSize.addSelectionListener(new ComputeSelectionListener(this)); |
42 |
|
|
43 |
|
|
42 | 44 |
} |
43 | 45 |
|
44 | 46 |
|
Formats disponibles : Unified diff