View | Details | Raw Unified | Return to bug 232366
Collapse All | Expand All

(-)src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepository.java (+30 lines)
Lines 160-165 Link Here
160
			}
160
			}
161
			allSiteIUs.add(featureIU);
161
			allSiteIUs.add(featureIU);
162
			allSiteIUs.add(groupIU);
162
			allSiteIUs.add(groupIU);
163
			publishSites(feature);
163
		}
164
		}
164
165
165
		for (int i = 0; i < siteCategories.length; i++) {
166
		for (int i = 0; i < siteCategories.length; i++) {
Lines 241-244 Link Here
241
		//nothing to do
242
		//nothing to do
242
	}
243
	}
243
244
245
	/**
246
	 * Broadcast events for any discovery sites associated with the feature
247
	 * so the repository managers add them to their list of known repositories.
248
	 */
249
	private void publishSites(Feature feature) {
250
		IProvisioningEventBus bus = (IProvisioningEventBus) ServiceHelper.getService(Activator.getBundleContext(), IProvisioningEventBus.SERVICE_NAME);
251
		if (bus == null)
252
			return;
253
		URLEntry[] discoverySites = feature.getDiscoverySites();
254
		for (int i = 0; i < discoverySites.length; i++)
255
			publishSite(feature, bus, discoverySites[i].getURL(), false);
256
		String updateSite = feature.getUpdateSiteURL();
257
		if (updateSite != null)
258
			publishSite(feature, bus, updateSite, true);
259
	}
260
261
	/**
262
	 * Broadcast a discovery event for the given repository location.
263
	 */
264
	private void publishSite(Feature feature, IProvisioningEventBus bus, String locationString, boolean isEnabled) {
265
		try {
266
			URL siteLocation = new URL(locationString);
267
			bus.publishEvent(new RepositoryEvent(siteLocation, IRepository.TYPE_METADATA, RepositoryEvent.DISCOVERED, isEnabled));
268
			bus.publishEvent(new RepositoryEvent(siteLocation, IRepository.TYPE_ARTIFACT, RepositoryEvent.DISCOVERED, isEnabled));
269
		} catch (MalformedURLException e) {
270
			LogHelper.log(new Status(IStatus.WARNING, Activator.ID, "Feature references invalid site: " + feature.getId(), e)); //$NON-NLS-1$
271
		}
272
	}
273
244
}
274
}

Return to bug 232366