Révision 3802
TXM/trunk/bundles/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 3802) | ||
---|---|---|
20 | 20 |
import java.util.HashMap; |
21 | 21 |
import java.util.List; |
22 | 22 |
import java.util.Locale; |
23 |
import java.util.Map; |
|
23 | 24 |
import java.util.Properties; |
24 | 25 |
import java.util.concurrent.Semaphore; |
25 | 26 |
import java.util.regex.Pattern; |
... | ... | |
2260 | 2261 |
* @return the created result |
2261 | 2262 |
*/ |
2262 | 2263 |
public TXMResult importResult(Properties props) { |
2264 |
return importResult(props); |
|
2265 |
} |
|
2266 |
|
|
2267 |
/** |
|
2268 |
* import a result from a Properties map |
|
2269 |
* |
|
2270 |
* @param allparameters the parameters file |
|
2271 |
* @return the created result |
|
2272 |
*/ |
|
2273 |
public TXMResult importResult(Map<String, String> map) { |
|
2263 | 2274 |
try { |
2264 | 2275 |
// some tests before... |
2265 |
String className = props.getProperty(TXMPreferences.CLASS);
|
|
2276 |
String className = map.get(TXMPreferences.CLASS);
|
|
2266 | 2277 |
if (className == null || className.length() == 0) { |
2267 | 2278 |
System.out.println("** Error: No class internal parameter set."); |
2268 | 2279 |
return null; |
2269 | 2280 |
} |
2270 | 2281 |
|
2271 |
String bundleId = props.getProperty(TXMPreferences.BUNDLE_ID);
|
|
2282 |
String bundleId = map.get(TXMPreferences.BUNDLE_ID);
|
|
2272 | 2283 |
if (bundleId == null || bundleId.length() == 0) { |
2273 | 2284 |
System.out.println("** Error: No bundle_id internal parameter set."); |
2274 | 2285 |
return null; |
... | ... | |
2283 | 2294 |
// copy parameters |
2284 | 2295 |
String newNodePath = this.getProject().getParametersNodeRootPath() + createUUID() + "_" + className; |
2285 | 2296 |
TXMPreferences.put(newNodePath, TXMPreferences.PARENT_PARAMETERS_NODE_PATH, this.getParametersNodePath()); |
2286 |
for (Object p : props.keySet()) {
|
|
2297 |
for (Object p : map.keySet()) {
|
|
2287 | 2298 |
String ps = p.toString(); |
2288 | 2299 |
if (TXMPreferences.PARENT_PARAMETERS_NODE_PATH.equals(ps)) continue; |
2289 | 2300 |
if (TXMPreferences.RESULT_PARAMETERS_NODE_PATH.equals(ps)) continue; |
2290 |
TXMPreferences.put(newNodePath, ps, props.getProperty(ps, ""));
|
|
2301 |
TXMPreferences.put(newNodePath, ps, map.get(ps));
|
|
2291 | 2302 |
} |
2292 | 2303 |
|
2293 | 2304 |
// create instance |
... | ... | |
2307 | 2318 |
} |
2308 | 2319 |
|
2309 | 2320 |
if (cons == null) { |
2310 |
System.out.println(NLS.bind("Cannot import {0} in {1}", props, this));
|
|
2321 |
System.out.println(NLS.bind("Cannot import {0} in {1}", map, this));
|
|
2311 | 2322 |
} |
2312 | 2323 |
else { |
2313 | 2324 |
cons = cl.getConstructor(String.class); |
... | ... | |
2318 | 2329 |
|
2319 | 2330 |
} |
2320 | 2331 |
catch (Exception e) { |
2321 |
System.out.println(NLS.bind("Fail to import result from {0}: {1}", props, e));
|
|
2332 |
System.out.println(NLS.bind("Fail to import result from {0}: {1}", map, e));
|
|
2322 | 2333 |
Log.printStackTrace(e); |
2323 | 2334 |
} |
2324 | 2335 |
|
Formats disponibles : Unified diff