Révision 1725
| tmp/org.txm.tigersearch.rcp/src/org/txm/tigersearch/rcp/InstallGroovyTIGERFiles.java (revision 1725) | ||
|---|---|---|
| 9 | 9 |
|
| 10 | 10 |
public class InstallGroovyTIGERFiles extends PostTXMHOMEInstallationStep {
|
| 11 | 11 |
|
| 12 |
final static String createfolders[] = {"scripts/groovy/lib", "scripts/groovy/user", "scripts/groovy/system"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
|
| 13 |
|
|
| 12 | 14 |
@Override |
| 13 |
public boolean install(Workspace workspace) {
|
|
| 15 |
public boolean do_install(Workspace workspace) {
|
|
| 14 | 16 |
File txmhomedir = new File(Toolbox.getTxmHomePath()); |
| 15 | 17 |
|
| 16 |
String createfolders[] = {"scripts/groovy/lib", "scripts/groovy/user", "scripts/groovy/system"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
|
| 17 | 18 |
|
| 18 | 19 |
for (String folder : createfolders) {
|
| 19 | 20 |
new File(txmhomedir, folder).mkdirs(); |
| ... | ... | |
| 37 | 38 |
public String getName() {
|
| 38 | 39 |
return "TIGERSearch (org.txm.tigersearch.rcp)"; |
| 39 | 40 |
} |
| 41 |
|
|
| 42 |
@Override |
|
| 43 |
public boolean needsReinstall(Workspace workspace) {
|
|
| 44 |
File txmhomedir = new File(Toolbox.getTxmHomePath()); |
|
| 45 |
for (String folder : createfolders) {
|
|
| 46 |
if (!new File(txmhomedir, folder).exists()) {
|
|
| 47 |
return true; |
|
| 48 |
} |
|
| 49 |
} |
|
| 50 |
return false; |
|
| 51 |
} |
|
| 40 | 52 |
} |
| tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/InstallRUserPart.java (revision 1725) | ||
|---|---|---|
| 10 | 10 |
public class InstallRUserPart extends PostTXMHOMEInstallationStep {
|
| 11 | 11 |
|
| 12 | 12 |
@Override |
| 13 |
public boolean install(Workspace workspace) {
|
|
| 13 |
public boolean do_install(Workspace workspace) {
|
|
| 14 | 14 |
File txmhomedir = new File(Toolbox.getTxmHomePath()); |
| 15 | 15 |
File dir = new File(txmhomedir, "R/libraries"); |
| 16 | 16 |
dir.mkdirs(); |
| ... | ... | |
| 26 | 26 |
public String getName() {
|
| 27 | 27 |
return "R (org.txm.statengine.r.core)"; |
| 28 | 28 |
} |
| 29 |
|
|
| 30 |
@Override |
|
| 31 |
public boolean needsReinstall(Workspace workspace) {
|
|
| 32 |
File txmhomedir = new File(Toolbox.getTxmHomePath()); |
|
| 33 |
File dir = new File(txmhomedir, "R/libraries"); |
|
| 34 |
return !dir.exists(); |
|
| 35 |
} |
|
| 29 | 36 |
} |
| tmp/org.txm.core/src/java/org/txm/utils/BundleUtils.java (revision 1725) | ||
|---|---|---|
| 6 | 6 |
import org.eclipse.core.runtime.FileLocator; |
| 7 | 7 |
import org.eclipse.core.runtime.Platform; |
| 8 | 8 |
import org.osgi.framework.Bundle; |
| 9 |
import org.osgi.framework.FrameworkUtil; |
|
| 9 | 10 |
import org.osgi.framework.Version; |
| 10 | 11 |
import org.osgi.framework.wiring.BundleWiring; |
| 11 | 12 |
import org.txm.Toolbox; |
| ... | ... | |
| 32 | 33 |
return bundle.getVersion(); |
| 33 | 34 |
} |
| 34 | 35 |
|
| 36 |
public static Bundle getBundle(Class clazz) {
|
|
| 37 |
return FrameworkUtil.getBundle(clazz); |
|
| 38 |
} |
|
| 39 |
|
|
| 40 |
public static String getBundleId(Class clazz) {
|
|
| 41 |
return getBundle(clazz).getSymbolicName(); |
|
| 42 |
} |
|
| 43 |
|
|
| 35 | 44 |
/** |
| 36 | 45 |
* |
| 37 | 46 |
* @param bundle_id the Bundle ID |
| tmp/org.txm.core/src/java/org/txm/importer/ApplyXsl2.java (revision 1725) | ||
|---|---|---|
| 308 | 308 |
w.write(strWriter.toString()); |
| 309 | 309 |
w.close(); |
| 310 | 310 |
|
| 311 |
if (debug && inputfile_copy != null) {
|
|
| 312 |
//FIXME: old version |
|
| 313 |
//File inputfile_copy = new File("/tmp", xmlinfile.getName());
|
|
| 314 |
|
|
| 315 |
String s = Diff.diffFile(inputfile_copy, xmloutfile); |
|
| 316 |
if (s.length() > 0) { // for ultra debug?
|
|
| 317 |
System.out.println("Result "+xmlinfile.getName()+" VS "+ xmloutfile.getName()+" diff="+s);
|
|
| 318 |
} else {
|
|
| 319 |
System.out.println("Warning: no diff between "+inputfile_copy+" and "+ xmloutfile);
|
|
| 320 |
} |
|
| 321 |
} |
|
| 311 |
// if (debug && inputfile_copy != null) {
|
|
| 312 |
// //FIXME: old version
|
|
| 313 |
// //File inputfile_copy = new File("/tmp", xmlinfile.getName());
|
|
| 314 |
// |
|
| 315 |
// String s = Diff.diffFile(inputfile_copy, xmloutfile);
|
|
| 316 |
// if (s.length() > 0) { // for ultra debug?
|
|
| 317 |
// System.out.println("Result "+xmlinfile.getName()+" VS "+ xmloutfile.getName()+" diff="+s);
|
|
| 318 |
// } else {
|
|
| 319 |
// System.out.println("Warning: no diff between "+inputfile_copy+" and "+ xmloutfile);
|
|
| 320 |
// }
|
|
| 321 |
// }
|
|
| 322 | 322 |
} |
| 323 | 323 |
|
| 324 | 324 |
cleanMemory(); |
| tmp/org.txm.core/src/java/org/txm/PostTXMHOMEInstallationStep.java (revision 1725) | ||
|---|---|---|
| 1 | 1 |
package org.txm; |
| 2 | 2 |
|
| 3 |
import org.osgi.framework.FrameworkUtil; |
|
| 4 |
import org.osgi.framework.Version; |
|
| 5 |
import org.txm.core.messages.TXMCoreMessages; |
|
| 6 |
import org.txm.core.preferences.TBXPreferences; |
|
| 3 | 7 |
import org.txm.objects.Workspace; |
| 8 |
import org.txm.utils.BundleUtils; |
|
| 9 |
import org.txm.utils.logger.Log; |
|
| 4 | 10 |
|
| 5 | 11 |
/** |
| 6 | 12 |
* Called by the Toolbox when a plugin needs to install things in a newly created/updated TXM user directory |
| ... | ... | |
| 16 | 22 |
* called after the Core has created its files |
| 17 | 23 |
* @return true if success, false if installation failed |
| 18 | 24 |
*/ |
| 19 |
public abstract boolean install(Workspace workspace); |
|
| 25 |
public final boolean install(Workspace workspace) {
|
|
| 26 |
String bundle_id = FrameworkUtil.getBundle(getClass()).getSymbolicName(); |
|
| 27 |
Version extcurrentVersion = BundleUtils.getBundleVersion(bundle_id); |
|
| 28 |
String extinstalledVersionString = Toolbox.getPreference(getName()); |
|
| 29 |
if (extinstalledVersionString.isEmpty()) {
|
|
| 30 |
extinstalledVersionString = "0.0.0"; |
|
| 31 |
} |
|
| 32 |
Version extinstalledVersion = new Version(extinstalledVersionString); |
|
| 33 |
Log.fine(TXMCoreMessages.bind("{0} nstalled version: {1}.", getName(), extinstalledVersion));
|
|
| 34 |
//System.out.println("Toolbox.startWorkspace(): workspace location = " + location);
|
|
| 35 |
boolean extDoUpdateworkspace = extcurrentVersion.compareTo(extinstalledVersion) > 0; |
|
| 36 |
if (needsReinstall(workspace) || extDoUpdateworkspace) {
|
|
| 37 |
return do_install(workspace); |
|
| 38 |
} |
|
| 39 |
return true; |
|
| 40 |
}; |
|
| 20 | 41 |
|
| 21 | 42 |
/** |
| 43 |
* copy files etc. |
|
| 22 | 44 |
* |
| 23 |
* @return user friendly extension point name |
|
| 45 |
* @param workspace |
|
| 46 |
* @return |
|
| 24 | 47 |
*/ |
| 48 |
public abstract boolean do_install(Workspace workspace); |
|
| 49 |
|
|
| 50 |
/** |
|
| 51 |
* Allow an extension to test if the needed files are installed |
|
| 52 |
* @param workspace |
|
| 53 |
* @return true if the extension needs to reinstall itself |
|
| 54 |
*/ |
|
| 55 |
public abstract boolean needsReinstall(Workspace workspace); |
|
| 56 |
|
|
| 57 |
/** |
|
| 58 |
* |
|
| 59 |
* @return extension unique name |
|
| 60 |
*/ |
|
| 25 | 61 |
public abstract String getName(); |
| 26 | 62 |
} |
| tmp/org.txm.core/src/java/org/txm/Toolbox.java (revision 1725) | ||
|---|---|---|
| 82 | 82 |
|
| 83 | 83 |
public static final DateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd");
|
| 84 | 84 |
public static final DateFormat shortUKDateformat = new SimpleDateFormat("dd-MM-yy");
|
| 85 |
|
|
| 85 |
|
|
| 86 | 86 |
private static LinkedHashMap<EngineType, EnginesManager<?>> enginesManagers = new LinkedHashMap<EngineType, EnginesManager<?>>(); |
| 87 | 87 |
|
| 88 | 88 |
private static boolean initializing = false; |
| ... | ... | |
| 90 | 90 |
/** The state. */ |
| 91 | 91 |
private static boolean state = false; |
| 92 | 92 |
|
| 93 |
|
|
| 94 | 93 |
|
| 95 |
|
|
| 96 |
|
|
| 94 |
|
|
| 95 |
|
|
| 96 |
|
|
| 97 | 97 |
public static Workspace workspace; |
| 98 | 98 |
|
| 99 | 99 |
/** |
| ... | ... | |
| 131 | 131 |
addEngineManager(enginesManager); |
| 132 | 132 |
if (enginesManager.fetchEngines()) {
|
| 133 | 133 |
//System.out.println("add engine: "+engine);
|
| 134 |
|
|
| 134 |
|
|
| 135 | 135 |
} |
| 136 | 136 |
else {
|
| 137 | 137 |
Log.severe("No engine found for " + enginesManager + ", installation failed.");
|
| ... | ... | |
| 245 | 245 |
} |
| 246 | 246 |
|
| 247 | 247 |
if (monitor != null && monitor.isCanceled()) return false; |
| 248 |
|
|
| 248 |
|
|
| 249 | 249 |
try {
|
| 250 | 250 |
// initialize workspace : list of corpus loaded in TXM |
| 251 | 251 |
// copy shared files if needed |
| 252 | 252 |
state = startWorkspace(monitor); |
| 253 | 253 |
if (monitor != null && monitor.isCanceled()) return false; |
| 254 |
|
|
| 254 |
|
|
| 255 | 255 |
Log.fine("Initializing logger...");
|
| 256 | 256 |
Log.setLevel(Level.parse(getPreference(TBXPreferences.LOG_LEVEL))); |
| 257 | 257 |
Log.setPrintInConsole(TBXPreferences.getInstance().getBoolean(TBXPreferences.ADD_TECH_LOGS)); |
| 258 | 258 |
Log.log_stacktrace_boolean = TBXPreferences.getInstance().getBoolean(TBXPreferences.LOG_STACKTRACE); |
| 259 |
|
|
| 259 |
|
|
| 260 | 260 |
if (!getPreference(TBXPreferences.LOG_DIR).isEmpty()) {
|
| 261 | 261 |
Log.setPrintInFile(TBXPreferences.getInstance().getBoolean(TBXPreferences.LOG_IN_FILE), new File(getPreference(TBXPreferences.LOG_DIR))); |
| 262 | 262 |
} else {
|
| ... | ... | |
| 476 | 476 |
return checkState(); |
| 477 | 477 |
} |
| 478 | 478 |
|
| 479 |
// /** |
|
| 480 |
// * Restart the toolbox's workspace. |
|
| 481 |
// * |
|
| 482 |
// * @return true, if successful |
|
| 483 |
// */ |
|
| 484 |
// public static boolean restartWorkspace(IProgressMonitor monitor) {
|
|
| 485 |
// try {
|
|
| 486 |
// shutdownWorkspace(); |
|
| 487 |
// startWorkspace(monitor); |
|
| 488 |
// } catch (Exception e) {
|
|
| 489 |
// Log.severe("Error while restarting workspace.");
|
|
| 490 |
// e.printStackTrace(); |
|
| 491 |
// } |
|
| 492 |
// return checkState(); |
|
| 493 |
// } |
|
| 479 |
// /**
|
|
| 480 |
// * Restart the toolbox's workspace.
|
|
| 481 |
// *
|
|
| 482 |
// * @return true, if successful
|
|
| 483 |
// */
|
|
| 484 |
// public static boolean restartWorkspace(IProgressMonitor monitor) {
|
|
| 485 |
// try {
|
|
| 486 |
// shutdownWorkspace();
|
|
| 487 |
// startWorkspace(monitor);
|
|
| 488 |
// } catch (Exception e) {
|
|
| 489 |
// Log.severe("Error while restarting workspace.");
|
|
| 490 |
// e.printStackTrace();
|
|
| 491 |
// }
|
|
| 492 |
// return checkState();
|
|
| 493 |
// }
|
|
| 494 | 494 |
|
| 495 | 495 |
/** |
| 496 | 496 |
* Shut the toolbox down. |
| ... | ... | |
| 509 | 509 |
// FIXME: other tmp solution |
| 510 | 510 |
TXMResult.deleteAllNonPersistentResults(); |
| 511 | 511 |
|
| 512 |
|
|
| 512 |
|
|
| 513 | 513 |
// save projects parameters |
| 514 | 514 |
if (Toolbox.workspace != null) {
|
| 515 | 515 |
Toolbox.workspace.saveParameters(true); |
| ... | ... | |
| 525 | 525 |
} |
| 526 | 526 |
} |
| 527 | 527 |
|
| 528 |
// /** |
|
| 529 |
// * Shut the toolbox workspace down. |
|
| 530 |
// */ |
|
| 531 |
// public static void shutdownWorkspace() {
|
|
| 532 |
// try {
|
|
| 533 |
// Toolbox.workspace.saveParameters(); |
|
| 534 |
// Toolbox.workspace = null; |
|
| 535 |
// state = false; |
|
| 536 |
// } catch (Exception e) {
|
|
| 537 |
// Log.severe("Error while closing workspace.");
|
|
| 538 |
// e.printStackTrace(); |
|
| 539 |
// } |
|
| 540 |
// } |
|
| 528 |
// /**
|
|
| 529 |
// * Shut the toolbox workspace down.
|
|
| 530 |
// */
|
|
| 531 |
// public static void shutdownWorkspace() {
|
|
| 532 |
// try {
|
|
| 533 |
// Toolbox.workspace.saveParameters();
|
|
| 534 |
// Toolbox.workspace = null;
|
|
| 535 |
// state = false;
|
|
| 536 |
// } catch (Exception e) {
|
|
| 537 |
// Log.severe("Error while closing workspace.");
|
|
| 538 |
// e.printStackTrace();
|
|
| 539 |
// }
|
|
| 540 |
// }
|
|
| 541 | 541 |
|
| 542 | 542 |
public static boolean startEnginesManagers(IProgressMonitor monitor) {
|
| 543 | 543 |
|
| ... | ... | |
| 642 | 642 |
return false; |
| 643 | 643 |
} else {
|
| 644 | 644 |
//System.out.println(TXMCoreMessages.DONE); |
| 645 |
|
|
| 646 |
// updating extension files |
|
| 647 |
IConfigurationElement[] contributions = Platform.getExtensionRegistry().getConfigurationElementsFor(PostTXMHOMEInstallationStep.EXTENSION_ID); |
|
| 648 |
//System.out.println("contributions: "+Arrays.toString(contributions));
|
|
| 649 |
for (int i = 0; i < contributions.length; i++) {
|
|
| 650 |
try {
|
|
| 651 |
Log.fine(TXMCoreMessages.bind("Registering engine: {0}...", contributions[i].getName()));
|
|
| 652 |
PostTXMHOMEInstallationStep extp = (PostTXMHOMEInstallationStep)contributions[i].createExecutableExtension("class"); //$NON-NLS-1$
|
|
| 653 |
|
|
| 654 |
if (!extp.install(workspace)) {
|
|
| 655 |
Log.severe("Fail to install "+extp.getName()+" files in "+workspace.getLocation());
|
|
| 656 |
} |
|
| 657 |
} catch(CoreException e) {
|
|
| 658 |
e.printStackTrace(); |
|
| 659 |
} |
|
| 660 |
} |
|
| 645 | 661 |
} |
| 646 | 662 |
} catch (Exception e) {
|
| 647 | 663 |
Log.severe(NLS.bind(TXMCoreMessages.errorDuringWorkspaceInitializationColonP0, workspaceFile)); |
| ... | ... | |
| 694 | 710 |
public static String getInstallDirectory() {
|
| 695 | 711 |
return getPreference(TBXPreferences.INSTALL_DIR); |
| 696 | 712 |
} |
| 697 |
|
|
| 713 |
|
|
| 698 | 714 |
/** |
| 699 | 715 |
* Creates&Update workspace directory. |
| 700 | 716 |
* |
| ... | ... | |
| 706 | 722 |
public static Workspace createOrUpdate(File txmhomedir) {
|
| 707 | 723 |
//TODO replace this old directory&file with the ".project" Eclipse project configuration file |
| 708 | 724 |
File workspaceDirectory = new File(txmhomedir, "corpora"); |
| 709 |
// File xmlfile = new File(workspaceDirectory, "default.xml"); |
|
| 725 |
// File xmlfile = new File(workspaceDirectory, "default.xml");
|
|
| 710 | 726 |
|
| 711 | 727 |
try {
|
| 712 | 728 |
txmhomedir.mkdirs(); |
| ... | ... | |
| 730 | 746 |
new File(txmhomedir, folder).mkdir(); |
| 731 | 747 |
} |
| 732 | 748 |
|
| 733 |
// if (!xmlfile.exists()) {
|
|
| 734 |
// if (!writeEmptyWorkspaceFile(xmlfile)) {
|
|
| 735 |
// System.out.println("Error while creating workspace definition file: "+xmlfile);
|
|
| 736 |
// } |
|
| 737 |
// } |
|
| 749 |
// if (!xmlfile.exists()) {
|
|
| 750 |
// if (!writeEmptyWorkspaceFile(xmlfile)) {
|
|
| 751 |
// System.out.println("Error while creating workspace definition file: "+xmlfile);
|
|
| 752 |
// }
|
|
| 753 |
// }
|
|
| 738 | 754 |
|
| 739 | 755 |
String path = Toolbox.getPreference(TBXPreferences.INSTALL_DIR); |
| 740 | 756 |
File installDirectory = new File(path); |
| ... | ... | |
| 757 | 773 |
|
| 758 | 774 |
Workspace workspace = Workspace.getInstance(); |
| 759 | 775 |
|
| 760 |
IConfigurationElement[] contributions = Platform.getExtensionRegistry().getConfigurationElementsFor(PostTXMHOMEInstallationStep.EXTENSION_ID); |
|
| 761 |
//System.out.println("contributions: "+Arrays.toString(contributions));
|
|
| 762 |
for (int i = 0; i < contributions.length; i++) {
|
|
| 763 |
try {
|
|
| 764 |
Log.fine(TXMCoreMessages.bind("Registering engine: {0}...", contributions[i].getName()));
|
|
| 765 |
PostTXMHOMEInstallationStep extp = (PostTXMHOMEInstallationStep)contributions[i].createExecutableExtension("class"); //$NON-NLS-1$
|
|
| 766 |
if (!extp.install(workspace)) {
|
|
| 767 |
Log.severe("Fail to install "+extp.getName()+" files in "+workspace.getLocation());
|
|
| 768 |
} |
|
| 769 |
} catch(CoreException e) {
|
|
| 770 |
e.printStackTrace(); |
|
| 771 |
} |
|
| 772 |
} |
|
| 773 |
|
|
| 774 | 776 |
return workspace; |
| 775 | 777 |
} catch (Exception e) {
|
| 776 | 778 |
Log.severe(NLS.bind(TXMCoreMessages.failedToCopyTXMFilesFromTXMINSTALLDIRToTXMHOMEColonP0, e.getLocalizedMessage())); |
| tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/MemCqiClient.java (revision 1725) | ||
|---|---|---|
| 56 | 56 |
} |
| 57 | 57 |
|
| 58 | 58 |
public byte[] throwExceptionFromCqi(int error) throws CqiServerError, UnexpectedAnswerException, IOException {
|
| 59 |
return throwExceptionFromCqi("CQi", error);
|
|
| 59 |
return throwExceptionFromCqi("", error);
|
|
| 60 | 60 |
} |
| 61 | 61 |
|
| 62 | 62 |
public byte[] throwExceptionFromCqi(String message, int error) throws CqiServerError, UnexpectedAnswerException, IOException {
|
| tmp/org.txm.ahc.core/src/org/txm/ahc/core/messages/AHCCoreMessages.java (revision 1725) | ||
|---|---|---|
| 24 | 24 |
|
| 25 | 25 |
public static String computingAHC; |
| 26 | 26 |
|
| 27 |
|
|
| 28 | 27 |
static {
|
| 29 | 28 |
Utf8NLS.initializeMessages(BUNDLE_NAME, AHCCoreMessages.class); |
| 30 | 29 |
} |
| tmp/org.txm.analec.rcp/src/org/txm/macro/urs/edit/ConcordanceToUnitMacro.groovy (revision 1725) | ||
|---|---|---|
| 79 | 79 |
// browse lines and check |
| 80 | 80 |
def units = analecCorpus.getUnites(unit_type) |
| 81 | 81 |
def lines = concordance.getLines() |
| 82 |
int iUnit = 0 |
|
| 82 |
|
|
| 83 | 83 |
int n = 0 |
| 84 | 84 |
for (int iLine = 0 ; iLine < lines.size() ; iLine++) {
|
| 85 | 85 |
def line = lines[iLine] |
| 86 | 86 |
def m = line.getMatch() |
| 87 | 87 |
if (create_only_if_new && iUnit < units.size()) { // test only if create_only_if_new == true
|
| 88 | 88 |
def unit = null |
| 89 |
while (iUnit < units.size() && units[iUnit].getDeb() < m.getStart()) {
|
|
| 90 |
|
|
| 89 |
//TODO don't iterates over |
|
| 90 |
int iUnit = 0 |
|
| 91 |
while (iUnit < units.size() ) { //&& units[iUnit].getDeb() < m.getStart()) {
|
|
| 91 | 92 |
if (iUnit < units.size()) {
|
| 92 | 93 |
unit = units[iUnit++] |
| 93 | 94 |
if (unit.getDeb() == m.getStart() && unit.getFin() == m.getEnd()) { // skip and print the line
|
| tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/InstallURSFiles.java (revision 1725) | ||
|---|---|---|
| 16 | 16 |
*/ |
| 17 | 17 |
public class InstallURSFiles extends PostTXMHOMEInstallationStep {
|
| 18 | 18 |
|
| 19 |
final static String createfolders[] = { "scripts/groovy/user" }; //$NON-NLS-1$
|
|
| 20 |
|
|
| 19 | 21 |
@Override |
| 20 |
public boolean install(Workspace workspace) {
|
|
| 22 |
public boolean do_install(Workspace workspace) {
|
|
| 21 | 23 |
|
| 22 | 24 |
File txmhomedir = new File(Toolbox.getTxmHomePath()); |
| 23 | 25 |
|
| 24 |
String createfolders[] = { "scripts/groovy/user" }; //$NON-NLS-1$
|
|
| 25 |
|
|
| 26 | 26 |
for (String folder : createfolders) {
|
| 27 | 27 |
new File(txmhomedir, folder).mkdirs(); |
| 28 | 28 |
} |
| ... | ... | |
| 41 | 41 |
public String getName() {
|
| 42 | 42 |
return "URS Annotation"; |
| 43 | 43 |
} |
| 44 |
|
|
| 45 |
@Override |
|
| 46 |
public boolean needsReinstall(Workspace workspace) {
|
|
| 47 |
File txmhomedir = new File(Toolbox.getTxmHomePath()); |
|
| 48 |
for (String folder : createfolders) {
|
|
| 49 |
if (!new File(txmhomedir, folder).exists()) {
|
|
| 50 |
return true; |
|
| 51 |
} |
|
| 52 |
} |
|
| 53 |
return false; |
|
| 54 |
} |
|
| 44 | 55 |
} |
| tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZImporter.groovy (revision 1725) | ||
|---|---|---|
| 343 | 343 |
} |
| 344 | 344 |
|
| 345 | 345 |
//if (wordTag != "w") {
|
| 346 |
if (doTokenizeStep) {
|
|
| 346 |
if (!doTokenizeStep) {
|
|
| 347 | 347 |
println "No tokenization do to." |
| 348 | 348 |
// ConsoleProgressBar cpb = new ConsoleProgressBar(filesToProcess.size()) |
| 349 | 349 |
for (File f : filesToProcess) {
|
| tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZCompilerStep.groovy (revision 1725) | ||
|---|---|---|
| 123 | 123 |
boolean stopAtFirstSort = true; |
| 124 | 124 |
boolean foundtei = false; |
| 125 | 125 |
boolean foundtext = false; |
| 126 |
|
|
| 126 |
int nWords = 0; |
|
| 127 | 127 |
try {
|
| 128 | 128 |
String localname; |
| 129 | 129 |
for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) |
| ... | ... | |
| 158 | 158 |
} |
| 159 | 159 |
anavalues = [:]; |
| 160 | 160 |
flagWord = true |
| 161 |
nWords++ |
|
| 161 | 162 |
break; |
| 162 | 163 |
case FORM: |
| 163 | 164 |
flagForm = true; |
| ... | ... | |
| 273 | 274 |
if (inputData != null) inputData.close(); |
| 274 | 275 |
return false; |
| 275 | 276 |
} |
| 276 |
return true; |
|
| 277 |
if (nWords == 0) {
|
|
| 278 |
println "** no words written." |
|
| 279 |
} |
|
| 280 |
return nWords > 0; |
|
| 277 | 281 |
} |
| 278 | 282 |
} |
| tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZCompiler.groovy (revision 1725) | ||
|---|---|---|
| 223 | 223 |
return false; |
| 224 | 224 |
} |
| 225 | 225 |
|
| 226 |
cwbEn.run(outputDirectory.getAbsolutePath() + "/$corpusname", |
|
| 226 |
if (!cwbEn.run(outputDirectory.getAbsolutePath() + "/$corpusname",
|
|
| 227 | 227 |
allcqpFile.getAbsolutePath(), |
| 228 |
regPath, pAttributes, sAttributes, false); |
|
| 229 |
|
|
| 228 |
regPath, pAttributes, sAttributes, false)) {
|
|
| 229 |
println "** cwb-encode did not ends well. Activate finer logs to see details." |
|
| 230 |
return false; |
|
| 231 |
} |
|
| 232 |
|
|
| 230 | 233 |
allcqpFile.delete(); // clean |
| 231 | 234 |
} catch (Exception e) {
|
| 232 | 235 |
println "Error while running cwb-encode: "+e |
| ... | ... | |
| 248 | 251 |
println "Error: The registry file was not created: $regPath. See https://groupes.renater.fr/wiki/txm-users/public/faq" |
| 249 | 252 |
return false; |
| 250 | 253 |
} |
| 251 |
cwbMa.run(corpusname, new File(regPath).getParent()); |
|
| 254 |
if (!cwbMa.run(corpusname, new File(regPath).getParent())) {
|
|
| 255 |
println "** cwb-makeall did not ends well. Activate finer logs to see details." |
|
| 256 |
return false; |
|
| 257 |
} |
|
| 252 | 258 |
|
| 253 | 259 |
// remove milestones from CWB registry and data files |
| 254 | 260 |
FixMilestoneDeclarations fm = new FixMilestoneDeclarations( |
| tmp/org.txm.groovy.core/src/java/org/txm/groovy/core/InstallGroovyFiles.java (revision 1725) | ||
|---|---|---|
| 17 | 17 |
*/ |
| 18 | 18 |
public class InstallGroovyFiles extends PostTXMHOMEInstallationStep {
|
| 19 | 19 |
|
| 20 |
final static String createfolders[] = {"scripts/groovy/lib", "scripts/groovy/user", "scripts/groovy/system"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
|
| 21 |
|
|
| 20 | 22 |
@Override |
| 21 |
public boolean install(Workspace workspace) {
|
|
| 23 |
public boolean do_install(Workspace workspace) {
|
|
| 22 | 24 |
File txmhomedir = new File(Toolbox.getTxmHomePath()); |
| 23 | 25 |
|
| 24 |
String createfolders[] = {"scripts/groovy/lib", "scripts/groovy/user", "scripts/groovy/system"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
|
| 25 | 26 |
|
| 26 | 27 |
for (String folder : createfolders) {
|
| 27 | 28 |
new File(txmhomedir, folder).mkdirs(); |
| ... | ... | |
| 90 | 91 |
public String getName() {
|
| 91 | 92 |
return "Groovy (org.txm.groovy.core)"; |
| 92 | 93 |
} |
| 94 |
|
|
| 95 |
@Override |
|
| 96 |
public boolean needsReinstall(Workspace workspace) {
|
|
| 97 |
File txmhomedir = new File(Toolbox.getTxmHomePath()); |
|
| 98 |
for (String folder : createfolders) {
|
|
| 99 |
if (!new File(txmhomedir, folder).exists()) {
|
|
| 100 |
return true; |
|
| 101 |
} |
|
| 102 |
} |
|
| 103 |
return false; |
|
| 104 |
} |
|
| 93 | 105 |
} |
Formats disponibles : Unified diff