Revision 48370
Added by Michele Artini almost 7 years ago
SimpleDatasourceManagerCore.java | ||
---|---|---|
118 | 118 |
public boolean bulkUpdateApiExtraFields(final String dsId, final String ifaceId, final Map<String, String> fields) |
119 | 119 |
throws DatasourceManagerServiceException { |
120 | 120 |
try { |
121 |
final String profile = is.getProfile(dsId);
|
|
121 |
final String profile = obtainProfile(dsId);
|
|
122 | 122 |
|
123 | 123 |
final SAXReader reader = new SAXReader(); |
124 | 124 |
final Document doc = reader.read(new StringReader(profile)); |
... | ... | |
297 | 297 |
@Override |
298 | 298 |
public DatasourceDesc getDatasource(final String dsId) throws DatasourceManagerServiceException { |
299 | 299 |
try { |
300 |
final String profile = is.getProfile(fixDsId(dsId));
|
|
300 |
final String profile = obtainProfile(fixDsId(dsId));
|
|
301 | 301 |
return ProfileToDatasourceDesc.convert(profile); |
302 | 302 |
} catch (final Exception e) { |
303 | 303 |
log.error("Error accessing profile: " + dsId, e); |
... | ... | |
320 | 320 |
final String profId = fixDsId(dsId); |
321 | 321 |
|
322 | 322 |
try { |
323 |
final String profile = is.getProfile(profId);
|
|
323 |
final String profile = obtainProfile(profId);
|
|
324 | 324 |
|
325 | 325 |
final SAXReader reader = new SAXReader(); |
326 | 326 |
final Document doc = reader.read(new StringReader(profile)); |
... | ... | |
413 | 413 |
|
414 | 414 |
final String profId = fixDsId(dsId); |
415 | 415 |
try { |
416 |
final String profile = is.getProfile(profId);
|
|
416 |
final String profile = obtainProfile(profId);
|
|
417 | 417 |
final Document doc = new SAXReader().read(new StringReader(profile)); |
418 | 418 |
|
419 | 419 |
final Node ifcNode = doc.selectSingleNode("//INTERFACE[@id = '" + ifaceId + "']"); |
... | ... | |
439 | 439 |
|
440 | 440 |
try { |
441 | 441 |
|
442 |
final String profile = is.getProfile(profId);
|
|
442 |
final String profile = obtainProfile(profId);
|
|
443 | 443 |
final Document doc = new SAXReader().read(new StringReader(profile)); |
444 | 444 |
|
445 | 445 |
final Node node = doc.selectSingleNode("//INTERFACE[@id = '" + ifaceId + "']/ACCESS_PROTOCOL"); |
... | ... | |
458 | 458 |
|
459 | 459 |
try { |
460 | 460 |
|
461 |
final String profile = is.getProfile(profId);
|
|
461 |
final String profile = obtainProfile(profId);
|
|
462 | 462 |
final Document doc = new SAXReader().read(new StringReader(profile)); |
463 | 463 |
|
464 | 464 |
final Node ap = doc.selectSingleNode("//INTERFACE[@id = '" + ifaceId + "']/ACCESS_PROTOCOL/@" + field); |
... | ... | |
479 | 479 |
|
480 | 480 |
try { |
481 | 481 |
|
482 |
final String profile = is.getProfile(profId);
|
|
482 |
final String profile = obtainProfile(profId);
|
|
483 | 483 |
final Document doc = new SAXReader().read(new StringReader(profile)); |
484 | 484 |
|
485 | 485 |
final Node ef = doc.selectSingleNode("//INTERFACE[@id = '" + ifaceId + "']/INTERFACE_EXTRA_FIELD[@name = '" + field + "']"); |
... | ... | |
498 | 498 |
final String profId = fixDsId(dsId); |
499 | 499 |
|
500 | 500 |
try { |
501 |
final String profile = is.getProfile(profId);
|
|
501 |
final String profile = obtainProfile(profId);
|
|
502 | 502 |
final Document doc = new SAXReader().read(new StringReader(profile)); |
503 | 503 |
|
504 | 504 |
final Node node = doc.selectSingleNode("//INTERFACE[@id = '" + iface.getId() + "']"); |
... | ... | |
520 | 520 |
final String profId = fixDsId(dsId); |
521 | 521 |
|
522 | 522 |
try { |
523 |
final String profile = is.getProfile(profId);
|
|
523 |
final String profile = obtainProfile(profId);
|
|
524 | 524 |
final Document doc = new SAXReader().read(new StringReader(profile)); |
525 | 525 |
|
526 | 526 |
final Node node = doc.selectSingleNode("//INTERFACE[@id = '" + ifaceId + "']"); |
... | ... | |
557 | 557 |
final String profId = fixDsId(dsId); |
558 | 558 |
|
559 | 559 |
try { |
560 |
final String profile = is.getProfile(profId);
|
|
560 |
final String profile = obtainProfile(profId);
|
|
561 | 561 |
|
562 | 562 |
final SAXReader reader = new SAXReader(); |
563 | 563 |
final Document doc = reader.read(new StringReader(profile)); |
... | ... | |
664 | 664 |
return iface; |
665 | 665 |
} |
666 | 666 |
|
667 |
private String obtainProfile(final String dsId) throws DatasourceManagerServiceException { |
|
668 |
try { |
|
669 |
return dsId.startsWith("entity/datasource") |
|
670 |
? is.getProfile(dsId) |
|
671 |
: is.find("collection('/db/DRIVER/entity/datasource')/*[.//DATASOURCE_ORIGINAL_ID='" + dsId + "']").get(0); |
|
672 |
} catch (final Throwable e) { |
|
673 |
log.error("Error accessing profile: " + dsId, e); |
|
674 |
throw new DatasourceManagerServiceException("Error accessing profile " + dsId, e); |
|
675 |
} |
|
676 |
} |
|
677 |
|
|
667 | 678 |
} |
Also available in: Unified diff