Révision 714
tmp/org.txm.imports.metopes/plugin.xml (revision 714) | ||
---|---|---|
6 | 6 |
<menuContribution |
7 | 7 |
locationURI="menu:menu.file.import?before=menu.file.import.separator.software"> |
8 | 8 |
<command |
9 |
commandId="org.txm.rcp.commands.ExecuteScriptImport"
|
|
9 |
commandId="org.txm.rcp.handlers.scripts.ExecuteImportScript"
|
|
10 | 10 |
label="XML-TEI Metopes" |
11 | 11 |
style="push" |
12 | 12 |
tooltip="Metopes"> |
tmp/org.txm.libs.cqp/plugin.xml (revision 714) | ||
---|---|---|
2 | 2 |
<?eclipse version="3.4"?> |
3 | 3 |
<plugin> |
4 | 4 |
<extension |
5 |
point="org.txm.postinstallationstep">
|
|
5 |
point="org.txm.PostInstallationStep">
|
|
6 | 6 |
<PostInstallationStep |
7 | 7 |
class="org.txm.libs.cqp.DoInstallStep" |
8 | 8 |
description="Set CQP preferences" |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteGroovyScript.java (revision 714) | ||
---|---|---|
378 | 378 |
String acName = b.getHeaders().get("Bundle-Activator"); |
379 | 379 |
Class<?> ac = b.loadClass(acName); |
380 | 380 |
loaders.add(ac.getClassLoader()); |
381 |
} catch (ClassNotFoundException e) {
|
|
382 |
e.printStackTrace();
|
|
381 |
} catch (Throwable e) {
|
|
382 |
System.out.println("Bundle Activator error: "+e);
|
|
383 | 383 |
} |
384 | 384 |
} |
385 | 385 |
Log.info("Initialized TXMClassLoader with "+loaders.size()+ " bundles."); |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/listeners/ComputeSelectionListener.java (revision 714) | ||
---|---|---|
7 | 7 |
import org.eclipse.jface.viewers.SelectionChangedEvent; |
8 | 8 |
import org.eclipse.swt.events.SelectionEvent; |
9 | 9 |
import org.eclipse.swt.events.SelectionListener; |
10 |
import org.txm.core.results.TXMResult; |
|
10 | 11 |
import org.txm.rcp.editors.TXMEditor; |
11 | 12 |
|
12 | 13 |
/** |
... | ... | |
16 | 17 |
*/ |
17 | 18 |
public class ComputeSelectionListener extends BaseAbstractComputeListener implements SelectionListener, ISelectionChangedListener { |
18 | 19 |
|
19 |
|
|
20 |
|
|
21 | 20 |
/** |
22 | 21 |
* |
23 | 22 |
* @param editor |
24 | 23 |
*/ |
25 |
public ComputeSelectionListener(TXMEditor editor) { |
|
24 |
public ComputeSelectionListener(TXMEditor<? extends TXMResult> editor) {
|
|
26 | 25 |
super(editor); |
27 | 26 |
} |
28 | 27 |
|
... | ... | |
34 | 33 |
@Override |
35 | 34 |
public void widgetDefaultSelected(SelectionEvent e) { |
36 | 35 |
// TODO Auto-generated method stub |
37 |
|
|
38 | 36 |
} |
39 | 37 |
|
40 | 38 |
@Override |
... | ... | |
44 | 42 |
this.editor.compute(false); |
45 | 43 |
} |
46 | 44 |
} |
47 |
|
|
48 |
|
|
49 | 45 |
} |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/listeners/ComputeKeyListener.java (revision 714) | ||
---|---|---|
6 | 6 |
import org.eclipse.swt.SWT; |
7 | 7 |
import org.eclipse.swt.events.KeyEvent; |
8 | 8 |
import org.eclipse.swt.events.KeyListener; |
9 |
import org.txm.core.results.TXMResult; |
|
9 | 10 |
import org.txm.rcp.editors.TXMEditor; |
10 | 11 |
|
11 | 12 |
/** |
... | ... | |
21 | 22 |
/** |
22 | 23 |
* @param editor |
23 | 24 |
*/ |
24 |
public ComputeKeyListener(TXMEditor editor) { |
|
25 |
public ComputeKeyListener(TXMEditor<? extends TXMResult> editor) {
|
|
25 | 26 |
super(editor); |
26 | 27 |
} |
27 | 28 |
|
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/listeners/BaseAbstractComputeListener.java (revision 714) | ||
---|---|---|
6 | 6 |
import java.util.EventObject; |
7 | 7 |
|
8 | 8 |
import org.eclipse.jface.viewers.Viewer; |
9 |
import org.txm.core.results.TXMResult; |
|
9 | 10 |
import org.txm.rcp.editors.TXMEditor; |
10 | 11 |
|
11 | 12 |
/** |
... | ... | |
19 | 20 |
/** |
20 | 21 |
* Linked editor. |
21 | 22 |
*/ |
22 |
protected TXMEditor editor; |
|
23 |
protected TXMEditor<? extends TXMResult> editor;
|
|
23 | 24 |
|
24 | 25 |
|
25 | 26 |
/** |
26 | 27 |
* |
27 | 28 |
* @param editor |
28 | 29 |
*/ |
29 |
public BaseAbstractComputeListener(TXMEditor editor) { |
|
30 |
public BaseAbstractComputeListener(TXMEditor<? extends TXMResult> editor) {
|
|
30 | 31 |
this.editor = editor; |
31 | 32 |
} |
32 | 33 |
|
33 | 34 |
|
34 | 35 |
/** |
35 |
* To skip programmatically setSelection() call. |
|
36 |
* To skip programmatically setSelection() call. The event source Viewer must set the "ignore" option
|
|
36 | 37 |
* @param event |
37 | 38 |
* @return |
38 | 39 |
*/ |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 714) | ||
---|---|---|
64 | 64 |
*/ |
65 | 65 |
public abstract class TXMEditor<T extends TXMResult> extends EditorPart { |
66 | 66 |
|
67 |
|
|
68 | 67 |
/** |
69 | 68 |
* ID to use in plugin.xml to contribute to the top toolbar. |
70 | 69 |
*/ |
71 | 70 |
public final static String TOP_TOOLBAR_ID = "TXMEditorTopToolBar"; //$NON-NLS-1$ |
72 |
|
|
73 | 71 |
|
74 | 72 |
/** |
75 | 73 |
* The editor main tool bar, positioned at the top of the editor. |
tmp/org.txm.rcp/plugin.xml (revision 714) | ||
---|---|---|
331 | 331 |
tooltip="%command.tooltip.27"> |
332 | 332 |
</command> |
333 | 333 |
<command |
334 |
commandId="org.txm.rcp.commands.ExecuteScriptImport"
|
|
334 |
commandId="org.txm.rcp.handlers.scripts.ExecuteImportScript"
|
|
335 | 335 |
label="%command.label.78" |
336 | 336 |
style="push" |
337 | 337 |
tooltip="%command.tooltip.45"> |
... | ... | |
341 | 341 |
</parameter> |
342 | 342 |
</command> |
343 | 343 |
<command |
344 |
commandId="org.txm.rcp.commands.ExecuteScriptImport"
|
|
344 |
commandId="org.txm.rcp.handlers.scripts.ExecuteImportScript"
|
|
345 | 345 |
label="%command.label.87" |
346 | 346 |
style="push" |
347 | 347 |
tooltip="%command.tooltip.66"> |
... | ... | |
355 | 355 |
visible="true"> |
356 | 356 |
</separator> |
357 | 357 |
<command |
358 |
commandId="org.txm.rcp.commands.ExecuteScriptImport"
|
|
358 |
commandId="org.txm.rcp.handlers.scripts.ExecuteImportScript"
|
|
359 | 359 |
label="%command.label.1" |
360 | 360 |
style="push" |
361 | 361 |
tooltip="%command.tooltip.44"> |
... | ... | |
365 | 365 |
</parameter> |
366 | 366 |
</command> |
367 | 367 |
<command |
368 |
commandId="org.txm.rcp.commands.ExecuteScriptImport"
|
|
368 |
commandId="org.txm.rcp.handlers.scripts.ExecuteImportScript"
|
|
369 | 369 |
label="%command.label.92" |
370 | 370 |
style="push" |
371 | 371 |
tooltip="%command.tooltip.88"> |
... | ... | |
375 | 375 |
</parameter> |
376 | 376 |
</command> |
377 | 377 |
<command |
378 |
commandId="org.txm.rcp.commands.ExecuteScriptImport"
|
|
378 |
commandId="org.txm.rcp.handlers.scripts.ExecuteImportScript"
|
|
379 | 379 |
label="%command.label.5" |
380 | 380 |
style="push" |
381 | 381 |
tooltip="%command.tooltip.8"> |
... | ... | |
385 | 385 |
</parameter> |
386 | 386 |
</command> |
387 | 387 |
<command |
388 |
commandId="org.txm.rcp.commands.ExecuteScriptImport"
|
|
388 |
commandId="org.txm.rcp.handlers.scripts.ExecuteImportScript"
|
|
389 | 389 |
label="%command.label.9" |
390 | 390 |
style="push" |
391 | 391 |
tooltip="%command.tooltip.9"> |
... | ... | |
395 | 395 |
</parameter> |
396 | 396 |
</command> |
397 | 397 |
<command |
398 |
commandId="org.txm.rcp.commands.ExecuteScriptImport"
|
|
398 |
commandId="org.txm.rcp.handlers.scripts.ExecuteImportScript"
|
|
399 | 399 |
label="%command.label.12" |
400 | 400 |
style="push" |
401 | 401 |
tooltip="%command.tooltip.11"> |
... | ... | |
405 | 405 |
</parameter> |
406 | 406 |
</command> |
407 | 407 |
<command |
408 |
commandId="org.txm.rcp.commands.ExecuteScriptImport"
|
|
408 |
commandId="org.txm.rcp.handlers.scripts.ExecuteImportScript"
|
|
409 | 409 |
label="%command.label.3" |
410 | 410 |
style="push" |
411 | 411 |
tooltip="%command.tooltip.5"> |
... | ... | |
415 | 415 |
</parameter> |
416 | 416 |
</command> |
417 | 417 |
<command |
418 |
commandId="org.txm.rcp.commands.ExecuteScriptImport"
|
|
418 |
commandId="org.txm.rcp.handlers.scripts.ExecuteImportScript"
|
|
419 | 419 |
label="%command.label.2" |
420 | 420 |
style="push" |
421 | 421 |
tooltip="%command.tooltip.1"> |
... | ... | |
425 | 425 |
</parameter> |
426 | 426 |
</command> |
427 | 427 |
<command |
428 |
commandId="org.txm.rcp.commands.ExecuteScriptImport"
|
|
428 |
commandId="org.txm.rcp.handlers.scripts.ExecuteImportScript"
|
|
429 | 429 |
label="%command.label.81" |
430 | 430 |
style="push" |
431 | 431 |
tooltip="%command.tooltip.24"> |
... | ... | |
439 | 439 |
visible="true"> |
440 | 440 |
</separator> |
441 | 441 |
<command |
442 |
commandId="org.txm.rcp.commands.ExecuteScriptImport"
|
|
442 |
commandId="org.txm.rcp.handlers.scripts.ExecuteImportScript"
|
|
443 | 443 |
label="%command.label.64" |
444 | 444 |
style="push" |
445 | 445 |
tooltip="%command.tooltip.22"> |
... | ... | |
449 | 449 |
</parameter> |
450 | 450 |
</command> |
451 | 451 |
<command |
452 |
commandId="org.txm.rcp.commands.ExecuteScriptImport"
|
|
452 |
commandId="org.txm.rcp.handlers.scripts.ExecuteImportScript"
|
|
453 | 453 |
label="%command.label.0" |
454 | 454 |
style="push" |
455 | 455 |
tooltip="%command.tooltip.28"> |
... | ... | |
459 | 459 |
</parameter> |
460 | 460 |
</command> |
461 | 461 |
<command |
462 |
commandId="org.txm.rcp.commands.ExecuteScriptImport"
|
|
462 |
commandId="org.txm.rcp.handlers.scripts.ExecuteImportScript"
|
|
463 | 463 |
label="%command.label.62" |
464 | 464 |
style="push" |
465 | 465 |
tooltip="%command.tooltip.30"> |
... | ... | |
469 | 469 |
</parameter> |
470 | 470 |
</command> |
471 | 471 |
<command |
472 |
commandId="org.txm.rcp.commands.ExecuteScriptImport"
|
|
472 |
commandId="org.txm.rcp.handlers.scripts.ExecuteImportScript"
|
|
473 | 473 |
label="%command.label.61" |
474 | 474 |
style="push" |
475 | 475 |
tooltip="%command.tooltip.29"> |
... | ... | |
479 | 479 |
</parameter> |
480 | 480 |
</command> |
481 | 481 |
<command |
482 |
commandId="org.txm.rcp.commands.ExecuteScriptImport"
|
|
482 |
commandId="org.txm.rcp.handlers.scripts.ExecuteImportScript"
|
|
483 | 483 |
label="%command.label.82" |
484 | 484 |
style="push" |
485 | 485 |
tooltip="%command.tooltip.25"> |
... | ... | |
2296 | 2296 |
</category> |
2297 | 2297 |
<command |
2298 | 2298 |
defaultHandler="org.txm.rcp.handlers.scripts.ExecuteImportScript" |
2299 |
id="org.txm.rcp.commands.ExecuteScriptImport"
|
|
2299 |
id="org.txm.rcp.handlers.scripts.ExecuteImportScript"
|
|
2300 | 2300 |
name="%command.name.22"> |
2301 | 2301 |
<commandParameter |
2302 | 2302 |
id="org.txm.rcp.commands.commandParameter3" |
tmp/org.txm.core/plugin.xml (revision 714) | ||
---|---|---|
3 | 3 |
<plugin> |
4 | 4 |
<extension-point id="org.txm.EnginesManager" name="org.txm.EnginesManager" schema="schema/engine_manager.exsd"/> |
5 | 5 |
<extension-point id="org.txm.functions.CommandsAPIDeclaration" name="CommandsAPIDeclaration" schema="schema/org.txm.commandapi.exsd"/> |
6 |
<extension-point id="org.txm.postinstallationstep" name="Post installation step" schema="schema/org.txm.postinstallationstep.exsd"/>
|
|
6 |
<extension-point id="org.txm.PostInstallationStep" name="Post installation step" schema="schema/org.txm.PostInstallationStep.exsd"/>
|
|
7 | 7 |
<extension |
8 | 8 |
point="org.eclipse.core.runtime.preferences"> |
9 | 9 |
<initializer |
tmp/org.txm.core/schema/org.txm.postinstallationstep.exsd (revision 714) | ||
---|---|---|
1 |
<?xml version='1.0' encoding='UTF-8'?> |
|
2 |
<!-- Schema file written by PDE --> |
|
3 |
<schema targetNamespace="org.txm.core" xmlns="http://www.w3.org/2001/XMLSchema"> |
|
4 |
<annotation> |
|
5 |
<appinfo> |
|
6 |
<meta.schema plugin="org.txm.core" id="org.txm.postinstallationstep" name="Post installation step"/> |
|
7 |
</appinfo> |
|
8 |
<documentation> |
|
9 |
use this extension point if you wish to do more plugin settings for each new version (such as copying Grovvy scripts) |
|
10 |
</documentation> |
|
11 |
</annotation> |
|
12 |
|
|
13 |
<element name="extension"> |
|
14 |
<annotation> |
|
15 |
<appinfo> |
|
16 |
<meta.element /> |
|
17 |
</appinfo> |
|
18 |
</annotation> |
|
19 |
<complexType> |
|
20 |
<choice minOccurs="1" maxOccurs="unbounded"> |
|
21 |
<element ref="PostInstallationStep"/> |
|
22 |
</choice> |
|
23 |
<attribute name="point" type="string" use="required"> |
|
24 |
<annotation> |
|
25 |
<documentation> |
|
26 |
|
|
27 |
</documentation> |
|
28 |
</annotation> |
|
29 |
</attribute> |
|
30 |
<attribute name="id" type="string"> |
|
31 |
<annotation> |
|
32 |
<documentation> |
|
33 |
|
|
34 |
</documentation> |
|
35 |
</annotation> |
|
36 |
</attribute> |
|
37 |
<attribute name="name" type="string"> |
|
38 |
<annotation> |
|
39 |
<documentation> |
|
40 |
|
|
41 |
</documentation> |
|
42 |
<appinfo> |
|
43 |
<meta.attribute translatable="true"/> |
|
44 |
</appinfo> |
|
45 |
</annotation> |
|
46 |
</attribute> |
|
47 |
</complexType> |
|
48 |
</element> |
|
49 |
|
|
50 |
<element name="PostInstallationStep"> |
|
51 |
<complexType> |
|
52 |
<attribute name="class" type="string"> |
|
53 |
<annotation> |
|
54 |
<documentation> |
|
55 |
|
|
56 |
</documentation> |
|
57 |
<appinfo> |
|
58 |
<meta.attribute kind="java" basedOn="org.txm.PostInstallationStep:"/> |
|
59 |
</appinfo> |
|
60 |
</annotation> |
|
61 |
</attribute> |
|
62 |
<attribute name="name" type="string" use="required"> |
|
63 |
<annotation> |
|
64 |
<documentation> |
|
65 |
|
|
66 |
</documentation> |
|
67 |
</annotation> |
|
68 |
</attribute> |
|
69 |
<attribute name="description" type="string" use="required"> |
|
70 |
<annotation> |
|
71 |
<documentation> |
|
72 |
|
|
73 |
</documentation> |
|
74 |
<appinfo> |
|
75 |
<meta.attribute translatable="true"/> |
|
76 |
</appinfo> |
|
77 |
</annotation> |
|
78 |
</attribute> |
|
79 |
</complexType> |
|
80 |
</element> |
|
81 |
|
|
82 |
<annotation> |
|
83 |
<appinfo> |
|
84 |
<meta.section type="since"/> |
|
85 |
</appinfo> |
|
86 |
<documentation> |
|
87 |
[Enter the first release in which this extension point appears.] |
|
88 |
</documentation> |
|
89 |
</annotation> |
|
90 |
|
|
91 |
<annotation> |
|
92 |
<appinfo> |
|
93 |
<meta.section type="examples"/> |
|
94 |
</appinfo> |
|
95 |
<documentation> |
|
96 |
[Enter extension point usage example here.] |
|
97 |
</documentation> |
|
98 |
</annotation> |
|
99 |
|
|
100 |
<annotation> |
|
101 |
<appinfo> |
|
102 |
<meta.section type="apiinfo"/> |
|
103 |
</appinfo> |
|
104 |
<documentation> |
|
105 |
[Enter API information here.] |
|
106 |
</documentation> |
|
107 |
</annotation> |
|
108 |
|
|
109 |
<annotation> |
|
110 |
<appinfo> |
|
111 |
<meta.section type="implementation"/> |
|
112 |
</appinfo> |
|
113 |
<documentation> |
|
114 |
[Enter information about supplied implementation of this extension point.] |
|
115 |
</documentation> |
|
116 |
</annotation> |
|
117 |
|
|
118 |
|
|
119 |
</schema> |
tmp/org.txm.core/schema/org.txm.PostInstallationStep.exsd (revision 714) | ||
---|---|---|
1 |
<?xml version='1.0' encoding='UTF-8'?> |
|
2 |
<!-- Schema file written by PDE --> |
|
3 |
<schema targetNamespace="org.txm.core" xmlns="http://www.w3.org/2001/XMLSchema"> |
|
4 |
<annotation> |
|
5 |
<appinfo> |
|
6 |
<meta.schema plugin="org.txm.core" id="org.txm.PostInstallationStep" name="Post installation step"/> |
|
7 |
</appinfo> |
|
8 |
<documentation> |
|
9 |
use this extension point if you wish to do more plugin settings for each new version (such as copying Grovvy scripts) |
|
10 |
</documentation> |
|
11 |
</annotation> |
|
12 |
|
|
13 |
<element name="extension"> |
|
14 |
<annotation> |
|
15 |
<appinfo> |
|
16 |
<meta.element /> |
|
17 |
</appinfo> |
|
18 |
</annotation> |
|
19 |
<complexType> |
|
20 |
<choice minOccurs="1" maxOccurs="unbounded"> |
|
21 |
<element ref="PostInstallationStep"/> |
|
22 |
</choice> |
|
23 |
<attribute name="point" type="string" use="required"> |
|
24 |
<annotation> |
|
25 |
<documentation> |
|
26 |
|
|
27 |
</documentation> |
|
28 |
</annotation> |
|
29 |
</attribute> |
|
30 |
<attribute name="id" type="string"> |
|
31 |
<annotation> |
|
32 |
<documentation> |
|
33 |
|
|
34 |
</documentation> |
|
35 |
</annotation> |
|
36 |
</attribute> |
|
37 |
<attribute name="name" type="string"> |
|
38 |
<annotation> |
|
39 |
<documentation> |
|
40 |
|
|
41 |
</documentation> |
|
42 |
<appinfo> |
|
43 |
<meta.attribute translatable="true"/> |
|
44 |
</appinfo> |
|
45 |
</annotation> |
|
46 |
</attribute> |
|
47 |
</complexType> |
|
48 |
</element> |
|
49 |
|
|
50 |
<element name="PostInstallationStep"> |
|
51 |
<complexType> |
|
52 |
<attribute name="class" type="string"> |
|
53 |
<annotation> |
|
54 |
<documentation> |
|
55 |
|
|
56 |
</documentation> |
|
57 |
<appinfo> |
|
58 |
<meta.attribute kind="java" basedOn="org.txm.PostInstallationStep:"/> |
|
59 |
</appinfo> |
|
60 |
</annotation> |
|
61 |
</attribute> |
|
62 |
<attribute name="name" type="string" use="required"> |
|
63 |
<annotation> |
|
64 |
<documentation> |
|
65 |
|
|
66 |
</documentation> |
|
67 |
</annotation> |
|
68 |
</attribute> |
|
69 |
<attribute name="description" type="string" use="required"> |
|
70 |
<annotation> |
|
71 |
<documentation> |
|
72 |
|
|
73 |
</documentation> |
|
74 |
<appinfo> |
|
75 |
<meta.attribute translatable="true"/> |
|
76 |
</appinfo> |
|
77 |
</annotation> |
|
78 |
</attribute> |
|
79 |
</complexType> |
|
80 |
</element> |
|
81 |
|
|
82 |
<annotation> |
|
83 |
<appinfo> |
|
84 |
<meta.section type="since"/> |
|
85 |
</appinfo> |
|
86 |
<documentation> |
|
87 |
[Enter the first release in which this extension point appears.] |
|
88 |
</documentation> |
|
89 |
</annotation> |
|
90 |
|
|
91 |
<annotation> |
|
92 |
<appinfo> |
|
93 |
<meta.section type="examples"/> |
|
94 |
</appinfo> |
|
95 |
<documentation> |
|
96 |
[Enter extension point usage example here.] |
|
97 |
</documentation> |
|
98 |
</annotation> |
|
99 |
|
|
100 |
<annotation> |
|
101 |
<appinfo> |
|
102 |
<meta.section type="apiinfo"/> |
|
103 |
</appinfo> |
|
104 |
<documentation> |
|
105 |
[Enter API information here.] |
|
106 |
</documentation> |
|
107 |
</annotation> |
|
108 |
|
|
109 |
<annotation> |
|
110 |
<appinfo> |
|
111 |
<meta.section type="implementation"/> |
|
112 |
</appinfo> |
|
113 |
<documentation> |
|
114 |
[Enter information about supplied implementation of this extension point.] |
|
115 |
</documentation> |
|
116 |
</annotation> |
|
117 |
|
|
118 |
|
|
119 |
</schema> |
|
0 | 120 |
tmp/org.txm.core/src/java/org/txm/Toolbox.java (revision 714) | ||
---|---|---|
110 | 110 |
return true; |
111 | 111 |
} |
112 | 112 |
|
113 |
/** |
|
114 |
* Shortcut to the TBXPreferences getString method |
|
115 |
* |
|
116 |
* @param key |
|
117 |
* @return |
|
118 |
*/ |
|
119 |
public static String getParam(String key) { |
|
120 |
return TXMPreferences.getString(key, TBXPreferences.PREFERENCES_NODE); |
|
121 |
} |
|
122 |
|
|
113 | 123 |
public static EnginesManager<?> getEngineManager(EngineType et) { |
114 | 124 |
|
115 | 125 |
if (engines == null) { |
tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/preferences/RPreferences.java (revision 714) | ||
---|---|---|
112 | 112 |
|
113 | 113 |
String os = ""; |
114 | 114 |
String ext = ""; |
115 |
String osname = System.getProperty("os.name").toLowerCase(); |
|
115 |
String osname = System.getProperty("os.name").toLowerCase(); //$NON-NLS-1$
|
|
116 | 116 |
if (osname.contains("windows")) { //$NON-NLS-1$ |
117 |
os = "win32"; |
|
118 |
ext = ".exe"; |
|
117 |
os = "win32"; //$NON-NLS-1$
|
|
118 |
ext = ".exe"; //$NON-NLS-1$
|
|
119 | 119 |
} else if (osname.contains("mac")) { //$NON-NLS-1$ |
120 |
os = "macosx"; |
|
120 |
os = "macosx"; //$NON-NLS-1$
|
|
121 | 121 |
} else { |
122 |
os = "linux32"; |
|
123 |
if (System.getProperty("os.arch").contains("64")) |
|
124 |
os = "linux64"; |
|
122 |
os = "linux32"; //$NON-NLS-1$
|
|
123 |
if (System.getProperty("os.arch").contains("64")) //$NON-NLS-1$ //$NON-NLS-2$
|
|
124 |
os = "linux64"; //$NON-NLS-1$
|
|
125 | 125 |
} |
126 | 126 |
|
127 | 127 |
File bundleDir = BundleUtils.getBundleFile(RFRAGMENT); |
tmp/org.txm.tigersearch.rcp/src/tigersearch4txm/Activator.java (revision 714) | ||
---|---|---|
1 | 1 |
package tigersearch4txm; |
2 | 2 |
|
3 |
import java.io.File; |
|
4 |
|
|
3 | 5 |
import org.eclipse.jface.resource.ImageDescriptor; |
4 | 6 |
import org.eclipse.ui.plugin.AbstractUIPlugin; |
5 | 7 |
import org.osgi.framework.BundleContext; |
8 |
import org.txm.Toolbox; |
|
9 |
import org.txm.utils.BundleUtils; |
|
6 | 10 |
|
7 | 11 |
/** |
8 | 12 |
* The activator class controls the plug-in life cycle |
... | ... | |
19 | 23 |
* The constructor |
20 | 24 |
*/ |
21 | 25 |
public Activator() { |
26 |
|
|
22 | 27 |
} |
23 | 28 |
|
24 | 29 |
/* |
tmp/org.txm.tigersearch.rcp/src/org/txm/tigersearch/commands/DoInstall.java (revision 714) | ||
---|---|---|
1 |
package org.txm.tigersearch.commands; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
|
|
5 |
import org.txm.PostInstallationStep; |
|
6 |
import org.txm.Toolbox; |
|
7 |
import org.txm.utils.BundleUtils; |
|
8 |
|
|
9 |
public class DoInstall extends PostInstallationStep { |
|
10 |
|
|
11 |
protected String name = "TIGERSearch"; //$NON-NLS-1$ |
|
12 |
|
|
13 |
public void install() |
|
14 |
{ |
|
15 |
File outputDirectory = new File(Toolbox.getTXMHOMEPATH(), "scripts/import"); |
|
16 |
outputDirectory.mkdirs(); |
|
17 |
BundleUtils.copyFiles("TIGERSearchRCP", "src", "org/txm/importer/tigersearch", "tigersearchLoader.groovy", outputDirectory); |
|
18 |
} |
|
19 |
} |
|
0 | 20 |
tmp/org.txm.tigersearch.rcp/src/org/txm/importer/tigersearch/tigersearchLoader.groovy (revision 714) | ||
---|---|---|
1 |
// Copyright © 2010-2013 ENS de Lyon. |
|
2 |
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of |
|
3 |
// Lyon 2, University of Franche-Comté, University of Nice |
|
4 |
// Sophia Antipolis, University of Paris 3. |
|
5 |
// |
|
6 |
// The TXM platform is free software: you can redistribute it |
|
7 |
// and/or modify it under the terms of the GNU General Public |
|
8 |
// License as published by the Free Software Foundation, |
|
9 |
// either version 2 of the License, or (at your option) any |
|
10 |
// later version. |
|
11 |
// |
|
12 |
// The TXM platform is distributed in the hope that it will be |
|
13 |
// useful, but WITHOUT ANY WARRANTY; without even the implied |
|
14 |
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
|
15 |
// PURPOSE. See the GNU General Public License for more |
|
16 |
// details. |
|
17 |
// |
|
18 |
// You should have received a copy of the GNU General |
|
19 |
// Public License along with the TXM platform. If not, see |
|
20 |
// http://www.gnu.org/licenses. |
|
21 |
// |
|
22 |
// $LastChangedDate: 2015-06-03 15:04:53 +0200 (mer., 03 juin 2015) $ |
|
23 |
// $LastChangedRevision: 2984 $ |
|
24 |
// $LastChangedBy: mdecorde $ |
|
25 |
// |
|
26 |
package org.txm.importer.tigersearch; |
|
27 |
|
|
28 |
import javax.xml.stream.XMLStreamReader; |
|
29 |
|
|
30 |
import org.txm.sw.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.scripts.teitxm.*; |
|
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; |
|
43 |
import org.txm.importer.xtz.* |
|
44 |
|
|
45 |
String userDir = System.getProperty("user.home"); |
|
46 |
|
|
47 |
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 |
if (!org.txm.Toolbox.isInitialized()) { |
|
56 |
|
|
57 |
TokenizerClasses.loadFromNode(params.getTokenizerElement(params.getCorpusElement())); |
|
58 |
Toolbox.setParam(Toolbox.INSTALL_DIR,new File("/usr/lib/TXM")); |
|
59 |
//Toolbox.setParam(Toolbox.INSTALL_DIR,new File("C:\\Program Files\\TXM"));//For Windows |
|
60 |
Toolbox.setParam(Toolbox.TREETAGGER_INSTALL_PATH,new File(userDir,"treetagger")); |
|
61 |
//Toolbox.setParam(Toolbox.TREETAGGER_INSTALL_PATH,new File("C:\\Program Files\\treetagger"));//for Windows |
|
62 |
Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File(userDir,"treetagger/models")); |
|
63 |
Toolbox.setParam(Toolbox.METADATA_ENCODING, "UTF-8"); |
|
64 |
Toolbox.setParam(Toolbox.METADATA_COLSEPARATOR, ","); |
|
65 |
Toolbox.setParam(Toolbox.METADATA_TXTSEPARATOR, "\""); |
|
66 |
//Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File("C:\\Program Files\\treetagger\\models"));//for Windows |
|
67 |
Toolbox.setParam(Toolbox.USER_TXM_HOME, new File(System.getProperty("user.home"), "TXM")); |
|
68 |
} |
|
69 |
} |
|
70 |
|
|
71 |
if (params == null) { println "no parameters. Aborting"; return; } |
|
72 |
|
|
73 |
//params.getKeyValueParameters().put(ImportKeys.CLEAN, "false") |
|
74 |
//params.getKeyValueParameters().put(ImportKeys.MULTITHREAD, "false") |
|
75 |
//params.getKeyValueParameters().put(ImportKeys.DEBUG, "false") |
|
76 |
//params.getKeyValueParameters().put(ImportKeys.UPDATECORPUS, "false") |
|
77 |
|
|
78 |
TSImport i = new TSImport(params); |
|
79 |
i.process(); |
|
80 |
readyToLoad = i.isSuccessful |
tmp/org.txm.tigersearch.rcp/src/org/txm/importer/tigersearch/ts.xsl (revision 714) | ||
---|---|---|
1 |
<?xml version="1.0"?> |
|
2 |
<xsl:stylesheet version="1.0" |
|
3 |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
|
4 |
xmlns:tei="http://www.tei-c.org/ns/1.0" |
|
5 |
xmlns:xd="http://www.pnp-software.com/XSLTdoc" |
|
6 |
xmlns:edate="http://exslt.org/dates-and-times" |
|
7 |
exclude-result-prefixes="edate xd"> |
|
8 |
|
|
9 |
<xd:doc type="stylesheet"> |
|
10 |
|
|
11 |
<xd:short> |
|
12 |
Feuille de transformation du format TIGER-XML vers le format XML-TXM |
|
13 |
</xd:short> |
|
14 |
|
|
15 |
<xd:detail> |
|
16 |
This stylesheet is free software; you can redistribute it and/or |
|
17 |
modify it under the terms of the GNU Lesser General Public |
|
18 |
License as published by the Free Software Foundation; either |
|
19 |
version 3 of the License, or (at your option) any later version. |
|
20 |
|
|
21 |
This stylesheet is distributed in the hope that it will be useful, |
|
22 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
23 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
24 |
Lesser General Public License for more details. |
|
25 |
|
|
26 |
You should have received a copy of GNU Lesser Public License with |
|
27 |
this stylesheet. If not, see http://www.gnu.org/licenses/lgpl.html |
|
28 |
</xd:detail> |
|
29 |
|
|
30 |
<xd:author>Matthieu Decorde, matthieu.decorde AT ens-lyon.fr</xd:author> |
|
31 |
<xd:author>Serge Heiden, slh AT ens-lyon.fr</xd:author> |
|
32 |
<xd:author>Alexey Lavrentev, alexei.lavrentev AT ens-lyon.fr></xd:author> |
|
33 |
|
|
34 |
<xd:copyright>2016, ENS de Lyon/CNRS (UMR IHRIM Cactus)</xd:copyright> |
|
35 |
|
|
36 |
</xd:doc> |
|
37 |
|
|
38 |
<xsl:output |
|
39 |
method="xml" |
|
40 |
encoding="UTF-8" |
|
41 |
indent="yes" /> |
|
42 |
|
|
43 |
<xsl:template match="corpus"> |
|
44 |
<corpus> |
|
45 |
<xsl:choose> |
|
46 |
<xsl:when test="subcorpus"> |
|
47 |
<xsl:apply-templates select="subcorpus"/> |
|
48 |
</xsl:when> |
|
49 |
<xsl:otherwise> |
|
50 |
<text> |
|
51 |
<xsl:apply-templates select="s"/> |
|
52 |
</text> |
|
53 |
</xsl:otherwise> |
|
54 |
</xsl:choose> |
|
55 |
<xsl:apply-templates/> |
|
56 |
</corpus> |
|
57 |
</xsl:template> |
|
58 |
|
|
59 |
<xsl:template match="subcorpus"> |
|
60 |
<text> |
|
61 |
<xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute> |
|
62 |
<xsl:apply-templates select="s"/> |
|
63 |
</text> |
|
64 |
</xsl:template> |
|
65 |
|
|
66 |
<xsl:template match="s"> |
|
67 |
<p> |
|
68 |
<s> |
|
69 |
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute> |
|
70 |
<xsl:apply-templates select="graph/terminals/t" /> |
|
71 |
</s> |
|
72 |
</p> |
|
73 |
</xsl:template> |
|
74 |
|
|
75 |
<xsl:template match="t"> |
|
76 |
<w> |
|
77 |
<xsl:for-each select="@*[not(name()='word')]"> |
|
78 |
<xsl:copy/> |
|
79 |
</xsl:for-each> |
|
80 |
<xsl:value-of select="@word"/> |
|
81 |
</w> |
|
82 |
</xsl:template> |
|
83 |
|
|
84 |
</xsl:stylesheet> |
|
0 | 85 |
tmp/org.txm.tigersearch.rcp/src/org/txm/importer/tigersearch/TSImporter.groovy (revision 714) | ||
---|---|---|
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 = new File(inputDirectory, "metadata.csv"); |
|
29 |
println allmetadatafile |
|
30 |
if (allmetadatafile.exists()) { |
|
31 |
File copy = new File(binDir, "metadata.csv") |
|
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.getParam(Toolbox.METADATA_ENCODING), |
|
38 |
Toolbox.getParam(Toolbox.METADATA_COLSEPARATOR), |
|
39 |
Toolbox.getParam(Toolbox.METADATA_TXTSEPARATOR), 1) |
|
40 |
} |
|
41 |
isSuccessFul = true; |
|
42 |
} |
|
43 |
} |
tmp/org.txm.tigersearch.rcp/src/org/txm/importer/tigersearch/package.html (revision 714) | ||
---|---|---|
1 |
<html> |
|
2 |
<body> |
|
3 |
<p>TIGERSearch import module. This is a prototype that can only manage SRCMF TIGERSearch sources</p> |
|
4 |
</body> |
|
5 |
</html> |
|
0 | 6 |
tmp/org.txm.tigersearch.rcp/src/org/txm/importer/tigersearch/TSImport.groovy (revision 714) | ||
---|---|---|
1 |
package org.txm.importer.tigersearch; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.util.ArrayList; |
|
5 |
|
|
6 |
import ims.tiger.index.writer.* |
|
7 |
import ims.tiger.system.* |
|
8 |
|
|
9 |
import org.txm.Toolbox; |
|
10 |
import org.txm.importer.ApplyXsl2; |
|
11 |
import org.txm.importer.xtz.* |
|
12 |
import org.txm.objects.BaseParameters |
|
13 |
import org.txm.utils.BundleUtils; |
|
14 |
import org.txm.utils.io.FileCopy; |
|
15 |
import org.apache.log4j.BasicConfigurator; |
|
16 |
|
|
17 |
class TSImport extends XTZImport { |
|
18 |
|
|
19 |
public TSImport(BaseParameters params) { |
|
20 |
super(params); |
|
21 |
} |
|
22 |
|
|
23 |
@Override |
|
24 |
public void init(BaseParameters p) { |
|
25 |
super.init(p); |
|
26 |
|
|
27 |
importer = new TSImporter(this); // only to build metadata |
|
28 |
compiler = new XTZCompiler(this) |
|
29 |
annotater = null; // no annotater step to do |
|
30 |
pager = new XTZPager(this) |
|
31 |
} |
|
32 |
|
|
33 |
@Override |
|
34 |
public void start() throws InterruptedException { |
|
35 |
File tigerSrcDir = sourceDirectory |
|
36 |
File tsXSLFile = new File(Toolbox.getTXMHOMEPATH(), "xsl/ts.xsl"); |
|
37 |
BundleUtils.copyFiles("TIGERSearchRCP", "src", "org/txm/importer/tigersearch", "ts.xml", tsXSLFile.getParentFile()); |
|
38 |
|
|
39 |
File xmltxmSrcDir = new File(binaryDirectory, "src"); // output directory of the TS XSL transformation |
|
40 |
|
|
41 |
if (!ApplyXsl2.processImportSources(tsXSLFile, sourceDirectory, xmltxmSrcDir)) { |
|
42 |
println "Error while applying TS XSL file to $tigerSrcDir" |
|
43 |
isSuccessful = false; |
|
44 |
return; |
|
45 |
} |
|
46 |
|
|
47 |
File[] files = xmltxmSrcDir.listFiles(); |
|
48 |
if (files == null || files.length == 0) { |
|
49 |
println "Error while applying TS XSL file to $xmltxmSrcDir is empty" |
|
50 |
isSuccessful = false; |
|
51 |
return; |
|
52 |
} |
|
53 |
|
|
54 |
sourceDirectory = xmltxmSrcDir; // hop |
|
55 |
File txmDir = new File(binaryDirectory, "txm/"+corpusName); |
|
56 |
txmDir.mkdirs(); |
|
57 |
FileCopy.copyFiles(sourceDirectory, txmDir) // the compiler step will use these files |
|
58 |
super.start(); |
|
59 |
|
|
60 |
if (isSuccessful) { |
|
61 |
|
|
62 |
File tigerDir = new File(binaryDirectory, "tiger"); |
|
63 |
tigerDir.mkdir(); |
|
64 |
File master = new File(tigerSrcDir, "master.xml"); |
|
65 |
|
|
66 |
File logprop = new File(tigerDir, "tigersearch.logprop"); |
|
67 |
|
|
68 |
logprop.withWriter("UTF-8") { writer -> |
|
69 |
writer.write("""# Default log configuration of the TIGERSearch suite |
|
70 |
log4j.rootLogger=WARN,Logfile |
|
71 |
log4j.logger.ims.tiger.gui.tigersearch.TIGERSearch=INFO |
|
72 |
log4j.appender.Logfile=org.apache.log4j.RollingFileAppender |
|
73 |
log4j.appender.Logfile.File=\${user.home}/tigersearch/tigersearch.log |
|
74 |
log4j.appender.Logfile.MaxFileSize=500KB |
|
75 |
log4j.appender.Logfile.MaxBackupIndex=1 |
|
76 |
log4j.appender.Logfile.layout=org.apache.log4j.PatternLayout |
|
77 |
log4j.appender.Logfile.layout.ConversionPattern=%5r %-5p [%t] %c{2} - %m%n""") |
|
78 |
} |
|
79 |
|
|
80 |
BasicConfigurator.configure(); |
|
81 |
String uri = master.getAbsolutePath(); |
|
82 |
File tigerBinDir = new File(tigerDir, corpusName) |
|
83 |
tigerBinDir.mkdir() |
|
84 |
try { |
|
85 |
IndexBuilderErrorHandler handler = new SimpleErrorHandler(tigerBinDir.getAbsolutePath()); |
|
86 |
XMLIndexing indexing = new XMLIndexing(corpusName, uri, tigerBinDir.getAbsolutePath(), handler,false); |
|
87 |
indexing.startIndexing(); |
|
88 |
} |
|
89 |
catch (Exception e) { System.out.println(e.getMessage()); } |
|
90 |
} |
|
91 |
} |
|
92 |
} |
tmp/org.txm.tigersearch.rcp/src/org/txm/importer/srcmf/tigersearchLoader.groovy (revision 714) | ||
---|---|---|
1 |
package org.txm.importer.srcmf |
|
2 |
|
|
3 |
// srcdir |
|
4 |
// txml/master.xml |
|
5 |
// txml/*.xml |
|
6 |
// txm/*.xml |
|
7 |
|
|
8 |
// 1 import xml-txm |
|
9 |
import ims.tiger.gui.tigerregistry.TIGERRegistry; |
|
10 |
import ims.tiger.index.writer.IndexBuilderErrorHandler; |
|
11 |
import ims.tiger.index.writer.SimpleErrorHandler; |
|
12 |
import ims.tiger.index.writer.XMLIndexing; |
|
13 |
import ims.tiger.system.*; |
|
14 |
|
|
15 |
import javax.xml.stream.*; |
|
16 |
|
|
17 |
import java.io.BufferedWriter; |
|
18 |
import java.io.File; |
|
19 |
import java.io.FileOutputStream; |
|
20 |
import java.io.IOException; |
|
21 |
import java.io.OutputStreamWriter; |
|
22 |
import java.io.PrintStream; |
|
23 |
import java.net.URL; |
|
24 |
import java.util.HashMap; |
|
25 |
import java.util.logging.FileHandler |
|
26 |
import java.io.File; |
|
27 |
|
|
28 |
import org.apache.log4j.BasicConfigurator; |
|
29 |
import org.txm.export.ts.*; |
|
30 |
import org.txm.importer.ApplyXsl2; |
|
31 |
import org.txm.utils.xml.DomUtils; |
|
32 |
import org.txm.importer.ValidateXml; |
|
33 |
import org.txm.importer.XPathResult; |
|
34 |
import org.txm.importer.xmltxm.compiler; |
|
35 |
import org.txm.importer.xml.pager; |
|
36 |
import org.txm.objects.*; |
|
37 |
import org.txm.utils.*; |
|
38 |
import org.txm.*; |
|
39 |
import org.txm.scripts.teitxm.*; |
|
40 |
import org.txm.metadatas.*; |
|
41 |
import org.txm.utils.i18n.*; |
|
42 |
import org.w3c.dom.Element |
|
43 |
import org.xml.sax.SAXException; |
|
44 |
|
|
45 |
import javax.xml.parsers.DocumentBuilderFactory |
|
46 |
|
|
47 |
String userDir = System.getProperty("user.home"); |
|
48 |
boolean debug = false |
|
49 |
def MONITOR; |
|
50 |
BaseParameters params; |
|
51 |
try {params = paramsBinding;MONITOR=monitor} catch (Exception) |
|
52 |
{ println "DEV MODE";//exception means we debug |
|
53 |
debug = true |
|
54 |
params = new BaseParameters(new File(userDir, "xml/slethgier/import.xml")) |
|
55 |
params.load() |
|
56 |
if (!org.txm.Toolbox.isInitialized()) { |
|
57 |
Toolbox.setParam(Toolbox.INSTALL_DIR,new File("/usr/lib/TXM")); |
|
58 |
Toolbox.setParam(Toolbox.TREETAGGER_INSTALL_PATH,new File(userDir,"treetagger")); |
|
59 |
Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File(userDir,"treetagger/models")); |
|
60 |
Toolbox.setParam(Toolbox.METADATA_ENCODING, "UTF-8"); |
|
61 |
Toolbox.setParam(Toolbox.METADATA_COLSEPARATOR, ","); |
|
62 |
Toolbox.setParam(Toolbox.METADATA_TXTSEPARATOR, "\""); |
|
63 |
Toolbox.setParam(Toolbox.USER_TXM_HOME, new File(System.getProperty("user.home"), "TXM")); |
|
64 |
} |
|
65 |
} |
|
66 |
if (params == null) { println "no parameters. Aborting"; return; } |
|
67 |
|
|
68 |
String corpusname = params.getCorpusName(); |
|
69 |
Element corpusElem = params.corpora.get(corpusname); |
|
70 |
String basename = params.name; |
|
71 |
String rootDir = params.rootDir; |
|
72 |
String lang = corpusElem.getAttribute("lang"); |
|
73 |
String model = lang |
|
74 |
String encoding = corpusElem.getAttribute("encoding"); |
|
75 |
boolean annotate = "true" == corpusElem.getAttribute("annotate"); |
|
76 |
String xsl = params.getXsltElement(corpusElem).getAttribute("xsl") |
|
77 |
def xslParams = params.getXsltParams(corpusElem); |
|
78 |
|
|
79 |
File txmSrcDir = new File(rootDir, "xml-txm"); |
|
80 |
File tigerSrcDir = new File(rootDir, "tiger-xml"); |
|
81 |
File headerFile = new File(rootDir, "tiger-xml/header.xml"); |
|
82 |
|
|
83 |
File binDir = new File(Toolbox.getTXMHOMEPATH(),"corpora/"+basename); |
|
84 |
|
|
85 |
binDir.deleteDir(); |
|
86 |
binDir.mkdirs(); |
|
87 |
if (!binDir.exists()) { |
|
88 |
println "Could not create binDir "+binDir |
|
89 |
return; |
|
90 |
} |
|
91 |
if (!txmSrcDir.exists()) { |
|
92 |
println "Error: txm src dir does not exists: "+txmSrcDir |
|
93 |
return; |
|
94 |
} |
|
95 |
if (!tigerSrcDir.exists()) { |
|
96 |
println "Error: tiger src dir does not exists: "+tigerSrcDir |
|
97 |
return; |
|
98 |
} |
|
99 |
File txmDir = new File(binDir,"txm/$corpusname"); |
|
100 |
txmDir.deleteDir(); |
|
101 |
txmDir.mkdirs(); |
|
102 |
// copy txm files |
|
103 |
List<File> srcfiles = txmSrcDir.listFiles(); |
|
104 |
for (File f : srcfiles) {// check XML format, and copy file into binDir |
|
105 |
if (f.getName().equals("import.xml") || f.getName().equals("metadata.csv") || f.getName().endsWith(".properties")) |
|
106 |
continue; |
|
107 |
if (ValidateXml.test(f)) { |
|
108 |
FileCopy.copy(f, new File(txmDir, f.getName())); |
|
109 |
} else { |
|
110 |
println "Won't process file "+f; |
|
111 |
} |
|
112 |
} |
|
113 |
if (txmDir.listFiles() == null) { |
|
114 |
println "No txm file to process" |
|
115 |
return; |
|
116 |
} |
|
117 |
|
|
118 |
List<File> filelist = txmDir.listFiles(); |
|
119 |
Collections.sort(filelist); |
|
120 |
|
|
121 |
if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); } |
|
122 |
if (MONITOR != null) MONITOR.worked(25, "COMPILING") |
|
123 |
println "-- COMPILING - Building Search Engine indexes" |
|
124 |
println "binDir: $binDir" |
|
125 |
println "txmDir: $txmDir" |
|
126 |
def c = new compiler(); |
|
127 |
if (debug) c.setDebug(); |
|
128 |
c.setLang(lang); |
|
129 |
//c.setSortMetadata(sortMetadata) |
|
130 |
if (!c.run(binDir, txmDir, basename, corpusname, filelist)) { |
|
131 |
println "import process stopped"; |
|
132 |
return; |
|
133 |
} |
|
134 |
|
|
135 |
if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); } |
|
136 |
if (MONITOR != null) MONITOR.worked(20, "EDITION") |
|
137 |
println "-- EDITION - Building edition" |
|
138 |
new File(binDir,"HTML/$corpusname").deleteDir(); |
|
139 |
new File(binDir,"HTML/$corpusname").mkdirs(); |
|
140 |
File outdir = new File(binDir,"/HTML/$corpusname/default/"); |
|
141 |
outdir.mkdirs(); |
|
142 |
|
|
143 |
|
|
144 |
def second = 0 |
|
145 |
println "Paginating text: " |
|
146 |
for (File srcfile : filelist) { |
|
147 |
String txtname = srcfile.getName(); |
|
148 |
int i = txtname.lastIndexOf("."); |
|
149 |
if(i > 0) txtname = txtname.substring(0, i); |
|
150 |
List<String> NoSpaceBefore = LangFormater.getNoSpaceBefore(lang); |
|
151 |
List<String> NoSpaceAfter = LangFormater.getNoSpaceAfter(lang); |
|
152 |
Element text = params.addText(params.corpora.get(corpusname), txtname, srcfile); |
|
153 |
if (second) { print(", ") } |
|
154 |
if (second > 0 && (second++ % 5) == 0) println "" |
|
155 |
print(srcfile.getName()); |
|
156 |
def ed = new pager(srcfile, outdir, txtname, NoSpaceBefore, NoSpaceAfter, 500, basename, "pb"); |
|
157 |
Element edition = params.addEdition(text, "default", outdir.getAbsolutePath(), "html"); |
|
158 |
for (i = 0 ; i < ed.getPageFiles().size();) { |
|
159 |
File f = ed.getPageFiles().get(i); |
|
160 |
String wordid = ed.getIdx().get(i); |
|
161 |
params.addPage(edition, ""+(++i), wordid); |
|
162 |
} |
|
163 |
} |
|
164 |
|
|
165 |
if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); } |
|
166 |
if (MONITOR != null) MONITOR.worked(20, "FINALIZING") |
|
167 |
File paramFile = new File(binDir, "import.xml"); |
|
168 |
DomUtils.save(params.root.getOwnerDocument(), paramFile);readyToLoad = true; |
|
169 |
|
|
170 |
|
|
171 |
// TMR Modifications start here |
|
172 |
File tigerDir = new File(binDir, "tiger"); |
|
173 |
tigerDir.mkdir(); |
|
174 |
File master = new File(tigerSrcDir, "master.xml"); |
|
175 |
File txmSrcFile = txmSrcDir.listFiles()[0]; // only one text file |
|
176 |
|
|
177 |
// Run SRCMF cmd line corpus import script |
|
178 |
if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); } |
|
179 |
def importer = new SrcmfImporter() |
|
180 |
def tigerXmlAll = importer.doAllButPnc(master, txmSrcFile, headerFile, binDir) |
|
181 |
|
|
182 |
// Create TigerXml-POS-PNC |
|
183 |
if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); } |
|
184 |
println "create TIGER XML POS PNC" |
|
185 |
PunctInjectImport injector; |
|
186 |
if (Toolbox.isInitialized()) { |
|
187 |
// get idx from CQP |
|
188 |
// INCOMPLETE |
|
189 |
// def injector = new PunctInjectImport(tmpFile, words) |
|
190 |
println "Error: the loader is not ready to be launched from RCP" |
|
191 |
return; |
|
192 |
} else { |
|
193 |
injector = new PunctInjectImport(tigerXmlAll, txmSrcFile) |
|
194 |
} |
|
195 |
injector.outputFile = new File(tigerDir, "TigerPnc.xml") |
|
196 |
injector.process() |
|
197 |
|
|
198 |
// Create the tigersearch.logprop file (used to launch TIGERSearch) |
|
199 |
File logprop = new File(tigerDir, "tigersearch.logprop"); |
|
200 |
logprop.withWriter("UTF-8") { writer -> |
|
201 |
writer.write("""# Default log configuration of the TIGERSearch suite |
|
202 |
|
|
203 |
log4j.rootLogger=WARN,Logfile |
|
204 |
log4j.logger.ims.tiger.gui.tigersearch.TIGERSearch=INFO |
|
205 |
|
|
206 |
log4j.appender.Logfile=org.apache.log4j.RollingFileAppender |
|
207 |
log4j.appender.Logfile.File=\${user.home}/tigersearch/tigersearch.log |
|
208 |
log4j.appender.Logfile.MaxFileSize=500KB |
|
209 |
log4j.appender.Logfile.MaxBackupIndex=1 |
|
210 |
|
|
211 |
log4j.appender.Logfile.layout=org.apache.log4j.PatternLayout |
|
212 |
log4j.appender.Logfile.layout.ConversionPattern=%5r %-5p [%t] %c{2} - %m%n""") |
|
213 |
} |
|
214 |
|
|
215 |
// Run TigerRegistry |
|
216 |
if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); } |
|
217 |
BasicConfigurator.configure(); |
|
218 |
String uri = tigerXmlAll.getAbsolutePath(); |
|
219 |
File tigerBinDir = new File(tigerDir, corpusname) |
|
220 |
tigerBinDir.mkdir() |
|
221 |
try { |
|
222 |
IndexBuilderErrorHandler handler = new SimpleErrorHandler(tigerBinDir.getAbsolutePath()); |
|
223 |
XMLIndexing indexing = new XMLIndexing(corpusname,uri, tigerBinDir.getAbsolutePath(), handler,false); |
|
224 |
indexing.startIndexing(); |
|
225 |
} |
|
226 |
catch (IOException e) { System.out.println("IO: "+e.getMessage()); } |
|
227 |
catch (SAXException e) { System.out.println("SAX: "+e.getMessage()); } |
|
228 |
|
|
229 |
tigerXmlAll.delete() |
tmp/org.txm.tigersearch.rcp/src/org/txm/importer/srcmf/srcmfLoader.groovy (revision 714) | ||
---|---|---|
1 |
package org.txm.importer.srcmf |
|
2 |
|
|
3 |
// srcdir |
|
4 |
// txml/master.xml |
|
5 |
// txml/*.xml |
|
6 |
// txm/*.xml |
|
7 |
|
|
8 |
// 1 import xml-txm |
|
9 |
import ims.tiger.gui.tigerregistry.TIGERRegistry; |
|
10 |
import ims.tiger.index.writer.IndexBuilderErrorHandler; |
|
11 |
import ims.tiger.index.writer.SimpleErrorHandler; |
|
12 |
import ims.tiger.index.writer.XMLIndexing; |
|
13 |
import ims.tiger.system.*; |
|
14 |
|
|
15 |
import javax.xml.stream.*; |
|
16 |
|
|
17 |
import java.io.BufferedWriter; |
|
18 |
import java.io.File; |
|
19 |
import java.io.FileOutputStream; |
|
20 |
import java.io.IOException; |
|
21 |
import java.io.OutputStreamWriter; |
|
22 |
import java.io.PrintStream; |
|
23 |
import java.net.URL; |
|
24 |
import java.util.HashMap; |
|
25 |
import java.util.logging.FileHandler |
|
26 |
import java.io.File; |
|
27 |
|
|
28 |
import org.apache.log4j.BasicConfigurator; |
|
29 |
import org.txm.export.ts.*; |
|
30 |
import org.txm.importer.ApplyXsl2; |
|
31 |
import org.txm.utils.xml.DomUtils; |
|
32 |
import org.txm.importer.ValidateXml; |
|
33 |
import org.txm.importer.XPathResult; |
|
34 |
import org.txm.importer.xmltxm.compiler; |
|
35 |
import org.txm.importer.xml.pager; |
|
36 |
import org.txm.objects.*; |
|
37 |
import org.txm.utils.*; |
|
38 |
import org.txm.*; |
|
39 |
import org.txm.scripts.teitxm.*; |
|
40 |
import org.txm.metadatas.*; |
|
41 |
import org.txm.utils.i18n.*; |
|
42 |
import org.w3c.dom.Element |
|
43 |
import org.xml.sax.SAXException; |
|
44 |
|
|
45 |
import javax.xml.parsers.DocumentBuilderFactory |
|
46 |
|
|
47 |
String userDir = System.getProperty("user.home"); |
|
48 |
boolean debug = false |
|
49 |
def MONITOR; |
|
50 |
BaseParameters params; |
|
51 |
try {params = paramsBinding;MONITOR=monitor} catch (Exception) |
|
52 |
{ println "DEV MODE";//exception means we debug |
|
53 |
debug = true |
|
54 |
params = new BaseParameters(new File(userDir, "xml/slethgier/import.xml")) |
|
55 |
params.load() |
|
56 |
if (!org.txm.Toolbox.isInitialized()) { |
|
57 |
Toolbox.setParam(Toolbox.INSTALL_DIR,new File("/usr/lib/TXM")); |
|
58 |
Toolbox.setParam(Toolbox.TREETAGGER_INSTALL_PATH,new File(userDir,"treetagger")); |
|
59 |
Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File(userDir,"treetagger/models")); |
|
60 |
Toolbox.setParam(Toolbox.METADATA_ENCODING, "UTF-8"); |
|
61 |
Toolbox.setParam(Toolbox.METADATA_COLSEPARATOR, ","); |
|
62 |
Toolbox.setParam(Toolbox.METADATA_TXTSEPARATOR, "\""); |
|
63 |
Toolbox.setParam(Toolbox.USER_TXM_HOME, new File(System.getProperty("user.home"), "TXM")); |
|
64 |
} |
|
65 |
} |
|
66 |
if (params == null) { println "no parameters. Aborting"; return; } |
|
67 |
|
|
68 |
String corpusname = params.getCorpusName(); |
|
69 |
Element corpusElem = params.corpora.get(corpusname); |
|
70 |
String basename = params.name; |
|
71 |
String rootDir = params.rootDir; |
|
72 |
String lang = corpusElem.getAttribute("lang"); |
|
73 |
String model = lang |
|
74 |
String encoding = corpusElem.getAttribute("encoding"); |
|
75 |
boolean annotate = "true" == corpusElem.getAttribute("annotate"); |
|
76 |
String xsl = params.getXsltElement(corpusElem).getAttribute("xsl") |
|
77 |
def xslParams = params.getXsltParams(corpusElem); |
|
78 |
|
|
79 |
File txmSrcDir = new File(rootDir, "xml-txm"); |
|
80 |
File tigerSrcDir = new File(rootDir, "tiger-xml"); |
|
81 |
File headerFile = new File(rootDir, "tiger-xml/header.xml"); |
|
82 |
|
|
83 |
File binDir = new File(Toolbox.getTXMHOMEPATH(),"corpora/"+basename); |
|
84 |
|
|
85 |
binDir.deleteDir(); |
|
86 |
binDir.mkdirs(); |
|
87 |
if (!binDir.exists()) { |
|
88 |
println "Could not create binDir "+binDir |
|
89 |
return; |
|
90 |
} |
|
91 |
if (!txmSrcDir.exists()) { |
|
92 |
println "Error: txm src dir does not exists: "+txmSrcDir |
|
93 |
return; |
|
94 |
} |
|
95 |
if (!tigerSrcDir.exists()) { |
|
96 |
println "Error: tiger src dir does not exists: "+tigerSrcDir |
|
97 |
return; |
|
98 |
} |
|
99 |
File txmDir = new File(binDir,"txm/$corpusname"); |
|
100 |
txmDir.deleteDir(); |
|
101 |
txmDir.mkdirs(); |
|
102 |
// copy txm files |
|
103 |
List<File> srcfiles = txmSrcDir.listFiles(); |
|
104 |
for (File f : srcfiles) {// check XML format, and copy file into binDir |
|
105 |
if (f.getName().equals("import.xml") || f.getName().equals("metadata.csv") || f.getName().endsWith(".properties")) |
|
106 |
continue; |
|
107 |
if (ValidateXml.test(f)) { |
|
108 |
FileCopy.copy(f, new File(txmDir, f.getName())); |
|
109 |
} else { |
|
110 |
println "Won't process file "+f; |
|
111 |
} |
|
112 |
} |
|
113 |
if (txmDir.listFiles() == null) { |
|
114 |
println "No txm file to process" |
|
115 |
return; |
|
116 |
} |
|
117 |
|
|
118 |
List<File> filelist = txmDir.listFiles(); |
|
119 |
Collections.sort(filelist); |
|
120 |
|
|
121 |
if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); } |
|
122 |
if (MONITOR != null) MONITOR.worked(25, "COMPILING") |
|
123 |
println "-- COMPILING - Building Search Engine indexes" |
|
124 |
println "binDir: $binDir" |
|
125 |
println "txmDir: $txmDir" |
|
126 |
def c = new compiler(); |
|
127 |
if (debug) c.setDebug(); |
|
128 |
c.setLang(lang); |
|
129 |
//c.setSortMetadata(sortMetadata) |
|
130 |
if (!c.run(binDir, txmDir, basename, corpusname, filelist)) { |
|
131 |
println "import process stopped"; |
|
132 |
return; |
|
133 |
} |
|
134 |
|
|
135 |
if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); } |
|
136 |
if (MONITOR != null) MONITOR.worked(20, "EDITION") |
|
137 |
println "-- EDITION - Building edition" |
|
138 |
new File(binDir,"HTML/$corpusname").deleteDir(); |
|
139 |
new File(binDir,"HTML/$corpusname").mkdirs(); |
|
140 |
File outdir = new File(binDir,"/HTML/$corpusname/default/"); |
|
141 |
outdir.mkdirs(); |
|
142 |
|
|
143 |
|
|
144 |
def second = 0 |
|
145 |
println "Paginating text: " |
|
146 |
for (File srcfile : filelist) { |
|
147 |
String txtname = srcfile.getName(); |
|
148 |
int i = txtname.lastIndexOf("."); |
|
149 |
if(i > 0) txtname = txtname.substring(0, i); |
|
150 |
List<String> NoSpaceBefore = LangFormater.getNoSpaceBefore(lang); |
|
151 |
List<String> NoSpaceAfter = LangFormater.getNoSpaceAfter(lang); |
|
152 |
Element text = params.addText(params.corpora.get(corpusname), txtname, srcfile); |
|
153 |
if (second) { print(", ") } |
|
154 |
if (second > 0 && (second++ % 5) == 0) println "" |
|
155 |
print(srcfile.getName()); |
|
156 |
def ed = new pager(srcfile, outdir, txtname, NoSpaceBefore, NoSpaceAfter, 500, basename, "pb"); |
|
157 |
Element edition = params.addEdition(text, "default", outdir.getAbsolutePath(), "html"); |
|
158 |
for (i = 0 ; i < ed.getPageFiles().size();) { |
|
159 |
File f = ed.getPageFiles().get(i); |
|
160 |
String wordid = ed.getIdx().get(i); |
|
161 |
params.addPage(edition, ""+(++i), wordid); |
|
162 |
} |
|
163 |
} |
|
164 |
|
|
165 |
if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); } |
|
166 |
if (MONITOR != null) MONITOR.worked(20, "FINALIZING") |
|
167 |
File paramFile = new File(binDir, "import.xml"); |
|
168 |
DomUtils.save(params.root.getOwnerDocument(), paramFile);readyToLoad = true; |
|
169 |
|
|
170 |
|
|
171 |
// TMR Modifications start here |
|
172 |
File tigerDir = new File(binDir, "tiger"); |
|
173 |
tigerDir.mkdir(); |
|
174 |
File master = new File(tigerSrcDir, "master.xml"); |
|
175 |
File txmSrcFile = txmSrcDir.listFiles()[0]; // only one text file |
|
176 |
|
|
177 |
// Run SRCMF cmd line corpus import script |
|
178 |
if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); } |
|
179 |
def importer = new SrcmfImporter() |
|
180 |
def tigerXmlAll = importer.doAllButPnc(master, txmSrcFile, headerFile, binDir) |
|
181 |
|
|
182 |
// Create TigerXml-POS-PNC |
|
183 |
if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); } |
|
184 |
println "create TIGER XML POS PNC" |
|
185 |
PunctInjectImport injector; |
|
186 |
if (Toolbox.isInitialized()) { |
|
187 |
// get idx from CQP |
|
188 |
// INCOMPLETE |
|
189 |
// def injector = new PunctInjectImport(tmpFile, words) |
|
190 |
println "Error: the loader is not ready to be launched from RCP" |
|
191 |
return; |
|
192 |
} else { |
|
193 |
injector = new PunctInjectImport(tigerXmlAll, txmSrcFile) |
|
194 |
} |
|
195 |
injector.outputFile = new File(tigerDir, "TigerPnc.xml") |
|
196 |
injector.process() |
|
197 |
|
|
198 |
// Create the tigersearch.logprop file (used to launch TIGERSearch) |
|
199 |
File logprop = new File(tigerDir, "tigersearch.logprop"); |
|
200 |
logprop.withWriter("UTF-8") { writer -> |
|
201 |
writer.write("""# Default log configuration of the TIGERSearch suite |
|
202 |
|
|
203 |
log4j.rootLogger=WARN,Logfile |
|
204 |
log4j.logger.ims.tiger.gui.tigersearch.TIGERSearch=INFO |
|
205 |
|
|
206 |
log4j.appender.Logfile=org.apache.log4j.RollingFileAppender |
|
207 |
log4j.appender.Logfile.File=\${user.home}/tigersearch/tigersearch.log |
|
208 |
log4j.appender.Logfile.MaxFileSize=500KB |
|
209 |
log4j.appender.Logfile.MaxBackupIndex=1 |
|
210 |
|
|
211 |
log4j.appender.Logfile.layout=org.apache.log4j.PatternLayout |
|
212 |
log4j.appender.Logfile.layout.ConversionPattern=%5r %-5p [%t] %c{2} - %m%n""") |
|
213 |
} |
|
214 |
|
|
215 |
// Run TigerRegistry |
|
216 |
if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); } |
|
217 |
BasicConfigurator.configure(); |
|
218 |
String uri = tigerXmlAll.getAbsolutePath(); |
|
219 |
File tigerBinDir = new File(tigerDir, corpusname) |
|
220 |
tigerBinDir.mkdir() |
|
221 |
try { |
|
222 |
IndexBuilderErrorHandler handler = new SimpleErrorHandler(tigerBinDir.getAbsolutePath()); |
|
223 |
XMLIndexing indexing = new XMLIndexing(corpusname,uri, tigerBinDir.getAbsolutePath(), handler,false); |
|
224 |
indexing.startIndexing(); |
|
225 |
} |
|
226 |
catch (IOException e) { System.out.println("IO: "+e.getMessage()); } |
|
227 |
catch (SAXException e) { System.out.println("SAX: "+e.getMessage()); } |
|
228 |
|
|
229 |
tigerXmlAll.delete() |
tmp/org.txm.tigersearch.rcp/plugin.xml (revision 714) | ||
---|---|---|
17 | 17 |
</command> |
18 | 18 |
<command |
19 | 19 |
categoryId="TIGERSearch4TXM.commands.category" |
20 |
defaultHandler="org.txm.tigersearch.commands.ComputeTSIndex" |
|
21 |
id="org.txm.tigersearch.commands.ComputeTSIndex" |
|
22 |
name="ComputeTSIndex"> |
|
23 |
</command> |
|
24 |
<command |
|
25 |
categoryId="TIGERSearch4TXM.commands.category" |
Formats disponibles : Unified diff