try {
try {
source = sourceResolver.resolveURI(sourceURI, baseURI, null);
} catch (Exception e) {
throw new LibraryException("Unable to resolve library.",
e, new LocationImpl("[LibraryManager]", sourceURI));
}
Library lib = (Library) this.cacheManager.get(source, PREFIX);
if (lib != null && lib.dependenciesHaveChanged()) {
if (LOG.isDebugEnabled()) {
LOG.debug("Library IS EXPIRED in cache: '" + sourceURI + "' relative to '" + baseURI + "'");
}
lib = null;
}
if (lib == null) {
if (LOG.isDebugEnabled()) {
LOG.debug("Library IS NOT in cache, loading: '" + sourceURI + "' relative to '" + baseURI + "'");
}
try {
InputSource inputSource = new InputSource(source.getInputStream());
inputSource.setSystemId(source.getURI());
Document doc = DomHelper.parse(inputSource, this.parser);
lib = newLibrary();
lib.buildLibrary(doc.getDocumentElement());
this.cacheManager.set(lib, source, PREFIX);
} catch (RuntimeException re) {
throw re;
} catch (Exception e) {
throw new LibraryException("Unable to load library.",
e, new LocationImpl("[LibraryManager]", source.getURI()));
}
}
return lib;
} finally {