try {
URI uri = URI.create(contributionURI);
URL location = locationURL(contributionLocation);
// Get contribution from cache
ContributionCache contributionCache = cache.contributions.get(location);
long lastModified = lastModified(location);
if (contributionCache != null) {
if (contributionCache.contributionLastModified == lastModified) {
return contributionCache.contribution;
}
// Reset contribution cache
cache.contributions.remove(location);
}
Contribution contribution = (Contribution)contributionProcessor.read(null, uri, location);
contributionProcessor.resolve(contribution, new DefaultModelResolver());
// Cache contribution
contributionCache = new ContributionCache();
contributionCache.contribution = contribution;
contributionCache.contributionLastModified = lastModified;
cache.contributions.put(location, contributionCache);
return contribution;