Révision 1649
tmp/org.txm.core/src/java/org/txm/core/engines/EnginesManager.java (revision 1649) | ||
---|---|---|
5 | 5 |
import org.eclipse.core.runtime.IConfigurationElement; |
6 | 6 |
import org.eclipse.core.runtime.IProgressMonitor; |
7 | 7 |
import org.eclipse.core.runtime.RegistryFactory; |
8 |
import org.txm.utils.LogMonitor; |
|
8 | 9 |
import org.txm.utils.logger.Log; |
9 | 10 |
|
10 | 11 |
/** |
... | ... | |
146 | 147 |
* @return |
147 | 148 |
*/ |
148 | 149 |
public boolean restartEngines() { |
150 |
|
|
149 | 151 |
Log.finest("Restarting " + this.size() + " " + this.getEnginesDescription() + " engine(s)."); //$NON-NLS-1$ |
150 |
return stopEngines() && startEngines(null); |
|
152 |
|
|
153 |
for (Engine engine : this.values()) { |
|
154 |
try { |
|
155 |
if (engine.isRunning()) { |
|
156 |
Log.fine("Stopping " + this.getEnginesDescription() + " engine: " + engine.getName() + "..."); //$NON-NLS-1$ |
|
157 |
engine.stop(); |
|
158 |
} |
|
159 |
if (!engine.isRunning()) { |
|
160 |
Log.fine("Starting " + this.getEnginesDescription() + " engine: " + engine.getName() + "..."); //$NON-NLS-1$ |
|
161 |
engine.start(new LogMonitor()); |
|
162 |
} |
|
163 |
} catch (Exception e) { |
|
164 |
Log.severe("Error: failed to stop engine " + engine.getName() + "."); |
|
165 |
e.printStackTrace(); |
|
166 |
} |
|
167 |
} |
|
168 |
return true; |
|
151 | 169 |
} |
152 | 170 |
|
153 | 171 |
/** |
tmp/org.txm.utils/src/org/txm/utils/StreamHog.java (revision 1649) | ||
---|---|---|
34 | 34 |
|
35 | 35 |
import org.txm.utils.logger.Log; |
36 | 36 |
|
37 |
// TODO: Auto-generated Javadoc |
|
38 | 37 |
/** |
39 | 38 |
* The Class StreamHog. |
40 | 39 |
* |
... | ... | |
102 | 101 |
printMessage(line); |
103 | 102 |
Log.fine(this.getName()+">" + line); //$NON-NLS-1$ |
104 | 103 |
lastline = line; |
105 |
|
|
106 | 104 |
} |
107 | 105 |
} catch (Throwable e) { |
108 | 106 |
Log.fine("ERROR: broken process logging : "+e); |
tmp/org.txm.setups/shared/win/txm.nsi (revision 1649) | ||
---|---|---|
267 | 267 |
|
268 | 268 |
CreateDirectory "$SMPROGRAMS\TXM${Version}" |
269 | 269 |
|
270 |
;CreateShortCut "$SMPROGRAMS\TXM${Version}\TXM.lnk" "$INSTDIR\TXM.bat" "$INSTDIR\TXM.ico" |
|
271 | 270 |
CreateShortCut "$SMPROGRAMS\TXM${Version}\TXM.lnk" "$INSTDIR\TXM.bat" "" "$INSTDIR\TXM.ico" 0 |
272 |
CreateShortCut "$SMPROGRAMS\TXM${Version}\TXM.lnk" "$INSTDIR\TXM debug.bat" "" "$INSTDIR\TXM.ico" 0 |
|
273 |
|
|
271 |
CreateShortCut "$SMPROGRAMS\TXM${Version}\TXM debug.lnk" "$INSTDIR\TXM debug.bat" "" "$INSTDIR\TXM.ico" 0 |
|
274 | 272 |
CreateShortCut "$SMPROGRAMS\TXM${Version}\uninstall.lnk" "$INSTDIR\uninstall.exe" |
275 |
|
|
276 | 273 |
#CreateShortCut "$SMPROGRAMS\TXM${Version}\Manuel utilisateur FR.pdf.lnk" "$INSTDIR\doc\Manuel de TXM 0.7 FR.pdf" |
277 |
|
|
278 | 274 |
#CreateShortCut "$SMPROGRAMS\TXM${Version}\User Manual EN.pdf.lnk" "$INSTDIR\doc\TXM 0.7 Manual EN.pdf" |
279 | 275 |
|
280 | 276 |
|
... | ... | |
511 | 507 |
|
512 | 508 |
RMDir /r $INSTDIR |
513 | 509 |
|
514 |
# second, remove the link from the start menu |
|
515 |
;Delete "$SMPROGRAMS\TXM${Version}\uninstall.lnk" |
|
516 |
|
|
517 | 510 |
RMDir /r "$SMPROGRAMS\TXM${Version}" |
518 | 511 |
|
519 | 512 |
SectionEnd |
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPSearchEngine.java (revision 1649) | ||
---|---|---|
29 | 29 |
import org.txm.utils.logger.Log; |
30 | 30 |
|
31 | 31 |
public class CQPSearchEngine extends SearchEngine { |
32 |
|
|
32 |
|
|
33 | 33 |
public static final String NAME = "CQP"; |
34 |
|
|
34 |
|
|
35 | 35 |
/** |
36 | 36 |
* initialization state |
37 | 37 |
*/ |
38 | 38 |
boolean state = false; |
39 | 39 |
boolean useNetCQi = false; |
40 |
|
|
40 |
|
|
41 | 41 |
/** |
42 | 42 |
* list of CQP loaded/computed corpus |
43 | 43 |
*/ |
... | ... | |
56 | 56 |
@Override |
57 | 57 |
public boolean start(IProgressMonitor monitor) throws Exception { |
58 | 58 |
|
59 |
boolean cqiserverok = false; |
|
60 |
|
|
59 | 61 |
if (monitor != null) { |
60 | 62 |
monitor.subTask("Starting Corpus Engine..."); |
61 | 63 |
} |
62 |
|
|
64 |
|
|
63 | 65 |
CorpusManager.cleanCorpora();// to be sure to call cqpserver |
64 | 66 |
|
65 |
boolean cqiserverok = false; |
|
66 |
|
|
67 | 67 |
useNetCQi = CQPLibPreferences.getInstance().getBoolean(CQPLibPreferences.CQI_NETWORK_MODE); |
68 | 68 |
|
69 | 69 |
Log.fine("Killing CQP processes if any..."); |
... | ... | |
84 | 84 |
if (!binDir.isDirectory()) continue; |
85 | 85 |
if (binDir.getName().startsWith(".")) continue; |
86 | 86 |
if (binDir.getName().startsWith("~")) continue; |
87 |
|
|
87 |
|
|
88 | 88 |
File registryDir = new File(binDir, "registry"); |
89 | 89 |
if (!registryDir.isDirectory()) continue; |
90 |
|
|
90 |
|
|
91 | 91 |
File[] files = registryDir.listFiles(IOUtils.HIDDENFILE_FILTER); |
92 | 92 |
if (files != null && files.length > 0) { |
93 | 93 |
reg_path += path_separator + registryDir.getAbsolutePath(); |
... | ... | |
116 | 116 |
init_path = null; |
117 | 117 |
} |
118 | 118 |
|
119 |
|
|
120 |
|
|
119 | 121 |
if (!remote) { |
120 | 122 |
|
121 | 123 |
if (!useNetCQi) { |
... | ... | |
136 | 138 |
if (exec_path == null || exec_path.length() == 0 || new File(exec_path).exists()) { |
137 | 139 |
Log.severe(TXMCoreMessages.bind("Error: the '{0}' preference is not set.", CQPLibPreferences.CQI_SERVER_PATH_TO_EXECUTABLE)); |
138 | 140 |
} |
139 |
// if (new File(exec_path).exists()) { |
|
140 |
// System.out.println("Error: the '"+CQPLibPreferences.CQI_SERVER_PATH_TO_EXECUTABLE+"' preference is not set."); |
|
141 |
// } |
|
141 |
// if (new File(exec_path).exists()) {
|
|
142 |
// System.out.println("Error: the '"+CQPLibPreferences.CQI_SERVER_PATH_TO_EXECUTABLE+"' preference is not set.");
|
|
143 |
// }
|
|
142 | 144 |
|
143 | 145 |
cqiServer = new NetCqiServer(exec_path, |
144 | 146 |
reg_path, |
... | ... | |
231 | 233 |
return false; |
232 | 234 |
} |
233 | 235 |
|
234 |
//// initialize pre-configured subcorpus and partition of corpus registered in the default.xml workspace file |
|
235 |
// System.out.print(TXMCoreMessages.Toolbox_workspace_init); |
|
236 |
// for (Project b : Toolbox.workspace.getProjects()) { |
|
237 |
// |
|
238 |
// Log.info("Loading CQP corpora of " + b.getName() + " corpus..."); |
|
239 |
// |
|
240 |
// if (!loadCQPCorpora(b, monitor)) { |
|
241 |
// Log.severe("Failed to load CQP corpora of " + b.getName() + " corpus."); |
|
242 |
// } |
|
243 |
// } |
|
244 |
|
|
236 |
//// initialize pre-configured subcorpus and partition of corpus registered in the default.xml workspace file
|
|
237 |
// System.out.print(TXMCoreMessages.Toolbox_workspace_init);
|
|
238 |
// for (Project b : Toolbox.workspace.getProjects()) {
|
|
239 |
//
|
|
240 |
// Log.info("Loading CQP corpora of " + b.getName() + " corpus...");
|
|
241 |
//
|
|
242 |
// if (!loadCQPCorpora(b, monitor)) {
|
|
243 |
// Log.severe("Failed to load CQP corpora of " + b.getName() + " corpus.");
|
|
244 |
// }
|
|
245 |
// }
|
|
246 |
|
|
245 | 247 |
Log.fine(TXMCoreMessages.common_done); |
246 | 248 |
|
247 | 249 |
return state; |
248 | 250 |
} |
249 | 251 |
|
250 |
// public boolean loadCQPCorpora(Project base, IProgressMonitor monitor) { |
|
251 |
// //System.out.println("Load corpus from params: "+params.corpora); |
|
252 |
// for (String corpusname : base.getProjectParameters().corpora.keySet()) { |
|
253 |
// Element c = base.getProjectParameters().corpora.get(corpusname); |
|
254 |
// try { |
|
255 |
// MainCorpus corp = CorpusManager.getCorpusManager().getCorpus(corpusname); |
|
256 |
// if (monitor != null) { |
|
257 |
// monitor.subTask("Loading " + corp + " subcorpora and partitions of corpus " + corpusname + "..."); |
|
258 |
// } |
|
259 |
// corp.setSelfElement(c); |
|
260 |
// corp.setParent(base); |
|
261 |
// corp.load(); // don't load corpus right now, wait for the search engine to be ready |
|
262 |
// base.addChild(corp); |
|
263 |
// if (!corp.getMetadatas().containsKey("lang")) { //$NON-NLS-1$ |
|
264 |
// corp.setAttribute("lang", c.getAttribute("lang")); //$NON-NLS-1$ //$NON-NLS-2$ |
|
265 |
// } |
|
266 |
// } catch (Exception e) { |
|
267 |
// System.out.println(e.getLocalizedMessage()); |
|
268 |
// org.txm.utils.logger.Log.printStackTrace(e); |
|
269 |
// return false; |
|
270 |
// } |
|
271 |
// } |
|
272 |
// return true; |
|
273 |
// } |
|
252 |
// public boolean loadCQPCorpora(Project base, IProgressMonitor monitor) {
|
|
253 |
// //System.out.println("Load corpus from params: "+params.corpora);
|
|
254 |
// for (String corpusname : base.getProjectParameters().corpora.keySet()) {
|
|
255 |
// Element c = base.getProjectParameters().corpora.get(corpusname);
|
|
256 |
// try {
|
|
257 |
// MainCorpus corp = CorpusManager.getCorpusManager().getCorpus(corpusname);
|
|
258 |
// if (monitor != null) {
|
|
259 |
// monitor.subTask("Loading " + corp + " subcorpora and partitions of corpus " + corpusname + "...");
|
|
260 |
// }
|
|
261 |
// corp.setSelfElement(c);
|
|
262 |
// corp.setParent(base);
|
|
263 |
// corp.load(); // don't load corpus right now, wait for the search engine to be ready
|
|
264 |
// base.addChild(corp);
|
|
265 |
// if (!corp.getMetadatas().containsKey("lang")) { //$NON-NLS-1$
|
|
266 |
// corp.setAttribute("lang", c.getAttribute("lang")); //$NON-NLS-1$ //$NON-NLS-2$
|
|
267 |
// }
|
|
268 |
// } catch (Exception e) {
|
|
269 |
// System.out.println(e.getLocalizedMessage());
|
|
270 |
// org.txm.utils.logger.Log.printStackTrace(e);
|
|
271 |
// return false;
|
|
272 |
// }
|
|
273 |
// }
|
|
274 |
// return true;
|
|
275 |
// }
|
|
274 | 276 |
|
275 | 277 |
@Override |
276 | 278 |
public boolean initialize() { |
... | ... | |
326 | 328 |
@Override |
327 | 329 |
public boolean stop() { |
328 | 330 |
try { |
329 |
if (cqiClient instanceof MemCqiClient) { |
|
330 |
for (String name : ((MemCqiClient)cqiClient).listCorpora()) { |
|
331 |
((MemCqiClient)cqiClient).dropCorpus(name); |
|
331 |
if (cqiClient != null) { |
|
332 |
|
|
333 |
if (cqiClient instanceof MemCqiClient) { |
|
334 |
for (String name : ((MemCqiClient)cqiClient).listCorpora()) { |
|
335 |
((MemCqiClient)cqiClient).dropCorpus(name); |
|
336 |
} |
|
332 | 337 |
} |
338 |
cqiClient.disconnect(); |
|
333 | 339 |
} |
334 |
|
|
335 |
cqiClient.disconnect(); |
|
336 |
cqiServer.stop(); |
|
337 | 340 |
|
338 |
CorpusManager.clean(); |
|
339 |
if (cqiServer instanceof NetCqiServer) { |
|
340 |
killSearchEngine(); |
|
341 |
if (cqiServer != null) { |
|
342 |
cqiServer.stop(); |
|
343 |
|
|
344 |
CorpusManager.clean(); |
|
345 |
if (cqiServer instanceof NetCqiServer) { |
|
346 |
killSearchEngine(); |
|
347 |
} |
|
348 |
|
|
349 |
cqiClient = null; |
|
350 |
cqiServer = null; |
|
341 | 351 |
} |
352 |
System.gc(); |
|
342 | 353 |
|
343 |
cqiClient = null; |
|
344 |
cqiServer = null; |
|
345 |
System.gc(); |
|
346 |
|
|
347 | 354 |
state = false; |
348 | 355 |
} catch (Exception e) { |
349 | 356 |
Log.severe("Error while closing CQP: "+e.getLocalizedMessage()); |
... | ... | |
360 | 367 |
// Windows OS |
361 | 368 |
if (OSDetector.isFamilyWindows()) { |
362 | 369 |
try { |
363 |
Process p = Runtime.getRuntime().exec( |
|
364 |
"taskkill /IM cqpserver.exe /F"); //$NON-NLS-1$ |
|
370 |
Process p = Runtime.getRuntime().exec("taskkill /IM cqpserver.exe /F"); //$NON-NLS-1$ |
|
365 | 371 |
p.waitFor(); |
366 | 372 |
p = Runtime.getRuntime().exec("taskkill /IM cqpserver.exe /F"); //$NON-NLS-1$ |
367 | 373 |
p.waitFor(); |
... | ... | |
369 | 375 |
Log.severe(TXMCoreMessages.bind(TXMCoreMessages.failedToExecTaskkillIMCqpserverexeFColon, Log.toString(e))); |
370 | 376 |
System.out.println(TXMCoreMessages.bind(TXMCoreMessages.failedToExecTaskkillIMCqpserverexeFColon, Log.toString(e))); |
371 | 377 |
try { |
372 |
Process p = Runtime.getRuntime().exec( |
|
373 |
"tskill cqpserver.exe"); //$NON-NLS-1$ |
|
378 |
Process p = Runtime.getRuntime().exec("tskill cqpserver.exe"); //$NON-NLS-1$ |
|
374 | 379 |
p.waitFor(); |
375 | 380 |
p = Runtime.getRuntime().exec("tskill cqpserver.exe"); //$NON-NLS-1$ |
376 | 381 |
p.waitFor(); |
... | ... | |
388 | 393 |
e.printStackTrace(); |
389 | 394 |
System.out.println(Log.toString(e)); |
390 | 395 |
} |
391 |
; |
|
392 | 396 |
} |
393 | 397 |
// Mac, Linux |
394 | 398 |
else { |
... | ... | |
466 | 470 |
@Override |
467 | 471 |
public boolean hasIndexes(CorpusBuild corpus) { |
468 | 472 |
if (corpus instanceof CQPCorpus) return true; |
469 |
|
|
473 |
|
|
470 | 474 |
try { |
471 | 475 |
String id = corpus.getID(); |
472 |
|
|
476 |
|
|
473 | 477 |
return CorpusManager.getCorpusManager().getCorpus(id) != null; |
474 | 478 |
} catch (Exception e) { |
475 | 479 |
e.printStackTrace(); |
tmp/org.txm.rcp.feature/win/TXM.bat (revision 1649) | ||
---|---|---|
32 | 32 |
|
33 | 33 |
mkdir "%DOTTXM%" |
34 | 34 |
|
35 |
( |
|
36 | 35 |
echo "TXM: getting install date from %installdir%STAMP and %DOTTXM%STAMP files" |
37 | 36 |
Fc "%installdir%STAMP" "%DOTTXM%STAMP" |
38 |
) >"%TXMHOME%TXMOutputLogs.txt" 2>"%TXMHOME%TXMErrorLogs.txt" |
|
39 | 37 |
|
40 | 38 |
IF errorlevel 1 (goto :install) else (goto :run) |
41 | 39 |
|
42 | 40 |
:install |
43 | 41 |
|
44 |
( |
|
45 | 42 |
echo "New TXM install: it's the first launch after the installation." |
46 | 43 |
del "%temp%\org.txm.rcpapplication.prefs" |
47 | 44 |
copy "%DOTTXM%configuration\.settings\org.txm.rcpapplication.prefs" "%temp%\org.txm.rcpapplication.prefs" |
... | ... | |
70 | 67 |
copy "%installdir%STAMP" "%DOTTXM%STAMP" |
71 | 68 |
IF errorlevel 1 (echo "TXM: failed to copy %DOTTXM%STAMP file") |
72 | 69 |
|
73 |
) >"%TXMHOME%TXMOutputLogs.txt" 2>"%TXMHOME%TXMErrorLogs.txt" |
|
74 |
|
|
75 | 70 |
:run |
76 | 71 |
|
77 |
( |
|
78 | 72 |
set _JAVA_OPTIONS=-Duser.home="%USERHOME%" |
79 | 73 |
echo running "%installdir%TXM.exe" -run --launcher.ini "%DOTTXM%TXM.ini" -data "%DOTTXM%data" -user "%DOTTXM%user" -install "%installdir%"echo running "%installdir%TXM.exe" -log -run --launcher.ini "%DOTTXM%TXM.ini" -consolelog -clean -debug -console -noexit -data "%TXMHOME%corpora" -user "%DOTTXM%user" -install "%installdir%\" |
80 | 74 |
REM "%installdir%TXM.exe" -run --launcher.ini "%DOTTXM%TXM.ini" -data "%DOTTXM%corpora" -user "%DOTTXM%user" -install "%installdir%" |
81 |
"%installdir%TXM.exe" -log -run --launcher.ini "%DOTTXM%TXM.ini" %ARGS% -data "%TXMHOME%corpora" -user "%DOTTXM%user" -install "%installdir%\" |
|
82 |
) >"%TXMHOME%TXMOutputLogs.txt" 2>"%TXMHOME%TXMErrorLogs.txt" |
|
75 |
"%installdir%TXM.exe" -run --launcher.ini "%DOTTXM%TXM.ini" %ARGS% -data "%TXMHOME%corpora" -user "%DOTTXM%user" -install "%installdir%\" |
tmp/org.txm.rcp.feature/win/TXM debug.bat (revision 1649) | ||
---|---|---|
1 |
%~dp0/TXM.bat -consolelog -clean -debug -console -noexit |
|
1 |
"%~dp0/TXM.bat" -log -consolelog -clean -debug -console -noexit |
tmp/org.txm.translate.rcp/.~lock.messages_fr-slh.odt# (revision 1649) | ||
---|---|---|
1 |
Matthieu Decorde,mdecorde,matthieuPC,08.01.2019 16:34,file:///home/mdecorde/.config/libreoffice/4; |
Formats disponibles : Unified diff