try {
sourceResolver = (SourceResolver) manager.lookup(SourceResolver.ROLE);
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 (getLogger().isDebugEnabled()) {
getLogger().debug("Library IS EXPIRED in cache: '" + sourceURI + "' relative to '" + baseURI + "'");
}
lib = null;
}
if (lib == null) {
if (getLogger().isDebugEnabled()) {
getLogger().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.manager);
lib = newLibrary();
lib.buildLibrary(doc.getDocumentElement());
this.cacheManager.set(lib,source,PREFIX);
} catch (Exception e) {
throw new LibraryException("Unable to load library.",
e, new LocationImpl("[LibraryManager]", source.getURI()));
}
}
return lib;
} finally {