Revision 1356
tmp/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/PatchCwbRegistry.java (revision 1356) | ||
---|---|---|
37 | 37 |
|
38 | 38 |
import org.txm.core.messages.TXMCoreMessages; |
39 | 39 |
import org.txm.searchengine.cqp.core.messages.CQPSearchEngineCoreMessages; |
40 |
import org.txm.utils.io.IOUtils; |
|
40 | 41 |
import org.txm.utils.logger.Log; |
41 | 42 |
|
42 | 43 |
// TODO: Auto-generated Javadoc |
... | ... | |
59 | 60 |
// HOME INFO |
60 | 61 |
String datadirPath = datadir.getAbsolutePath(); |
61 | 62 |
File temp = File.createTempFile("temp", ".registry", registryfile.getParentFile()); //$NON-NLS-1$ //$NON-NLS-2$ |
62 |
if (datadirPath.startsWith("\\\\")) datadirPath = datadirPath.replace("\\\\", "//"); // fix UNC paths for mingw |
|
63 | 63 |
|
64 |
String encoding = "UTF-8"; //$NON-NLS-1$ |
|
64 |
// fix UNC paths for mingw |
|
65 |
if (datadirPath.startsWith("\\\\")) { |
|
66 |
datadirPath = datadirPath.replace("\\\\", "//"); |
|
67 |
} |
|
68 |
|
|
69 |
String encoding = IOUtils.UTF8; |
|
65 | 70 |
//if (OSDetector.isFamilyWindows()) encoding = "ISO-8859-1"; //$NON-NLS-1$ |
66 |
BufferedReader reader = new BufferedReader(new InputStreamReader( |
|
67 |
new FileInputStream(registryfile), encoding)); |
|
68 |
OutputStreamWriter writer = new OutputStreamWriter( |
|
69 |
new FileOutputStream(temp), encoding); |
|
71 |
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(registryfile), encoding)); |
|
72 |
OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(temp), encoding); |
|
70 | 73 |
|
71 | 74 |
String line = reader.readLine(); |
72 | 75 |
while (line != null) { |
... | ... | |
88 | 91 |
// System.out.println("TMP file exists?: "+temp.exists()); |
89 | 92 |
// System.out.println("REG file exists?: "+registryfile.exists()); |
90 | 93 |
if (registryfile.exists()) { |
91 |
System.out.println("ERROR: old registry path still exists. Result in "+temp);
|
|
94 |
System.err.println(TXMCoreMessages.bind("ERROR: old registry path still exists. Result in {0}.", temp));
|
|
92 | 95 |
} else { |
93 | 96 |
temp.renameTo(registryfile); |
94 | 97 |
} |
... | ... | |
104 | 107 |
* @param corpusEncoding the new encoding value |
105 | 108 |
* @throws IOException Signals that an I/O exception has occurred. |
106 | 109 |
*/ |
107 |
public static void patchEncoding(File registryfile, String corpusEncoding) |
|
108 |
throws IOException { |
|
110 |
public static void patchEncoding(File registryfile, String corpusEncoding) throws IOException { |
|
109 | 111 |
String corpus = registryfile.getName(); |
110 | 112 |
|
111 | 113 |
// HOME INFO |
112 | 114 |
File temp = File.createTempFile("temp", ".regsitry", registryfile.getParentFile()); //$NON-NLS-1$ //$NON-NLS-2$ |
113 | 115 |
|
114 |
String encoding = "UTF-8"; //$NON-NLS-1$
|
|
116 |
String encoding = IOUtils.UTF8;
|
|
115 | 117 |
//if (OSDetector.isFamilyWindows()) encoding = "ISO-8859-1"; //$NON-NLS-1$ |
116 | 118 |
BufferedReader reader = new BufferedReader(new InputStreamReader( |
117 | 119 |
new FileInputStream(registryfile), encoding)); |
... | ... | |
123 | 125 |
} |
124 | 126 |
corpusEncoding = corpusEncoding.toLowerCase(); |
125 | 127 |
|
126 |
Log.info(CQPSearchEngineCoreMessages.updating + corpus
|
|
127 |
+ CQPSearchEngineCoreMessages.encodingTo + corpusEncoding); |
|
128 |
Log.info(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.updating, corpus, corpusEncoding));
|
|
129 |
|
|
128 | 130 |
String line = reader.readLine(); |
129 | 131 |
while (line != null) { |
130 | 132 |
if (line.startsWith("##:: charset") || line.startsWith("charset")) { //$NON-NLS-1$ //$NON-NLS-2$ |
... | ... | |
191 | 193 |
String corpus = registryfile.getName(); |
192 | 194 |
|
193 | 195 |
if (!new File(registryfile.getParent(), targetcorpus).exists()) { |
194 |
Log.severe(CQPSearchEngineCoreMessages.theTargetCorpusDoesntExist+" : "+new File(registryfile.getParent(), targetcorpus)); //$NON-NLS-1$
|
|
196 |
Log.severe(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.theTargetCorpusDoesntExist, new File(registryfile.getParent(), targetcorpus)));
|
|
195 | 197 |
return false; |
196 | 198 |
} |
197 | 199 |
if (!registryfile.exists()) { |
198 |
Log.severe(CQPSearchEngineCoreMessages.sourceRegistryDoesNotExistsDDot+registryfile.getAbsolutePath());
|
|
200 |
Log.severe(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.sourceRegistryDoesNotExistsDDot, registryfile.getAbsolutePath()));
|
|
199 | 201 |
return false; |
200 | 202 |
} |
201 | 203 |
|
... | ... | |
256 | 258 |
// HOME INFO |
257 | 259 |
File temp = File.createTempFile("temp", ".regsitry", registryfile.getParentFile()); //$NON-NLS-1$ //$NON-NLS-2$ |
258 | 260 |
|
259 |
String encoding = "UTF-8"; //$NON-NLS-1$
|
|
261 |
String encoding = IOUtils.UTF8;
|
|
260 | 262 |
//if (OSDetector.isFamilyWindows()) encoding = "ISO-8859-1"; //$NON-NLS-1$ |
261 | 263 |
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(registryfile), encoding)); |
262 | 264 |
OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(temp), encoding); |
... | ... | |
285 | 287 |
f.renameTo(new File(f.getParent(), f.getName().replace(oldname+".", newname+"."))); //$NON-NLS-1$ //$NON-NLS-2$ |
286 | 288 |
} |
287 | 289 |
else { |
288 |
System.out.println(CQPSearchEngineCoreMessages.dataDirectory+datadir +TXMCoreMessages.doesNotExists_2);
|
|
290 |
System.out.println(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.dataDirectory, datadir));
|
|
289 | 291 |
writer.close(); |
290 | 292 |
reader.close(); |
291 | 293 |
return false; |
... | ... | |
294 | 296 |
else { |
295 | 297 |
Log.severe(CQPSearchEngineCoreMessages.couldNotPatchTheRegistryFile); |
296 | 298 |
|
297 |
if(!found) { |
|
298 |
Log.severe(oldname +CQPSearchEngineCoreMessages.couldNotBeFoundInRegistryFile+registryfile);
|
|
299 |
if(!found || !(datapath.length() > 0)) {
|
|
300 |
Log.severe(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.couldNotBeFoundInRegistryFile, oldname, registryfile));
|
|
299 | 301 |
} |
300 |
|
|
301 |
if(!(datapath.length() > 0)) { |
|
302 |
Log.severe(CQPSearchEngineCoreMessages.dataDirectory+oldname +CQPSearchEngineCoreMessages.couldNotBeFoundInRegistryFile+registryfile); |
|
303 |
} |
|
304 | 302 |
writer.close(); |
305 | 303 |
reader.close(); |
306 | 304 |
return false; |
... | ... | |
330 | 328 |
"~/TXM/corpora/tmxtest/registry/tmxen"), "TMXFR"); //$NON-NLS-1$ //$NON-NLS-2$ |
331 | 329 |
*/ |
332 | 330 |
File registry = new File("/home/mdecorde/TXM/corpora/VOEUX/registry/voeux"); //$NON-NLS-1$ |
333 |
File data = new File("/home/mdecorde/TXM/corpora/VOEUX/data/VOEUX"); |
|
331 |
File data = new File("/home/mdecorde/TXM/corpora/VOEUX/data/VOEUX"); //$NON-NLS-1$
|
|
334 | 332 |
PatchCwbRegistry.patch(registry, data); |
335 | 333 |
// PatchCwbRegistry.patchAttribute(registry, "word", "form"); //$NON-NLS-1$ //$NON-NLS-2$ |
336 | 334 |
// try { |
tmp/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/CwbProcess.java (revision 1356) | ||
---|---|---|
93 | 93 |
File pathToExecutable = new File(CQPLibPreferences.getInstance().getString(CQPLibPreferences.CQI_SERVER_PATH_TO_CQPLIB), filename); |
94 | 94 |
|
95 | 95 |
if (!pathToExecutable.exists()) { |
96 |
Log.severe("Error: "+pathToExecutable.getAbsolutePath()+" not found.");
|
|
96 |
Log.severe(TXMCoreMessages.bind("Error: \"{0}\" not found.", pathToExecutable.getAbsolutePath()));
|
|
97 | 97 |
return false; |
98 | 98 |
} |
99 | 99 |
|
100 | 100 |
if (!pathToExecutable.canExecute()) { |
101 |
Log.severe("Error: "+pathToExecutable.getAbsolutePath()+" not executable.");
|
|
101 |
Log.severe(TXMCoreMessages.bind("Error: \"{0}\" not executable.", pathToExecutable.getAbsolutePath()));
|
|
102 | 102 |
return false; |
103 | 103 |
} |
104 | 104 |
return true; |
... | ... | |
116 | 116 |
*/ |
117 | 117 |
protected boolean run(List<String> cmd, boolean monitorOutput, boolean waitFor) throws ServerNotFoundException, InterruptedException, IOException { |
118 | 118 |
|
119 |
Log.info(CQPSearchEngineCoreMessages.startingProcessWithCommandDDot + StringUtils.join(cmd, " ")); //$NON-NLS-1$
|
|
119 |
Log.info(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.startingProcessWithCommandDDot, StringUtils.join(cmd, " "))); //$NON-NLS-1$
|
|
120 | 120 |
|
121 | 121 |
//System.out.println(StringUtils.join(cmd, " ")); |
122 | 122 |
for (String s : cmd) { |
123 | 123 |
//System.out.println("s="+s); |
124 | 124 |
if (s == null) { |
125 |
Log.severe("ERROR null arg parameter: "+cmd);
|
|
125 |
Log.severe(TXMCoreMessages.bind("ERROR null arg parameter: {0}.", cmd));
|
|
126 | 126 |
return false; |
127 | 127 |
} |
128 | 128 |
} |
... | ... | |
134 | 134 |
new Thread() { |
135 | 135 |
@Override |
136 | 136 |
public void run() { |
137 |
if (debug) System.out.println("Start logging "+name+" process..."); |
|
137 |
if (debug) { |
|
138 |
System.out.println(TXMCoreMessages.bind("Starting logging {0} process...", name)); |
|
139 |
} |
|
138 | 140 |
try { |
139 | 141 |
InputStreamReader isr = new InputStreamReader(is); |
140 | 142 |
BufferedReader br = new BufferedReader(isr); |
141 | 143 |
String line; |
142 | 144 |
while ((line = br.readLine()) != null) { |
143 |
if (debug) |
|
145 |
if (debug) {
|
|
144 | 146 |
System.out.println(line); |
147 |
} |
|
145 | 148 |
} |
146 | 149 |
isr.close(); |
147 |
if (debug) System.out.println("End of "+name+" process logs."); |
|
150 |
if (debug) { |
|
151 |
System.out.println(TXMCoreMessages.bind("End of {0} logging process.", name)); |
|
152 |
} |
|
148 | 153 |
} catch (IOException e) { |
149 | 154 |
e.printStackTrace(); |
150 | 155 |
} |
... | ... | |
152 | 157 |
}.start(); |
153 | 158 |
|
154 | 159 |
if (waitFor) { |
155 |
Log.warning("Waiting for end of process: "+name);
|
|
160 |
Log.warning(TXMCoreMessages.bind("Waiting for end of process: {0}...", name));
|
|
156 | 161 |
endProcess(); |
157 | 162 |
} |
158 | 163 |
|
... | ... | |
179 | 184 |
* Stop the CWB process. |
180 | 185 |
*/ |
181 | 186 |
public void stop() { |
182 |
Log.finest(CQPSearchEngineCoreMessages.stoppingProcessDDot + name.toUpperCase());
|
|
187 |
Log.finest(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.stoppingProcessDDot, name.toUpperCase()));
|
|
183 | 188 |
this.process.destroy(); |
184 |
Log.finest(CQPSearchEngineCoreMessages.processStopedDDot + name.toUpperCase());
|
|
189 |
Log.finest(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.processStopedDDot, name.toUpperCase()));
|
|
185 | 190 |
} |
186 | 191 |
|
187 | 192 |
/** |
... | ... | |
263 | 268 |
*/ |
264 | 269 |
public static String getCWBLocation() |
265 | 270 |
{ |
266 |
String cwbLoc = CQPLibPreferences.getInstance().getString(CQPLibPreferences.CQI_SERVER_PATH_TO_CQPLIB)+File.separator;
|
|
271 |
String cwbLoc = CQPLibPreferences.getInstance().getString(CQPLibPreferences.CQI_SERVER_PATH_TO_CQPLIB) + File.separator;
|
|
267 | 272 |
|
268 | 273 |
if (!new File(cwbLoc).exists()) { |
269 |
Log.severe(CQPSearchEngineCoreMessages.cantFindCQPLocationDDot + cwbLoc);
|
|
274 |
Log.severe(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.cantFindCQPLocationDDot, cwbLoc));
|
|
270 | 275 |
return null; |
271 | 276 |
} |
272 | 277 |
|
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/messages/messages_fr.properties (revision 1356) | ||
---|---|---|
10 | 10 |
|
11 | 11 |
cQPErrorDDot = Erreur CQP : |
12 | 12 |
|
13 |
cantFindCQPLocationDDot = ** Echec de localisation de CQP : |
|
13 |
cantFindCQPLocationDDot = ** Echec de localisation de CQP : {0}.
|
|
14 | 14 |
|
15 |
cantFindRegistryFile = Le fichier 'registry' est introuvable |
|
15 |
cantFindRegistryFile = Le fichier 'registry' est introuvable.
|
|
16 | 16 |
|
17 | 17 |
clientdumpSubCorpussubcorpusNetCqiClientCQICONSTFIELDMATCH12DDot = client.dumpSubCorpus(subcorpus, NetCqiClient.CQI_CONST_FIELD_MATCH, 1, 2) : |
18 | 18 |
|
... | ... | |
20 | 20 |
|
21 | 21 |
connectingToTheSearchEngineWithTheFollowingParametersDDotP0DDotP1AtP2P3 = Connexion au moteur de recherche avec les paramètres suivants : {0}:{1}@{2}{3}... |
22 | 22 |
|
23 |
couldNotBeFoundInRegistryFile = n'a pu être trouvé dans
|
|
23 |
couldNotBeFoundInRegistryFile = {0} n'a pu être trouvé dans le fichier 'registry' {1}.
|
|
24 | 24 |
|
25 | 25 |
couldNotPatchTheRegistryFile = Erreur lors de la reécriture du fichier 'registry'. |
26 | 26 |
|
... | ... | |
30 | 30 |
|
31 | 31 |
cqpserverStdoutDDot = ** cqpserver stdout: |
32 | 32 |
|
33 |
dataDirectory = dossier 'data'
|
|
33 |
dataDirectory = Le dossier 'data' {0} n'existe pas.
|
|
34 | 34 |
|
35 | 35 |
encodingTo = pour l'encodage |
36 | 36 |
|
... | ... | |
56 | 56 |
|
57 | 57 |
p0IsNotAValidCQPIDForASubcorpusItMustBeAnUppercaseCharacterFollowedByLowercaseCharacters = {0} n'est pas un identifiant de sous-corpus CQP valide. Il doit être en majuscules suivies de caractères minuscules. |
58 | 58 |
|
59 |
processStopedDDot = Processus arrêté :
|
|
59 |
processStopedDDot = Processus {0} arrêté.
|
|
60 | 60 |
|
61 | 61 |
processingCorpus = Traitement du corpus "{0}"... |
62 | 62 |
|
... | ... | |
92 | 92 |
|
93 | 93 |
searchEngineLaunched = Moteur de recherche lancé... |
94 | 94 |
|
95 |
sourceRegistryDoesNotExistsDDot = Le fichier registry source n'existe pas |
|
95 |
sourceRegistryDoesNotExistsDDot = Le fichier registry source n'existe pas dans {0}.
|
|
96 | 96 |
|
97 |
startingProcessWithCommandDDot = Démarrage du processus avec la ligne de commande : |
|
97 |
startingProcessWithCommandDDot = Démarrage du processus avec la ligne de commande : {0}...
|
|
98 | 98 |
|
99 |
stoppingProcessDDot = Arrêt en cours du processus : |
|
99 |
stoppingProcessDDot = Arrêt en cours du processus : {0}...
|
|
100 | 100 |
|
101 | 101 |
theBinaryDirectoryDoesNotExistsDDot = Le dossier "bin" n'existe pas : {0}. |
102 | 102 |
|
... | ... | |
110 | 110 |
|
111 | 111 |
theRegistryDirectoryDoesNotExistsDDot = Le dossier "registry" n'existe pas : {0}. |
112 | 112 |
|
113 |
theTargetCorpusDoesntExist = ** Le corpus cible n'existe pas. |
|
113 |
theTargetCorpusDoesntExist = ** Le corpus cible {0} n'existe pas.
|
|
114 | 114 |
|
115 | 115 |
unknownCQPCQIErrorDDotB1 = Erreur CQP CQI inconnue : b1 |
116 | 116 |
|
... | ... | |
120 | 120 |
|
121 | 121 |
unknownCQPErrorDDotB1 = Erreur CQP inconnue : b1 |
122 | 122 |
|
123 |
updating = Mise à jour du corpus
|
|
123 |
updating = Mise à jour de l'encodage du corpus {0} vers {1}...
|
|
124 | 124 |
|
125 | 125 |
updatingP0CorpusLanguageToP1 = Mise à jour de la langue du corpus {0} vers {1}... |
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/messages/messages.properties (revision 1356) | ||
---|---|---|
10 | 10 |
|
11 | 11 |
cQPErrorDDot = CQP error: |
12 | 12 |
|
13 |
cantFindCQPLocationDDot = ** Can't find CQP location :
|
|
13 |
cantFindCQPLocationDDot = ** Can't find CQP location: {0}.
|
|
14 | 14 |
|
15 |
cantFindRegistryFile = Can't find registry file
|
|
15 |
cantFindRegistryFile = Can't find 'registry' file.
|
|
16 | 16 |
|
17 | 17 |
clientdumpSubCorpussubcorpusNetCqiClientCQICONSTFIELDMATCH12DDot = client.dumpSubCorpus(subcorpus, NetCqiClient.CQI_CONST_FIELD_MATCH, 1, 2) : |
18 | 18 |
|
... | ... | |
20 | 20 |
|
21 | 21 |
connectingToTheSearchEngineWithTheFollowingParametersDDotP0DDotP1AtP2P3 = Connecting to the Search Engine with the following parameters: {0}:{1}@{2}{3}... |
22 | 22 |
|
23 |
couldNotBeFoundInRegistryFile = could not be found in registry file
|
|
23 |
couldNotBeFoundInRegistryFile = {0} not found in 'registry' file {1}.
|
|
24 | 24 |
|
25 | 25 |
couldNotPatchTheRegistryFile = Could not patch the 'registry' file. |
26 | 26 |
|
... | ... | |
30 | 30 |
|
31 | 31 |
cqpserverStdoutDDot = ** cqpserver stdout: |
32 | 32 |
|
33 |
dataDirectory = data directory
|
|
33 |
dataDirectory = 'data' directory {0} does not exist.
|
|
34 | 34 |
|
35 | 35 |
encodingTo = encoding to |
36 | 36 |
|
... | ... | |
56 | 56 |
|
57 | 57 |
p0IsNotAValidCQPIDForASubcorpusItMustBeAnUppercaseCharacterFollowedByLowercaseCharacters = {0} is not a valid CQP ID for a subcorpus. It must be an uppercase character followed by lowercase characters. |
58 | 58 |
|
59 |
processStopedDDot = Process stoped:
|
|
59 |
processStopedDDot = Process {0} stopped.
|
|
60 | 60 |
|
61 | 61 |
processingCorpus = Processing corpus "{0}"... |
62 | 62 |
|
... | ... | |
92 | 92 |
|
93 | 93 |
searchEngineLaunched = Search Engine launched... |
94 | 94 |
|
95 |
sourceRegistryDoesNotExistsDDot = Source registry does not exists:
|
|
95 |
sourceRegistryDoesNotExistsDDot = Source registry file does not exist in {0}.
|
|
96 | 96 |
|
97 |
startingProcessWithCommandDDot = Starting process with command: |
|
97 |
startingProcessWithCommandDDot = Starting process with command: {0}...
|
|
98 | 98 |
|
99 |
stoppingProcessDDot = Stopping process: |
|
99 |
stoppingProcessDDot = Stopping process: {0}...
|
|
100 | 100 |
|
101 | 101 |
theBinaryDirectoryDoesNotExistsDDot = The "bin" directory does not exists: {0}. |
102 | 102 |
|
... | ... | |
110 | 110 |
|
111 | 111 |
theRegistryDirectoryDoesNotExistsDDot = The "registry" directory does not exists: {0}. |
112 | 112 |
|
113 |
theTargetCorpusDoesntExist = ** The target corpus doesn't exist. |
|
113 |
theTargetCorpusDoesntExist = ** The target corpus {0} doesn't exist.
|
|
114 | 114 |
|
115 | 115 |
unknownCQPCQIErrorDDotB1 = Unknown CQP CQI error: b1 |
116 | 116 |
|
... | ... | |
120 | 120 |
|
121 | 121 |
unknownCQPErrorDDotB1 = Unknown CQP error: b1 |
122 | 122 |
|
123 |
updating = Updating |
|
123 |
updating = Updating {0} corpus encoding to {1}...
|
|
124 | 124 |
|
125 | 125 |
updatingP0CorpusLanguageToP1 = Updating {0} corpus language to {1}... |
Also available in: Unified diff