}
private void mirrorUpdateSite(final boolean force)
throws StorageException, IllegalOperationException, UnsupportedStorageOperationException
{
UpdateSite site;
try {
final RepositoryItemUid siteUID = createUid(P2Constants.SITE_XML);
String oldSha1 = null;
final ResourceStoreRequest request = new ResourceStoreRequest(siteUID.getPath());
try {
oldSha1 =
getLocalStorage().retrieveItem(this, request).getRepositoryItemAttributes().get(
StorageFileItem.DIGEST_SHA1_KEY);
}
catch (final ItemNotFoundException e) {
// it's okay
}
final StorageFileItem siteItem = (StorageFileItem) doRetrieveRemoteItem(request);
if (!force && oldSha1 != null
&& oldSha1.equals(siteItem.getRepositoryItemAttributes().get(StorageFileItem.DIGEST_SHA1_KEY))) {
return;
}
site = UpdateSite.read(siteItem.getInputStream());
}
catch (final Exception e) {
throw new StorageException("Could not read site.xml", e);
}
final List<SiteFeatureRef> features = site.getFeatures();
log.info("Mirroring " + features.size() + " features from update site " + getName());
final Set<String> mirrored = new HashSet<String>();